diff options
Diffstat (limited to 'tests/auto/controls/data/tst_stackview.qml')
-rw-r--r-- | tests/auto/controls/data/tst_stackview.qml | 78 |
1 files changed, 69 insertions, 9 deletions
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml index 1b421b4f..f4b7fc4a 100644 --- a/tests/auto/controls/data/tst_stackview.qml +++ b/tests/auto/controls/data/tst_stackview.qml @@ -221,33 +221,75 @@ TestCase { function test_depth() { var control = createTemporaryObject(stackView, testCase) verify(control) + + var depthChanges = 0 + var emptyChanges = 0 var depthSpy = signalSpy.createObject(control, {target: control, signalName: "depthChanged"}) + var emptySpy = signalSpy.createObject(control, {target: control, signalName: "emptyChanged"}) verify(depthSpy.valid) + verify(emptySpy.valid) compare(control.depth, 0) + compare(control.empty, true) + control.push(item, StackView.Immediate) compare(control.depth, 1) - compare(depthSpy.count, 1) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, false) + compare(emptySpy.count, ++emptyChanges) + control.clear() compare(control.depth, 0) - compare(depthSpy.count, 2) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, true) + compare(emptySpy.count, ++emptyChanges) + control.push(component, StackView.Immediate) compare(control.depth, 1) - compare(depthSpy.count, 3) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, false) + compare(emptySpy.count, ++emptyChanges) + control.push(component, StackView.Immediate) compare(control.depth, 2) - compare(depthSpy.count, 4) - control.pop(StackView.Immediate) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, false) + compare(emptySpy.count, emptyChanges) + + control.replace(component, StackView.Immediate) + compare(control.depth, 2) + compare(depthSpy.count, depthChanges) + compare(control.empty, false) + compare(emptySpy.count, emptyChanges) + + control.replace([component, component], StackView.Immediate) + compare(control.depth, 3) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, false) + compare(emptySpy.count, emptyChanges) + + control.pop(null, StackView.Immediate) compare(control.depth, 1) - compare(depthSpy.count, 5) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, false) + compare(emptySpy.count, emptyChanges) + control.pop(StackView.Immediate) // ignored compare(control.depth, 1) - compare(depthSpy.count, 5) + compare(depthSpy.count, depthChanges) + compare(control.empty, false) + compare(emptySpy.count, emptyChanges) + control.clear() compare(control.depth, 0) - compare(depthSpy.count, 6) + compare(depthSpy.count, ++depthChanges) + compare(control.empty, true) + compare(emptySpy.count, ++emptyChanges) + control.clear() compare(control.depth, 0) - compare(depthSpy.count, 6) + compare(depthSpy.count, depthChanges) + compare(control.empty, true) + compare(emptySpy.count, emptyChanges) } function test_size() { @@ -510,6 +552,24 @@ TestCase { compare(control.currentItem, item8) } + function test_clear() { + var control = createTemporaryObject(stackView, testCase) + verify(control) + + control.push(component, StackView.Immediate) + + control.clear() + compare(control.depth, 0) + compare(control.busy, false) + + control.push(component, StackView.Immediate) + + control.clear(StackView.PopTransition) + compare(control.depth, 0) + compare(control.busy, true) + tryCompare(control, "busy", false) + } + function test_visibility_data() { return [ {tag:"default transitions", properties: {}}, |