diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2015-10-27 12:15:47 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2015-10-27 12:13:41 +0000 |
commit | 3c8195bd4cd4ec5fc882ee40eab888568e048b8d (patch) | |
tree | 4a597987deed47a183b10e4efe55ec4e67073edd /tests | |
parent | b27fa0974957346f2ec4bde55efbabec0c293bcf (diff) |
Stabilize arrow key navigation tests
The arrow key navigation tests could fail due to bug in a test function.
Previously the navigation key press and the highlight rectangle could
go out of sync due to highlight animation. Now the test waits until the
highlight animation is completed and then proceeds with the test, making
the test cases more robust and not dependent of system performance.
Change-Id: I72bc15de988a212fa2e96230bc346bbfd3fdea41
Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/inputpanel/data/inputpanel/inputpanel.qml | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml index 113431c2..2027cb76 100644 --- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml +++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml @@ -54,6 +54,10 @@ InputPanel { readonly property var characterPreviewBubble: Utils.findChildByProperty(keyboard, "objectName", "characterPreviewBubble", null) readonly property var alternativeKeys: Utils.findChildByProperty(keyboard, "objectName", "alternativeKeys", null) readonly property var naviationHighlight: Utils.findChildByProperty(keyboard, "objectName", "naviationHighlight", null) + readonly property bool naviationHighlightAnimating: naviationHighlight.xAnimation.running || + naviationHighlight.yAnimation.running || + naviationHighlight.widthAnimation.running || + naviationHighlight.heightAnimation.running readonly property var wordCandidateView: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateView", null) readonly property bool wordCandidateListVisibleHint: InputContext.inputEngine.wordCandidateListVisibleHint readonly property bool keyboardLayoutsAvailable: keyboard.availableLocaleIndices.length > 0 && keyboard.availableLocaleIndices.indexOf(-1) === -1 @@ -332,7 +336,8 @@ InputPanel { function emulateNavigationKeyClick(navigationKey) { testcase.keyClick(navigationKey) - testcase.waitForRendering(inputPanel) + while (inputPanel.naviationHighlightAnimating) + testcase.wait(inputPanel.naviationHighlight.moveDuration / 2) } function navigationHighlightContains(point) { @@ -355,7 +360,6 @@ InputPanel { emulateNavigationKeyClick(Qt.Key_Left) else if (inputPanel.naviationHighlight.x + inputPanel.naviationHighlight.width < point.x) emulateNavigationKeyClick(Qt.Key_Right) - testcase.wait(inputPanel.naviationHighlight.moveDuration) } } return false @@ -407,8 +411,10 @@ InputPanel { function activateNavigationKeyMode() { if (!inputPanel.naviationHighlight.visible) { emulateNavigationKeyClick(Qt.Key_Right) - if (inputPanel.naviationHighlight.visible) - testcase.wait(inputPanel.naviationHighlight.moveDuration) + if (inputPanel.naviationHighlight.visible) { + while (inputPanel.naviationHighlightAnimating) + testcase.wait(inputPanel.naviationHighlight.moveDuration / 2) + } } return inputPanel.naviationHighlight.visible } |