Commit fdb91f51 authored by Robert Loehning's avatar Robert Loehning
Browse files

Squish: Wait for search results consistently



Change-Id: I956bf543505c5391a78325070b72e3affc5133a6
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent c7042e70
......@@ -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)
......
......@@ -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.")
......@@ -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
......@@ -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'} "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment