2012-04-23 13:17:40 +02:00
|
|
|
source("../../shared/suites_qtta.py")
|
|
|
|
source("../../shared/qtcreator.py")
|
|
|
|
|
|
|
|
# entry of test
|
|
|
|
def main():
|
|
|
|
global searchFinished
|
|
|
|
# prepare example project
|
|
|
|
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
|
2012-09-27 15:05:38 +02:00
|
|
|
proFile = "propertyanimation.pro"
|
|
|
|
if not neededFilePresent(os.path.join(sourceExample, proFile)):
|
2012-04-23 13:17:40 +02:00
|
|
|
return
|
|
|
|
# copy example project to temp directory
|
|
|
|
templateDir = prepareTemplate(sourceExample)
|
2012-09-27 15:05:38 +02:00
|
|
|
examplePath = os.path.join(templateDir, proFile)
|
2012-04-23 13:17:40 +02:00
|
|
|
startApplication("qtcreator" + SettingsPath)
|
2013-02-22 14:31:39 +01:00
|
|
|
if not startedWithoutPluginError():
|
|
|
|
return
|
2012-04-23 13:17:40 +02:00
|
|
|
# open example project
|
|
|
|
openQmakeProject(examplePath)
|
|
|
|
installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__")
|
|
|
|
# wait for parsing to complete
|
2013-04-25 19:08:55 +02:00
|
|
|
progressBarWait(30000)
|
2012-04-23 13:17:40 +02:00
|
|
|
# open .cpp file in editor
|
2013-01-31 12:27:24 +01:00
|
|
|
if not openDocument("propertyanimation.Sources.main\\.cpp"):
|
|
|
|
test.fatal("Could not open main.cpp")
|
|
|
|
invokeMenuItem("File", "Exit")
|
|
|
|
return
|
2012-04-23 13:17:40 +02:00
|
|
|
test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
|
|
|
|
"Verifying if: .cpp file is opened in Edit mode.")
|
|
|
|
# place cursor on line "QmlApplicationViewer viewer;"
|
|
|
|
editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
|
|
|
searchFinished = False
|
|
|
|
# invoke find usages from context menu on word "viewer"
|
|
|
|
if not invokeFindUsage(editorWidget, "QmlApplicationViewer viewer;", "<Left>", 10):
|
|
|
|
invokeMenuItem("File", "Exit")
|
|
|
|
return
|
|
|
|
# wait until search finished and verify search results
|
2013-05-03 09:31:14 +02:00
|
|
|
waitFor("searchFinished", 20000)
|
2012-08-21 12:40:38 +02:00
|
|
|
validateSearchResult(18)
|
2012-04-23 13:17:40 +02:00
|
|
|
result = re.search("QmlApplicationViewer", str(editorWidget.plainText))
|
|
|
|
test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. "
|
|
|
|
"File with used text is opened.")
|
|
|
|
# move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U.
|
2013-01-30 18:15:38 +01:00
|
|
|
openDocument("propertyanimation.Sources.main\\.cpp")
|
2012-04-23 13:17:40 +02:00
|
|
|
if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"):
|
|
|
|
return
|
|
|
|
for i in range(4):
|
|
|
|
type(editorWidget, "<Left>")
|
|
|
|
searchFinished = False
|
|
|
|
type(editorWidget, "<Ctrl+Shift+U>")
|
|
|
|
# wait until search finished and verify search results
|
2013-05-03 09:31:14 +02:00
|
|
|
waitFor("searchFinished", 20000)
|
2012-04-23 13:17:40 +02:00
|
|
|
validateSearchResult(3)
|
|
|
|
# exit qt creator
|
|
|
|
invokeMenuItem("File", "Save All")
|
|
|
|
invokeMenuItem("File", "Exit")
|
|
|
|
|
|
|
|
def __handleFutureProgress__(obj):
|
|
|
|
global searchFinished
|
|
|
|
if className(obj) == "Core::FutureProgress":
|
|
|
|
searchFinished = True
|
|
|
|
|