From 2a261588f4a1d6eb87b037fd2aa9166740f7b8cd Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 8 Apr 2013 14:05:17 +0200 Subject: [PATCH] Squish: Add helper functions to Target class Change-Id: Iba67cc28d29346689ca8443ce0b594056feaa0cf Reviewed-by: Robert Loehning --- tests/system/shared/classes.py | 13 +++++++++++++ .../system/suite_debugger/tst_simple_debug/test.py | 11 +++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index 53894a97074..60562376641 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -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 diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index 7dc1d0242ba..b5fd5fdc378 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -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, '')