def test_single_click_preview_false(self, mocked_singleShot, MockedSettings): """ Test that when "Preview items when clicked in Service Manager" disabled the preview timer doesn't start """ # GIVEN: A setting to enable "Preview items when clicked in Service Manager" and a service manager. mocked_settings = MagicMock() mocked_settings.value.return_value = False MockedSettings.return_value = mocked_settings service_manager = ServiceManager(None) # WHEN: on_single_click_preview() is called service_manager.on_single_click_preview() # THEN: timer should not be started self.assertEqual(mocked_singleShot.call_count, 0, 'Should not be called')
def test_single_click_preview_false(self, mocked_singleShot, MockedSettings): """ Test that when "Preview items when clicked in Service Manager" disabled the preview timer doesn't start """ # GIVEN: A setting to enable "Preview items when clicked in Service Manager" and a service manager. mocked_settings = MagicMock() mocked_settings.value.return_value = False MockedSettings.return_value = mocked_settings service_manager = ServiceManager(None) # WHEN: on_single_click_preview() is called service_manager.on_single_click_preview() # THEN: timer should not be started assert mocked_singleShot.call_count == 0, 'Should not be called'
def test_single_click_preview_true(self, mocked_singleShot, MockedSettings): """ Test that when "Preview items when clicked in Service Manager" enabled the preview timer starts """ # GIVEN: A setting to enable "Preview items when clicked in Service Manager" and a service manager. mocked_settings = MagicMock() mocked_settings.value.return_value = True MockedSettings.return_value = mocked_settings service_manager = ServiceManager(None) # WHEN: on_single_click_preview() is called service_manager.on_single_click_preview() # THEN: timer should have been started mocked_singleShot.assert_called_with(PyQt5.QtWidgets.QApplication.instance().doubleClickInterval(), service_manager.on_single_click_preview_timeout)
def test_single_click_preview_double(self, mocked_make_live, mocked_singleShot, MockedSettings): """ Test that when a double click has registered the preview timer doesn't start """ # GIVEN: A setting to enable "Preview items when clicked in Service Manager" and a service manager. mocked_settings = MagicMock() mocked_settings.value.return_value = True MockedSettings.return_value = mocked_settings service_manager = ServiceManager(None) # WHEN: on_single_click_preview() is called following a double click service_manager.on_double_click_live() service_manager.on_single_click_preview() # THEN: timer should not be started mocked_make_live.assert_called_with() self.assertEqual(mocked_singleShot.call_count, 0, 'Should not be called')
def test_single_click_preview_double(self, mocked_make_live, mocked_singleShot, MockedSettings): """ Test that when a double click has registered the preview timer doesn't start """ # GIVEN: A setting to enable "Preview items when clicked in Service Manager" and a service manager. mocked_settings = MagicMock() mocked_settings.value.return_value = True MockedSettings.return_value = mocked_settings service_manager = ServiceManager(None) # WHEN: on_single_click_preview() is called following a double click service_manager.on_double_click_live() service_manager.on_single_click_preview() # THEN: timer should not be started mocked_make_live.assert_called_with() assert mocked_singleShot.call_count == 0, 'Should not be called'
def test_single_click_preview_true(self, mocked_singleShot, MockedSettings): """ Test that when "Preview items when clicked in Service Manager" enabled the preview timer starts """ # GIVEN: A setting to enable "Preview items when clicked in Service Manager" and a service manager. mocked_settings = MagicMock() mocked_settings.value.return_value = True MockedSettings.return_value = mocked_settings service_manager = ServiceManager(None) # WHEN: on_single_click_preview() is called service_manager.on_single_click_preview() # THEN: timer should have been started mocked_singleShot.assert_called_with( PyQt5.QtWidgets.QApplication.instance().doubleClickInterval(), service_manager.on_single_click_preview_timeout)