diff options
author | Robert Löhning <robert.loehning@qt.io> | 2024-01-11 16:34:00 +0100 |
---|---|---|
committer | Robert Löhning <robert.loehning@qt.io> | 2024-01-17 11:52:20 +0000 |
commit | 154df923889b2e479704a1bddf25c824bbdaa166 (patch) | |
tree | 4051eca41cfcc3ce38ab5d89bdd9ed68f8962c3c | |
parent | 9c76277296d18db0465b5c3b73ad8cd6e836ab32 (diff) |
Squish: Test building created projects
Change-Id: Idc50b1cc93d712b9c7f6f8582fac63a237d03dd2
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r-- | Tests/system/suite_configuration/shared/scripts/names.py | 9 | ||||
-rw-r--r-- | Tests/system/suite_configuration/tst_new_project_file_creation/test.py | 30 |
2 files changed, 39 insertions, 0 deletions
diff --git a/Tests/system/suite_configuration/shared/scripts/names.py b/Tests/system/suite_configuration/shared/scripts/names.py index 8759686d..8eab1b2c 100644 --- a/Tests/system/suite_configuration/shared/scripts/names.py +++ b/Tests/system/suite_configuration/shared/scripts/names.py @@ -56,3 +56,12 @@ qt_Microsoft_Visual_Studio_cpp_TabItem = {"container":globalnames.microsoft_Visu "type": "TabItem"} qt_cpp_Label = {"container": qt_Microsoft_Visual_Studio_cpp_TabItem, "text": RegularExpression(".+\.(cpp|qml)$"), "type": "Label"} +build_MenuItem = {"container": globalnames.microsoft_Visual_Studio_MenuBar, "text": "Build", + "type": "MenuItem"} +build_Build_Solution_MenuItem = {"container": build_MenuItem, "text": "Build Solution", + "type": "MenuItem"} +Microsoft_Visual_Studio_ToolBar = {"container": globalnames.microsoft_Visual_Studio_Window, + "type": "ToolBar"} +platforms_ComboBox = {"container": Microsoft_Visual_Studio_ToolBar, + "tooltip": "Solution Platforms", "type": "ComboBox"} +x64_ComboBoxItem = {"container": platforms_ComboBox, "id": "x64", "type": "ComboBoxItem"} diff --git a/Tests/system/suite_configuration/tst_new_project_file_creation/test.py b/Tests/system/suite_configuration/tst_new_project_file_creation/test.py index 4cddbaa3..b4de3151 100644 --- a/Tests/system/suite_configuration/tst_new_project_file_creation/test.py +++ b/Tests/system/suite_configuration/tst_new_project_file_creation/test.py @@ -82,6 +82,30 @@ def listExpectedWrittenFiles(workDir, projectName, templateName): return [] +def getExpectedBuiltFile(workDir, projectName, templateName): + buildPath = os.path.join(workDir, projectName) + expand(waitForObject(names.platforms_ComboBox)) + try: + waitForObjectExists(names.x64_ComboBoxItem, 5000) + buildPath = os.path.join(buildPath, "x64") + except: + pass + collapse(waitForObject(names.platforms_ComboBox)) + if templateName in ["Qt Console Application", + "Qt Quick Application", + "Qt Widgets Application"]: + return os.path.join(buildPath, "Debug", projectName + ".exe") + elif templateName in ["Qt Class Library", + "Qt Designer Custom Widget"]: + return os.path.join(buildPath, "Debug", projectName + ".dll") + elif templateName == "Qt Empty Application": + return os.path.join(buildPath, "Debug") + else: + test.fatal("Unexpected template '%s'" % templateName, + "You might need to update function getExpectedBuiltFile()") + return "" + + workDir = os.getenv("SQUISH_VSTOOLS_WORKDIR") createdProjects = set() @@ -149,6 +173,12 @@ def main(): test.verify(all(map(os.path.exists, listExpectedWrittenFiles(workDir, projectName, templateName))), "Were all expected files created?") + if templateName != "Qt ActiveQt Server": + builtFile = getExpectedBuiltFile(workDir, projectName, templateName) + mouseClick(waitForObject(names.build_MenuItem)) + mouseClick(waitForObject(names.build_Build_Solution_MenuItem)) + test.verify(waitFor("os.path.exists(builtFile)", 15000), + "Was %s built as expected?" % builtFile) mouseClick(waitForObject(globalnames.file_MenuItem)) mouseClick(waitForObject(names.file_Close_Solution_MenuItem)) # reopens the "New Project" dialog |