aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickwidgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-12-20 08:32:22 +0100
committerLiang Qi <liang.qi@qt.io>2017-12-20 08:50:58 +0100
commit9a38fdcf8f9b734808bb54422e306872f3bfa944 (patch)
tree20fd361db6c505d99a40ab7a695511b97dcdcbd3 /tests/auto/quickwidgets
parent1db9405128972d5ba77e33181bee40356f718cea (diff)
parent4fff2bb14e55484eacec0a1b49a2b02958f75eca (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: tests/auto/quick/pointerhandlers/flickableinterop/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/flickableinterop/data/Slider.qml tests/auto/quick/pointerhandlers/flickableinterop/data/TapHandlerButton.qml tests/auto/quick/pointerhandlers/flickableinterop/data/flickableWithHandlers.qml tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/DragAnywhereSlider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/Slider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/multipleSliders.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/Button.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/buttons.qml tests/manual/pointer/content/FakeFlickable.qml tests/manual/pointer/content/FlashAnimation.qml tests/manual/pointer/content/MomentumAnimation.qml tests/manual/pointer/content/MouseAreaButton.qml tests/manual/pointer/content/MouseAreaSlider.qml tests/manual/pointer/content/MptaButton.qml tests/manual/pointer/content/MultiButton.qml tests/manual/pointer/content/ScrollBar.qml tests/manual/pointer/content/Slider.qml tests/manual/pointer/content/TapHandlerButton.qml tests/manual/pointer/fakeFlickable.qml tests/manual/pointer/flickableWithHandlers.qml tests/manual/pointer/flingAnimation.qml tests/manual/pointer/joystick.qml tests/manual/pointer/main.cpp tests/manual/pointer/main.qml tests/manual/pointer/map.qml tests/manual/pointer/map2.qml tests/manual/pointer/mixer.qml tests/manual/pointer/multibuttons.qml tests/manual/pointer/photosurface.qml tests/manual/pointer/pinchDragFlingMPTA.qml tests/manual/pointer/pinchHandler.qml tests/manual/pointer/singlePointHandlerProperties.qml tests/manual/pointer/tapHandler.qml tests/manual/pointer/tapWithModifiers.qml tests/manual/shapestest/main.cpp Change-Id: I4f233a521305fab1ebfecbac801da192434ed524
Diffstat (limited to 'tests/auto/quickwidgets')
-rw-r--r--tests/auto/quickwidgets/qquickwidget/BLACKLIST2
-rw-r--r--tests/auto/quickwidgets/qquickwidget/data/enterleave.qml12
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp25
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/quickwidgets/qquickwidget/BLACKLIST b/tests/auto/quickwidgets/qquickwidget/BLACKLIST
new file mode 100644
index 0000000000..6594a22472
--- /dev/null
+++ b/tests/auto/quickwidgets/qquickwidget/BLACKLIST
@@ -0,0 +1,2 @@
+[enterLeave]
+osx
diff --git a/tests/auto/quickwidgets/qquickwidget/data/enterleave.qml b/tests/auto/quickwidgets/qquickwidget/data/enterleave.qml
new file mode 100644
index 0000000000..b3057e30ad
--- /dev/null
+++ b/tests/auto/quickwidgets/qquickwidget/data/enterleave.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Rectangle {
+ property bool hasMouse: mouseArea.containsMouse
+ height: 200
+ width: 200
+ MouseArea {
+ id: mouseArea
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index c0db9c733d..c0b2d8e5d8 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -65,6 +65,7 @@ private slots:
void nullEngine();
void keyEvents();
void shortcuts();
+ void enterLeave();
};
@@ -449,6 +450,30 @@ void tst_qquickwidget::shortcuts()
QTRY_VERIFY(filter.shortcutOk);
}
+void tst_qquickwidget::enterLeave()
+{
+ QQuickWidget view;
+ view.setSource(testFileUrl("enterleave.qml"));
+
+ // Ensure it is not inside the window first
+ QCursor::setPos(QPoint(50, 50));
+ QTRY_VERIFY(QCursor::pos() == QPoint(50, 50));
+
+ view.move(100, 100);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view, 5000));
+ QQuickItem *rootItem = view.rootObject();
+ QVERIFY(rootItem);
+
+ QTRY_VERIFY(!rootItem->property("hasMouse").toBool());
+ // Check the enter
+ QCursor::setPos(view.pos() + QPoint(50, 50));
+ QTRY_VERIFY(rootItem->property("hasMouse").toBool());
+ // Now check the leave
+ QCursor::setPos(view.pos() - QPoint(50, 50));
+ QTRY_VERIFY(!rootItem->property("hasMouse").toBool());
+}
+
QTEST_MAIN(tst_qquickwidget)
#include "tst_qquickwidget.moc"