Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/fix-ftw-download-progress into lp:openlp.
Commit message: Fixed an issue with the FTW not displaying any download progress. Requested reviews: Tim Bentley (trb143) For more details, see: https://code.launchpad.net/~raoul-snyman/openlp/fix-ftw-download-progress/+merge/336576 Fixed an issue with the FTW not displaying any download progress. Add this to your merge proposal: -------------------------------------------------------------------------------- lp:~raoul-snyman/openlp/fix-ftw-download-progress (revision 2811) https://ci.openlp.io/job/Branch-01-Pull/2430/ [SUCCESS] https://ci.openlp.io/job/Branch-02a-Linux-Tests/2331/ [SUCCESS] https://ci.openlp.io/job/Branch-02b-macOS-Tests/125/ [SUCCESS] https://ci.openlp.io/job/Branch-03a-Build-Source/47/ [SUCCESS] https://ci.openlp.io/job/Branch-03b-Build-macOS/45/ [SUCCESS] https://ci.openlp.io/job/Branch-04a-Code-Analysis/1509/ [SUCCESS] https://ci.openlp.io/job/Branch-04b-Test-Coverage/1322/ [SUCCESS] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/270/ [FAILURE] Stopping after failure -- Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/firsttimeform.py' --- openlp/core/ui/firsttimeform.py 2018-01-04 06:37:59 +0000 +++ openlp/core/ui/firsttimeform.py 2018-01-24 21:23:20 +0000 @@ -400,9 +400,9 @@ if item: item.setIcon(build_icon(Path(gettempdir(), 'openlp', screenshot))) - def _download_progress(self, count, block_size): + def update_progress(self, count, block_size): """ - Calculate and display the download progress. + Calculate and display the download progress. This method is called by download_file(). """ increment = (count * block_size) - self.previous_size self._increment_progress_bar(None, increment) === modified file 'openlp/core/ui/firsttimewizard.py' --- openlp/core/ui/firsttimewizard.py 2017-12-29 09:15:48 +0000 +++ openlp/core/ui/firsttimewizard.py 2018-01-24 21:23:20 +0000 @@ -63,7 +63,7 @@ first_time_wizard.setOptions(QtWidgets.QWizard.IndependentPages | QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.NoBackButtonOnLastPage | QtWidgets.QWizard.HaveCustomButton1 | QtWidgets.QWizard.HaveCustomButton2) - if is_macosx(): + if is_macosx(): # pragma: nocover first_time_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png')) first_time_wizard.resize(634, 386) === added directory 'tests/functional/openlp_core/api/endpoint' === added file 'tests/functional/openlp_core/api/endpoint/test_remote.py' --- tests/functional/openlp_core/api/endpoint/test_remote.py 1970-01-01 00:00:00 +0000 +++ tests/functional/openlp_core/api/endpoint/test_remote.py 2018-01-24 21:23:20 +0000 @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2018 OpenLP Developers # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +Functional tests to test the remote index +""" +from unittest.mock import MagicMock, patch + +from openlp.core.api.endpoint.remote import index +from openlp.core.api.endpoint.core import TRANSLATED_STRINGS + + +@patch('openlp.core.api.endpoint.remote.remote_endpoint') +def test_index(mocked_endpoint): + """ + Test the index method of the remote + """ + # GIVEN: A mocked Endpoint + mocked_endpoint.render_template.return_value = 'test template' + + # WHEN: index is called + result = index(MagicMock(), 'index') + + # THEN: The result should be "test template" and the right methods should have been called + mocked_endpoint.render_template.assert_called_once_with('index.mako', **TRANSLATED_STRINGS) + assert result == 'test template' === modified file 'tests/functional/openlp_core/lib/test_pluginmanager.py' --- tests/functional/openlp_core/lib/test_pluginmanager.py 2017-12-28 08:22:55 +0000 +++ tests/functional/openlp_core/lib/test_pluginmanager.py 2018-01-24 21:23:20 +0000 @@ -23,7 +23,7 @@ Package to test the openlp.core.lib.pluginmanager package. """ from unittest import TestCase -from unittest.mock import MagicMock +from unittest.mock import MagicMock, patch from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings @@ -50,6 +50,32 @@ Registry().register('main_window', self.mocked_main_window) Registry().register('settings_form', self.mocked_settings_form) + def test_bootstrap_initialise(self): + """ + Test the PluginManager.bootstrap_initialise() method + """ + # GIVEN: A plugin manager with some mocked out methods + manager = PluginManager() + + with patch.object(manager, 'find_plugins') as mocked_find_plugins, \ + patch.object(manager, 'hook_settings_tabs') as mocked_hook_settings_tabs, \ + patch.object(manager, 'hook_media_manager') as mocked_hook_media_manager, \ + patch.object(manager, 'hook_import_menu') as mocked_hook_import_menu, \ + patch.object(manager, 'hook_export_menu') as mocked_hook_export_menu, \ + patch.object(manager, 'hook_tools_menu') as mocked_hook_tools_menu, \ + patch.object(manager, 'initialise_plugins') as mocked_initialise_plugins: + # WHEN: bootstrap_initialise() is called + manager.bootstrap_initialise() + + # THEN: The hook methods should have been called + mocked_find_plugins.assert_called_with() + mocked_hook_settings_tabs.assert_called_with() + mocked_hook_media_manager.assert_called_with() + mocked_hook_import_menu.assert_called_with() + mocked_hook_export_menu.assert_called_with() + mocked_hook_tools_menu.assert_called_with() + mocked_initialise_plugins.assert_called_with() + def test_hook_media_manager_with_disabled_plugin(self): """ Test running the hook_media_manager() method with a disabled plugin === added file 'tests/interfaces/openlp_core/ui/test_init.py' --- tests/interfaces/openlp_core/ui/test_init.py 1970-01-01 00:00:00 +0000 +++ tests/interfaces/openlp_core/ui/test_init.py 2018-01-24 21:23:20 +0000 @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2018 OpenLP Developers # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +Test the openlp.core.ui package. +""" +from unittest.mock import MagicMock, patch + +from openlp.core.ui import SingleColumnTableWidget + + +def test_single_col_widget_create(): + """ + Test creating the SingleColumnTableWidget object + """ + # GIVEN: the SingleColumnTableWidget class + # WHEN: An object is created + widget = SingleColumnTableWidget(None) + + # THEN: The object should have 1 column and no visible header + assert widget.columnCount() == 1, 'There should be only 1 column' + assert widget.horizontalHeader().isVisible() is False, 'The horizontal header should not be visible' + + +@patch('openlp.core.ui.QtWidgets.QTableWidget') +def test_single_col_widget_resize_event(MockQTableWidget): + """ + Test that the resizeEvent method does the right thing + """ + # GIVEN: An instance of a SingleColumnTableWidget and a mocked event + widget = SingleColumnTableWidget(None) + mocked_event = MagicMock() + mocked_event.size.return_value.width.return_value = 10 + + # WHEN: resizeEvent() is called + with patch.object(widget, 'columnCount') as mocked_column_count, \ + patch.object(widget, 'setColumnWidth') as mocked_set_column_width, \ + patch.object(widget, 'resizeRowsToContents') as mocked_resize_rows_to_contents: + mocked_column_count.return_value = 1 + widget.resizeEvent(mocked_event) + + # THEN: The correct calls should have been made + MockQTableWidget.resizeEvent.assert_called_once_with(widget, mocked_event) + mocked_column_count.assert_called_once_with() + mocked_set_column_width.assert_called_once_with(0, 10) + mocked_resize_rows_to_contents.assert_called_once_with()
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp