From 589c8445e2623ef8e0b8294d7c558a2948b2a5e3 Mon Sep 17 00:00:00 2001 From: Matthew Cattell Date: Thu, 8 Sep 2011 16:46:54 +0200 Subject: [PATCH] =?utf8?q?fixed=20autotest =20removed=20debug=20statements =20Change-Id:=20Id09e3a6a43b5d5170d8b50b10cc35eb8c4e1f3d0 =20Reviewed-on:=20http://codereview.qt-project.org/4472 =20Reviewed-by:=20Samuel=20R=C3=B8dal=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../declarative/qsgmousearea/tst_qsgmousearea.cpp | 39 +++++++------------- 1 files changed, 13 insertions(+), 26 deletions(-) diff --git a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp index c3f3ba1..2f91f15 100644 --- a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp +++ b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp @@ -585,14 +585,9 @@ void tst_QSGMouseArea::preventStealing() // Without preventStealing, mouse movement over MouseArea would // cause the Flickable to steal mouse and trigger content movement. - QMouseEvent moveEvent(QEvent::MouseMove, QPoint(70, 70), Qt::LeftButton, Qt::LeftButton, 0); - QApplication::sendEvent(canvas, &moveEvent); - - moveEvent = QMouseEvent(QEvent::MouseMove, QPoint(60, 60), Qt::LeftButton, Qt::LeftButton, 0); - QApplication::sendEvent(canvas, &moveEvent); - - moveEvent = QMouseEvent(QEvent::MouseMove, QPoint(50, 50), Qt::LeftButton, Qt::LeftButton, 0); - QApplication::sendEvent(canvas, &moveEvent); + QTest::mouseMove(canvas,QPoint(69,69)); + QTest::mouseMove(canvas,QPoint(58,58)); + QTest::mouseMove(canvas,QPoint(47,47)); // We should have received all three move events QCOMPARE(mousePositionSpy.count(), 3); @@ -602,7 +597,7 @@ void tst_QSGMouseArea::preventStealing() QCOMPARE(flickable->contentX(), 0.); QCOMPARE(flickable->contentY(), 0.); - QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(47, 47)); // Now allow stealing and confirm Flickable does its thing. canvas->rootObject()->setProperty("stealing", false); @@ -611,14 +606,10 @@ void tst_QSGMouseArea::preventStealing() // Without preventStealing, mouse movement over MouseArea would // cause the Flickable to steal mouse and trigger content movement. - moveEvent = QMouseEvent(QEvent::MouseMove, QPoint(70, 70), Qt::LeftButton, Qt::LeftButton, 0); - QApplication::sendEvent(canvas, &moveEvent); - - moveEvent = QMouseEvent(QEvent::MouseMove, QPoint(60, 60), Qt::LeftButton, Qt::LeftButton, 0); - QApplication::sendEvent(canvas, &moveEvent); - moveEvent = QMouseEvent(QEvent::MouseMove, QPoint(50, 50), Qt::LeftButton, Qt::LeftButton, 0); - QApplication::sendEvent(canvas, &moveEvent); + QTest::mouseMove(canvas,QPoint(69,69)); + QTest::mouseMove(canvas,QPoint(58,58)); + QTest::mouseMove(canvas,QPoint(47,47)); // We should only have received the first move event QCOMPARE(mousePositionSpy.count(), 4); @@ -626,8 +617,9 @@ void tst_QSGMouseArea::preventStealing() QVERIFY(!mouseArea->pressed()); // Flickable content should have moved. - QCOMPARE(flickable->contentX(), 10.); - QCOMPARE(flickable->contentY(), 10.); + + QCOMPARE(flickable->contentX(), 11.); + QCOMPARE(flickable->contentY(), 11.); QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(50, 50)); @@ -790,12 +782,9 @@ void tst_QSGMouseArea::hoverPosition() QCOMPARE(root->property("mouseX").toReal(), qreal(0)); QCOMPARE(root->property("mouseY").toReal(), qreal(0)); - QMouseEvent moveEvent(QEvent::MouseMove, QPoint(10, 32), Qt::NoButton, Qt::NoButton, 0); - QApplication::sendEvent(canvas, &moveEvent); + QTest::mouseMove(canvas,QPoint(10,32)); + -#ifdef Q_WS_QPA - QEXPECT_FAIL("", "QTBUG-21008 fails", Abort); -#endif QCOMPARE(root->property("mouseX").toReal(), qreal(10)); QCOMPARE(root->property("mouseY").toReal(), qreal(32)); @@ -816,9 +805,7 @@ void tst_QSGMouseArea::hoverPropagation() QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0); QApplication::sendEvent(canvas, &moveEvent); -#ifdef Q_WS_QPA - QEXPECT_FAIL("", "QTBUG-21008 fails", Abort); -#endif + QCOMPARE(root->property("point1").toBool(), true); QCOMPARE(root->property("point2").toBool(), false); -- 1.7.2.5