diff options
author | Robert Löhning <robert.loehning@qt.io> | 2021-06-25 16:21:41 +0200 |
---|---|---|
committer | Robert Löhning <robert.loehning@qt.io> | 2021-07-05 09:25:31 +0000 |
commit | c8b176c9a70a6d4b8cc2231f9812965198f5989c (patch) | |
tree | 458f2ed0f42eca5d7599ba6f5d2b8cd9c3c062c0 | |
parent | befe84f8d2749c27cdd58eaa1dda0f700982d6e3 (diff) | |
download | qt-creator-c8b176c9a70a6d4b8cc2231f9812965198f5989c.tar.gz |
Squish: Stabilize tst_HELP02
On Windows, the shortcut gets lost when
clicking "Stop Recording" too quickly.
Change-Id: Ieb89b7f59ded0792bf09fbad0b4b44a78d369c0f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rwxr-xr-x | tests/system/suite_HELP/tst_HELP02/test.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 1d776689be..2492be950f 100755 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -66,6 +66,11 @@ def checkQtCreatorHelpVersion(expectedVersion): test.log("Exception caught", "%s(%s)" % (str(t), str(v))) test.fail("Missing Qt Creator Manual.") + +def _shortcutMatches_(shortcutEdit, expectedText): + return str(findObject(shortcutEdit).text) == expectedText + + def setKeyboardShortcutForAboutQtC(): invokeMenuItem("Tools", "Options...") mouseClick(waitForObjectItem(":Options_QListView", "Environment")) @@ -85,20 +90,19 @@ def setKeyboardShortcutForAboutQtC(): "visible='1' text~='(Stop Recording|Record)'}" % shortcutGB) shortcut = ("{container=%s type='Utils::FancyLineEdit' unnamed='1' visible='1' " "placeholderText='Enter key sequence as text'}" % shortcutGB) + expected = 'Ctrl+Opt+A' if platform.system() == 'Darwin' else 'Ctrl+Alt+A' clickButton(record) nativeType("<Ctrl+Alt+a>") + waitFor("_shortcutMatches_(shortcut, expected)", 5000) clickButton(record) - expected = 'Ctrl+Alt+A' - if platform.system() == 'Darwin': - expected = 'Ctrl+Opt+A' - shortcutMatches = waitFor("str(findObject(shortcut).text) == expected", 5000) - if not shortcutMatches and platform.system() == 'Darwin': + gotExpectedShortcut = _shortcutMatches_(shortcut, expected) + if not gotExpectedShortcut and platform.system() == 'Darwin': test.warning("Squish Issue: shortcut was set to %s - entering it manually now" % waitForObject(shortcut).text) replaceEditorContent(shortcut, expected) else: - test.verify(shortcutMatches, "Expected key sequence is displayed.") + test.verify(gotExpectedShortcut, "Expected key sequence is displayed.") clickButton(waitForObject(":Options.OK_QPushButton")) def main(): |