forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user