diff options
author | Christian Stenger <christian.stenger@nokia.com> | 2011-10-07 15:43:45 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@nokia.com> | 2011-10-12 14:21:45 +0200 |
commit | 2c155447be40b45c6a16a0f8bc67e5b26735695b (patch) | |
tree | 771a4c0a74b3f6b0fdcf716fa8ca239535d7ce7f /tests | |
parent | 14c9e077fab91134a98dafb8eb4a00c593aa91a4 (diff) | |
download | qt-creator-2c155447be40b45c6a16a0f8bc67e5b26735695b.tar.gz |
Squish: Fixed some minor problems
* problems on shutdown (mostly Win)
* timing problems (Mac, Win)
* support for accidental whitespace in settingspath (all)
* added support for further special characters that could exist
inside TreeView of the Project files (all)
* removing the testing folder instead its content (all)
Change-Id: I146b56d253e3245641d0dcaebfad4d6f1dd684fc
Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/shared/qtcreator.py | 8 | ||||
-rw-r--r-- | tests/system/shared/qtquick.py | 5 | ||||
-rw-r--r-- | tests/system/suite_qtquick/tst_qml_editor/test.py | 38 |
3 files changed, 39 insertions, 12 deletions
diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 418f696779..2aacbf68c1 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -21,11 +21,13 @@ source("../../shared/editor_utils.py") def waitForCleanShutdown(timeOut=10): appCtxt = currentApplicationContext() - shutdownDone = False + shutdownDone = (str(appCtxt)=="") if platform.system() in ('Windows','Microsoft'): endtime = datetime.utcnow() + timedelta(seconds=timeOut) while not shutdownDone: # following work-around because os.kill() works for win not until python 2.7 + if appCtxt.pid==-1: + break tasks = subprocess.Popen("tasklist /FI \"PID eq %d\"" % appCtxt.pid, shell=True,stdout=subprocess.PIPE) output = tasks.communicate()[0] tasks.stdout.close() @@ -47,7 +49,7 @@ def waitForCleanShutdown(timeOut=10): def __removeTmpSettingsDir__(): waitForCleanShutdown() - deleteDirIfExists(os.path.dirname(tmpSettingsDir)) + deleteDirIfExists(os.path.dirname(os.path.dirname(tmpSettingsDir))) if platform.system() in ('Windows', 'Microsoft'): sdkPath = "C:\\QtSDK" @@ -67,5 +69,5 @@ tmpSettingsDir = os.path.abspath(tmpSettingsDir+"/settings") shutil.copytree(cwd, tmpSettingsDir) # the following only doesn't work if the test ends in an exception atexit.register(__removeTmpSettingsDir__) -SettingsPath = " -settingspath %s" % tmpSettingsDir +SettingsPath = ' -settingspath "%s"' % tmpSettingsDir diff --git a/tests/system/shared/qtquick.py b/tests/system/shared/qtquick.py index 98b664bf0b..899bdeeda0 100644 --- a/tests/system/shared/qtquick.py +++ b/tests/system/shared/qtquick.py @@ -119,8 +119,11 @@ def runAndCloseQtQuickUI(): # the following is currently a work-around for not using hooking into subprocesses if (waitForObject(":Qt Creator_Core::Internal::OutputPaneToggleButton").checked!=True): clickButton(":Qt Creator_Core::Internal::OutputPaneToggleButton") - clickButton(":Qt Creator.Stop_QToolButton") + stop = findObject(":Qt Creator.Stop_QToolButton") + waitFor("stop.enabled==True") + clickButton(stop) if platform.system()=="Darwin": + waitFor("stop.enabled==False") snooze(2) nativeType("<Escape>") return True diff --git a/tests/system/suite_qtquick/tst_qml_editor/test.py b/tests/system/suite_qtquick/tst_qml_editor/test.py index 4c7edff0f0..f2bf98e3c9 100644 --- a/tests/system/suite_qtquick/tst_qml_editor/test.py +++ b/tests/system/suite_qtquick/tst_qml_editor/test.py @@ -32,11 +32,22 @@ def testRenameId(): model = navTree.model() files = ["Core.ContextMenu\\.qml", "Core.GridMenu\\.qml", "Core.ListMenu\\.qml", "focus\\.qml"] originalTexts = {} + editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) + # temporarily store editor content for synchronizing purpose + # usage of formerTxt is done because I couldn't get waitForSignal() to work + # it always stored a different object into the signalObjects map as it looked up afterwards + # although used objectMap.realName() for both + formerTxt = editor.plainText for file in files: doubleClickFile(navTree, file) - editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) - originalTexts.setdefault(file, "%s" % editor.plainText) + # wait until editor content switched to the double-clicked file + while formerTxt==editor.plainText: + editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) + # store content for next round + formerTxt = editor.plainText + originalTexts.setdefault(file, "%s" % formerTxt) test.log("stored %s's content" % file.replace("Core.","").replace("\\","")) # last opened file is the main file focus.qml line = "FocusScope\s*\{" @@ -52,21 +63,32 @@ def testRenameId(): "window=':Qt Creator_Core::Internal::MainWindow'}"), "renamedView") clickButton(waitForObject("{text='Replace' type='QToolButton' unnamed='1' visible='1' " "window=':Qt Creator_Core::Internal::MainWindow'}")) + # store editor content for synchronizing purpose + formerTxt = editor.plainText for file in files: doubleClickFile(navTree, file) - editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) - modifiedText = "%s" % editor.plainText + # wait until editor content switched to double-clicked file + while formerTxt==editor.plainText: + editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}", 20000) + # store content for next round + formerTxt = editor.plainText originalText = originalTexts.get(file).replace("mainView", "renamedView") - test.compare(originalText,modifiedText) + test.compare(originalText,formerTxt, "Comparing %s" % file.replace("Core.","").replace("\\","")) invokeMenuItem("File","Save All") def doubleClickFile(navTree, file): treeElement = ("untitled.QML.%s/qml.%s" % - (templateDir.replace("\\", "/").replace("_", "\\_").replace(".","\\."),file)) + (maskSpecialCharsForProjectTree(templateDir),file)) waitForObjectItem(navTree, treeElement) doubleClickItem(navTree, treeElement, 5, 5, 0, Qt.LeftButton) +def maskSpecialCharsForProjectTree(filename): + filename = filename.replace("\\", "/").replace("_", "\\_").replace(".","\\.") + # undoing mask operations on chars masked by mistake + filename = filename.replace("/?","\\?").replace("/*","\\*") + return filename + def cleanup(): global workingDir, templateDir waitForCleanShutdown() |