diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-06-03 13:42:18 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-06-03 16:36:12 +0300 |
commit | c86cdf76825a19c4ca3fdc498f60266c1e1af0ff (patch) | |
tree | 985e6c94a0104e471f8b0b5e268143816f6b5c7e /tests | |
parent | 9903cc73439f978830a99791432752bbd6f1d3b1 (diff) |
Fix flaky test test_wclAutoCommitWordSetting
Use signal spy to observe the auto commit.
This should be reliable since it is triggered by
QVirtualKeyboardSelectionListModel in the event of auto commit.
Change-Id: I91c49c33e92df5e3d8fbdefee9c7f03e498bceeb
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/inputpanel/data/inputpanel/inputpanel.qml | 7 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 13 |
2 files changed, 13 insertions, 7 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml index b61331ab..73b08413 100644 --- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml +++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml @@ -89,6 +89,7 @@ InputPanel { property alias soundEffectSpy: soundEffectSpy property alias inputMethodResultSpy: inputMethodResultSpy property alias wordCandidateListChangedSpy: wordCandidateListChangedSpy + property alias wordCandidateListItemSelectedSpy: wordCandidateListItemSelectedSpy property alias inputMethodSelectionListChangedSpy: inputMethodSelectionListChangedSpy property alias wordCandidateListVisibleSpy: wordCandidateListVisibleSpy property alias shiftStateSpy: shiftStateSpy @@ -179,6 +180,12 @@ InputPanel { } SignalSpy { + id: wordCandidateListItemSelectedSpy + target: wordCandidateView.model + signalName: "itemSelected" + } + + SignalSpy { id: inputMethodSelectionListChangedSpy target: InputContext.inputEngine.inputMethod signalName: "selectionListChanged" diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index b141f1b3..b92b2712 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -1948,20 +1948,19 @@ Rectangle { if (!inputPanel.wordCandidateListVisibleHint) skip("Prediction/spell correction not enabled") + inputPanel.wordCandidateListItemSelectedSpy.clear() for (var len = 1; len <= 5; ++len) { inputPanel.virtualKeyClick("z") - if (len >= 2) { - inputPanel.inputMethodSelectionListChangedSpy.clear() - inputPanel.inputMethodSelectionListChangedSpy.wait() - if (inputPanel.wordCandidateView.model.count <= 1) - break + wait(200) + if (inputPanel.wordCandidateListItemSelectedSpy.count > 0) { + break } } if (data.wclAutoCommitWord) - verify(textInput.text.length > 0) + compare(inputPanel.wordCandidateListItemSelectedSpy.count, 1) else - verify(textInput.text.length === 0) + compare(inputPanel.wordCandidateListItemSelectedSpy.count, 0) } function test_fullScreenModeActivation() { |