From 504dd08854a8f6519a0529014df2233938b82728 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 16 Sep 2009 15:48:59 +0200 Subject: Fix QTimer overflow with interval > 35 minutes on symbian For long intervals, restart the system timer every 2000 seconds New autotest to verify long timers don't crash or complete immediately Task-number: QT-651 Reviewed-by: axis --- tests/auto/qtimer/tst_qtimer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/auto/qtimer') diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index a55c1c63a5..0877500641 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -88,6 +88,7 @@ private slots: void timerFiresOnlyOncePerProcessEvents_data(); void timerFiresOnlyOncePerProcessEvents(); void timerIdPersistsAfterThreadExit(); + void cancelLongTimer(); }; class TimerHelper : public QObject @@ -602,5 +603,16 @@ void tst_QTimer::timerIdPersistsAfterThreadExit() QVERIFY((timerId & 0xffffff) != (thread.timerId & 0xffffff)); } +void tst_QTimer::cancelLongTimer() +{ + QTimer timer; + timer.setSingleShot(true); + timer.start(1000 * 60 * 60); //set timer for 1 hour (which would overflow Symbian RTimer) + QCoreApplication::processEvents(); + QVERIFY(timer.isActive()); //if the timer completes immediately with an error, then this will fail + timer.stop(); + QVERIFY(!timer.isActive()); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" -- cgit v1.2.3