aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-08-01 16:20:26 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-02 06:42:28 +0200
commit1b65161042108ee46ca42331dacc2b66b63c6b4e (patch)
tree86827961301d01d59bbe72b944373293d8409984 /tests
parent9dfd621aec9a031297c50dd7df5ca90c771f46a3 (diff)
Allow descendant chains to simultaneously be hovered.
Matches GV behaviour. Also fixes a bug in QSGMouseArea, which we aren't fixing for QtQuick 1. Task-number: QTBUG-18175 Change-Id: I4ecac7b908504f28de830732c731281407d7b0bc Reviewed-on: http://codereview.qt.nokia.com/2422 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml54
-rw-r--r--tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp26
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml b/tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml
new file mode 100644
index 0000000000..c47c794132
--- /dev/null
+++ b/tests/auto/declarative/qsgmousearea/data/hoverPropagation.qml
@@ -0,0 +1,54 @@
+import QtQuick 2.0
+
+Item{
+ width: 400
+ height: 200
+ property bool point1: ma2.containsMouse && !ma1.containsMouse
+ property bool point2: ma3.containsMouse && ma4.containsMouse
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma1.containsMouse ? "red" : "white"
+ MouseArea{
+ id: ma1
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma2.containsMouse ? "blue" : "white"
+ MouseArea{
+ id: ma2
+ hoverEnabled: true
+ anchors.fill: parent
+ }
+ }
+ }
+
+ Item{
+ x:200
+ Rectangle{
+ width: 200
+ height: 200
+ color: ma3.containsMouse ? "yellow" : "white"
+ Rectangle{
+ width: 100
+ height: 100
+ color: ma4.containsMouse ? "green" : "white"
+ }
+ }
+ MouseArea{
+ id: ma3
+ hoverEnabled: true
+ width: 200
+ height: 200
+ MouseArea{
+ id: ma4
+ width: 100
+ height: 100
+ hoverEnabled: true
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
index 8e711e6ceb..e9788cd147 100644
--- a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
+++ b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp
@@ -75,6 +75,7 @@ private slots:
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
void hoverPosition();
+ void hoverPropagation();
private:
QSGView *createView();
@@ -741,6 +742,31 @@ void tst_QSGMouseArea::hoverPosition()
delete canvas;
}
+void tst_QSGMouseArea::hoverPropagation()
+{
+ //QTBUG-18175, to behave like GV did.
+ QSGView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hoverPropagation.qml"));
+
+ QSGItem *root = canvas->rootObject();
+ QVERIFY(root != 0);
+
+ QCOMPARE(root->property("point1").toBool(), false);
+ QCOMPARE(root->property("point2").toBool(), false);
+
+ QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0);
+ QApplication::sendEvent(canvas, &moveEvent);
+ QCOMPARE(root->property("point1").toBool(), true);
+ QCOMPARE(root->property("point2").toBool(), false);
+
+ QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, 0);
+ QApplication::sendEvent(canvas, &moveEvent2);
+ QCOMPARE(root->property("point1").toBool(), false);
+ QCOMPARE(root->property("point2").toBool(), true);
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_QSGMouseArea)
#include "tst_qsgmousearea.moc"