diff options
author | Jonathan Liu <net147@gmail.com> | 2012-02-25 01:54:58 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-28 05:33:15 (GMT) |
commit | f323f01648a33a22ba2b0f4975efe19a1af1b9b5 (patch) | |
tree | 0329e2d41f39265473ff0a26fdf0cc5d7c06617f /tests | |
parent | 3165fe0d809e25177dd0b91964f7d0718922121e (diff) | |
download | Qt-f323f01648a33a22ba2b0f4975efe19a1af1b9b5.zip Qt-f323f01648a33a22ba2b0f4975efe19a1af1b9b5.tar.gz Qt-f323f01648a33a22ba2b0f4975efe19a1af1b9b5.tar.bz2 |
Specify global mouse position for QDeclarativeMouseArea auto test
The preventContextMenu QDeclarativeMouseArea auto test creates
QContextMenuEvent without specifying the global mouse position. As a
result, the event's global mouse position is incorrectly set to
QCursor::pos().
Change-Id: Ib67fbcf3acf968eb2748426ad0db0e900826b232
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index 078fa12..98158e2 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -681,20 +681,21 @@ void tst_QDeclarativeMouseArea::preventContextMenu() QCOMPARE(eventsReceived.read().toInt(), 0); QPoint targetPoint = view->mapFromScene(QPoint(80, 80)); + QPoint targetGlobalPoint = view->viewport()->mapToGlobal(targetPoint); - QContextMenuEvent fakeEvent1(QContextMenuEvent::Mouse, targetPoint); + QContextMenuEvent fakeEvent1(QContextMenuEvent::Mouse, targetPoint, targetGlobalPoint); QApplication::sendEvent(view->viewport(), &fakeEvent1); QCOMPARE(eventsReceived.read().toInt(), 0); mouseAreaEnabled.write(false); QVERIFY(!mouseAreaEnabled.read().toBool()); - QContextMenuEvent fakeEvent2(QContextMenuEvent::Mouse, targetPoint); + QContextMenuEvent fakeEvent2(QContextMenuEvent::Mouse, targetPoint, targetGlobalPoint); QApplication::sendEvent(view->viewport(), &fakeEvent2); QCOMPARE(eventsReceived.read().toInt(), 1); mouseAreaEnabled.write(true); QVERIFY(mouseAreaEnabled.read().toBool()); - QContextMenuEvent fakeEvent3(QContextMenuEvent::Mouse, targetPoint); + QContextMenuEvent fakeEvent3(QContextMenuEvent::Mouse, targetPoint, targetGlobalPoint); QApplication::sendEvent(view->viewport(), &fakeEvent3); QCOMPARE(eventsReceived.read().toInt(), 1); } |