aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2023-06-22 17:47:28 +0200
committerRobert Löhning <robert.loehning@qt.io>2024-01-12 16:45:50 +0000
commit6dee879e48ca8430a3d0734dea3ddb7a6e329c6a (patch)
treeb3f4e8305038df1d57233d552ea3f7086e688257
parentcfcb67687f5b313b4202fb6a6ab2fbaaad7d0855 (diff)
Squish: Add test for changing project and class names
Change-Id: I832a006a54e82d8ceb1e986cf8ac73c2db2d9f7d Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--Tests/system/suite_configuration/shared/scripts/names.py2
-rw-r--r--Tests/system/suite_configuration/suite.conf2
-rw-r--r--Tests/system/suite_configuration/tst_new_project_edit/test.py68
3 files changed, 71 insertions, 1 deletions
diff --git a/Tests/system/suite_configuration/shared/scripts/names.py b/Tests/system/suite_configuration/shared/scripts/names.py
index 4b1c6ed5..18bc4b7c 100644
--- a/Tests/system/suite_configuration/shared/scripts/names.py
+++ b/Tests/system/suite_configuration/shared/scripts/names.py
@@ -43,3 +43,5 @@ qt_Wizard_Header_h_file_Edit = {"container": qt_Wizard_Window, "id": "ClassHeade
"type": "Edit"}
no_Qt_version_Label = {"container": qt_Wizard_Window, "id": "ErrorMsg", "type": "Label"}
qt_Wizard_Finish_Button = {"container": qt_Wizard_Window, "text": "Finish", "type": "Button"}
+lower_case_file_names_CheckBox = {"container": qt_Wizard_Window, "text": "Lower case file names",
+ "type": "CheckBox"}
diff --git a/Tests/system/suite_configuration/suite.conf b/Tests/system/suite_configuration/suite.conf
index 252701b3..f2197549 100644
--- a/Tests/system/suite_configuration/suite.conf
+++ b/Tests/system/suite_configuration/suite.conf
@@ -3,6 +3,6 @@ ENVVARS=envvars
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
-TEST_CASES=tst_add_remove_qt_versions tst_new_project_defaults tst_new_project_no_qt
+TEST_CASES=tst_add_remove_qt_versions tst_new_project_defaults tst_new_project_edit tst_new_project_no_qt
VERSION=3
WRAPPERS=Windows
diff --git a/Tests/system/suite_configuration/tst_new_project_edit/test.py b/Tests/system/suite_configuration/tst_new_project_edit/test.py
new file mode 100644
index 00000000..e29a7bae
--- /dev/null
+++ b/Tests/system/suite_configuration/tst_new_project_edit/test.py
@@ -0,0 +1,68 @@
+####################################################################################################
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+####################################################################################################
+
+# -*- coding: utf-8 -*-
+
+source("../shared/scripts/config_utils.py")
+
+import names
+
+myProjectName = ""
+
+
+def setNames(_, __, expectedName):
+ global myProjectName
+ projectNameEdit = waitForObjectExists(names.microsoft_Visual_Studio_Project_name_Edit)
+ myProjectName = "My%sProject" % expectedName
+ type(projectNameEdit, myProjectName)
+ solutionNameEdit = waitForObjectExists(names.solutionNameText_Edit)
+ type(solutionNameEdit, "My%sSolution" % expectedName)
+
+
+def testWizardPage3(_, __):
+ classNameEdit = waitForObjectExists(names.qt_Wizard_Class_Name_Edit)
+ headerEdit = waitForObjectExists(names.qt_Wizard_Header_h_file_Edit)
+ sourceEdit = waitForObjectExists(names.qt_Wizard_Source_cpp_file_Edit)
+ # Check that names are derived from project name
+ test.compare(classNameEdit.text, myProjectName)
+ test.compare(headerEdit.text, myProjectName + ".h")
+ test.compare(sourceEdit.text, myProjectName + ".cpp")
+ # Check that changing class name changes file names
+ type(classNameEdit, "HereIs")
+ changedClassName = "HereIs" + myProjectName
+ waitFor("classNameEdit.text == changedClassName", 2000)
+ test.compare(classNameEdit.text, changedClassName)
+ test.compare(headerEdit.text, changedClassName + ".h")
+ test.compare(sourceEdit.text, changedClassName + ".cpp")
+ # Check that file names can be made lower case
+ test.verify(not waitForObject(names.lower_case_file_names_CheckBox).checked)
+ mouseClick(waitForObject(names.lower_case_file_names_CheckBox))
+ test.compare(headerEdit.text, changedClassName.lower() + ".h")
+ test.compare(sourceEdit.text, changedClassName.lower() + ".cpp")
+ test.verify(waitForObject(names.lower_case_file_names_CheckBox).checked)
+ # Check that file names can be set back to camel case
+ mouseClick(waitForObject(names.lower_case_file_names_CheckBox))
+ test.compare(headerEdit.text, changedClassName + ".h")
+ test.compare(sourceEdit.text, changedClassName + ".cpp")
+ test.verify(not waitForObject(names.lower_case_file_names_CheckBox).checked)
+
+ # Check that the wizard can't proceed with empty values
+ def clearAndRestoreEdit(edit):
+ previousText = edit.text
+ type(edit, "<Ctrl+a>")
+ type(edit, "<Delete>")
+ waitFor("edit.text == ''")
+ test.verify(not waitForObjectExists(names.qt_Wizard_Finish_Button).enabled)
+ type(edit, previousText)
+ waitFor("edit.text == previousText")
+ test.verify(waitForObjectExists(names.qt_Wizard_Finish_Button).enabled)
+
+ clearAndRestoreEdit(sourceEdit)
+ clearAndRestoreEdit(headerEdit)
+ clearAndRestoreEdit(classNameEdit)
+
+
+def main():
+ testAllQtWizards(setNames, funcPage3=testWizardPage3)