aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <[email protected]>2025-05-13 10:15:23 +0200
committerChristian Stenger <[email protected]>2025-05-13 09:57:53 +0000
commitb98c7a511bf8d4e98db7501a340d44047ec56a85 (patch)
tree7504b0daf063c656e187f0937ba15888422c057a
parent5ac21d80bfb9b8d18fc57e00b8b2b87fe978dc8d (diff)
SquishTests: Adapt QML refactoring test
Refactoring a component into a new file nowadays allows the user to handle some of the used properties explicitly. For now just check these properties as well and adapt the expected source file. Change-Id: Ic69204ac90a3bfddf6d4d1a71547b343366faaf7 Reviewed-by: Jukka Nokso <[email protected]> Reviewed-by: Christian Stenger <[email protected]>
-rw-r--r--tests/system/objects.map2
-rw-r--r--tests/system/suite_QMLS/tst_QMLS04/test.py17
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/system/objects.map b/tests/system/objects.map
index f5343e9118b..d43cd05447a 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -41,6 +41,8 @@
:Close Debugging Session_Utils::CheckableMessageBox {type='Utils::CheckableMessageBox' unnamed='1' visible='1' windowTitle='Close Debugging Session'}
:Compiler:_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':Compiler:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Compiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='C/C++:' type='QLabel' unnamed='1' visible='1'}
+:ComponentDialog.PropertiesLabel {text?='Property assignments for *' type='QLabel' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'}
+:ComponentDialog.PropertiesListWidget {aboveWidget=':ComponentDialog.PropertiesLabel' type='QListWidget' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='Behavior' type='QGroupBox' visible='1'}
:DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='GlobalLogDockWidget' type='QDockWidget' visible='1'}
:DebugModeWidget.Debugger.Docks.BreakDockWidget_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.BreakpointManagerDockWidget' type='QDockWidget' visible='1'}
diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py
index 0693b5edf1b..8bff6c3fef9 100644
--- a/tests/system/suite_QMLS/tst_QMLS04/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS04/test.py
@@ -21,6 +21,19 @@ def main():
invokeContextMenuItem(editorArea, "Refactoring", "Move Component into Separate File")
# give component name and proceed
replaceEditorContent(waitForObject(":Dialog.componentNameEdit_QLineEdit"), "MyComponent")
+ propertyListWidget = waitForObject(":ComponentDialog.PropertiesListWidget")
+ propertiesModel = propertyListWidget.model()
+ expectedPropertiesAndCheckState = {"anchors.horizontalCenter":True, "anchors.top":True,
+ "anchors.topMargin":True, "text":False}
+ indices = dumpIndices(propertiesModel)
+ test.compare(len(indices), len(expectedPropertiesAndCheckState), "Number of listed properties matches.")
+ for index in indices:
+ property = str(index.data().toString())
+ checked = index.data(10).toInt() == 2 # Qt::CheckState == 10, Qt::Checked == 2
+ if test.verify(property in expectedPropertiesAndCheckState,
+ "Excepted property '%s' found." % property):
+ test.compare(checked, expectedPropertiesAndCheckState[property],
+ "Expected check state matches.")
clickButton(waitForObject(":Dialog.OK_QPushButton"))
try:
waitForObject(":Add to Version Control_QMessageBox", 5000)
@@ -30,8 +43,8 @@ def main():
# verify if refactoring is done correctly
waitFor("'MyComponent' in str(editorArea.plainText)", 2000)
codeText = str(editorArea.plainText)
- patternCodeToAdd = "MyComponent\s+\{\s*id: textEdit\s*\}"
- patternCodeToMove = "TextEdit\s+\{.*\}"
+ patternCodeToAdd = "MyComponent\s+\{\s*id: textEdit\s*(.*(anchors|parent)\..*){4}\}"
+ patternCodeToMove = "TextEdit\s+\{.*text: \"Enter something\".*\}"
# there should be empty MyComponent item instead of TextEdit item
if re.search(patternCodeToAdd, codeText, re.DOTALL) and not re.search(patternCodeToMove, codeText, re.DOTALL):
test.passes("Refactoring was properly applied in source file")