aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/platform/data/tst_menuitem.qml
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-07-17 15:40:17 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-07-17 15:40:17 +0200
commit50244fc5d6f0730a447f1ac1ce19827890bc1456 (patch)
treefd937513dc616c270a1b8da23f982c2b9a7b6ac2 /tests/auto/platform/data/tst_menuitem.qml
parentbf727efa7aa9a4738ae86a2c699832129813c670 (diff)
parent49ffc6e6af83b295c67fd119b79c925879cc292e (diff)
Merge branch 'dev' into nativestyle
Diffstat (limited to 'tests/auto/platform/data/tst_menuitem.qml')
-rw-r--r--tests/auto/platform/data/tst_menuitem.qml31
1 files changed, 17 insertions, 14 deletions
diff --git a/tests/auto/platform/data/tst_menuitem.qml b/tests/auto/platform/data/tst_menuitem.qml
index 29d369bc..316af97d 100644
--- a/tests/auto/platform/data/tst_menuitem.qml
+++ b/tests/auto/platform/data/tst_menuitem.qml
@@ -68,8 +68,9 @@ TestCase {
}
}
- SignalSpy {
- id: spy
+ Component {
+ id: signalSpyComponent
+ SignalSpy {}
}
function test_properties_data() {
@@ -81,30 +82,32 @@ TestCase {
{tag: "checked", signal: "checkedChanged", init: false, value: true},
{tag: "role", signal: "roleChanged", init: MenuItem.TextHeuristicRole, value: MenuItem.AboutRole},
{tag: "text", signal: "textChanged", init: "", value: "text"},
- {tag: "iconSource", signal: "iconSourceChanged", init: "", value: "qrc:/undo.png"},
- {tag: "iconName", signal: "iconNameChanged", init: "", value: "edit-undo"},
+ {tag: "icon.source", signal: "iconChanged", init: "", value: "qrc:/undo.png"},
+ {tag: "icon.name", signal: "iconChanged", init: "", value: "edit-undo"},
{tag: "shortcut", signal: "shortcutChanged", init: undefined, value: StandardKey.Undo}
]
}
function test_properties(data) {
- var item = menuItem.createObject(testCase)
+ let item = createTemporaryObject(menuItem, testCase)
verify(item)
- spy.target = item
- spy.signalName = data.signal
+ let groupedProperty = data.tag.indexOf(".") !== -1
+ let spy = createTemporaryObject(signalSpyComponent, testCase, {
+ target: item, signalName: data.signal
+ })
+ verify(spy)
verify(spy.valid)
- compare(item[data.tag], data.init)
- item[data.tag] = data.value
+ let propertyName = groupedProperty ? data.tag.split('.')[1] : data.tag
+ let object = !groupedProperty ? item : item.icon
+ compare(object[propertyName], data.init)
+ object[propertyName] = data.value
compare(spy.count, 1)
- compare(item[data.tag], data.value)
+ compare(object[propertyName], data.value)
- item[data.tag] = data.value
+ object[propertyName] = data.value
compare(spy.count, 1)
-
- spy.clear()
- item.destroy()
}
function test_role() {