From 59563677c654557a4890990f494c52b3a2e0d7c3 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 5 Sep 2024 22:03:52 +0300 Subject: [PATCH] tst_QTimer::livelock_data(): use std::chrono::milliseconds Change-Id: I3dcb6cae53c040242263920e40557bde96dcf3ce Reviewed-by: Marc Mutz --- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 40190ca4654..68dc0e87739 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -458,10 +458,10 @@ void tst_QTimer::basic_chrono() void tst_QTimer::livelock_data() { - QTest::addColumn("interval"); - QTest::newRow("zero timer") << 0; - QTest::newRow("non-zero timer") << 1; - QTest::newRow("longer than sleep") << 20; + QTest::addColumn("interval"); + QTest::newRow("zero timer") << 0ms; + QTest::newRow("non-zero timer") << 1ms; + QTest::newRow("longer than sleep") << 20ms; } /*! @@ -473,13 +473,13 @@ void tst_QTimer::livelock_data() class LiveLockTester : public QObject { public: - LiveLockTester(int i) + LiveLockTester(std::chrono::milliseconds i) : interval(i), timeoutsForFirst(0), timeoutsForExtra(0), timeoutsForSecond(0), postEventAtRightTime(false) { firstTimerId = startTimer(interval); - extraTimerId = startTimer(interval + 80); + extraTimerId = startTimer(interval + 80ms); secondTimerId = -1; // started later } @@ -514,7 +514,7 @@ public: killTimer(te->timerId()); } - const int interval; + const std::chrono::milliseconds interval; int firstTimerId; int secondTimerId; int extraTimerId; @@ -533,7 +533,7 @@ void tst_QTimer::livelock() events (since new posted events are not sent until the next iteration of the eventloop either). */ - QFETCH(int, interval); + QFETCH(std::chrono::milliseconds, interval); LiveLockTester tester(interval); QTest::qWait(180); // we have to use wait here, since we're testing timers with a non-zero timeout QTRY_COMPARE(tester.timeoutsForFirst, 1);