summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2016-06-01 10:56:14 +0200
committerChristian Stenger <christian.stenger@qt.io>2016-06-01 14:50:25 +0000
commitb04b5e5d75b188a6eac4fcc1537327423cae5efb (patch)
treed96c84d4cb128ffbab08458c3835429b7bf0eae2
parent48423414f6911f76ec31f48e600149a8893aeab7 (diff)
downloadqt-creator-b04b5e5d75b188a6eac4fcc1537327423cae5efb.tar.gz
Squish: Provide functions for getting paths inside Qt installation
Change-Id: I273304f0c6d451d28a256c99588479525eef95e4 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
-rw-r--r--tests/system/shared/classes.py53
-rw-r--r--tests/system/suite_editors/tst_qml_editor/test.py7
2 files changed, 57 insertions, 3 deletions
diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py
index f276e8d19e..51248b40bc 100644
--- a/tests/system/shared/classes.py
+++ b/tests/system/shared/classes.py
@@ -23,6 +23,7 @@
#
############################################################################
+import __builtin__
import operator
# for easier re-usage (because Python hasn't an enum type)
@@ -200,3 +201,55 @@ class Qt5Path:
else:
return map(os.path.expanduser, ["~/Qt5.2.1/5.2.1/clang_64" + path52,
"~/Qt5.3.1" + path53])
+
+ @staticmethod
+ def __preCheckAndExtractQtVersionStr__(target):
+ if target not in Targets.ALL_TARGETS:
+ raise Exception("Unexpected target '%s'" % str(target))
+
+ matcher = re.match("^Desktop (5\\d{2}).*$", Targets.getStringForTarget(target))
+ if matcher is None:
+ raise Exception("Currently this is supported for Desktop Qt5 only, got target '%s'"
+ % str(Targets.getStringForTarget(target)))
+ return matcher.group(1)
+
+ @staticmethod
+ def __createPlatformQtPath__(qt5Minor):
+ # special handling for Qt5.2
+ if qt5Minor == 2:
+ if platform.system() in ('Microsoft', 'Windows'):
+ return "C:/Qt/Qt5.2.1/5.2.1/msvc2010"
+ elif platform.system() == 'Linux':
+ if __is64BitOS__():
+ return os.path.expanduser("~/Qt5.2.1/5.2.1/gcc_64")
+ else:
+ return os.path.expanduser("~/Qt5.2.1/5.2.1/gcc")
+ else:
+ return os.path.expanduser("~/Qt5.2.1/5.2.1/clang_64")
+ # Qt5.3+
+ if platform.system() in ('Microsoft', 'Windows'):
+ return "C:/Qt/Qt5.%d.1" % qt5Minor
+ else:
+ return os.path.expanduser("~/Qt5.%d.1" % qt5Minor)
+
+ @staticmethod
+ def examplesPath(target):
+ qtVersionStr = Qt5Path.__preCheckAndExtractQtVersionStr__(target)
+ qtMinorVersion = __builtin__.int(qtVersionStr[1])
+ if qtMinorVersion == 2:
+ path = "examples"
+ else:
+ path = "Examples/Qt-5.%d" % qtMinorVersion
+
+ return os.path.join(Qt5Path.__createPlatformQtPath__(qtMinorVersion), path)
+
+ @staticmethod
+ def docsPath(target):
+ qtVersionStr = Qt5Path.__preCheckAndExtractQtVersionStr__(target)
+ qtMinorVersion = __builtin__.int(qtVersionStr[1])
+ if qtMinorVersion == 2:
+ path = "doc"
+ else:
+ path = "Docs/Qt-5.%d" % qtMinorVersion
+
+ return os.path.join(Qt5Path.__createPlatformQtPath__(qtMinorVersion), path)
diff --git a/tests/system/suite_editors/tst_qml_editor/test.py b/tests/system/suite_editors/tst_qml_editor/test.py
index 69dc71a14b..70f56ea14d 100644
--- a/tests/system/suite_editors/tst_qml_editor/test.py
+++ b/tests/system/suite_editors/tst_qml_editor/test.py
@@ -26,7 +26,8 @@
source("../../shared/qtcreator.py")
def main():
- sourceExample = os.path.abspath(Qt5Path.getPaths(Qt5Path.EXAMPLES)[0] + "/declarative/keyinteraction/focus")
+ target = Targets.DESKTOP_521_DEFAULT
+ sourceExample = os.path.join(Qt5Path.examplesPath(target), "declarative/keyinteraction/focus")
proFile = "focus.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
@@ -34,9 +35,9 @@ def main():
if not startedWithoutPluginError():
return
# add docs to have the correct tool tips
- addHelpDocumentation([os.path.join(Qt5Path.getPaths(Qt5Path.DOCS)[0], "qtquick.qch")])
+ addHelpDocumentation([os.path.join(Qt5Path.docsPath(target), "qtquick.qch")])
templateDir = prepareTemplate(sourceExample, "/../../helper")
- openQmakeProject(os.path.join(templateDir, proFile), Targets.DESKTOP_521_DEFAULT)
+ openQmakeProject(os.path.join(templateDir, proFile), target)
openDocument("focus.QML.qml" + os.sep + "focus.focus\\.qml")
testRenameId()
testFindUsages()