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>
This commit is contained in:
parent
0dd0d2f9d5
commit
181ee8f9ff
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user