aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-04-18 10:57:18 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-18 16:50:08 +0000
commitbc02757b15f8bfb4e9f754cba2071a9efadaa87c (patch)
tree095c979096286f3c15262898d7d862af3cef6dfe /tests
parentbc96ae68ecbcdf0d8e435678844b441db761bd3b (diff)
StackView: emit depthChanged when clearing with transition
When a transition is used in the call to clear(), then we pop the top element off the stack and start the transition for it. If we read the old depth after doing that, then it will be off by one and prevent the emission of the changed signal if that was the last element on the stack. So read the old depth already before we pop, and add a test. Fixes: QTBUG-84920 Change-Id: Idae619efa25729fafbf238cb4db62472042b1cb7 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 838b9ee9fe3ad26e5b1fac1616cb575288f4f8a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quickcontrols/controls/data/tst_stackview.qml9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/quickcontrols/controls/data/tst_stackview.qml b/tests/auto/quickcontrols/controls/data/tst_stackview.qml
index 8584385cbf..eebaeb357f 100644
--- a/tests/auto/quickcontrols/controls/data/tst_stackview.qml
+++ b/tests/auto/quickcontrols/controls/data/tst_stackview.qml
@@ -253,6 +253,15 @@ TestCase {
compare(depthSpy.count, depthChanges)
compare(control.empty, true)
compare(emptySpy.count, emptyChanges)
+
+ control.push(item, StackView.PushTransition)
+ compare(depthSpy.count, ++depthChanges)
+ compare(emptySpy.count, ++emptyChanges)
+ compare(control.depth, 1)
+ control.clear(StackView.PopTransition)
+ compare(depthSpy.count, ++depthChanges)
+ compare(emptySpy.count, ++emptyChanges)
+ compare(control.depth, 0)
}
function test_size() {