From eb2265d4c89b64c571f276e628b751abac29f895 Mon Sep 17 00:00:00 2001 From: Alexandr Akulich Date: Thu, 16 Jun 2016 11:15:12 +0500 Subject: QQuickFlickable: Use QQuickItem::setSize() in resizeContent() Sequential call of setWidth() and setHeight() results in outdated height on widthChanged() signal. Use setSize() to set width and height at once. Change-Id: I013f5e1fcfc65a8606f9596ddc196b633873dc98 Reviewed-by: Shawn Rutledge --- tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp') diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index f8277c6895..4ae021e609 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -38,6 +38,7 @@ #include #include #include "../../shared/util.h" +#include "../shared/geometrytestutil.h" #include "../shared/viewtestutil.h" #include "../shared/visualtestutil.h" @@ -784,7 +785,14 @@ void tst_qquickflickable::resizeContent() QCOMPARE(obj->contentWidth(), 300.); QCOMPARE(obj->contentHeight(), 300.); + QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(obj); + QSizeChangeListener sizeListener(fp->contentItem); + QMetaObject::invokeMethod(root, "resizeContent"); + for (const QSize sizeOnGeometryChanged : sizeListener) { + // Check that we have the correct size on all signals + QCOMPARE(sizeOnGeometryChanged, QSize(600, 600)); + } QCOMPARE(obj->contentX(), 100.); QCOMPARE(obj->contentY(), 100.); -- cgit v1.2.3