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.qml58
1 files changed, 51 insertions, 7 deletions
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index 762be4cc..28a22306 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -40,7 +40,7 @@
import QtQuick 2.2
import QtTest 1.0
-import Qt.labs.controls 1.0
+import QtQuick.Controls 2.0
TestCase {
id: testCase
@@ -59,6 +59,11 @@ TestCase {
StackView { }
}
+ Component {
+ id: signalSpy
+ SignalSpy { }
+ }
+
function test_initialItem() {
var control1 = stackView.createObject(testCase)
verify(control1)
@@ -87,18 +92,13 @@ TestCase {
control.destroy()
}
- SignalSpy {
- id: busySpy
- signalName: "busyChanged"
- }
-
function test_busy() {
var control = stackView.createObject(testCase)
verify(control)
compare(control.busy, false)
var busyCount = 0
- busySpy.target = control
+ var busySpy = signalSpy.createObject(control, {target: control, signalName: "busyChanged"})
verify(busySpy.valid)
control.push(component)
@@ -243,10 +243,31 @@ TestCase {
verify(container)
var control = stackView.createObject(container, {width: 100, height: 100})
verify(control)
+
container.width += 10
container.height += 20
compare(control.width, 100)
compare(control.height, 100)
+
+ control.push(item, StackView.Immediate)
+ compare(item.width, control.width)
+ compare(item.height, control.height)
+
+ control.width = 200
+ control.height = 200
+ compare(item.width, control.width)
+ compare(item.height, control.height)
+
+ control.clear()
+ control.width += 10
+ control.height += 20
+ verify(item.width !== control.width)
+ verify(item.height !== control.height)
+
+ control.push(item, StackView.Immediate)
+ compare(item.width, control.width)
+ compare(item.height, control.height)
+
container.destroy()
}
@@ -385,6 +406,11 @@ TestCase {
compare(control.depth, 6)
compare(control.currentItem, items[5])
+ // pop down to the current item
+ compare(control.pop(control.currentItem, StackView.Immediate), null)
+ compare(control.depth, 6)
+ compare(control.currentItem, items[5])
+
// pop down to (but not including) the Nth item
compare(control.pop(items[3], StackView.Immediate), items[5])
compare(control.depth, 4)
@@ -835,4 +861,22 @@ TestCase {
control.destroy()
}
+
+ // QTBUG-56158
+ function test_repeatedPop() {
+ var control = stackView.createObject(testCase, {initialItem: component, width: testCase.width, height: testCase.height})
+ verify(control)
+
+ for (var i = 0; i < 12; ++i)
+ control.push(component)
+ tryCompare(control, "busy", false)
+
+ while (control.depth > 1) {
+ control.pop()
+ wait(50)
+ }
+ tryCompare(control, "busy", false)
+
+ control.destroy()
+ }
}