This commit is contained in:
Tomas Groth 2019-08-28 21:50:03 +02:00
commit 842b0c07c7
9 changed files with 690 additions and 644 deletions

View File

@ -17,3 +17,4 @@ include LICENSE
include README.txt
include openlp/.version
include package.json
include karma.conf.js

View File

@ -26,18 +26,21 @@ module.exports = function(config) {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
"display.js": ["coverage"]
// "display.js": ["coverage"]
},
// test results reporter to use
// possible values: "dots", "progress"
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["progress", "coverage"],
reporters: ["dots", "junit"],
// configure the coverateReporter
coverageReporter: {
/* coverageReporter: {
type : "html",
dir : "htmlcov/"
}, */
junitReporter: {
outputFile: "test-results.xml"
},
// web server port
@ -60,11 +63,11 @@ module.exports = function(config) {
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ["Firefox"],
browsers: ["Chromium"],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous

View File

@ -67,7 +67,7 @@ def database_exists(url):
create_database(engine.url)
database_exists(engine.url) #=> True
Borrowed from SQLAlchemy_Utils (v0.32.14 )since we only need this one function.
Borrowed from SQLAlchemy_Utils (v0.32.14) since we only need this one function.
"""
url = copy(make_url(url))

File diff suppressed because it is too large Load Diff

View File

@ -50,19 +50,20 @@ class AboutForm(QtWidgets.QDialog, UiAboutDialog):
Set up the dialog. This method is mocked out in tests.
"""
self.setup_ui(self)
self.button_box.buttons()[0].setFocus()
application_version = get_version()
about_text = self.about_text_edit.toPlainText()
about_text = about_text.replace('<version>', application_version['version'])
about_text = self.about_text_edit.toHtml()
about_text = about_text.replace('{version}', application_version['version'])
if application_version['build']:
build_text = translate('OpenLP.AboutForm', ' build {version}').format(version=application_version['build'])
else:
build_text = ''
about_text = about_text.replace('<revision>', build_text)
self.about_text_edit.setPlainText(about_text)
self.volunteer_button.clicked.connect(self.on_volunteer_button_clicked)
about_text = about_text.replace('{revision}', build_text)
self.about_text_edit.setHtml(about_text)
self.contribute_button.clicked.connect(self.on_contribute_button_clicked)
def on_volunteer_button_clicked(self):
def on_contribute_button_clicked(self):
"""
Launch a web browser and go to the contribute page on the site.
"""
webbrowser.open_new('http://openlp.org/en/contribute')
webbrowser.open_new('http://openlp.org/contribute')

View File

@ -9,9 +9,11 @@
"dependencies": {
"jasmine-core": "^2.6.4",
"karma": "^3.1.4",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^1.1.2",
"karma-jasmine": "^1.1.0",
"karma-firefox-launcher": "^1.2.0",
"karma-jasmine": "^1.1.0",
"karma-junit-reporter": "^1.2.0",
"karma-log-reporter": "0.0.4"
},
"scripts": {

View File

@ -97,7 +97,7 @@ MODULES = [
OPTIONAL_MODULES = [
('qdarkstyle', '(dark style support)'),
('mysql.connector', '(MySQL support)'),
('pymysql', '(MySQL support)'),
('pyodbc', '(ODBC support)'),
('psycopg2', '(PostgreSQL support)'),
('enchant', '(spell checker)'),

View File

@ -191,7 +191,7 @@ using a computer and a data projector.""",
extras_require={
'agpl-pdf': ['PyMuPDF'],
'darkstyle': ['QDarkStyle'],
'mysql': ['mysql-connector-python'],
'mysql': ['pymysql'],
'odbc': ['pyodbc'],
'postgresql': ['psycopg2'],
'spellcheck': ['pyenchant >= 1.6'],

View File

@ -30,10 +30,10 @@ from openlp.core.ui.aboutform import AboutForm
from tests.helpers.testmixin import TestMixin
class TestFirstTimeForm(TestCase, TestMixin):
class TestAboutForm(TestCase, TestMixin):
@patch('openlp.core.ui.aboutform.webbrowser')
def test_on_volunteer_button_clicked(self, mocked_webbrowser):
def test_on_contribute_button_clicked(self, mocked_webbrowser):
"""
Test that clicking on the "Volunteer" button opens a web page.
"""
@ -41,10 +41,10 @@ class TestFirstTimeForm(TestCase, TestMixin):
about_form = AboutForm(None)
# WHEN: The "Volunteer" button is "clicked"
about_form.on_volunteer_button_clicked()
about_form.on_contribute_button_clicked()
# THEN: A web browser is opened
mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
mocked_webbrowser.open_new.assert_called_with('http://openlp.org/contribute')
@patch('openlp.core.ui.aboutform.get_version')
def test_about_form_build_number(self, mocked_get_version):
@ -66,11 +66,11 @@ class TestFirstTimeForm(TestCase, TestMixin):
Test that the copyright date is included correctly
"""
# GIVEN: A correct application date
date_string = "2004-%s" % datetime.date.today().year
date_string = '2004-{year}'.format(year=datetime.date.today().year)
# WHEN: The about form is created
about_form = AboutForm(None)
license_text = about_form.license_text_edit.toPlainText()
about_text = about_form.about_text_edit.toPlainText()
# THEN: The date should be in the text twice.
assert license_text.count(date_string, 0) == 2, "The text string should be added twice to the license string"
assert about_text.count(date_string, 0) == 1, "The text string should be added twice to the license string"