testlib: Print event coordinates and window size when event is outside of window
This gives the user a much clearer understanding of which part of the test caused the warning. Old warning: WARNING: tst_controls::Default::Dial::test_linearInputMode(mouse) Mouse event occurs outside of target window. New warning: WARNING: tst_controls::Default::Dial::test_linearInputMode(mouse) Mouse event at 501, 179 occurs outside of target window (450x450). Change-Id: I2943d79bab5a808e9b5b721758db216b91a07bbd Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
9d8a4d16c6
commit
30609e684f
@ -94,8 +94,10 @@ namespace QTest
|
||||
extern int Q_TESTLIB_EXPORT defaultMouseDelay();
|
||||
|
||||
// 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.");
|
||||
const QSize windowSize = window->geometry().size();
|
||||
if (windowSize.width() <= pos.x() || windowSize.height() <= pos.y()) {
|
||||
QTest::qWarn(qPrintable(QString::fromLatin1("Mouse event at %1, %2 occurs outside of target window (%3x%4).")
|
||||
.arg(pos.x()).arg(pos.y()).arg(windowSize.width()).arg(windowSize.height())));
|
||||
}
|
||||
|
||||
if (delay == -1 || delay < defaultMouseDelay())
|
||||
|
Loading…
Reference in New Issue
Block a user