From 7a300d4d3a89d7002643bd7e70b1525d72967681 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 5 Feb 2010 12:52:37 +0100 Subject: Fixed the context menu test case in the qgraphicsscene autotest. When creating a custom QContextMenuEvent to send to a viewport we should use the viewport to convert the mouse cursor position to screen coordinates. Reviewed-by: Olivier Goffart --- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 6743fbe..469ded0 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2806,14 +2806,14 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() { QPoint pos(50, 50); - QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); + QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); event.ignore(); QApplication::sendEvent(view.viewport(), &event); QVERIFY(event.isAccepted()); } { QPoint pos(150, 150); - QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); + QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); event.ignore(); QApplication::sendEvent(view.viewport(), &event); QVERIFY(!event.isAccepted()); @@ -2821,14 +2821,14 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() view.scale(1.5, 1.5); { QPoint pos(25, 25); - QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); + QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); event.ignore(); QApplication::sendEvent(view.viewport(), &event); QVERIFY(event.isAccepted()); } { QPoint pos(55, 55); - QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.mapToGlobal(pos)); + QContextMenuEvent event(QContextMenuEvent::Keyboard, pos, view.viewport()->mapToGlobal(pos)); event.ignore(); QApplication::sendEvent(view.viewport(), &event); QVERIFY(!event.isAccepted()); -- cgit v0.12