diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-07-30 13:28:49 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-07-30 13:28:49 (GMT) |
commit | a08b3f5336e5c819b33d922d3a809b5203d728f3 (patch) | |
tree | 952f42304d50f28ed6651bace587ab7935b29cd0 /tests/auto/qgraphicsscene | |
parent | 813fc3574a006cb2687715ccf7bdb984a485b173 (diff) | |
parent | 188ac02e2fb6cc6437b776f8c5b69a508728fbdb (diff) | |
download | Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.zip Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.tar.gz Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
demos/demos.pro
src/gui/graphicsview/qgraphicsitem_p.h
Diffstat (limited to 'tests/auto/qgraphicsscene')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 27b1da6..d3b8883 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -263,6 +263,7 @@ private slots: void sendEvent(); void inputMethod_data(); void inputMethod(); + void dispatchHoverOnPress(); // task specific tests below me void task139710_bspTreeCrash(); @@ -3729,5 +3730,73 @@ void tst_QGraphicsScene::inputMethod() QCOMPARE(item->queryCalls, 0); } +void tst_QGraphicsScene::dispatchHoverOnPress() +{ + QGraphicsScene scene; + EventTester *tester1 = new EventTester; + tester1->setAcceptHoverEvents(true); + EventTester *tester2 = new EventTester; + tester2->setAcceptHoverEvents(true); + tester2->setPos(30, 30); + scene.addItem(tester1); + scene.addItem(tester2); + + tester1->eventTypes.clear(); + tester2->eventTypes.clear(); + + { + QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress); + me.setButton(Qt::LeftButton); + me.setButtons(Qt::LeftButton); + QGraphicsSceneMouseEvent me2(QEvent::GraphicsSceneMouseRelease); + me2.setButton(Qt::LeftButton); + qApp->sendEvent(&scene, &me); + qApp->sendEvent(&scene, &me2); + QCOMPARE(tester1->eventTypes, QList<QEvent::Type>() + << QEvent::GraphicsSceneHoverEnter + << QEvent::GraphicsSceneHoverMove + << QEvent::GrabMouse + << QEvent::GraphicsSceneMousePress + << QEvent::UngrabMouse); + tester1->eventTypes.clear(); + qApp->sendEvent(&scene, &me); + qApp->sendEvent(&scene, &me2); + QCOMPARE(tester1->eventTypes, QList<QEvent::Type>() + << QEvent::GraphicsSceneHoverMove + << QEvent::GrabMouse + << QEvent::GraphicsSceneMousePress + << QEvent::UngrabMouse); + } + { + QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress); + me.setScenePos(QPointF(30, 30)); + me.setButton(Qt::LeftButton); + me.setButtons(Qt::LeftButton); + QGraphicsSceneMouseEvent me2(QEvent::GraphicsSceneMouseRelease); + me2.setScenePos(QPointF(30, 30)); + me2.setButton(Qt::LeftButton); + tester1->eventTypes.clear(); + qApp->sendEvent(&scene, &me); + qApp->sendEvent(&scene, &me2); + qDebug() << tester1->eventTypes; + QCOMPARE(tester1->eventTypes, QList<QEvent::Type>() + << QEvent::GraphicsSceneHoverLeave); + QCOMPARE(tester2->eventTypes, QList<QEvent::Type>() + << QEvent::GraphicsSceneHoverEnter + << QEvent::GraphicsSceneHoverMove + << QEvent::GrabMouse + << QEvent::GraphicsSceneMousePress + << QEvent::UngrabMouse); + tester2->eventTypes.clear(); + qApp->sendEvent(&scene, &me); + qApp->sendEvent(&scene, &me2); + QCOMPARE(tester2->eventTypes, QList<QEvent::Type>() + << QEvent::GraphicsSceneHoverMove + << QEvent::GrabMouse + << QEvent::GraphicsSceneMousePress + << QEvent::UngrabMouse); + } +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" |