tests/auto/qtimer/tst_qtimer.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    83     void restartedTimerFiresTooSoon();
    83     void restartedTimerFiresTooSoon();
    84     void timerFiresOnlyOncePerProcessEvents_data();
    84     void timerFiresOnlyOncePerProcessEvents_data();
    85     void timerFiresOnlyOncePerProcessEvents();
    85     void timerFiresOnlyOncePerProcessEvents();
    86     void timerIdPersistsAfterThreadExit();
    86     void timerIdPersistsAfterThreadExit();
    87     void cancelLongTimer();
    87     void cancelLongTimer();
       
    88     void singleShotStaticFunctionZeroTimeout();
    88 };
    89 };
    89 
    90 
    90 class TimerHelper : public QObject
    91 class TimerHelper : public QObject
    91 {
    92 {
    92     Q_OBJECT
    93     Q_OBJECT
   609     QVERIFY(timer.isActive()); //if the timer completes immediately with an error, then this will fail
   610     QVERIFY(timer.isActive()); //if the timer completes immediately with an error, then this will fail
   610     timer.stop();
   611     timer.stop();
   611     QVERIFY(!timer.isActive());
   612     QVERIFY(!timer.isActive());
   612 }
   613 }
   613 
   614 
       
   615 void tst_QTimer::singleShotStaticFunctionZeroTimeout()
       
   616 {
       
   617     TimerHelper helper;
       
   618 
       
   619     QTimer::singleShot(0, &helper, SLOT(timeout()));
       
   620     QTest::qWait(500);
       
   621     QCOMPARE(helper.count, 1);
       
   622     QTest::qWait(500);
       
   623     QCOMPARE(helper.count, 1);
       
   624 }
       
   625 
   614 QTEST_MAIN(tst_QTimer)
   626 QTEST_MAIN(tst_QTimer)
   615 #include "tst_qtimer.moc"
   627 #include "tst_qtimer.moc"