summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@digia.com>2013-08-23 10:01:59 +0200
committerChristian Stenger <christian.stenger@digia.com>2013-08-29 15:10:14 +0200
commit4fc9302c564753b131787fd42d897f17c7b92d3e (patch)
treecd792e3d7e012e7145eeccc4344f270ca3a845d5
parent4c0778786b8827cca9412e7c60562a39b4e4d0fc (diff)
downloadqt-creator-4fc9302c564753b131787fd42d897f17c7b92d3e.tar.gz
Squish: Move common code to shared file
Change-Id: I5e268d6faf9a2a5a779e850667c582328c42387d Reviewed-by: Robert Loehning <robert.loehning@digia.com>
-rw-r--r--tests/system/shared/project_explorer.py16
-rw-r--r--tests/system/suite_SCOM/tst_SCOM05/test.py16
-rw-r--r--tests/system/suite_WELP/tst_WELP03/test.py10
3 files changed, 19 insertions, 23 deletions
diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py
index edd99e78bd..a4d78618e5 100644
--- a/tests/system/shared/project_explorer.py
+++ b/tests/system/shared/project_explorer.py
@@ -286,3 +286,19 @@ def getQtInformationByQMakeCall(qtDir, which):
test.fatal("You're trying to fetch an unknown information (%s)" % which)
return None
return getOutputFromCmdline("%s -query %s" % (qmake, query)).strip()
+
+def invokeContextMenuOnProject(projectName, menuItem):
+ try:
+ projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName, 3000)
+ except:
+ try:
+ projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView",
+ addBranchWildcardToRoot(projectName), 1000)
+ except:
+ test.fatal("Failed to find root node of the project '%s'." % projectName)
+ return
+ openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"),
+ str(projItem.text).replace("_", "\\_").replace(".", "\\."), 5, 5, 0)
+ activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1' "
+ "window=':Qt Creator_Core::Internal::MainWindow'}", menuItem))
+ return projItem
diff --git a/tests/system/suite_SCOM/tst_SCOM05/test.py b/tests/system/suite_SCOM/tst_SCOM05/test.py
index b44789e995..c3abea9092 100644
--- a/tests/system/suite_SCOM/tst_SCOM05/test.py
+++ b/tests/system/suite_SCOM/tst_SCOM05/test.py
@@ -31,21 +31,7 @@ source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
def verifyChangeProject(projectName):
- # select project
- try:
- projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", projectName, 3000)
- except:
- try:
- projItem = waitForObjectItem(":Qt Creator_Utils::NavigationTreeView",
- addBranchWildcardToRoot(projectName), 1000)
- except:
- test.fatal("Failed to find root node of the project '%s'." % projectName)
- return
- openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"),
- str(projItem.text).replace("_", "\\_").replace(".", "\\."), 5, 5, 0)
- activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}",
- 'Set "%s" as Active Project' % projectName))
+ projItem = invokeContextMenuOnProject(projectName, 'Set "%s" as Active Project' % projectName)
waitFor("projItem.font.bold==True", 3000)
# check if bold is right project
test.verify(projItem.font.bold == True,
diff --git a/tests/system/suite_WELP/tst_WELP03/test.py b/tests/system/suite_WELP/tst_WELP03/test.py
index 9f9e9e2527..aadc8c3896 100644
--- a/tests/system/suite_WELP/tst_WELP03/test.py
+++ b/tests/system/suite_WELP/tst_WELP03/test.py
@@ -127,10 +127,7 @@ def main():
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='2dpainting' type='QModelIndex'}"),
"Verifying: The project is shown in 'Edit' mode.")
- openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"),
- "2dpainting", 5, 5, 0)
- activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Project_QMenu",
- 'Close Project "2dpainting"'))
+ invokeContextMenuOnProject('2dpainting', 'Close Project "2dpainting"')
navTree = waitForObject(":Qt Creator_Utils::NavigationTreeView")
res = waitFor("navTree.model().rowCount(navTree.rootIndex()) == 0", 2000)
test.verify(not checkIfObjectItemExists(":Qt Creator_Utils::NavigationTreeView", "2dpainting"),
@@ -165,10 +162,7 @@ def main():
checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='addressbook' type='QModelIndex'}"),
"Verifying: The project is shown in 'Edit' mode while old project isn't.")
- openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"),
- "addressbook", 5, 5, 0)
- activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Project_QMenu",
- 'Close Project "addressbook"'))
+ invokeContextMenuOnProject('addressbook', 'Close Project "addressbook"')
navTree = waitForObject(":Qt Creator_Utils::NavigationTreeView")
res = waitFor("navTree.model().rowCount(navTree.rootIndex()) == 0", 2000)
test.verify(not checkIfObjectItemExists(":Qt Creator_Utils::NavigationTreeView", "addressbook"),