diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2013-09-27 14:26:48 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-01 01:50:49 +0200 |
commit | a8b27d974a4ced654a4566b6a9822ed92956a2d2 (patch) | |
tree | e6ac77a3cf040c8a342f0ae8c3098dcae58fcd78 /tests | |
parent | 23793482e9b187441203fb629b459245c504dfba (diff) |
Fix PathView stealing mouse grab from its child items.
Apply the improvements that have been applied to Flickables handling of
child items over time to PathView to bring its behavior back in line.
Task-number: QTBUG-33699
Change-Id: I76a412d75c48f9cf2f12f5f6f1aa01ff62d06364
Reviewed-by: Joona Petrell <joona.petrell@jollamobile.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickpathview/data/nestedmousearea.qml | 36 | ||||
-rw-r--r-- | tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 24 |
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/data/nestedmousearea.qml b/tests/auto/quick/qquickpathview/data/nestedmousearea.qml new file mode 100644 index 0000000000..bdd28650e2 --- /dev/null +++ b/tests/auto/quick/qquickpathview/data/nestedmousearea.qml @@ -0,0 +1,36 @@ +import QtQuick 2.0 + +PathView { + width: 400 + height: 400 + + model: 2 + path: Path { + startX: -300 + startY: 200 + PathLine { + x: 700 + y: 200 + } + } + delegate: Rectangle { + width: 300 + height: 300 + border.width: 5 + color: "lightsteelblue" + + Rectangle { + x: 100 + y: 100 + width: 100 + height: 100 + + color: "yellow" + + MouseArea { + drag.target: parent + anchors.fill: parent + } + } + } +} diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 083497750d..81d1bbd01d 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -124,6 +124,7 @@ private slots: void visualDataModel(); void undefinedPath(); void mouseDrag(); + void nestedMouseAreaDrag(); void treeModel(); void changePreferredHighlight(); void missingPercent(); @@ -1507,6 +1508,29 @@ void tst_QQuickPathView::mouseDrag() } +void tst_QQuickPathView::nestedMouseAreaDrag() +{ + QScopedPointer<QQuickView> window(createView()); + QQuickViewTestUtil::moveMouseAway(window.data()); + window->setSource(testFileUrl("nestedmousearea.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + QCOMPARE(window.data(), qGuiApp->focusWindow()); + + + QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); + QVERIFY(pathview != 0); + + // Dragging the child mouse area should move it and not animate the PathView + flick(window.data(), QPoint(200,200), QPoint(300,200), 200); + QVERIFY(!pathview->isMoving()); + + // Dragging outside the mouse are should animate the PathView. + flick(window.data(), QPoint(75,75), QPoint(175,75), 200); + QVERIFY(pathview->isMoving()); +} + void tst_QQuickPathView::treeModel() { QScopedPointer<QQuickView> window(createView()); |