tests: Move waitForDeleted() into Platform

So each platform can implement their own.
Meaning old Testing.cpp can be deleted too.
This commit is contained in:
Sergio Martins
2022-05-20 16:41:59 +01:00
parent cc1f75b1b3
commit 07fc7d0437
14 changed files with 166 additions and 241 deletions

View File

@@ -211,6 +211,26 @@ bool Platform_qt::tests_waitForDeleted(View *view, int timeout) const
return wasDeleted;
}
bool Platform_qt::tests_waitForDeleted(QObject *o, int timeout) const
{
if (!o)
return true;
QPointer<QObject> ptr = o;
QElapsedTimer time;
time.start();
while (ptr && time.elapsed() < timeout) {
qApp->processEvents();
QTest::qWait(50);
}
const bool wasDeleted = !ptr;
return wasDeleted;
}
void Platform_qt::sendEvent(View *view, QEvent *ev) const
{
qApp->sendEvent(view->asQObject(), ev);