SquishTests: Rename helper class

Change-Id: I39890cbd98b7e6ebcc0fdf4722d0311eb6650397
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-02-22 13:49:54 +01:00
parent ef731faa47
commit 3a7ab3ce8e
15 changed files with 29 additions and 29 deletions

View File

@@ -75,7 +75,7 @@ class LibType:
return "Qt Plugin" return "Qt Plugin"
return None return None
class Qt5Path: class QtPath:
DOCS = 0 DOCS = 0
EXAMPLES = 1 EXAMPLES = 1
@@ -84,10 +84,10 @@ class Qt5Path:
qt5targets = [Targets.DESKTOP_5_10_1_DEFAULT, Targets.DESKTOP_5_14_1_DEFAULT] qt5targets = [Targets.DESKTOP_5_10_1_DEFAULT, Targets.DESKTOP_5_14_1_DEFAULT]
if platform.system() != 'Darwin': if platform.system() != 'Darwin':
qt5targets.append(Targets.DESKTOP_5_4_1_GCC) qt5targets.append(Targets.DESKTOP_5_4_1_GCC)
if pathSpec == Qt5Path.DOCS: if pathSpec == QtPath.DOCS:
return map(lambda target: Qt5Path.docsPath(target), qt5targets) return map(lambda target: QtPath.docsPath(target), qt5targets)
elif pathSpec == Qt5Path.EXAMPLES: elif pathSpec == QtPath.EXAMPLES:
return map(lambda target: Qt5Path.examplesPath(target), qt5targets) return map(lambda target: QtPath.examplesPath(target), qt5targets)
else: else:
test.fatal("Unknown pathSpec given: %s" % str(pathSpec)) test.fatal("Unknown pathSpec given: %s" % str(pathSpec))
return [] return []
@@ -116,29 +116,29 @@ class Qt5Path:
@staticmethod @staticmethod
def getQtMinorAndPatchVersion(target): def getQtMinorAndPatchVersion(target):
qtVersionStr = Qt5Path.__preCheckAndExtractQtVersionStr__(target) qtVersionStr = QtPath.__preCheckAndExtractQtVersionStr__(target)
versionTuple = Qt5Path.toVersionTuple(qtVersionStr) versionTuple = QtPath.toVersionTuple(qtVersionStr)
return versionTuple[1], versionTuple[2] return versionTuple[1], versionTuple[2]
@staticmethod @staticmethod
def examplesPath(target): def examplesPath(target):
qtMinorVersion, qtPatchVersion = Qt5Path.getQtMinorAndPatchVersion(target) qtMinorVersion, qtPatchVersion = QtPath.getQtMinorAndPatchVersion(target)
if qtMinorVersion < 10: if qtMinorVersion < 10:
path = "Examples/Qt-5.%d" % qtMinorVersion path = "Examples/Qt-5.%d" % qtMinorVersion
else: else:
path = "Examples/Qt-5.%d.%d" % (qtMinorVersion, qtPatchVersion) path = "Examples/Qt-5.%d.%d" % (qtMinorVersion, qtPatchVersion)
return os.path.join(Qt5Path.__createPlatformQtPath__(qtMinorVersion), path) return os.path.join(QtPath.__createPlatformQtPath__(qtMinorVersion), path)
@staticmethod @staticmethod
def docsPath(target): def docsPath(target):
qtMinorVersion, qtPatchVersion = Qt5Path.getQtMinorAndPatchVersion(target) qtMinorVersion, qtPatchVersion = QtPath.getQtMinorAndPatchVersion(target)
if qtMinorVersion < 10: if qtMinorVersion < 10:
path = "Docs/Qt-5.%d" % qtMinorVersion path = "Docs/Qt-5.%d" % qtMinorVersion
else: else:
path = "Docs/Qt-5.%d.%d" % (qtMinorVersion, qtPatchVersion) path = "Docs/Qt-5.%d.%d" % (qtMinorVersion, qtPatchVersion)
return os.path.join(Qt5Path.__createPlatformQtPath__(qtMinorVersion), path) return os.path.join(QtPath.__createPlatformQtPath__(qtMinorVersion), path)
class TestSection: class TestSection:
def __init__(self, description): def __init__(self, description):

View File

@@ -188,7 +188,7 @@ def __modifyAvailableTargets__(available, requiredQt, asStrings=False):
item = Targets.getStringForTarget(currentItem) item = Targets.getStringForTarget(currentItem)
found = versionFinder.search(item) found = versionFinder.search(item)
if found: if found:
if Qt5Path.toVersionTuple(found.group(1)) < Qt5Path.toVersionTuple(requiredQt): if QtPath.toVersionTuple(found.group(1)) < QtPath.toVersionTuple(requiredQt):
available.discard(currentItem) available.discard(currentItem)
elif currentItem.endswith(" (invalid)"): elif currentItem.endswith(" (invalid)"):
available.discard(currentItem) available.discard(currentItem)

View File

@@ -6,7 +6,7 @@ source("../../shared/qtcreator.py")
# entry of test # entry of test
def main(): def main():
# prepare example project # prepare example project
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "animation") "quick", "animation")
proFile = "animation.pro" proFile = "animation.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):

View File

@@ -7,7 +7,7 @@ source("../../shared/qtcreator.py")
# entry of test # entry of test
def main(): def main():
# prepare example project # prepare example project
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "animation") "quick", "animation")
proFile = "animation.pro" proFile = "animation.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):

View File

@@ -6,7 +6,7 @@ source("../../shared/qtcreator.py")
# entry of test # entry of test
def main(): def main():
# prepare example project # prepare example project
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"gui", "openglwindow") "gui", "openglwindow")
proFile = "openglwindow.pro" proFile = "openglwindow.pro"

View File

@@ -6,7 +6,7 @@ source("../../shared/qtcreator.py")
# entry of test # entry of test
def main(): def main():
# prepare example project # prepare example project
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"gui", "openglwindow") "gui", "openglwindow")
proFile = "openglwindow.pro" proFile = "openglwindow.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):

View File

@@ -48,7 +48,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
docFiles = ["qtdoc.qch", "qtsql.qch"] docFiles = ["qtdoc.qch", "qtsql.qch"]
docFiles = [os.path.join(Qt5Path.docsPath(Targets.DESKTOP_5_14_1_DEFAULT), file) for file in docFiles] docFiles = [os.path.join(QtPath.docsPath(Targets.DESKTOP_5_14_1_DEFAULT), file) for file in docFiles]
addHelpDocumentation(docFiles) addHelpDocumentation(docFiles)
# switch to help mode # switch to help mode
switchViewTo(ViewConstants.HELP) switchViewTo(ViewConstants.HELP)

View File

@@ -25,7 +25,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
qchs = [] qchs = []
for p in Qt5Path.getPaths(Qt5Path.DOCS): for p in QtPath.getPaths(QtPath.DOCS):
qchs.append(os.path.join(p, "qtquick.qch")) qchs.append(os.path.join(p, "qtquick.qch"))
addHelpDocumentation(qchs) addHelpDocumentation(qchs)
setFixedHelpViewer(HelpViewer.SIDEBYSIDE) setFixedHelpViewer(HelpViewer.SIDEBYSIDE)

View File

@@ -45,7 +45,7 @@ def checkUsages(resultsView, expectedResults, directory):
def main(): def main():
# prepare example project # prepare example project
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "animation") "quick", "animation")
proFile = "animation.pro" proFile = "animation.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):

View File

@@ -43,7 +43,7 @@ def checkTypeAndProperties(typePropertiesDetails):
def main(): def main():
# prepare example project # prepare example project
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "animation") "quick", "animation")
if not neededFilePresent(sourceExample): if not neededFilePresent(sourceExample):
return return

View File

@@ -41,7 +41,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
qchs = [] qchs = []
for p in Qt5Path.getPaths(Qt5Path.DOCS): for p in QtPath.getPaths(QtPath.DOCS):
qchs.extend([os.path.join(p, "qtopengl.qch"), os.path.join(p, "qtwidgets.qch")]) qchs.extend([os.path.join(p, "qtopengl.qch"), os.path.join(p, "qtwidgets.qch")])
addHelpDocumentation(qchs) addHelpDocumentation(qchs)
setFixedHelpViewer(HelpViewer.HELPMODE) setFixedHelpViewer(HelpViewer.HELPMODE)
@@ -72,7 +72,7 @@ def main():
test.verify(example is None, "Verifying: No example is shown.") test.verify(example is None, "Verifying: No example is shown.")
proFiles = [os.path.join(p, "opengl", "2dpainting", "2dpainting.pro") proFiles = [os.path.join(p, "opengl", "2dpainting", "2dpainting.pro")
for p in Qt5Path.getPaths(Qt5Path.EXAMPLES)] for p in QtPath.getPaths(QtPath.EXAMPLES)]
cleanUpUserFiles(proFiles) cleanUpUserFiles(proFiles)
for p in proFiles: for p in proFiles:
removePackagingDirectory(os.path.dirname(p)) removePackagingDirectory(os.path.dirname(p))
@@ -94,7 +94,7 @@ def main():
# go to "Welcome" page and choose another example # go to "Welcome" page and choose another example
switchViewTo(ViewConstants.WELCOME) switchViewTo(ViewConstants.WELCOME)
proFiles = [os.path.join(p, "widgets", "itemviews", "addressbook", "addressbook.pro") proFiles = [os.path.join(p, "widgets", "itemviews", "addressbook", "addressbook.pro")
for p in Qt5Path.getPaths(Qt5Path.EXAMPLES)] for p in QtPath.getPaths(QtPath.EXAMPLES)]
cleanUpUserFiles(proFiles) cleanUpUserFiles(proFiles)
for p in proFiles: for p in proFiles:
removePackagingDirectory(os.path.dirname(p)) removePackagingDirectory(os.path.dirname(p))

View File

@@ -7,7 +7,7 @@ focusDocumentPath = "keyinteraction.Resources.keyinteraction\.qrc./keyinteractio
def main(): def main():
target = Targets.DESKTOP_5_14_1_DEFAULT target = Targets.DESKTOP_5_14_1_DEFAULT
sourceExample = os.path.join(Qt5Path.examplesPath(target), "quick/keyinteraction") sourceExample = os.path.join(QtPath.examplesPath(target), "quick/keyinteraction")
proFile = "keyinteraction.pro" proFile = "keyinteraction.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):
return return
@@ -15,7 +15,7 @@ def main():
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
# add docs to have the correct tool tips # add docs to have the correct tool tips
addHelpDocumentation([os.path.join(Qt5Path.docsPath(target), "qtquick.qch")]) addHelpDocumentation([os.path.join(QtPath.docsPath(target), "qtquick.qch")])
templateDir = prepareTemplate(sourceExample) templateDir = prepareTemplate(sourceExample)
openQmakeProject(os.path.join(templateDir, proFile), [target]) openQmakeProject(os.path.join(templateDir, proFile), [target])
openDocument(focusDocumentPath % "focus\\.qml") openDocument(focusDocumentPath % "focus\\.qml")

View File

@@ -6,7 +6,7 @@ source("../../shared/qtcreator.py")
def main(): def main():
# prepare example project # prepare example project
projectName = "adding" projectName = "adding"
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"qml", "referenceexamples", "adding") "qml", "referenceexamples", "adding")
proFile = projectName + ".pro" proFile = projectName + ".pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):

View File

@@ -45,9 +45,9 @@ def main():
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def prepareTestExamples(): def prepareTestExamples():
examples = [os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), examples = [os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "animation", "animation.pro"), "quick", "animation", "animation.pro"),
os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "keyinteraction", "keyinteraction.pro") "quick", "keyinteraction", "keyinteraction.pro")
] ]
projects = [] projects = []

View File

@@ -8,7 +8,7 @@ outline = ":Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView"
treebase = "keyinteraction.Resources.keyinteraction\\.qrc./keyinteraction.focus." treebase = "keyinteraction.Resources.keyinteraction\\.qrc./keyinteraction.focus."
def main(): def main():
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT), sourceExample = os.path.join(QtPath.examplesPath(Targets.DESKTOP_5_14_1_DEFAULT),
"quick", "keyinteraction") "quick", "keyinteraction")
proFile = "keyinteraction.pro" proFile = "keyinteraction.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)): if not neededFilePresent(os.path.join(sourceExample, proFile)):