Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
Description
Testcase:
#include <QTimeLine> #include <QTest> #include <QSignalSpy> class Test : public QObject { Q_OBJECT private slots: void signalEmission() { QTimeLine timeLine(1000); timeLine.setUpdateInterval(1); // ms timeLine.setFrameRange(0, 12); QSignalSpy spy(&timeLine, &QTimeLine::frameChanged); QVERIFY(spy.isValid()); timeLine.start(); QTRY_COMPARE( spy.count(), 12 ); for ( int i = 0; i < 12; ++i ) { QCOMPARE( spy[i][0].toInt(), i + 1 ); } } }; QTEST_MAIN(Test) #include "main.moc"
Please ignore the compare with i+1, which stems from QTBUG-41610.
On macOS, and only on macOS, this test fails on the QTRY_COMPARE as only 9-10 signal emissions are recorded, not 12. This seems to be incompatible with the chosen update interval. Even the default (40ms = 25Hz) should suffice to get 12 activations in 1 second.
Raising the overall duration of the QTimeline to 3+ seconds fixes this.
Are timers in Qt 5 on macOS so inaccurate / so always massively "rounded up" that even the above cannot be guaranteed to work?