diff options
author | Michal Guminiak <michal.guminiak@teleca.com> | 2011-01-07 10:30:55 +0100 |
---|---|---|
committer | Dominik Kapusta <dominik.kapusta@teleca.com> | 2011-01-07 10:38:58 +0100 |
commit | f5eea42b7c3ebe31fcd22e0bf9e397f3261ede7a (patch) | |
tree | d37f11cd7f57a01c7b62f154eae200357b4c6e32 /tests | |
parent | 007270faed92e3ca9d2631d490c0a757a1f668b4 (diff) |
Fixes: NB#216528 - MSwipeRecognizer should use QElapsedTimer instead of QTime
RevBy: to be done
Details: changes the swipe recognizer so that it uses QElapsedTimer instead of QTime.
Also updates unittest for it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ut_mswiperecognizer/ut_mswiperecognizer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/ut_mswiperecognizer/ut_mswiperecognizer.cpp b/tests/ut_mswiperecognizer/ut_mswiperecognizer.cpp index 65ec460f..af04de30 100644 --- a/tests/ut_mswiperecognizer/ut_mswiperecognizer.cpp +++ b/tests/ut_mswiperecognizer/ut_mswiperecognizer.cpp @@ -127,6 +127,12 @@ void Ut_MSwipeRecognizer::testFastTap() QCOMPARE( currentState, QGestureRecognizer::CancelGesture); } +qint64 elapsedTime = 0; +qint64 QElapsedTimer::elapsed() const +{ + return elapsedTime; +} + void Ut_MSwipeRecognizer::testTimedout() { QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(0,0), QPoint(0,0), Qt::LeftButton, Qt::LeftButton, 0); @@ -136,11 +142,13 @@ void Ut_MSwipeRecognizer::testTimedout() currentState = recognizer->recognize(swipeGesture, 0, &pressEvent); QCOMPARE( currentState, QGestureRecognizer::MayBeGesture); - swipeGesture->time = QTime().currentTime().addSecs(-3); + elapsedTime = 3000; currentState = recognizer->recognize(swipeGesture, 0, &moveEvent); QCOMPARE( currentState, QGestureRecognizer::CancelGesture); + elapsedTime = 0; + } void Ut_MSwipeRecognizer::testZigzagged() |