diff options
author | Alexandr Akulich <akulichalexander@gmail.com> | 2016-06-16 11:15:12 +0500 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2017-11-03 08:27:25 +0000 |
commit | eb2265d4c89b64c571f276e628b751abac29f895 (patch) | |
tree | 183a79eacc5ef0d7a9d99b3837f13a3a0b3285f8 /tests | |
parent | 0d84aaf05c7306c8e39bac7acd7c85dc04358b17 (diff) |
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 <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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 <private/qqmlvaluetype_p.h> #include <math.h> #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.); |