summaryrefslogtreecommitdiff
path: root/tests/system/suite_qtquick/tst_qml_editor/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system/suite_qtquick/tst_qml_editor/test.py')
-rw-r--r--tests/system/suite_qtquick/tst_qml_editor/test.py38
1 files changed, 30 insertions, 8 deletions
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()