Commit 85e656b0 authored by Christian Stenger's avatar Christian Stenger

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: default avatarRobert Loehning <robert.loehning@qt.io>
parent 5b48bd04
......@@ -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):
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment