diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-08-16 20:37:43 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-08-16 20:37:43 +0300 |
commit | bbd4a25e456a2922ff71d9cbe9a8b7f656e753ad (patch) | |
tree | 560da0e7bf6e3546ac4fdd9826213c8a1568d407 /tests/auto/controls/data/tst_combobox.qml | |
parent | a970e15d7281d2d13485a486c6debadf46ed7950 (diff) | |
parent | 05522a30193a3090dd7cae26b36d675ae1f18e08 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.6' into tqtc/lts-5.15-opensourcev5.15.6-lts-lgpl
Change-Id: I85122ded86860165f2d9523e3ac15e129df1fa75
Diffstat (limited to 'tests/auto/controls/data/tst_combobox.qml')
-rw-r--r-- | tests/auto/controls/data/tst_combobox.qml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index eaf9b3c6..9bbea26d 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -157,6 +157,7 @@ TestCase { verify(control.delegate) verify(control.indicator) verify(control.popup) + verify(control.acceptableInput) compare(control.inputMethodHints, Qt.ImhNoPredictiveText) } @@ -2062,4 +2063,43 @@ TestCase { verify(control.activeFocus) verify(control.contentItem.focus) } + + Component { + id: intValidatorComponent + IntValidator { + bottom: 0 + top: 255 + } + } + + function test_acceptableInput_QTBUG_94307() { + let items = [ + { text: "A" }, + { text: "2" }, + { text: "3" } + ] + let control = createTemporaryObject(comboBox, testCase, {model: items, editable: true}) + verify(control) + + verify(control.acceptableInput) + compare(control.displayText, "A") + + let acceptableInputSpy = signalSpy.createObject(control, {target: control, signalName: "acceptableInputChanged"}) + verify(acceptableInputSpy.valid) + + let intValidator = intValidatorComponent.createObject(testCase) + verify(intValidator) + + control.validator = intValidator + + compare(acceptableInputSpy.count, 1) + compare(control.displayText, "A") + compare(control.acceptableInput, false) + + control.currentIndex = 1 + + compare(acceptableInputSpy.count, 2) + compare(control.displayText, "2") + compare(control.acceptableInput, true) + } } |