summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@theqtcompany.com>2014-11-13 11:14:17 +0100
committerRobert Loehning <robert.loehning@theqtcompany.com>2014-11-13 12:50:02 +0100
commitfdb91f513558f2402a17dbd260bf382612525e0f (patch)
tree7c8ed3ead88edf9bfa9fe421ce969fb93c568b62 /tests
parentc7042e70319e69538194598292fc53154146bc47 (diff)
downloadqt-creator-fdb91f513558f2402a17dbd260bf382612525e0f.tar.gz
Squish: Wait for search results consistently
Change-Id: I956bf543505c5391a78325070b72e3affc5133a6 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/system/shared/editor_utils.py14
-rw-r--r--tests/system/suite_CSUP/tst_CSUP04/test.py14
-rw-r--r--tests/system/suite_editors/tst_qml_editor/test.py16
-rw-r--r--tests/system/suite_editors/tst_rename_macros/test.py1
4 files changed, 17 insertions, 28 deletions
diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py
index 59fce42456..52baf8b4cd 100644
--- a/tests/system/shared/editor_utils.py
+++ b/tests/system/shared/editor_utils.py
@@ -308,6 +308,20 @@ def maskSpecialCharsForSearchResult(filename):
filename = filename.replace("_", "\\_").replace(".","\\.")
return filename
+def waitForSearchResults():
+ def __noCancelButton__():
+ global passes
+ passes += 1
+ return not object.exists("{text='Cancel' type='QToolButton' unnamed='1' visible='1' "
+ "window=':Qt Creator_Core::Internal::MainWindow'}")
+
+ global passes
+ passes = 0
+ waitFor("__noCancelButton__()", 20000)
+ if passes < 2:
+ test.warning("Did not have to wait for search results.",
+ "Either Creator was really quick or the GUI was changed.")
+
def validateSearchResult(expectedCount):
searchResult = waitForObject(":Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton")
ensureChecked(searchResult)
diff --git a/tests/system/suite_CSUP/tst_CSUP04/test.py b/tests/system/suite_CSUP/tst_CSUP04/test.py
index f221427149..c9a5bcbbc7 100644
--- a/tests/system/suite_CSUP/tst_CSUP04/test.py
+++ b/tests/system/suite_CSUP/tst_CSUP04/test.py
@@ -83,17 +83,3 @@ def main():
validateSearchResult(3)
invokeMenuItem("File", "Close All")
invokeMenuItem("File", "Exit")
-
-def waitForSearchResults():
- def __noCancelButton__():
- global passes
- passes += 1
- return not object.exists("{text='Cancel' type='QToolButton' unnamed='1' visible='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}")
-
- global passes
- passes = 0
- waitFor("__noCancelButton__()", 20000)
- if passes < 2:
- test.warning("Did not have to wait for search results.",
- "Either Creator was really quick or the GUI was changed.")
diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py
index 8bbcaee640..aa81ea45ad 100644
--- a/tests/system/suite_editors/tst_qml_editor/test.py
+++ b/tests/system/suite_editors/tst_qml_editor/test.py
@@ -30,8 +30,6 @@
source("../../shared/qtcreator.py")
-searchFinished = False
-
def main():
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/keyinteraction/focus")
proFile = "focus.pro"
@@ -43,7 +41,6 @@ def main():
# add docs to have the correct tool tips
addHelpDocumentation([os.path.join(sdkPath, "Documentation", "qt.qch")])
templateDir = prepareTemplate(sourceExample)
- installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__")
openQmakeProject(os.path.join(templateDir,proFile), Targets.DESKTOP_480_GCC)
openDocument("focus.QML.qml.focus\\.qml")
testRenameId()
@@ -53,7 +50,6 @@ def main():
invokeMenuItem("File", "Exit")
def testRenameId():
- global searchFinished
test.log("Testing rename of id")
navTree = waitForObject("{type='Utils::NavigationTreeView' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}")
@@ -77,9 +73,8 @@ def testRenameId():
test.fatal("File seems to have changed... Canceling current test")
return False
type(editor, "<Down>")
- searchFinished = False
invokeContextMenuItem(editor, "Rename Symbol Under Cursor")
- waitFor("searchFinished")
+ waitForSearchResults()
type(waitForObject("{leftWidget={text='Replace with:' type='QLabel' unnamed='1' visible='1'} "
"type='Core::Internal::WideEnoughLineEdit' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}"), "renamedView")
@@ -99,7 +94,6 @@ def testRenameId():
invokeMenuItem("File","Save All")
def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expectedCount):
- global searchFinished
openDocument("focus.QML.qml.%s" % filename)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if not placeCursorToLine(editor, line, True):
@@ -107,9 +101,8 @@ def __invokeFindUsage__(treeView, filename, line, additionalKeyPresses, expected
return
for ty in additionalKeyPresses:
type(editor, ty)
- searchFinished = False
invokeContextMenuItem(editor, "Find Usages")
- waitFor("searchFinished")
+ waitForSearchResults()
validateSearchResult(expectedCount)
def testFindUsages():
@@ -196,8 +189,3 @@ def maskSpecialCharsForProjectTree(filename):
# undoing mask operations on chars masked by mistake
filename = filename.replace("/?","\\?").replace("/*","\\*")
return filename
-
-def __handleFutureProgress__(*args):
- global searchFinished
- if className(args[0]) == "Core::FutureProgress":
- searchFinished = True
diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py
index 71f93393fe..1459de7ba4 100644
--- a/tests/system/suite_editors/tst_rename_macros/test.py
+++ b/tests/system/suite_editors/tst_rename_macros/test.py
@@ -125,6 +125,7 @@ def performMacroRenaming(newMacroName):
type(cppEditorStr, "<Left>")
invokeContextMenuItem(waitForObject(cppEditorStr), "Refactor",
"Rename Symbol Under Cursor")
+ waitForSearchResults()
validateSearchResult(2)
replaceLineEdit = waitForObject("{leftWidget={text='Replace with:' type='QLabel' "
"unnamed='1' visible='1'} "