forked from openlp/openlp
Add test
This commit is contained in:
parent
89042982d6
commit
7ced39594f
@ -580,8 +580,6 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
|||||||
for file_item in write_list:
|
for file_item in write_list:
|
||||||
total_size += file_item.stat().st_size
|
total_size += file_item.stat().st_size
|
||||||
self.log_debug('ServiceManager.save_file - ZIP contents size is %i bytes' % total_size)
|
self.log_debug('ServiceManager.save_file - ZIP contents size is %i bytes' % total_size)
|
||||||
|
|
||||||
# Number of items + 1 to zip it
|
|
||||||
self.main_window.display_progress_bar(total_size)
|
self.main_window.display_progress_bar(total_size)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -242,3 +242,30 @@ class TestMainWindow(TestCase, TestMixin):
|
|||||||
|
|
||||||
# THEN: projector_manager_dock.setVisible should had been called once
|
# THEN: projector_manager_dock.setVisible should had been called once
|
||||||
mocked_dock.setVisible.assert_called_once_with(False)
|
mocked_dock.setVisible.assert_called_once_with(False)
|
||||||
|
|
||||||
|
def test_increment_progress_bar_default_increment(self):
|
||||||
|
"""
|
||||||
|
Test that increment_progress_bar increments the progress bar by 1 when called without the `increment` arg.
|
||||||
|
"""
|
||||||
|
# GIVEN: A mocked progress bar
|
||||||
|
with patch.object(self.main_window, 'load_progress_bar', **{'value.return_value': 0}) as mocked_progress_bar:
|
||||||
|
|
||||||
|
# WHEN: Calling increment_progress_bar without the `increment` arg
|
||||||
|
self.main_window.increment_progress_bar()
|
||||||
|
|
||||||
|
# THEN: The progress bar value should have been incremented by 1
|
||||||
|
mocked_progress_bar.setValue.assert_called_once_with(1)
|
||||||
|
|
||||||
|
def test_increment_progress_bar_custom_increment(self):
|
||||||
|
"""
|
||||||
|
Test that increment_progress_bar increments the progress bar by the `increment` arg when called with the
|
||||||
|
`increment` arg with a set value.
|
||||||
|
"""
|
||||||
|
# GIVEN: A mocked progress bar
|
||||||
|
with patch.object(self.main_window, 'load_progress_bar', **{'value.return_value': 0}) as mocked_progress_bar:
|
||||||
|
|
||||||
|
# WHEN: Calling increment_progress_bar with `increment` set to 10
|
||||||
|
self.main_window.increment_progress_bar(increment=10)
|
||||||
|
|
||||||
|
# THEN: The progress bar value should have been incremented by 10
|
||||||
|
mocked_progress_bar.setValue.assert_called_once_with(10)
|
||||||
|
Loading…
Reference in New Issue
Block a user