diff options
author | Jonathan Liu <net147@gmail.com> | 2012-02-25 12:54:58 +1100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-28 23:24:09 +0100 |
commit | dc5c8d1099ac851b51accf5f87c5be4fc1610c1a (patch) | |
tree | 179f194ca513b55fd300928dbe2a8f855391b84b /tests/auto | |
parent | afebb988c090d7a941af2ac97b3d23b364b878fc (diff) |
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>
(cherry picked from commit f323f01648a33a22ba2b0f4975efe19a1af1b9b5)
Diffstat (limited to 'tests/auto')
-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 624e5595..811fcd46 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -682,20 +682,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); } |