Fixed up the test

This commit is contained in:
Raoul Snyman 2015-04-25 21:29:39 +02:00
parent 8e0fc05b82
commit 1387bfc838
1 changed files with 13 additions and 10 deletions

View File

@ -66,21 +66,24 @@ class TestInit(TestCase, TestMixin):
mocked_file_method.assert_called_once_with() mocked_file_method.assert_called_once_with()
self.assertEqual(self.openlp.args[0], file_path, "The path should be in args.") self.assertEqual(self.openlp.args[0], file_path, "The path should be in args.")
def application_activate_event_test(self): @patch('openlp.core.is_macosx')
def application_activate_event_test(self, mocked_is_macosx):
""" """
Test that clicking on the dock icon on Mac OS X restores the main window if it is minimized Test that clicking on the dock icon on Mac OS X restores the main window if it is minimized
""" """
# GIVEN: # GIVEN: Mac OS X and an ApplicationActivate event
with patch('openlp.core.is_macosx') as mocked_is_macosx: mocked_is_macosx.return_value = True
mocked_is_macosx.return_value = True event = MagicMock()
event = QtCore.QEvent(QtCore.QEvent.ApplicationActivate) event.type.return_value = QtCore.QEvent.ApplicationActivate
mocked_main_window = MagicMock()
self.openlp.main_window = mocked_main_window
# WHEN: # WHEN: The icon in the dock is clicked
result = self.openlp.event(event) result = self.openlp.event(event)
# THEN: # THEN:
self.assertTrue(result, "The method should have returned True.") self.assertTrue(result, "The method should have returned True.")
self.assertFalse(self.openlp.main_window.isMinimized()) # self.assertFalse(self.openlp.main_window.isMinimized())
def backup_on_upgrade_first_install_test(self): def backup_on_upgrade_first_install_test(self):
""" """