diff options
author | Jiří Techet <techet@gmail.com> | 2024-03-08 07:56:22 +1100 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2024-03-08 07:56:22 +1100 |
commit | 548093449967bb84aaf112df736428681657c528 (patch) | |
tree | 2b0fa62496674d8d1f777679628a56e8fcbca0c0 /test | |
parent | 792b3fde18766b74c56472a26fa82107b650d3e4 (diff) | |
download | scintilla-mirror-548093449967bb84aaf112df736428681657c528.tar.gz |
Bug [#2403]. Add SC_AUTOCOMPLETE_SELECT_FIRST_ITEM.
This option always selects the first item in the autocompletion list.
Diffstat (limited to 'test')
-rw-r--r-- | test/simpleTests.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/simpleTests.py b/test/simpleTests.py index 72007f86a..900f97faf 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -3129,6 +3129,28 @@ class TestAutoComplete(unittest.TestCase): self.assertEqual(self.ed.AutoCActive(), 0) + def testAutoSelectFirstItem(self): + self.assertEqual(self.ed.AutoCActive(), 0) + + self.ed.AutoCSetOrder(self.ed.SC_ORDER_CUSTOM) + + # without SC_AUTOCOMPLETE_SELECT_FIRST_ITEM option + self.ed.SetSel(3, 3) + self.ed.AutoCShow(3, b"aaa1 bbb1 xxx1") + # automatically selects the item with the entered prefix xxx + self.ed.AutoCComplete() + self.assertEqual(self.ed.Contents(), b"xxx1\n") + + # with SC_AUTOCOMPLETE_SELECT_FIRST_ITEM option + self.ed.AutoCSetOptions(2, 0) + self.ed.SetSel(3, 3) + self.ed.AutoCShow(3, b"aaa1 bbb1 xxx1") + # selects the first item regardless of the entered prefix and replaces the entered xxx + self.ed.AutoCComplete() + self.assertEqual(self.ed.Contents(), b"aaa11\n") + + self.assertEqual(self.ed.AutoCActive(), 0) + def testAutoCustomSort(self): # Checks bug #2294 where SC_ORDER_CUSTOM with an empty list asserts # https://sourceforge.net/p/scintilla/bugs/2294/ |