diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2016-05-12 21:55:41 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2016-05-12 19:08:57 +0000 |
commit | be05be97de848e1b021e2cf56ffe6755e59508a6 (patch) | |
tree | 26996e0c4f9623b51f86613dbbc7bca623fd2454 /tests | |
parent | 5009730b5dd04b5c53d77b88fb618e6d7fb1acb8 (diff) |
Make test_keyPress more robust
The test was based on a simple delay, which proved to be an
unreliable way to measure the number of keystrokes. Now the
test uses SignalSpy to measure the keystrokes.
Change-Id: Id2474e07e002fb001eba4a3b595c2719aac81f6c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index 5a3aafb8..85de31d4 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -204,7 +204,7 @@ Rectangle { // function key press { initText: "x", initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputKey: Qt.Key_Shift, outputKeyCountMin: 1, outputKey: Qt.Key_Shift, preview: false, outputKeyText: "", outputKeyModifiers: Qt.NoModifier, outputKeyRepeat: false, outputText: "x" }, { initText: "x", initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputKey: Qt.Key_Backspace, outputKeyCountMin: 1, outputKey: Qt.Key_Backspace, preview: false, outputKeyText: "", outputKeyModifiers: Qt.NoModifier, outputKeyRepeat: false, outputText: "" }, - { initText: "xxxxxx", initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputKey: Qt.Key_Backspace, keyHold: 600 + 8 * 50, outputKeyCountMin: 6, outputKey: Qt.Key_Backspace, preview: false, outputKeyText: "", outputKeyModifiers: Qt.NoModifier, outputKeyRepeat: true, outputText: "" }, + { initText: "xxxxxx", initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, inputKey: Qt.Key_Backspace, keyHold: 1000, outputKeyCountMin: 6, outputKey: Qt.Key_Backspace, preview: false, outputKeyText: "", outputKeyModifiers: Qt.NoModifier, outputKeyRepeat: true, outputText: "" }, ] } @@ -215,7 +215,9 @@ Rectangle { inputPanel.virtualKeyClickedSpy.clear() if (data.hasOwnProperty("keyHold")) { inputPanel.virtualKeyPress(data.inputKey) - wait(data.keyHold) + do { + inputPanel.virtualKeyClickedSpy.wait(data.keyHold) + } while (inputPanel.virtualKeyClickedSpy.count < data.outputKeyCountMin) inputPanel.virtualKeyRelease() } else { inputPanel.virtualKeyClick(data.inputKey) |