diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-13 15:06:40 +1000 |
---|---|---|
committer | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-13 15:22:14 +1000 |
commit | 784555f3032194a8923d804a8ce84957f113caf6 (patch) | |
tree | 6b538cea5bf82bd5288ac180125abd1bb312ddad /tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | |
parent | 1f52c5430144eb7ba6baa7e3954675ca0707b947 (diff) | |
parent | 648c80c4c0759efb6e35fac7acc8daad5aab13e2 (diff) |
Merge branch 'master' of git://gitorious.org/qt/qtdeclarative into merge-master
Change-Id: Iaefec13503dadfa200539b8de7a2d80fc5bb3bcf
Diffstat (limited to 'tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp')
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 0b4a6fa438..a4b04bb88a 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -47,7 +47,6 @@ #include <QtQuick/qquickview.h> #include <QtQml/qqmlcontext.h> #include <QtQml/qqmlengine.h> -#include <QtOpenGL/QGLShaderProgram> #include "../../shared/util.h" //#define OLDWAY @@ -468,6 +467,8 @@ void tst_QQuickMouseArea::doubleClick() canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); + // The sequence for a double click is: + // press, release, (click), press, double click, release QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); @@ -476,9 +477,9 @@ void tst_QQuickMouseArea::doubleClick() QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); + QGuiApplication::sendEvent(canvas, &pressEvent); pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); - QGuiApplication::sendEvent(canvas, &releaseEvent); QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); @@ -507,9 +508,8 @@ void tst_QQuickMouseArea::clickTwice() QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); - + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(canvas, &pressEvent); QGuiApplication::sendEvent(canvas, &releaseEvent); @@ -787,13 +787,17 @@ void tst_QQuickMouseArea::hoverVisible() QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered())); - QTest::mouseMove(canvas,QPoint(10,32)); + // Note: We need to use a position that is different from the position in the last event + // generated in the previous test case. Otherwise it is not interpreted as a move. + QTest::mouseMove(canvas,QPoint(11,33)); QCOMPARE(mouseTracker->hovered(), false); QCOMPARE(enteredSpy.count(), 0); mouseTracker->setVisible(true); + QTest::mouseMove(canvas,QPoint(10,31)); + QCOMPARE(mouseTracker->hovered(), true); QCOMPARE(enteredSpy.count(), 1); |