diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-24 10:14:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-24 11:48:14 +0100 |
commit | b1fa22c1683d9f6cedb001f5ef8a0dac71868935 (patch) | |
tree | c30a114c75be071310df974283b928329f9d5c12 /tests/auto/quick | |
parent | ba68c325688acf3072715757480497524f61c425 (diff) | |
parent | fe5d69669197a51662061b014810f0242eec5ca7 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/quick/accessible/qaccessiblequickview_p.h
src/quick/items/qquickmousearea.cpp
src/quick/util/qquickanimatorjob.cpp
tools/qmlplugindump/main.cpp
Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
Diffstat (limited to 'tests/auto/quick')
4 files changed, 87 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickflickable/data/hide.qml b/tests/auto/quick/qquickflickable/data/hide.qml new file mode 100644 index 0000000000..ab520549e2 --- /dev/null +++ b/tests/auto/quick/qquickflickable/data/hide.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Flickable { + id: flickable + width: 200; height: 200 + contentWidth: 400; contentHeight: 400 + + MouseArea { + objectName: "mouseArea" + width: 400; height: 400 + onDoubleClicked: flickable.visible = false + } +} diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 1ad691d1c1..9ead271bfe 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -80,6 +80,7 @@ private slots: void disabled(); void flickVelocity(); void margins(); + void cancelOnHide(); void cancelOnMouseGrab(); void clickAndDragWhenTransformed(); void flickTwiceUsingTouches(); @@ -1425,6 +1426,25 @@ void tst_qquickflickable::margins() delete root; } +void tst_qquickflickable::cancelOnHide() +{ + QScopedPointer<QQuickView> window(new QQuickView); + window->setSource(testFileUrl("hide.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + QQuickViewTestUtil::centerOnScreen(window.data()); + QQuickViewTestUtil::moveMouseAway(window.data()); + window->show(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + QVERIFY(window->rootObject()); + + QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); + QVERIFY(flickable); + + QTest::mouseDClick(window.data(), Qt::LeftButton); + QVERIFY(!flickable->isVisible()); + QVERIFY(!QQuickFlickablePrivate::get(flickable)->pressed); +} + void tst_qquickflickable::cancelOnMouseGrab() { QScopedPointer<QQuickView> window(new QQuickView); diff --git a/tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml b/tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml new file mode 100644 index 0000000000..2b45a19340 --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/availableDistanceLessThanDragThreshold.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 200 + + MouseArea { + id: mouseArea + objectName: "mouseArea" + width: 200 + height: 200 + + drag.target: mouseArea + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: 200 + drag.threshold: 200 + + Rectangle { + anchors.fill: parent + color: "red" + } + } +} diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index c8351b9e18..01bce46ccb 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -88,6 +88,7 @@ private slots: void invalidDrag_data() { rejectedButton_data(); } void invalidDrag(); void cancelDragging(); + void availableDistanceLessThanDragThreshold(); void setDragOnPressed(); void updateMouseAreaPosOnClick(); void updateMouseAreaPosOnResize(); @@ -585,6 +586,35 @@ void tst_QQuickMouseArea::cancelDragging() QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); } +// QTBUG-58347 +void tst_QQuickMouseArea::availableDistanceLessThanDragThreshold() +{ + QQuickView view; + QByteArray errorMessage; + QVERIFY2(initView(view, testFileUrl("availableDistanceLessThanDragThreshold.qml"), true, &errorMessage), + errorMessage.constData()); + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QVERIFY(view.rootObject()); + + QQuickMouseArea *mouseArea = view.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); + QVERIFY(mouseArea); + + QPoint position(100, 100); + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + position.setX(301); + QTest::mouseMove(&view, position); + position.setX(501); + QTest::mouseMove(&view, position); + QVERIFY(mouseArea->drag()->active()); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + + QVERIFY(!mouseArea->drag()->active()); + QCOMPARE(mouseArea->x(), 200.0); +} + void tst_QQuickMouseArea::setDragOnPressed() { QQuickView window; |