From 181ee8f9ffacc51265ccc3a0005bf146f230cf85 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 4 Jun 2015 13:39:29 +0200 Subject: Keep the mouse timestamp for tests closer to the actual time Pass on the requested delay into the mouse events. We don't care about single msecs as the surrounding code also takes time that we don't consider and whenever we generate a release we add 500ms of time skew anyway. The initial press of a double click has to increment the timestamp, just like all other mouse events do. Change-Id: Ifb94830f9f878ce87d92bfd86c72a16b55052f3b Reviewed-by: Simon Hausmann Reviewed-by: Lars Knoll --- src/testlib/qtestmouse.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/testlib/qtestmouse.h') diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 83ea3dd0a5..cd3901ae6f 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -89,8 +89,10 @@ namespace QTest if (delay == -1 || delay < defaultMouseDelay()) delay = defaultMouseDelay(); - if (delay > 0) + if (delay > 0) { QTest::qWait(delay); + lastMouseTimestamp += delay; + } if (pos.isNull()) pos = window->geometry().center(); @@ -105,7 +107,7 @@ namespace QTest switch (action) { case MouseDClick: - qt_handleMouseEvent(w, pos, global, button, stateKey, lastMouseTimestamp); + qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp); qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp); // fall through case MousePress: -- cgit v1.2.3