From bd43956bbd6ff5fac05f5260d351b0c3ec2a25a0 Mon Sep 17 00:00:00 2001
From: Christian Stenger <christian.stenger@nokia.com>
Date: Wed, 5 Sep 2012 16:49:35 +0200
Subject: [PATCH] Squish: Use global objects.map from inside CCOM

Change-Id: Icc22f595f6c5c9472755e1134b7663dde7bccb86
Reviewed-by: Robert Loehning <robert.loehning@nokia.com>
---
 tests/system/objects.map                      |  4 ++++
 tests/system/shared/build_utils.py            | 12 ++++------
 tests/system/shared/debugger.py               |  3 +--
 tests/system/shared/editor_utils.py           |  3 +--
 tests/system/shared/utils.py                  |  3 +--
 tests/system/suite_CCOM/objects.map           | 12 ----------
 tests/system/suite_CCOM/suite.conf            |  2 ++
 tests/system/suite_CCOM/tst_CCOM01/test.py    |  2 +-
 tests/system/suite_CCOM/tst_CCOM02/test.py    |  2 +-
 .../suite_debugger/tst_simple_debug/test.py   |  3 +--
 .../suite_qtquick/tst_qml_editor/test.py      | 24 +++++++------------
 .../suite_qtquick/tst_qml_indent/test.py      |  8 +++----
 12 files changed, 27 insertions(+), 51 deletions(-)
 delete mode 100644 tests/system/suite_CCOM/objects.map

diff --git a/tests/system/objects.map b/tests/system/objects.map
index 45e3b8628c7..b9831ab715b 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -40,14 +40,18 @@
 :QML Debugging_QMessageBox	{type='QMessageBox' unnamed='1' visible='1' windowTitle='QML Debugging'}
 :Qt Creator.Compile Output_Core::OutputWindow	{type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'}
 :Qt Creator.DebugModeWidget_QSplitter	{name='DebugModeWidget' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+:Qt Creator.Issues_QListView	{type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
 :Qt Creator.QtCreator.MenuBar_QMenuBar	{name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator.ReRun_QToolButton	{toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator.Stop_QToolButton	{text='Stop' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator.scrollArea_QScrollArea	{name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton	{occurrence='3' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_CloseButton	{type='CloseButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+:Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton	{occurrence='4' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_Core::Internal::MainWindow	{type='Core::Internal::MainWindow' visible='1' windowTitle?='*Qt Creator'}
 :Qt Creator_CppEditor::Internal::CPPEditorWidget	{type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+:Qt Creator_Issues_Core::Internal::OutputPaneToggleButton	{occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
+:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget	{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_QTableView	{type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton	{occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
 :Qt Creator_SystemSettings.Details_Utils::DetailsButton	{occurrence='4' text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py
index 672c7ff4b63..1d72345dc90 100644
--- a/tests/system/shared/build_utils.py
+++ b/tests/system/shared/build_utils.py
@@ -67,10 +67,8 @@ def checkLastBuild(expectedToFail=False):
     else:
         test.fail("Errors: %s | Warnings: %s" % (errors, warnings))
     # additional stuff - could be removed... or improved :)
-    ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' "
-                  "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
-    list=waitForObject("{type='QListView' unnamed='1' visible='1' "
-                       "window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}", 20000)
+    ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
+    list=waitForObject(":Qt Creator.Issues_QListView", 20000)
     model = list.model()
     test.log("Rows inside issues: %d" % model.rowCount())
     if gotErrors and createTasksFileOnError:
@@ -79,10 +77,8 @@ def checkLastBuild(expectedToFail=False):
 
 # helper function to check the compilation when build wasn't successful
 def checkCompile():
-    ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
-                  "window=':Qt Creator_Core::Internal::MainWindow' occurrence='4'}")
-    output = waitForObject("{type='Core::OutputWindow' unnamed='1' visible='1' windowTitle='Compile Output'"
-                                 " window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    ensureChecked(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton")
+    output = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow", 20000)
     waitFor("len(str(output.plainText))>0",5000)
     success = str(output.plainText).endswith("exited normally.")
     if success:
diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py
index c9480f05778..6432550d94e 100644
--- a/tests/system/shared/debugger.py
+++ b/tests/system/shared/debugger.py
@@ -180,8 +180,7 @@ def __startDebugger__(config):
 
 def __stopDebugger__():
     clickButton(waitForObject(":Debugger Toolbar.Exit Debugger_QToolButton"))
-    ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
-                  "window=':Qt Creator_Core::Internal::MainWindow' occurrence='3'}")
+    ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
     output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
     waitFor("'Debugging has finished' in str(output.plainText)", 20000)
     return __logDebugResult__()
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py
index 2315b3c9111..76bc7eff692 100644
--- a/tests/system/shared/editor_utils.py
+++ b/tests/system/shared/editor_utils.py
@@ -213,8 +213,7 @@ def getEditorForFileSuffix(curFile):
         editor = waitForObject("{type='CppEditor::Internal::CPPEditorWidget' unnamed='1' "
                                "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
     elif suffix in qmlEditorSuffixes:
-        editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' "
-                               "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
+        editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
     elif suffix in proEditorSuffixes:
         editor = waitForObject("{type='Qt4ProjectManager::Internal::ProFileEditorWidget' unnamed='1' "
                                "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 0fbcf83b393..37d6ed37efa 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -194,8 +194,7 @@ def invokeMenuItem(menu, item, subItem = None):
 
 def logApplicationOutput():
     # make sure application output is shown
-    ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
-                  "window=':Qt Creator_Core::Internal::MainWindow' occurrence='3'}")
+    ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
     try:
         output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
         test.log("Application Output:\n%s" % output.plainText)
diff --git a/tests/system/suite_CCOM/objects.map b/tests/system/suite_CCOM/objects.map
deleted file mode 100644
index d0b75eb58e1..00000000000
--- a/tests/system/suite_CCOM/objects.map
+++ /dev/null
@@ -1,12 +0,0 @@
-:*Qt Creator.DoubleTabWidget_ProjectExplorer::Internal::DoubleTabWidget	{name='ProjectExplorer__Internal__DoubleTabWidget' type='ProjectExplorer::Internal::DoubleTabWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='DoubleTabWidget'}
-:Compile Output - Qt Creator_Core::Internal::OutputPaneToggleButton	{occurrence='4' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Issues - Qt Creator_Core::Internal::OutputPaneToggleButton	{occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Qt Creator.Compile Output_Core::OutputWindow	{type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'}
-:Qt Creator.Issues_QListView	{type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
-:Qt Creator.QtCreator.MenuBar_QMenuBar	{name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Qt Creator.scrollArea_QScrollArea	{name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Qt Creator_Core::Internal::MainWindow	{type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'}
-:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget	{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:Qt Creator_Utils::NavigationTreeView	{type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
-:scrollArea.Edit build configuration:_QComboBox	{leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'}
-:scrollArea.Edit build configuration:_QLabel	{text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'}
diff --git a/tests/system/suite_CCOM/suite.conf b/tests/system/suite_CCOM/suite.conf
index 09d3aa120fe..51dd282bd84 100755
--- a/tests/system/suite_CCOM/suite.conf
+++ b/tests/system/suite_CCOM/suite.conf
@@ -1,10 +1,12 @@
 AUT=qtcreator
 CLASS=
 CLASSPATH=
+CWD=
 ENVVARS=envvars
 HOOK_SUB_PROCESSES=false
 IMPLICITAUTSTART=0
 LANGUAGE=Python
+OBJECTMAP=../objects.map
 TEST_CASES=tst_CCOM01 tst_CCOM02
 VERSION=2
 WRAPPERS=Qt
diff --git a/tests/system/suite_CCOM/tst_CCOM01/test.py b/tests/system/suite_CCOM/tst_CCOM01/test.py
index cf122d145dc..ae2f3199c00 100755
--- a/tests/system/suite_CCOM/tst_CCOM01/test.py
+++ b/tests/system/suite_CCOM/tst_CCOM01/test.py
@@ -24,7 +24,7 @@ def main():
         invokeMenuItem("Build", "Build All")
         waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
         # verify build successful
-        ensureChecked(waitForObject(":Compile Output - Qt Creator_Core::Internal::OutputPaneToggleButton"))
+        ensureChecked(waitForObject(":Qt Creator_CompileOutput_Core::Internal::OutputPaneToggleButton"))
         compileOutput = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
         if not test.verify(str(compileOutput.plainText).endswith("exited normally."),
                            "Verifying building of existing complex qt application."):
diff --git a/tests/system/suite_CCOM/tst_CCOM02/test.py b/tests/system/suite_CCOM/tst_CCOM02/test.py
index 8050b1f033e..dd0215dcf92 100755
--- a/tests/system/suite_CCOM/tst_CCOM02/test.py
+++ b/tests/system/suite_CCOM/tst_CCOM02/test.py
@@ -21,7 +21,7 @@ def main():
     # save all to invoke qml parsing
     invokeMenuItem("File", "Save All")
     # open issues list view
-    ensureChecked(waitForObject(":Issues - Qt Creator_Core::Internal::OutputPaneToggleButton"))
+    ensureChecked(waitForObject(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton"))
     issuesView = waitForObject(":Qt Creator.Issues_QListView")
     # verify that error is properly reported
     test.verify(checkSyntaxError(issuesView, ["Syntax error"], True),
diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py
index dac3c060103..bdcaf7c2d60 100644
--- a/tests/system/suite_debugger/tst_simple_debug/test.py
+++ b/tests/system/suite_debugger/tst_simple_debug/test.py
@@ -15,8 +15,7 @@ def main():
     # wait for parsing to complete
     waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
                   "sourceFilesRefreshed(QStringList)")
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' "
-                           "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
     if placeCursorToLine(editor, "MouseArea.*", True):
         type(editor, '<Up>')
         type(editor, '<Return>')
diff --git a/tests/system/suite_qtquick/tst_qml_editor/test.py b/tests/system/suite_qtquick/tst_qml_editor/test.py
index 13a63d7d64e..0fda22aea1e 100644
--- a/tests/system/suite_qtquick/tst_qml_editor/test.py
+++ b/tests/system/suite_qtquick/tst_qml_editor/test.py
@@ -34,8 +34,7 @@ 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)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 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
@@ -45,8 +44,7 @@ def testRenameId():
         doubleClickFile(navTree, file)
         # 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)
+            editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
         # store content for next round
         formerTxt = editor.plainText
         originalTexts.setdefault(file, "%s" % formerTxt)
@@ -72,8 +70,7 @@ def testRenameId():
         doubleClickFile(navTree, file)
         # 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)
+            editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
         # store content for next round
         formerTxt = editor.plainText
         originalText = originalTexts.get(file).replace("mainView", "renamedView")
@@ -83,8 +80,7 @@ def testRenameId():
 def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
     global searchFinished
     doubleClickFile(treeView, filename)
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                       "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
     if not placeCursorToLine(editor, line, True):
         test.fatal("File seems to have changed... Canceling current test")
         return
@@ -113,8 +109,7 @@ def testHovering():
                             "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
     test.log("Testing hovering elements")
     doubleClickFile(navTree, "focus\\.qml")
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                       "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
     lines=["FocusScope\s*\{", "Rectangle\s*\{"]
     if platform.system() == "Darwin":
         home = "<Ctrl+Left>"
@@ -132,8 +127,7 @@ def testHovering():
     verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
     test.log("Testing hovering properties")
     doubleClickFile(navTree, "focus\\.qml")
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                       "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
     lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{']
     expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"]
     expectedValues = [
@@ -153,16 +147,14 @@ def testHovering():
     verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
     test.log("Testing hovering expressions")
     doubleClickFile(navTree, "focus\\.qml")
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                       "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
     lines=['color:\s*"black"', 'color:\s*"#3E606F"']
     additionalKeyPresses = ["<Left>"]
     expectedValues = ["black", "#3E606F"]
     expectedTypes = ["ColorTip", "ColorTip"]
     verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues)
     doubleClickFile(navTree, "Core.ListMenu\\.qml")
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                       "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
     lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}']
     additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"]
     expectedTypes = ["ColorTip", "TextTip"]
diff --git a/tests/system/suite_qtquick/tst_qml_indent/test.py b/tests/system/suite_qtquick/tst_qml_indent/test.py
index 14faece9296..6efdb3b2fe6 100644
--- a/tests/system/suite_qtquick/tst_qml_indent/test.py
+++ b/tests/system/suite_qtquick/tst_qml_indent/test.py
@@ -23,8 +23,7 @@ def prepareQmlFile():
     model = navTree.model()
     waitForObjectItem(navTree, "untitled.QML.qml/untitled.main\\.qml")
     doubleClickItem(navTree, "untitled.QML.qml/untitled.main\\.qml", 5, 5, 0, Qt.LeftButton)
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                           "window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget", 20000)
     for i in range(3):
         content = "%s" % editor.plainText
         start = content.find("Text {")
@@ -53,11 +52,10 @@ def handleTextChanged(object):
 
 def testReIndent():
     global originalText,textHasChanged
-    installLazySignalHandler("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1'}",
+    installLazySignalHandler(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget",
                              "textChanged()", "handleTextChanged")
     textHasChanged = False
-    editor = waitForObject("{type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' "
-                           "window=':Qt Creator_Core::Internal::MainWindow'}")
+    editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
     type(editor, "<Ctrl+A>")
     test.log("calling re-indent")
     starttime = datetime.utcnow()
-- 
GitLab