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 <stephen.kelly@kdab.com>
This commit is contained in:
parent
d20f003f36
commit
c210668346
@ -61,6 +61,8 @@
|
|||||||
#include <QtWidgets/qwidget.h>
|
#include <QtWidgets/qwidget.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
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);
|
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);
|
QTEST_ASSERT(window);
|
||||||
extern int Q_TESTLIB_EXPORT defaultMouseDelay();
|
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.");
|
QTest::qWarn("Mouse event occurs outside of target window.");
|
||||||
|
}
|
||||||
|
|
||||||
static Qt::MouseButton lastButton = Qt::NoButton;
|
static Qt::MouseButton lastButton = Qt::NoButton;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user