summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2012-02-15 16:27:36 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-16 08:31:13 +0100
commit0d1f29c6e026a6656430aa601ebc25459015d53e (patch)
tree8acec4ce4d3869dabdafe914430b5635bc4d7e7c /tests
parent64a5087df7896524bf6af30067f442d1fc8458bc (diff)
Ensure visibility changes are communicated through itemChange.
Also added MouseArea test that depends on this functionality. Change-Id: I1c303504ffd63d6b9dbdf95ab63e8426dc09c02d Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qtquick2/qquickmousearea/data/hoverVisible.qml15
-rw-r--r--tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp30
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/qtquick2/qquickmousearea/data/hoverVisible.qml b/tests/auto/qtquick2/qquickmousearea/data/hoverVisible.qml
new file mode 100644
index 0000000000..2d65b5573e
--- /dev/null
+++ b/tests/auto/qtquick2/qquickmousearea/data/hoverVisible.qml
@@ -0,0 +1,15 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 400;
+
+ Rectangle {
+ width: 100; height: 100;
+ MouseArea {
+ id: mousetracker; objectName: "mousetracker"
+ anchors.fill: parent
+ visible: false
+ hoverEnabled: true
+ }
+ }
+}
diff --git a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
index 1520dd5d6e..66f651329a 100644
--- a/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/qtquick2/qquickmousearea/tst_qquickmousearea.cpp
@@ -71,6 +71,7 @@ private slots:
void clickThrough();
void hoverPosition();
void hoverPropagation();
+ void hoverVisible();
private:
QQuickView *createView();
@@ -771,6 +772,35 @@ void tst_QQuickMouseArea::hoverPropagation()
delete canvas;
}
+void tst_QQuickMouseArea::hoverVisible()
+{
+ QQuickView *canvas = createView();
+ canvas->setSource(testFileUrl("hoverVisible.qml"));
+
+ QQuickItem *root = canvas->rootObject();
+ QVERIFY(root != 0);
+
+ QQuickMouseArea *mouseTracker = canvas->rootObject()->findChild<QQuickMouseArea*>("mousetracker");
+ QVERIFY(mouseTracker != 0);
+
+ QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered()));
+
+ QTest::mouseMove(canvas,QPoint(10,32));
+
+ QCOMPARE(mouseTracker->hovered(), false);
+ QCOMPARE(enteredSpy.count(), 0);
+
+ mouseTracker->setVisible(true);
+
+ QCOMPARE(mouseTracker->hovered(), true);
+ QCOMPARE(enteredSpy.count(), 1);
+
+ QEXPECT_FAIL("", "QTBUG-24282", Continue);
+ QCOMPARE(QPointF(mouseTracker->mouseX(), mouseTracker->mouseY()), QPointF(10,32));
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_QQuickMouseArea)
#include "tst_qquickmousearea.moc"