Use Qt::PreciseTimer for the QDeadlineTimers in QTest::qWait*
QDeadlineTimer will eventually support CLOCK_MONOTONIC_COARSE on Linux, so let's be safe before that change appears. Change-Id: I9b423f1b71194205b27afffd14a383a7e9f66a9d Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
fb376e0fcc
commit
a7ba91bd64
@ -58,7 +58,7 @@ namespace QTest
|
||||
{
|
||||
Q_ASSERT(QCoreApplication::instance());
|
||||
|
||||
QDeadlineTimer timer(ms);
|
||||
QDeadlineTimer timer(ms, Qt::PreciseTimer);
|
||||
int remaining = ms;
|
||||
do {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
|
||||
@ -74,7 +74,7 @@ namespace QTest
|
||||
#ifdef QT_GUI_LIB
|
||||
inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000)
|
||||
{
|
||||
QDeadlineTimer timer(timeout);
|
||||
QDeadlineTimer timer(timeout, Qt::PreciseTimer);
|
||||
int remaining = timeout;
|
||||
while (!window->isActive() && remaining > 0) {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
|
||||
@ -101,7 +101,7 @@ namespace QTest
|
||||
|
||||
inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000)
|
||||
{
|
||||
QDeadlineTimer timer(timeout);
|
||||
QDeadlineTimer timer(timeout, Qt::PreciseTimer);
|
||||
int remaining = timeout;
|
||||
while (!window->isExposed() && remaining > 0) {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
|
||||
|
Loading…
Reference in New Issue
Block a user