Better test

This commit is contained in:
Samuel Mehrbrodt 2014-04-08 23:20:51 +02:00
parent 11884adbed
commit 31649b0a8e
1 changed files with 12 additions and 11 deletions

View File

@ -82,18 +82,19 @@ class TestUi(TestCase):
self.assertEqual(1, len(btnbox.buttons())) self.assertEqual(1, len(btnbox.buttons()))
self.assertEqual(QtGui.QDialogButtonBox.HelpRole, btnbox.buttonRole(btnbox.buttons()[0])) self.assertEqual(QtGui.QDialogButtonBox.HelpRole, btnbox.buttonRole(btnbox.buttons()[0]))
def test_set_case_insensitive_completer(self): def test_create_valign_selection_widgets(self):
""" """
Test setting a case insensitive text completer for a widget Test creating a combo box for valign selection
""" """
# GIVEN: A ComboBox and a list of strings # GIVEN: A dialog
combo = QtGui.QComboBox() dialog = QtGui.QDialog()
suggestions = ['hello', 'world', 'and', 'others']
# WHEN: We set the autocompleter # WHEN: We create the widgets
set_case_insensitive_completer(suggestions, combo) label, combo = create_valign_selection_widgets(dialog)
# THEN: The Combobox should have the autocompleter. # THEN: We should get a label and a combobox.
self.assertIsInstance(combo.completer(), QtGui.QCompleter) self.assertEqual(translate('OpenLP.Ui', '&Vertical Align:'), label.text())
#self.assertEqual(QtCore.Qt.CaseInsensitive, combo.completer().caseSensitivity()) self.assertIsInstance(combo, QtGui.QComboBox)
#self.assertEqual(suggestions, combo.completer().completionModel().data()) self.assertEqual(combo, label.buddy())
for text in [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom]:
self.assertTrue(combo.findText(text) >= 0)