aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_stackview.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/controls/data/tst_stackview.qml')
-rw-r--r--tests/auto/controls/data/tst_stackview.qml34
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index b0e18389..44089e57 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -223,9 +223,9 @@ TestCase {
compare(control.depth, 0)
control.push(item, StackView.Immediate)
compare(control.depth, 1)
- control.push(item, StackView.Immediate)
- compare(control.depth, 2)
- control.pop(StackView.Immediate)
+ control.clear()
+ compare(control.depth, 0)
+ control.push(component, StackView.Immediate)
compare(control.depth, 1)
control.push(component, StackView.Immediate)
compare(control.depth, 2)
@@ -1020,4 +1020,32 @@ TestCase {
control.destroy()
}
+
+ function test_pushSameItem() {
+ var control = stackView.createObject(testCase)
+ verify(control)
+
+ control.push(item, StackView.Immediate)
+ compare(control.currentItem, item)
+ compare(control.depth, 1)
+
+ // Pushing the same Item should do nothing.
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML StackView: push: nothing to push")
+ control.push(item, StackView.Immediate)
+ compare(control.currentItem, item)
+ compare(control.depth, 1)
+
+ // Push a component so that it becomes current.
+ var current = control.push(component, StackView.Immediate)
+ compare(control.currentItem, current)
+ compare(control.depth, 2)
+
+ // Push a bunch of stuff. "item" is already in the stack, so it should be ignored.
+ current = control.push(component, item, StackView.Immediate)
+ verify(current !== item)
+ compare(control.currentItem, current)
+ compare(control.depth, 3)
+
+ control.destroy()
+ }
}