Squish: Add helper functions to Target class

Change-Id: Iba67cc28d29346689ca8443ce0b594056feaa0cf
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2013-04-08 14:05:17 +02:00
parent c74bb8dfca
commit 2a261588f4
2 changed files with 16 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
import operator
# for easier re-usage (because Python hasn't an enum type)
class Targets:
DESKTOP_474_GCC = 1
@@ -44,6 +46,17 @@ class Targets:
test.fatal("You've passed at least one unknown target!")
return result
@staticmethod
def intToArray(targets):
available = [Targets.DESKTOP_474_GCC, Targets.SIMULATOR, Targets.MAEMO5, Targets.HARMATTAN,
Targets.EMBEDDED_LINUX, Targets.DESKTOP_474_MSVC2008,
Targets.DESKTOP_501_DEFAULT]
return filter(lambda x: x & targets == x, available)
@staticmethod
def arrayToInt(targetArr):
return reduce(operator.or_, targetArr, 0)
# this class holds some constants for easier usage inside the Projects view
class ProjectSettings:
BUILD = 1

View File

@@ -7,19 +7,14 @@ def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
targets = [Targets.DESKTOP_474_GCC]
if platform.system() in ('Windows', 'Microsoft'):
targets.append(Targets.DESKTOP_474_MSVC2008)
if not checkDebuggingLibrary(targets):
targets = Targets.desktopTargetClasses()
if not checkDebuggingLibrary(Targets.intToArray(targets)):
test.fatal("Error while checking debugging libraries - leaving this test.")
invokeMenuItem("File", "Exit")
return
# using a temporary directory won't mess up a potentially existing
workingDir = tempDir()
targetsVal = 0
for t in targets:
targetsVal |= t
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targetsVal)
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if placeCursorToLine(editor, "MouseArea.*", True):
type(editor, '<Up>')