TaskTree: Introduce Timeout task

By default, when finished, it returns success.
In order to convert it into failing task,
enclose it inside a Group with finishAllAndError.

Reuse it in tasking tests.

Task-number: QTCREATORBUG-28741
Change-Id: Ic81203203e0b139d4f9bfd553279ecb01cd303f4
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2023-05-28 22:47:59 +02:00
parent 5e9eadfc58
commit f6e7dbd416
3 changed files with 47 additions and 34 deletions

View File

@@ -1848,4 +1848,14 @@ void TaskTreeTaskAdapter::start()
task()->start();
}
TimeoutTaskAdapter::TimeoutTaskAdapter()
{
*task() = std::chrono::milliseconds::zero();
}
void TimeoutTaskAdapter::start()
{
QTimer::singleShot(*task(), this, [this] { emit done(true); });
}
} // namespace Tasking