removed not working tests

This commit is contained in:
Andreas Preikschat 2014-05-01 18:57:45 +02:00
parent 3cf9094e5f
commit 3f75a913e2
5 changed files with 50 additions and 24 deletions

View File

@ -53,7 +53,7 @@ class HistoryComboBox(QtGui.QComboBox):
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
self.setInsertPolicy(QtGui.QComboBox.InsertAtTop) 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 Override the inherited keyPressEvent method to emit the ``returnPressed`` signal and to save the current text to
the dropdown list. the dropdown list.

View File

@ -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 #
###############################################################################

View File

@ -27,34 +27,39 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # 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 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.helpers.testmixin import TestMixin
from tests.interfaces import MagicMock, patch
class TestSplashScreen(TestCase, TestMixin): class TestHistoryComboBox(TestCase, TestMixin):
def setUp(self): def setUp(self):
Registry.create()
self.get_application() self.get_application()
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.combo = HistoryComboBox(self.main_window)
def tearDown(self): def tearDown(self):
""" del self.combo
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.app
del self.main_window
def setupUi_test(self): def getItems_test(self):
""" """
Test if the setupUi method.... Test the getItems() method
""" """
# GIVEN: A splash screen instance. # GIVEN: The combo.
splash = SplashScreen()
# THEN: Check if the splash has a setupUi method. # WHEN: Add two items.
assert hasattr(splash, 'setupUi'), 'The Splash Screen should have a setupUi() method.' self.combo.addItem('test1')
self.combo.addItem('test2')
# THEN: The list of items should contain both strings.
self.assertEqual(self.combo.getItems(), ['test1', 'test2'])

View File

@ -30,7 +30,6 @@
Module to test the EditCustomForm. Module to test the EditCustomForm.
""" """
from unittest import TestCase from unittest import TestCase
from unittest.mock import MagicMock
from PyQt4 import QtCore, QtGui, QtTest 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. # 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 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." 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."

View File

@ -89,7 +89,7 @@ class TestStartFileRenameForm(TestCase, TestMixin):
Test that the file_name_edit setFocus has called with True when executed 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. # 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() mocked_set_focus = MagicMock()
self.form.file_name_edit.setFocus = mocked_set_focus self.form.file_name_edit.setFocus = mocked_set_focus