forked from openlp/openlp
Add test
This commit is contained in:
parent
a9e620c175
commit
3d1cb3f383
@ -295,7 +295,7 @@ def set_case_insensitive_completer(cache, widget):
|
||||
Sets a case insensitive text completer for a widget.
|
||||
|
||||
:param cache: The list of items to use as suggestions.
|
||||
:param widget: A widget to set the completer (QComboBox or QTextEdit instance)
|
||||
:param widget: A widget to set the completer (QComboBox or QLineEdit instance)
|
||||
"""
|
||||
completer = QtGui.QCompleter(cache)
|
||||
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
||||
|
@ -170,3 +170,19 @@ class TestUi(TestCase):
|
||||
self.assertIsInstance(action.icon(), QtGui.QIcon)
|
||||
self.assertEqual('my tooltip', action.toolTip())
|
||||
self.assertEqual('my statustip', action.statusTip())
|
||||
|
||||
def test_set_case_insensitive_completer(self):
|
||||
"""
|
||||
Test setting a case insensitive completer on a widget
|
||||
"""
|
||||
# GIVEN: A QComboBox and a list of completion items
|
||||
line_edit = QtGui.QLineEdit()
|
||||
suggestions = ['one', 'Two', 'THRee', 'FOUR']
|
||||
|
||||
# WHEN: We call the function
|
||||
set_case_insensitive_completer(suggestions, line_edit)
|
||||
|
||||
# THEN: The Combobox should have a completer which is case insensitive
|
||||
completer = line_edit.completer()
|
||||
self.assertIsInstance(completer, QtGui.QCompleter)
|
||||
self.assertEqual(completer.caseSensitivity(), QtCore.Qt.CaseInsensitive)
|
||||
|
Loading…
Reference in New Issue
Block a user