diff options
author | David Boddie <dboddie@trolltech.com> | 2010-08-11 11:50:37 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-08-11 11:50:37 (GMT) |
commit | c6ed32dc7e9c8a566f376d1baa7e616a1019f9af (patch) | |
tree | 95ce43172963aa266630d8836ccb6b23dde78991 /tests/auto/qtimer/tst_qtimer.cpp | |
parent | 9986c3f0c0681c7ea8bc8e5cfea5662880db6654 (diff) | |
parent | 5fa15620d09df1164cc28aa9b1e646a61f87e909 (diff) | |
download | Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.zip Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.tar.gz Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'tests/auto/qtimer/tst_qtimer.cpp')
-rw-r--r-- | tests/auto/qtimer/tst_qtimer.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index a0408ef..8d213ed 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -86,6 +86,7 @@ private slots: void timerIdPersistsAfterThreadExit(); void cancelLongTimer(); void singleShotStaticFunctionZeroTimeout(); + void recurseOnTimeoutAndStopTimer(); }; class TimerHelper : public QObject @@ -623,5 +624,48 @@ void tst_QTimer::singleShotStaticFunctionZeroTimeout() QCOMPARE(helper.count, 1); } +class RecursOnTimeoutAndStopTimerTimer : public QObject +{ + Q_OBJECT + +public: + QTimer *one; + QTimer *two; + +public slots: + void onetrigger() + { + QCoreApplication::processEvents(); + } + + void twotrigger() + { + one->stop(); + } +}; + +void tst_QTimer::recurseOnTimeoutAndStopTimer() +{ + QEventLoop eventLoop; + QTimer::singleShot(1000, &eventLoop, SLOT(quit())); + + RecursOnTimeoutAndStopTimerTimer t; + t.one = new QTimer(&t); + t.two = new QTimer(&t); + + QObject::connect(t.one, SIGNAL(timeout()), &t, SLOT(onetrigger())); + QObject::connect(t.two, SIGNAL(timeout()), &t, SLOT(twotrigger())); + + t.two->setSingleShot(true); + + t.one->start(); + t.two->start(); + + (void) eventLoop.exec(); + + QVERIFY(!t.one->isActive()); + QVERIFY(!t.two->isActive()); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" |