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

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. Set up the dialog. This method is mocked out in tests.
""" """
self.setup_ui(self) self.setup_ui(self)
self.button_box.buttons()[0].setFocus()
application_version = get_version() application_version = get_version()
about_text = self.about_text_edit.toPlainText() about_text = self.about_text_edit.toHtml()
about_text = about_text.replace('<version>', application_version['version']) about_text = about_text.replace('{version}', application_version['version'])
if application_version['build']: if application_version['build']:
build_text = translate('OpenLP.AboutForm', ' build {version}').format(version=application_version['build']) build_text = translate('OpenLP.AboutForm', ' build {version}').format(version=application_version['build'])
else: else:
build_text = '' build_text = ''
about_text = about_text.replace('<revision>', build_text) about_text = about_text.replace('{revision}', build_text)
self.about_text_edit.setPlainText(about_text) self.about_text_edit.setHtml(about_text)
self.volunteer_button.clicked.connect(self.on_volunteer_button_clicked) 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. 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": { "dependencies": {
"jasmine-core": "^2.6.4", "jasmine-core": "^2.6.4",
"karma": "^3.1.4", "karma": "^3.1.4",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^1.1.2", "karma-coverage": "^1.1.2",
"karma-jasmine": "^1.1.0",
"karma-firefox-launcher": "^1.2.0", "karma-firefox-launcher": "^1.2.0",
"karma-jasmine": "^1.1.0",
"karma-junit-reporter": "^1.2.0",
"karma-log-reporter": "0.0.4" "karma-log-reporter": "0.0.4"
}, },
"scripts": { "scripts": {

View File

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

View File

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

View File

@ -30,10 +30,10 @@ from openlp.core.ui.aboutform import AboutForm
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
class TestFirstTimeForm(TestCase, TestMixin): class TestAboutForm(TestCase, TestMixin):
@patch('openlp.core.ui.aboutform.webbrowser') @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. Test that clicking on the "Volunteer" button opens a web page.
""" """
@ -41,10 +41,10 @@ class TestFirstTimeForm(TestCase, TestMixin):
about_form = AboutForm(None) about_form = AboutForm(None)
# WHEN: The "Volunteer" button is "clicked" # WHEN: The "Volunteer" button is "clicked"
about_form.on_volunteer_button_clicked() about_form.on_contribute_button_clicked()
# THEN: A web browser is opened # 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') @patch('openlp.core.ui.aboutform.get_version')
def test_about_form_build_number(self, mocked_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 Test that the copyright date is included correctly
""" """
# GIVEN: A correct application date # 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 # WHEN: The about form is created
about_form = AboutForm(None) 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. # 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"