diff options
author | Christian Stenger <christian.stenger@qt.io> | 2017-09-07 12:45:01 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2017-09-07 12:47:44 +0000 |
commit | 85e656b04183d0cba01fa5ddeedde7ffdbfb7dbe (patch) | |
tree | 8d458d5a227bbdd5a61df777f95b0757a84704ee /tests/system | |
parent | 5b48bd0420271ed3919b208b56e2734716abe088 (diff) | |
download | qt-creator-85e656b04183d0cba01fa5ddeedde7ffdbfb7dbe.tar.gz |
Squish: Workaround Squish issues when using nativeType
When using nativeType() Squish sends single key press events for
any char to type.
nativeType() does not wait until these events have been processed
which leads to complete useless time measurings inside
tst_tasks_handling as timestamps are taken too early if nativeType
had to be used - which happens when a native FileDialog is used.
Change-Id: I446de898fd99b2e169ca39bef1adb4306d6ee530
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Diffstat (limited to 'tests/system')
-rw-r--r-- | tests/system/shared/utils.py | 12 | ||||
-rw-r--r-- | tests/system/suite_general/tst_tasks_handling/test.py | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index db4c4e1cd5..b331ddb667 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -243,7 +243,7 @@ def getOutputFromCmdline(cmdline, environment=None, acceptedError=0): test.warning("Command '%s' returned %d" % (e.cmd, e.returncode)) return e.output -def selectFromFileDialog(fileName, waitForFile=False): +def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False): if platform.system() == "Darwin": snooze(1) nativeType("<Command+Shift+g>") @@ -253,7 +253,8 @@ def selectFromFileDialog(fileName, waitForFile=False): nativeType("<Return>") snooze(3) nativeType("<Return>") - snooze(1) + if not ignoreFinalSnooze: + snooze(1) else: fName = os.path.basename(os.path.abspath(fileName)) pName = os.path.dirname(os.path.abspath(fileName)) + os.sep @@ -271,9 +272,12 @@ def selectFromFileDialog(fileName, waitForFile=False): nativeType("<Ctrl+a>") nativeType("<Delete>") nativeType(pName + fName) - snooze(1) + seconds = len(pName + fName) / 20 + test.log("Using snooze(%d) [problems with event processing of nativeType()]" % seconds) + snooze(seconds) nativeType("<Return>") - snooze(3) + if not ignoreFinalSnooze: + snooze(3) if waitForFile: fileCombo = waitForObject(":Qt Creator_FilenameQComboBox") if not waitFor("str(fileCombo.currentText) in fileName", 5000): diff --git a/tests/system/suite_general/tst_tasks_handling/test.py b/tests/system/suite_general/tst_tasks_handling/test.py index 69e7a6719c..6870cceead 100644 --- a/tests/system/suite_general/tst_tasks_handling/test.py +++ b/tests/system/suite_general/tst_tasks_handling/test.py @@ -99,7 +99,7 @@ def main(): model = waitForObject(":Qt Creator.Issues_QListView").model() test.verify(model.rowCount() == 0, 'Got an empty issue list to start from.') invokeMenuItem("File", "Open File or Project...") - selectFromFileDialog(tasksFile) + selectFromFileDialog(tasksFile, False, True) starttime = datetime.utcnow() waitFor("model.rowCount() == expectedNo", 10000) endtime = datetime.utcnow() |