From d1f20a0506d729bd84041ea2359578254fdfcd54 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 27 Jun 2023 10:48:31 +0200 Subject: [PATCH] AutoTest: Fix auto expansion of Qt test results ..especially when using data driven tests. In this case we add an intermediate before the first data tag result which apparently never got automatically expanded. Change-Id: I282a57444b8014877c7a0e9f67c11c05ba1d06a5 Reviewed-by: David Schulz --- src/plugins/autotest/testresultmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index 812303e47af..41c53ac100d 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -4,6 +4,7 @@ #include "testresultmodel.h" #include "autotesticons.h" +#include "testresultspane.h" #include "testrunner.h" #include "testsettings.h" #include "testtreeitem.h" @@ -14,6 +15,7 @@ #include #include +#include using namespace Utils; @@ -184,6 +186,17 @@ TestResultItem *TestResultItem::createAndAddIntermediateFor(const TestResultItem result.setResult(ResultType::TestStart); TestResultItem *intermediate = new TestResultItem(result); appendChild(intermediate); + // FIXME: make the expand button's state easier accessible + auto widgets = TestResultsPane::instance()->toolBarWidgets(); + if (!widgets.empty()) { + if (QToolButton *expand = qobject_cast(widgets.at(0))) { + if (expand->isChecked()) { + QMetaObject::invokeMethod(TestResultsPane::instance(), + [intermediate] { intermediate->expand(); }, + Qt::QueuedConnection); + } + } + } return intermediate; }