diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-25 23:13:56 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-29 09:27:17 +0000 |
commit | 98637d8ba2bb40d5bfa0fa63dbc56541ac8ddd64 (patch) | |
tree | fea5f491469cad3e566e23cf6552bb00acb5e131 /tests | |
parent | 70c4a9ea2a8c3e5f6ac1ca714d096586adda0613 (diff) |
Flickable: remove spurious emission of content size changes
If contentWidth or contentHeight is negative (unspecified), Flickable
should not emit contentWidthChanged() or contentHeightChanged() when
its own geometry changes. The value of contentWidth or contentHeight
does not change. It remains negative (unspecified).
Change-Id: Iad478d11e2e4370d2e94abe84cfd62d144e23dd9
Task-number: QTBUG-35038
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index eee7ffe560..f7267800c9 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -93,6 +93,7 @@ private slots: void pressDelayWithLoader(); void movementFromProgrammaticFlick(); void cleanup(); + void contentSize(); private: void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to); @@ -1739,6 +1740,40 @@ void tst_qquickflickable::movementFromProgrammaticFlick() QTRY_COMPARE(flickable->property("signalString").toString(), QString("msfsfeme")); } +// QTBUG_35038 +void tst_qquickflickable::contentSize() +{ + QQuickFlickable flickable; + QCOMPARE(flickable.contentWidth(), qreal(-1)); + QCOMPARE(flickable.contentHeight(), qreal(-1)); + + QSignalSpy cwspy(&flickable, SIGNAL(contentWidthChanged())); + QVERIFY(cwspy.isValid()); + + QSignalSpy chspy(&flickable, SIGNAL(contentHeightChanged())); + QVERIFY(chspy.isValid()); + + flickable.setWidth(100); + QCOMPARE(flickable.width(), qreal(100)); + QCOMPARE(flickable.contentWidth(), qreal(-1.0)); + QCOMPARE(cwspy.count(), 0); + + flickable.setContentWidth(10); + QCOMPARE(flickable.width(), qreal(100)); + QCOMPARE(flickable.contentWidth(), qreal(10)); + QCOMPARE(cwspy.count(), 1); + + flickable.setHeight(100); + QCOMPARE(flickable.height(), qreal(100)); + QCOMPARE(flickable.contentHeight(), qreal(-1.0)); + QCOMPARE(chspy.count(), 0); + + flickable.setContentHeight(10); + QCOMPARE(flickable.height(), qreal(100)); + QCOMPARE(flickable.contentHeight(), qreal(10)); + QCOMPARE(chspy.count(), 1); +} + QTEST_MAIN(tst_qquickflickable) #include "tst_qquickflickable.moc" |