forked from qt-creator/qt-creator
TaskTree: Fix progress value on synchronous error
Add a test for it. Change-Id: I86a1cf89efaef88b152c9db274ea712381cad407 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -2271,6 +2271,7 @@ void TaskTreePrivate::startChildren(RuntimeContainer *container)
|
||||
if (task->m_setupResult == SetupResult::Continue)
|
||||
continue;
|
||||
|
||||
task->m_parentIteration->deleteChild(task.get());
|
||||
childDone(iteration, task->m_setupResult == SetupResult::StopWithSuccess);
|
||||
if (container->m_parentTask->m_setupResult != SetupResult::Continue)
|
||||
return;
|
||||
|
@@ -3009,6 +3009,25 @@ void tst_Tasking::testTree_data()
|
||||
<< TestData{storage, root, {}, 1, DoneWith::Success, 0};
|
||||
}
|
||||
|
||||
{
|
||||
class CustomTaskAdapter : public TaskAdapter<bool> // bool is dummy
|
||||
{
|
||||
private:
|
||||
void start() final { emit done(DoneResult::Error); }
|
||||
};
|
||||
|
||||
using CustomTask = CustomTask<CustomTaskAdapter>;
|
||||
|
||||
// Check if progress is updated correctly on error when the 1st task finishes synchonously.
|
||||
const Group root {
|
||||
storage,
|
||||
CustomTask(),
|
||||
createSuccessTask(1)
|
||||
};
|
||||
QTest::newRow("ProgressOnSynchronousError")
|
||||
<< TestData{storage, root, {}, 2, DoneWith::Error, 0};
|
||||
}
|
||||
|
||||
{
|
||||
const auto recipe = [storage, createSuccessTask](bool withTask) {
|
||||
return Group {
|
||||
|
Reference in New Issue
Block a user