aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickmultipointtoucharea
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-05-25 13:28:22 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-28 05:30:34 +0200
commit45931aac0cc9e251923453b980d6466028e908eb (patch)
treefa4339bf3ffc328b5b1a2bd5a55e9279cd29d878 /tests/auto/quick/qquickmultipointtoucharea
parent4d9bc3bb6a3b500013a569267dcdbd423ee50ac2 (diff)
Flickable containing MultiPointTouchArea is unresponsive following touch.
MPTA was releasing the mouse grab when all touches were released, causing the mouse release event to not be propagated to its parents, who were then unable to correct their state. Remove this code and allow the normal event handlers to do their thing. This is the same fix as was implemented for PinchArea in 9634dc440269fc03f825a6d18b371d8e612ba9ec Change-Id: I2715677157f5838e3f81137f64765024cf2f0459 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickmultipointtoucharea')
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml30
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp83
2 files changed, 113 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml
new file mode 100644
index 0000000000..48773a1eb0
--- /dev/null
+++ b/tests/auto/quick/qquickmultipointtoucharea/data/inFlickable2.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 400
+
+ Flickable {
+ objectName: "flickable"
+ width: 100
+ height: 400
+
+ flickableDirection: Flickable.VerticalFlick
+ contentHeight: 800
+
+ Rectangle {
+ property bool highlight: false
+ width: 300
+ height: 350
+ color: "green"
+
+ MultiPointTouchArea {
+ anchors.fill: parent
+ minimumTouchPoints: 1
+ maximumTouchPoints: 1
+ touchPoints: [ TouchPoint { id: point1; objectName: "point1" } ]
+ }
+ }
+
+ }
+}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 063edbcdba..c5ede2629e 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -70,6 +70,7 @@ private slots:
void nonOverlapping();
void nested();
void inFlickable();
+ void inFlickable2();
void invisible();
private:
@@ -687,6 +688,88 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
delete canvas;
}
+// test that dragging out of a Flickable containing a MPTA doesn't harm Flickable's state.
+void tst_QQuickMultiPointTouchArea::inFlickable2()
+{
+ QQuickView *canvas = createAndShowView("inFlickable2.qml");
+ QVERIFY(canvas->rootObject() != 0);
+
+ QQuickFlickable *flickable = canvas->rootObject()->findChild<QQuickFlickable*>("flickable");
+ QVERIFY(flickable != 0);
+
+ QQuickTouchPoint *point11 = canvas->rootObject()->findChild<QQuickTouchPoint*>("point1");
+ QVERIFY(point11);
+
+ QCOMPARE(point11->pressed(), false);
+
+ QPoint p1(50,100);
+
+ // move point horizontally, out of Flickable area
+ QTest::touchEvent(canvas, device).press(0, p1);
+ QTest::mousePress(canvas, Qt::LeftButton, 0, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ p1 += QPoint(15,0);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ QVERIFY(!flickable->isMoving());
+ QVERIFY(point11->pressed());
+
+ QTest::touchEvent(canvas, device).release(0, p1);
+ QTest::mouseRelease(canvas,Qt::LeftButton, 0, p1);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(!flickable->isMoving());
+
+ // Check that we can still move the Flickable
+ p1 = QPoint(50,100);
+ QTest::touchEvent(canvas, device).press(0, p1);
+ QTest::mousePress(canvas, Qt::LeftButton, 0, p1);
+
+ QCOMPARE(point11->pressed(), true);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ p1 += QPoint(0,15);
+ QTest::touchEvent(canvas, device).move(0, p1);
+ QTest::mouseMove(canvas, p1);
+
+ QVERIFY(flickable->contentY() < 0);
+ QVERIFY(flickable->isMoving());
+ QCOMPARE(point11->pressed(), false);
+
+ QTest::touchEvent(canvas, device).release(0, p1);
+ QTest::mouseRelease(canvas,Qt::LeftButton, 0, p1);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(!flickable->isMoving());
+
+
+ delete canvas;
+}
+
// QTBUG-23327
void tst_QQuickMultiPointTouchArea::invisible()
{