aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@jollamobile.com>2014-01-21 16:12:48 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 23:28:20 +0100
commit918159a2aae5062935a946e6d64120769802d625 (patch)
tree2065e9fe8f7163e26eda13e77d127491a483bcc1 /tests
parent4cf8a6ad7189991ff6852f4096fa8673ffa98bf0 (diff)
Ensure Flickable bounds detection is executed at the end of animation.
In pixelAligned mode the content position when animating is rounded to a whole pixel, so the contentItem may reach the bound before the animation completes. Ensure bounds detection is run on animation completion. Task-number: QTBUG-36300 Change-Id: I083ff6a03a5d1b9ca9e2201487b602f1588002be Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Joona Petrell <joona.petrell@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 86321c775e..59b54e7ba5 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -1440,17 +1440,23 @@ void tst_qquickflickable::stopAtBounds_data()
{
QTest::addColumn<bool>("transpose");
QTest::addColumn<bool>("invert");
-
- QTest::newRow("left") << false << false;
- QTest::newRow("right") << false << true;
- QTest::newRow("top") << true << false;
- QTest::newRow("bottom") << true << true;
+ QTest::addColumn<bool>("pixelAligned");
+
+ QTest::newRow("left") << false << false << false;
+ QTest::newRow("right") << false << true << false;
+ QTest::newRow("top") << true << false << false;
+ QTest::newRow("bottom") << true << true << false;
+ QTest::newRow("left,pixelAligned") << false << false << true;
+ QTest::newRow("right,pixelAligned") << false << true << true;
+ QTest::newRow("top,pixelAligned") << true << false << true;
+ QTest::newRow("bottom,pixelAligned") << true << true << true;
}
void tst_qquickflickable::stopAtBounds()
{
QFETCH(bool, transpose);
QFETCH(bool, invert);
+ QFETCH(bool, pixelAligned);
QQuickView view;
view.setSource(testFileUrl("stopAtBounds.qml"));
@@ -1469,6 +1475,7 @@ void tst_qquickflickable::stopAtBounds()
flickable->setContentY(invert ? 100 : 0);
else
flickable->setContentX(invert ? 100 : 0);
+ flickable->setPixelAligned(pixelAligned);
const int threshold = qApp->styleHints()->startDragDistance();
@@ -1518,6 +1525,29 @@ void tst_qquickflickable::stopAtBounds()
}
QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
+
+ if (transpose) {
+ flickable->setContentY(invert ? 100 : 0);
+ } else {
+ flickable->setContentX(invert ? 100 : 0);
+ }
+ if (invert)
+ flick(&view, QPoint(20,20), QPoint(100,100), 100);
+ else
+ flick(&view, QPoint(100,100), QPoint(20,20), 100);
+
+ QVERIFY(flickable->isFlicking());
+ if (transpose) {
+ if (invert)
+ QTRY_COMPARE(flickable->isAtYBeginning(), true);
+ else
+ QTRY_COMPARE(flickable->isAtYEnd(), true);
+ } else {
+ if (invert)
+ QTRY_COMPARE(flickable->isAtXBeginning(), true);
+ else
+ QTRY_COMPARE(flickable->isAtXEnd(), true);
+ }
}
void tst_qquickflickable::nestedMouseAreaUsingTouch()