aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2021-12-13 21:59:38 +0100
committerRobert Löhning <robert.loehning@qt.io>2022-02-18 22:01:14 +0000
commit00c7161e3359d5eb59d1463df9ad3448d74f5414 (patch)
tree46b63c491651b4942e13687778b3c727000e40c6 /tests
parentc82937a78cb7bc23352d2c698dd7a4d5b6e53b21 (diff)
Squish: Run tst_save_before_build on CMake and qmake
Change-Id: I91501633e0fe7c863c43af4224474c09f57dbf8c Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/system/README2
-rw-r--r--tests/system/suite_general/tst_save_before_build/test.py82
2 files changed, 52 insertions, 32 deletions
diff --git a/tests/system/README b/tests/system/README
index 61847485fb..2d71245cb3 100644
--- a/tests/system/README
+++ b/tests/system/README
@@ -59,7 +59,7 @@ This folder must contain the following:
* a speedcrunch 0.11 repository (or source copy) inside 'creator-test-data' named 'speedcrunch'
Fifth - you'll have to make sure that some needed tools are available (no matter on which OS you're on).
- * cmake
+ * cmake 3.14 or newer
* wget or curl, capable of HTTPS
Normally it should be okay to just install them as usual and add their executables' path(s) to the PATH variable.
diff --git a/tests/system/suite_general/tst_save_before_build/test.py b/tests/system/suite_general/tst_save_before_build/test.py
index 728f849975..3befbbd8ea 100644
--- a/tests/system/suite_general/tst_save_before_build/test.py
+++ b/tests/system/suite_general/tst_save_before_build/test.py
@@ -25,43 +25,63 @@
source("../../shared/qtcreator.py")
-def ensureSaveBeforeBuildChecked(shouldBeChecked):
+
+def __openBuildAndRunSettings__():
invokeMenuItem("Tools", "Options...")
mouseClick(waitForObjectItem(":Options_QListView", "Build & Run"))
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "General")
- if test.compare(waitForObject(":Build and Run.Save all files before build_QCheckBox").checked,
- shouldBeChecked, "'Save all files before build' should be %s" % str(shouldBeChecked)):
- clickButton(waitForObject(":Options.Cancel_QPushButton"))
- else:
- ensureChecked(":Build and Run.Save all files before build_QCheckBox", shouldBeChecked)
- clickButton(waitForObject(":Options.OK_QPushButton"))
+
+
+def verifySaveBeforeBuildChecked(shouldBeChecked):
+ __openBuildAndRunSettings__()
+ test.compare(waitForObject(":Build and Run.Save all files before build_QCheckBox").checked,
+ shouldBeChecked,
+ "'Save all files before build' should be %s" % str(shouldBeChecked))
+ clickButton(waitForObject(":Options.Cancel_QPushButton"))
+
+
+def ensureSaveBeforeBuildChecked(shouldBeChecked):
+ __openBuildAndRunSettings__()
+ ensureChecked(":Build and Run.Save all files before build_QCheckBox", shouldBeChecked)
+ clickButton(waitForObject(":Options.OK_QPushButton"))
+
def main():
startQC()
if not startedWithoutPluginError():
return
- ensureSaveBeforeBuildChecked(False)
- # create qt quick application
- createNewQtQuickApplication(tempDir(), "SampleApp")
- for expectDialog in [True, False]:
- files = ["SampleApp.SampleApp\\.pro",
- "SampleApp.Sources.main\\.cpp",
- "SampleApp.Resources.qml\.qrc./.main\\.qml"]
- for i, file in enumerate(files):
- if not openDocument(file):
- test.fatal("Could not open file '%s'" % simpleFileName(file))
- continue
- test.log("Changing file '%s'" % simpleFileName(file))
- typeLines(getEditorForFileSuffix(file, True), "")
- # try to compile
- clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
- try:
- ensureChecked(":Save Changes.Always save files before build_QCheckBox",
- i == len(files) - 1, 5000) # At the last iteration, check the box
- clickButton(waitForObject(":Save Changes.Save All_QPushButton"))
- test.verify(expectDialog, "The 'Save Changes' dialog was shown.")
- except:
- test.verify(not expectDialog, "The 'Save Changes' dialog was not shown.")
- waitForCompile()
- ensureSaveBeforeBuildChecked(True)
+ verifySaveBeforeBuildChecked(False)
+ for buildSystem in ["CMake", "qmake"]:
+ projectName = "SampleApp-" + buildSystem
+ ensureSaveBeforeBuildChecked(False)
+ # create qt quick application
+ createNewQtQuickApplication(tempDir(), projectName, buildSystem=buildSystem)
+ for expectDialog in [True, False]:
+ verifySaveBeforeBuildChecked(not expectDialog)
+ if buildSystem == "CMake":
+ files = ["%s.CMakeLists\\.txt" % projectName,
+ "%s.%s.Source Files.main\\.cpp" % (projectName, projectName),
+ "%s.%s.qml\.qrc./.main\\.qml" % (projectName, projectName)]
+ elif buildSystem == "qmake":
+ files = ["%s.%s\\.pro" % (projectName, projectName),
+ "%s.Sources.main\\.cpp" % projectName,
+ "%s.Resources.qml\.qrc./.main\\.qml" % projectName]
+ for i, file in enumerate(files):
+ if not openDocument(file):
+ test.fatal("Could not open file '%s'" % simpleFileName(file))
+ continue
+ test.log("Changing file '%s'" % simpleFileName(file))
+ typeLines(getEditorForFileSuffix(file, True), "")
+ # try to compile
+ clickButton(waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton"))
+ try:
+ ensureChecked(":Save Changes.Always save files before build_QCheckBox",
+ i == len(files) - 1, 5000) # At the last iteration, check the box
+ clickButton(waitForObject(":Save Changes.Save All_QPushButton"))
+ test.verify(expectDialog, "The 'Save Changes' dialog was shown.")
+ except:
+ test.verify(not expectDialog, "The 'Save Changes' dialog was not shown.")
+ waitForCompile()
+ verifySaveBeforeBuildChecked(True)
+ invokeMenuItem("File", "Close All Projects and Editors")
invokeMenuItem("File", "Exit")