From 3f75a913e2f33505a60562a71f5dbdd49d5750a1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 May 2014 18:57:45 +0200 Subject: [PATCH] removed not working tests --- openlp/core/common/historycombobox.py | 2 +- .../interfaces/openlp_core_common/__init__.py | 28 +++++++++++++++ .../test_historycombobox.py} | 35 +++++++++++-------- .../openlp_core_lib/test_searchedit.py | 7 ---- .../openlp_core_ui/test_filerenamedialog.py | 2 +- 5 files changed, 50 insertions(+), 24 deletions(-) create mode 100644 tests/interfaces/openlp_core_common/__init__.py rename tests/interfaces/{openlp_core_ui/test_splashscreen.py => openlp_core_common/test_historycombobox.py} (74%) diff --git a/openlp/core/common/historycombobox.py b/openlp/core/common/historycombobox.py index b6d06ff9f..aadc0ea39 100644 --- a/openlp/core/common/historycombobox.py +++ b/openlp/core/common/historycombobox.py @@ -53,7 +53,7 @@ class HistoryComboBox(QtGui.QComboBox): self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.setInsertPolicy(QtGui.QComboBox.InsertAtTop) - def keyPressEvent(self, event): + def keyPressEvlent(self, event): """ Override the inherited keyPressEvent method to emit the ``returnPressed`` signal and to save the current text to the dropdown list. diff --git a/tests/interfaces/openlp_core_common/__init__.py b/tests/interfaces/openlp_core_common/__init__.py new file mode 100644 index 000000000..6b241e7fc --- /dev/null +++ b/tests/interfaces/openlp_core_common/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2014 Raoul Snyman # +# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # +# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # +# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # +# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # +# Frode Woldsund, Martin Zibricky, Patrick Zimmermann # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### diff --git a/tests/interfaces/openlp_core_ui/test_splashscreen.py b/tests/interfaces/openlp_core_common/test_historycombobox.py similarity index 74% rename from tests/interfaces/openlp_core_ui/test_splashscreen.py rename to tests/interfaces/openlp_core_common/test_historycombobox.py index 35c15f9ec..00a63f15f 100644 --- a/tests/interfaces/openlp_core_ui/test_splashscreen.py +++ b/tests/interfaces/openlp_core_common/test_historycombobox.py @@ -27,34 +27,39 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -Test the openlp.core.ui.splashscreen class. +Module to test the :mod:`~openlp.core.common.historycombobox` module. """ + from unittest import TestCase -from PyQt4 import QtGui +from PyQt4 import QtCore, QtGui, QtTest -from openlp.core.ui import SplashScreen +from openlp.core.common import Registry +from openlp.core.common import HistoryComboBox from tests.helpers.testmixin import TestMixin +from tests.interfaces import MagicMock, patch -class TestSplashScreen(TestCase, TestMixin): +class TestHistoryComboBox(TestCase, TestMixin): def setUp(self): + Registry.create() self.get_application() self.main_window = QtGui.QMainWindow() + Registry().register('main_window', self.main_window) + self.combo = HistoryComboBox(self.main_window) def tearDown(self): - """ - Delete all the C++ objects at the end so that we don't have a segfault - """ - del self.app - del self.main_window + del self.combo - def setupUi_test(self): + def getItems_test(self): """ - Test if the setupUi method.... + Test the getItems() method """ - # GIVEN: A splash screen instance. - splash = SplashScreen() + # GIVEN: The combo. - # THEN: Check if the splash has a setupUi method. - assert hasattr(splash, 'setupUi'), 'The Splash Screen should have a setupUi() method.' + # WHEN: Add two items. + self.combo.addItem('test1') + self.combo.addItem('test2') + + # THEN: The list of items should contain both strings. + self.assertEqual(self.combo.getItems(), ['test1', 'test2']) \ No newline at end of file diff --git a/tests/interfaces/openlp_core_lib/test_searchedit.py b/tests/interfaces/openlp_core_lib/test_searchedit.py index 22bf6fae3..f2cf18988 100644 --- a/tests/interfaces/openlp_core_lib/test_searchedit.py +++ b/tests/interfaces/openlp_core_lib/test_searchedit.py @@ -30,7 +30,6 @@ Module to test the EditCustomForm. """ from unittest import TestCase -from unittest.mock import MagicMock from PyQt4 import QtCore, QtGui, QtTest @@ -127,9 +126,3 @@ class TestSearchEdit(TestCase, TestMixin): # THEN: The search edit text should be cleared and the button be hidden. assert not self.search_edit.text(), "The search edit should not have any text." assert self.search_edit.clear_button.isHidden(), "The clear button should be hidden." - - def resize_event_test(self): - """ - Just check if the resizeEvent() method is re-implemented. - """ - assert hasattr(self.search_edit, "resizeEvent"), "The search edit should re-implement the resizeEvent method." diff --git a/tests/interfaces/openlp_core_ui/test_filerenamedialog.py b/tests/interfaces/openlp_core_ui/test_filerenamedialog.py index 905f167e9..7d14c7d9c 100644 --- a/tests/interfaces/openlp_core_ui/test_filerenamedialog.py +++ b/tests/interfaces/openlp_core_ui/test_filerenamedialog.py @@ -89,7 +89,7 @@ class TestStartFileRenameForm(TestCase, TestMixin): Test that the file_name_edit setFocus has called with True when executed """ # GIVEN: A mocked QDialog.exec_() method and mocked file_name_edit.setFocus() method. - with patch('PyQt4.QtGui.QDialog.exec_') as mocked_exec: + with patch('PyQt4.QtGui.QDialog.exec_'): mocked_set_focus = MagicMock() self.form.file_name_edit.setFocus = mocked_set_focus