diff options
Diffstat (limited to 'tests/auto/controls/data/tst_stackview.qml')
-rw-r--r-- | tests/auto/controls/data/tst_stackview.qml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml index 23eaf317..2eb802bf 100644 --- a/tests/auto/controls/data/tst_stackview.qml +++ b/tests/auto/controls/data/tst_stackview.qml @@ -459,6 +459,22 @@ TestCase { compare(control.depth, 1) compare(control.currentItem, item6) + // replace the topmost item + control.push(component) + compare(control.depth, 2) + var item7 = control.replace(control.get(1), component, StackView.Immediate) + compare(control.depth, 2) + compare(control.currentItem, item7) + + // replace the item in the middle + control.push(component) + control.push(component) + control.push(component) + compare(control.depth, 5) + var item8 = control.replace(control.get(2), component, StackView.Immediate) + compare(control.depth, 3) + compare(control.currentItem, item8) + control.destroy() } @@ -744,4 +760,40 @@ TestCase { control.destroy() } + + function test_failures() { + var control = stackView.createObject(testCase, {initialItem: component}) + verify(control) + + ignoreWarning("QQmlComponent: Component is not ready") + ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 File not found") + control.push(Qt.resolvedUrl("non-existent.qml")) + + ignoreWarning("QQmlComponent: Component is not ready") + ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 File not found") + control.replace(Qt.resolvedUrl("non-existent.qml")) + + control.pop() + + control.destroy() + } + + Component { + id: rectangle + Rectangle { + property color initialColor + Component.onCompleted: initialColor = color + } + } + + function test_properties() { + var control = stackView.createObject(testCase) + verify(control) + + var rect = control.push(rectangle, {color: "#ff0000"}) + compare(rect.color, "#ff0000") + compare(rect.initialColor, "#ff0000") + + control.destroy() + } } |