mirror of
https://github.com/QuasarApp/Patronum.git
synced 2025-04-27 08:04:32 +00:00
30 lines
741 B
C++
30 lines
741 B
C++
#include "testutils.h"
|
|
|
|
#include <QCoreApplication>
|
|
#include <QDateTime>
|
|
#include <QVariantMap>
|
|
|
|
TestUtils::TestUtils()
|
|
{
|
|
|
|
}
|
|
|
|
bool TestUtils::wait(const bool &forWait, int msec) {
|
|
auto curmsec = QDateTime::currentMSecsSinceEpoch() + msec;
|
|
while (curmsec > QDateTime::currentMSecsSinceEpoch() && !forWait) {
|
|
QCoreApplication::processEvents();
|
|
}
|
|
QCoreApplication::processEvents();
|
|
return forWait;
|
|
}
|
|
|
|
|
|
bool TestUtils::wait(std::function<bool ()> forWait, int msec) {
|
|
auto curmsec = QDateTime::currentMSecsSinceEpoch() + msec;
|
|
while (curmsec > QDateTime::currentMSecsSinceEpoch() && !forWait()) {
|
|
QCoreApplication::processEvents();
|
|
}
|
|
QCoreApplication::processEvents();
|
|
return forWait();
|
|
}
|