Squish: Always use the same function for preparing templates

Change-Id: I90dac33dde4c0c3d39c8e8038371dfbb3403dce3
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
This commit is contained in:
Robert Loehning
2012-04-05 14:29:13 +02:00
committed by Robert Löhning
parent 2aa4b803a6
commit f521c9f062
5 changed files with 9 additions and 28 deletions

View File

@@ -449,3 +449,9 @@ def __getSupportedPlatforms__(text, getAsStrings=False):
if getAsStrings: if getAsStrings:
result = QtQuickConstants.getTargetsAsStrings(result) result = QtQuickConstants.getTargetsAsStrings(result)
return result, version return result, version
# copy example project (sourceExample is path to project) to temporary directory inside repository
def prepareTemplate(sourceExample):
templateDir = os.path.abspath(tempDir() + "/template")
shutil.copytree(sourceExample, templateDir)
return templateDir

View File

@@ -33,10 +33,3 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
else: else:
return True return True
return False return False
# copy example project (sourceExample is path to project) to <temp>/template dir
def prepareTemplate(sourceExample):
templateDir = os.path.abspath(tempDir() + "/template")
shutil.copytree(sourceExample, templateDir)
return templateDir

View File

@@ -7,7 +7,7 @@ def main():
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection") sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/text/textselection")
if not neededFilePresent(sourceExample): if not neededFilePresent(sourceExample):
return return
prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
overrideInstallLazySignalHandler() overrideInstallLazySignalHandler()
installLazySignalHandler(":frame.templateDescription_QTextBrowser", installLazySignalHandler(":frame.templateDescription_QTextBrowser",
@@ -102,12 +102,6 @@ def main():
clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}", 20000)) clickButton(waitForObject("{text='Cancel' type='QPushButton' unnamed='1' visible='1'}", 20000))
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def prepareTemplate(sourceExample):
global templateDir
templateDir = tempDir()
templateDir = os.path.abspath(templateDir + "/template")
shutil.copytree(sourceExample, templateDir)
def cleanup(): def cleanup():
global templateDir global templateDir
# waiting for a clean exit - for a full-remove of the temp directory # waiting for a clean exit - for a full-remove of the temp directory

View File

@@ -14,7 +14,7 @@ def main():
addHelpDocumentationFromSDK() addHelpDocumentationFromSDK()
# using a temporary directory won't mess up an eventually exisiting # using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir() workingDir = tempDir()
prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
prepareForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)") prepareForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
installLazySignalHandler("{type='Core::FutureProgress' unnamed='1''}", "finished()", "__handleFutureProgress__") installLazySignalHandler("{type='Core::FutureProgress' unnamed='1''}", "finished()", "__handleFutureProgress__")
createNewQtQuickApplication(workingDir, "untitled", templateDir + "/qml/focus.qml") createNewQtQuickApplication(workingDir, "untitled", templateDir + "/qml/focus.qml")
@@ -26,12 +26,6 @@ def main():
test.log("Test finished") test.log("Test finished")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def prepareTemplate(sourceExample):
global templateDir
templateDir = tempDir()
templateDir = os.path.abspath(templateDir + "/template")
shutil.copytree(sourceExample, templateDir)
def testRenameId(): def testRenameId():
global searchFinished global searchFinished
test.log("Testing rename of id") test.log("Testing rename of id")

View File

@@ -11,7 +11,7 @@ def main():
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
# using a temporary directory won't mess up an eventually exisiting # using a temporary directory won't mess up an eventually exisiting
workingDir = tempDir() workingDir = tempDir()
prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
projectName = createNewQtQuickApplication(workingDir, None, templateDir + "/qml/textselection.qml") projectName = createNewQtQuickApplication(workingDir, None, templateDir + "/qml/textselection.qml")
# wait for parsing to complete # wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)") waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
@@ -50,12 +50,6 @@ def subprocessFunction():
test.log("Closing QmlApplicationViewer") test.log("Closing QmlApplicationViewer")
sendEvent("QCloseEvent", "{type='QmlApplicationViewer' unnamed='1' visible='1'}") sendEvent("QCloseEvent", "{type='QmlApplicationViewer' unnamed='1' visible='1'}")
def prepareTemplate(sourceExample):
global templateDir
templateDir = tempDir()
templateDir = os.path.abspath(templateDir + "/template")
shutil.copytree(sourceExample, templateDir)
def cleanup(): def cleanup():
global workingDir,templateDir global workingDir,templateDir
# waiting for a clean exit - for a full-remove of the temp directory # waiting for a clean exit - for a full-remove of the temp directory