QTimer: use QTest::ingoreMessage() for negative internvals tests
Pick-to: 6.6 6.5 Change-Id: I87d095b748a7488a71b22710ab7ed72d9451c769 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 026e1e3fdb8ab2116f7fae28455c7141c926bb88) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1c8cb94e4a
commit
6816da00a9
@ -1291,13 +1291,20 @@ void tst_QTimer::bindToTimer()
|
|||||||
timer.stop();
|
timer.stop();
|
||||||
QVERIFY(!active);
|
QVERIFY(!active);
|
||||||
|
|
||||||
|
auto ignoreMsg = [] {
|
||||||
|
QTest::ignoreMessage(QtWarningMsg,
|
||||||
|
"QObject::startTimer: Timers cannot have negative intervals");
|
||||||
|
};
|
||||||
|
|
||||||
// also test that using negative interval updates the binding correctly
|
// also test that using negative interval updates the binding correctly
|
||||||
timer.start(100);
|
timer.start(100);
|
||||||
QVERIFY(active);
|
QVERIFY(active);
|
||||||
|
ignoreMsg();
|
||||||
timer.setInterval(-100);
|
timer.setInterval(-100);
|
||||||
QVERIFY(!active);
|
QVERIFY(!active);
|
||||||
timer.start(100);
|
timer.start(100);
|
||||||
QVERIFY(active);
|
QVERIFY(active);
|
||||||
|
ignoreMsg();
|
||||||
timer.start(-100);
|
timer.start(-100);
|
||||||
QVERIFY(!active);
|
QVERIFY(!active);
|
||||||
}
|
}
|
||||||
@ -1382,9 +1389,15 @@ void tst_QTimer::automatedBindingTests()
|
|||||||
|
|
||||||
void tst_QTimer::negativeInterval()
|
void tst_QTimer::negativeInterval()
|
||||||
{
|
{
|
||||||
|
auto ignoreMsg = [] {
|
||||||
|
QTest::ignoreMessage(QtWarningMsg,
|
||||||
|
"QObject::startTimer: Timers cannot have negative intervals");
|
||||||
|
};
|
||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
|
|
||||||
// Starting with a negative interval does not change active state.
|
// Starting with a negative interval does not change active state.
|
||||||
|
ignoreMsg();
|
||||||
timer.start(-100ms);
|
timer.start(-100ms);
|
||||||
QVERIFY(!timer.isActive());
|
QVERIFY(!timer.isActive());
|
||||||
|
|
||||||
@ -1392,6 +1405,7 @@ void tst_QTimer::negativeInterval()
|
|||||||
// the active state.
|
// the active state.
|
||||||
timer.start(100ms);
|
timer.start(100ms);
|
||||||
QVERIFY(timer.isActive());
|
QVERIFY(timer.isActive());
|
||||||
|
ignoreMsg();
|
||||||
timer.setInterval(-100);
|
timer.setInterval(-100);
|
||||||
QVERIFY(!timer.isActive());
|
QVERIFY(!timer.isActive());
|
||||||
|
|
||||||
@ -1399,6 +1413,7 @@ void tst_QTimer::negativeInterval()
|
|||||||
// and inactive state.
|
// and inactive state.
|
||||||
timer.start(100);
|
timer.start(100);
|
||||||
QVERIFY(timer.isActive());
|
QVERIFY(timer.isActive());
|
||||||
|
ignoreMsg();
|
||||||
timer.start(-100ms);
|
timer.start(-100ms);
|
||||||
QVERIFY(!timer.isActive());
|
QVERIFY(!timer.isActive());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user