summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-06-04 13:39:29 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-05 14:29:21 +0000
commit181ee8f9ffacc51265ccc3a0005bf146f230cf85 (patch)
tree2eb7f52b302bbeaf6e717e4bb2981b83baa745b5 /src/testlib
parent0dd0d2f9d5b333b215848ea3965e3af3dccaf599 (diff)
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 <simon.hausmann@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestmouse.h6
1 files changed, 4 insertions, 2 deletions
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: