From c2106683461bc02da95f7bd014eca17beeec4319 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Sat, 17 Aug 2013 15:49:33 +1000 Subject: Fix mouse test event in window warning message. The tests use local coordinates, but window->geometry() gives the global position on the window, i.e. offset by the size of the decoration. Change-Id: Id63ffd7e160b77ddb0f5563d8c3c65c36ad45e89 Reviewed-by: Stephen Kelly --- src/testlib/qtestmouse.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/testlib/qtestmouse.h') diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 4d70aff27e..8efa80789c 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -61,6 +61,8 @@ #include #endif +#include + QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); @@ -84,8 +86,10 @@ namespace QTest QTEST_ASSERT(window); extern int Q_TESTLIB_EXPORT defaultMouseDelay(); - if (!window->geometry().contains(pos)) + // pos is in window local coordinates + if (window->geometry().width() <= pos.x() || window->geometry().height() <= pos.y()) { QTest::qWarn("Mouse event occurs outside of target window."); + } static Qt::MouseButton lastButton = Qt::NoButton; -- cgit v1.2.3