diff options
Diffstat (limited to 'tests')
5 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 84d723ca61..29fa98b8bb 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -616,6 +616,7 @@ public: bool unregisterTimer(int ) { return false; } bool unregisterTimers(QObject *) { return false; } QList<TimerInfo> registeredTimers(QObject *) const { return QList<TimerInfo>(); } + int remainingTime(int) { return 0; } void wakeUp() {} void interrupt() {} void flush() {} diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index e8dade9387..e4ecfb6f2d 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -55,6 +55,7 @@ private slots: void zeroTimer(); void singleShotTimeout(); void timeout(); + void remainingTime(); void livelock_data(); void livelock(); void timerInfiniteRecursion_data(); @@ -143,6 +144,22 @@ void tst_QTimer::timeout() QVERIFY(helper.count > oldCount); } +void tst_QTimer::remainingTime() +{ + TimerHelper helper; + QTimer timer; + + connect(&timer, SIGNAL(timeout()), &helper, SLOT(timeout())); + timer.start(200); + + QCOMPARE(helper.count, 0); + + QTest::qWait(50); + QCOMPARE(helper.count, 0); + + int remainingTime = timer.remainingTime(); + QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime))); +} void tst_QTimer::livelock_data() { diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 8eccd17376..41cfc52354 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -1234,6 +1234,7 @@ public: bool unregisterTimer(int ) { return false; } bool unregisterTimers(QObject *) { return false; } QList<TimerInfo> registeredTimers(QObject *) const { return QList<TimerInfo>(); } + int remainingTime(int) { return 0; } void wakeUp() {} void interrupt() {} void flush() {} diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp index bcd703b5d1..82de653586 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp @@ -62,6 +62,7 @@ public: void unregisterSocketNotifier(QSocketNotifier*) {} bool unregisterTimer(int) { return false; } bool unregisterTimers(QObject*) { return false; } + int remainingTime(int) { return 0; } void wakeUp() {} }; diff --git a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp index cb1f7feead..d3be93b715 100644 --- a/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp +++ b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp @@ -62,6 +62,7 @@ public: void unregisterSocketNotifier(QSocketNotifier*) {} bool unregisterTimer(int) { return false; } bool unregisterTimers(QObject*) { return false; } + int remainingTime(int) { return 0; } void wakeUp() {} }; |