From 36573eda7b85b8659c6ba340db14794fa8726d3b Mon Sep 17 00:00:00 2001
From: Robert Loehning <robert.loehning@nokia.com>
Date: Tue, 17 Jan 2012 15:39:57 +0100
Subject: [PATCH] Squish: Running tst_build_new_project on more build configs

Change-Id: I413f5393bb8d56842d8132e26123ebe21d89c57a
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
Reviewed-by: Bill King <bill.king@nokia.com>
---
 tests/system/shared/project.py                | 31 ++++++++++++++-----
 .../tst_build_new_project/test.py             |  7 +++--
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py
index 22468d16a3b..224cd5dad35 100644
--- a/tests/system/shared/project.py
+++ b/tests/system/shared/project.py
@@ -66,15 +66,24 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True):
     clickButton(waitForObject(":Next_QPushButton"))
     return str(projectName)
 
+# Selects the Qt versions for a project
+# param qtVersion is the name of a Qt version. In the project, build configurations will be
+#                 created for this version. If it is None, all Qt versions will be used
+# param checks turns tests in the function on if set to True
 def __selectQtVersionDesktop__(qtVersion, checks):
     __chooseTargets__()
-    selectFromCombo(":scrollArea.Create Build Configurations:_QComboBox_2",
-                    "For One Qt Version One Debug And One Release")
-    ensureChecked(":scrollArea.Use Shadow Building_QCheckBox")
-    selectFromCombo(":scrollArea.Qt Version:_QComboBox", qtVersion)
-    if checks:
-        verifyChecked(":scrollArea.Qt 4 for Desktop - (Qt SDK) debug_QCheckBox")
-        verifyChecked(":scrollArea.Qt 4 for Desktop - (Qt SDK) release_QCheckBox")
+    if qtVersion == None:
+        selectFromCombo(":scrollArea.Create Build Configurations:_QComboBox_2",
+                        "For Each Qt Version One Debug And One Release")
+        ensureChecked(":scrollArea.Use Shadow Building_QCheckBox")
+    else:
+        selectFromCombo(":scrollArea.Create Build Configurations:_QComboBox_2",
+                        "For One Qt Version One Debug And One Release")
+        ensureChecked(":scrollArea.Use Shadow Building_QCheckBox")
+        selectFromCombo(":scrollArea.Qt Version:_QComboBox", qtVersion)
+        if checks:
+            verifyChecked(":scrollArea.Qt 4 for Desktop - (Qt SDK) debug_QCheckBox")
+            verifyChecked(":scrollArea.Qt 4 for Desktop - (Qt SDK) release_QCheckBox")
     clickButton(waitForObject(":Next_QPushButton"))
 
 def __createProjectHandleLastPage__(expectedFiles = None):
@@ -95,7 +104,13 @@ def __verifyFileCreation__(path, expectedFiles):
             filename = os.path.join(path, filename)
         test.verify(os.path.exists(filename), "Checking if '" + filename + "' was created")
 
-def createProject_Qt_GUI(path, projectName, qtVersion, checks):
+# Creates a Qt GUI project
+# param path specifies where to create the project
+# param projectName is the name for the new project
+# param qtVersion is the name of a Qt version. In the project, build configurations will be
+#                 created for this version. If it is None, all Qt versions will be used
+# param checks turns tests in the function on if set to True
+def createProject_Qt_GUI(path, projectName, qtVersion = None, checks = True):
     __createProjectSelectType__("Other Qt Project", "Qt Gui Application")
     __createProjectSetNameAndPath__(path, projectName, checks)
     __selectQtVersionDesktop__(qtVersion, checks)
diff --git a/tests/system/suite_debugger/tst_build_new_project/test.py b/tests/system/suite_debugger/tst_build_new_project/test.py
index 5673f1669b6..80f40748b11 100644
--- a/tests/system/suite_debugger/tst_build_new_project/test.py
+++ b/tests/system/suite_debugger/tst_build_new_project/test.py
@@ -5,8 +5,11 @@ project = "SquishProject"
 
 def main():
     startApplication("qtcreator" + SettingsPath)
-    createProject_Qt_GUI(projectsPath, project, defaultQtVersion, True)
-    runAndCloseApp()
+    createProject_Qt_GUI(projectsPath, project)
+    for config in iterateBuildConfigs(1, 0):
+        selectBuildConfig(1, 0, config)
+        test.log("Testing build configuration: " + config)
+        runAndCloseApp()
     sendEvent("QCloseEvent", waitForObject(":Qt Creator_Core::Internal::MainWindow"))
     waitForCleanShutdown()
 
-- 
GitLab