From be05be97de848e1b021e2cf56ffe6755e59508a6 Mon Sep 17 00:00:00 2001 From: Jarkko Koivikko Date: Thu, 12 May 2016 21:55:41 +0300 Subject: 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 --- tests/auto/inputpanel/data/tst_inputpanel.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto') 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) -- cgit v1.2.3