aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2022-09-21 13:44:19 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2022-11-21 04:18:52 +0100
commit52535d21f084bae67b845a1ff2cf70f03b5fa6a0 (patch)
tree1ffc30b37568d299684884dd98dcc5174fd7c168 /tests
parenta6273d93216503a2a8ce4a1b08a8ceb378627a16 (diff)
Fix wrong item-sizeHint-cache when StackLayout children were reordered
This fixes the Tests_StackLayout::test_addAndRemoveItems() autotest The code uses an index to look up the cached size hints. This index corresponds to the layout's item child index (which doesn't have to correspond to the children index). The vector of sizeHints then had to be in sync with the index of the child layout items for this to work. The problem here was that if the first item in the stack was removed (or siblings was reordered), the vector was not adjusted for this (basically we could get the size hint of an previously removed item). In order to avoid to keep the QVector<SizeHints> index in sync with the layout children index, we change it to use a QHash instead, where we look up by QQuickItem*. QHash<QQuickItem*, SizeHints> Task-number: QTBUG-106520 Task-number: QTBUG-106521 Change-Id: I7c1f9fb018fcab093b074c45dfaba264f76749f4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit c41075d9e2808f636d793c93e237f80a8ecadb2e)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml1
1 files changed, 0 insertions, 1 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml b/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml
index 32b149336a..2536b9789f 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_stacklayout.qml
@@ -255,7 +255,6 @@ Item {
function test_addAndRemoveItems()
{
- skip("There is a bug with the internal StackLayout cache that causes this to fail")
var stack = emtpy_StackLayout_Component.createObject(container)
stack.currentIndex = 2
compare(stack.implicitWidth, 0)