diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 965adb053..a1e37abcf 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -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) diff --git a/tests/functional/openlp_core_lib/test_ui.py b/tests/functional/openlp_core_lib/test_ui.py index 025b1a638..d48e5d694 100644 --- a/tests/functional/openlp_core_lib/test_ui.py +++ b/tests/functional/openlp_core_lib/test_ui.py @@ -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)