diff --git a/src/plugins/autotest/testresult.cpp b/src/plugins/autotest/testresult.cpp index 11d4ecb9365..ea4261a4536 100644 --- a/src/plugins/autotest/testresult.cpp +++ b/src/plugins/autotest/testresult.cpp @@ -55,6 +55,8 @@ TestResult::TestResult(const QString &id, const QString &name) const QString TestResult::outputString(bool selected) const { + if (m_result == Result::Application) + return m_id; return selected ? m_description : m_description.split('\n').first(); } @@ -145,6 +147,7 @@ QString TestResult::resultToString(const Result::Type type) case Result::BlacklistedXFail: return QString("BXFAIL"); case Result::MessageLocation: + case Result::Application: return QString(); default: if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END) diff --git a/src/plugins/autotest/testresult.h b/src/plugins/autotest/testresult.h index 2632be9e309..a1e1d2e7bf1 100644 --- a/src/plugins/autotest/testresult.h +++ b/src/plugins/autotest/testresult.h @@ -67,6 +67,8 @@ enum Type { MessageIntermediate, MessageCurrentTest, INTERNAL_MESSAGES_END = MessageCurrentTest, + Application, + Invalid, LAST_TYPE = Invalid }; diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index 6cabd39cbcf..0a1ee0c6169 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -24,9 +24,12 @@ ****************************************************************************/ #include "autotesticons.h" +#include "autotestplugin.h" #include "testresultdelegate.h" #include "testresultmodel.h" +#include "testsettings.h" +#include #include #include @@ -62,6 +65,7 @@ static QIcon testResultIcon(Result::Type result) { QIcon(), Icons::RESULT_MESSAGEPASSWARN.icon(), Icons::RESULT_MESSAGEFAILWARN.icon(), + ProjectExplorer::Icons::DESKTOP_DEVICE.icon(), // for now }; // provide an icon for unknown?? if (result < 0 || result >= Result::MessageInternal) { @@ -74,6 +78,8 @@ static QIcon testResultIcon(Result::Type result) { return icons[16]; case Result::MessageTestCaseFailWarn: return icons[17]; + case Result::Application: + return icons[18]; default: return QIcon(); } @@ -224,7 +230,32 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx m_testResultCount[testResult->result()]++; TestResultItem *newItem = new TestResultItem(testResult); - TestResultItem *parentItem = findParentItemFor(newItem); + + TestResultItem *root = nullptr; + if (AutotestPlugin::settings()->displayApplication) { + const QString application = testResult->id(); + if (!application.isEmpty()) { + for (int row = rootItem()->childCount() - 1; row >= 0; --row) { + TestResultItem *tmp = static_cast(rootItem()->childAt(row)); + auto tmpTestResult = tmp->testResult(); + if (tmpTestResult->id() == application) { + root = tmp; + break; + } + } + if (!root) { + TestResult *tmpAppResult = new TestResult(application, application); + tmpAppResult->setResult(Result::Application); + root = new TestResultItem(TestResultPtr(tmpAppResult)); + if (lastRow >= 0) + rootItem()->insertChild(lastRow, root); + else + rootItem()->appendChild(root); + } + } + } + + TestResultItem *parentItem = findParentItemFor(newItem, root); addFileName(testResult->fileName()); // ensure we calculate the results pane correctly if (parentItem) { parentItem->appendChild(newItem); @@ -373,7 +404,7 @@ void TestResultFilterModel::enableAllResultTypes() << Result::MessageTestCaseSuccess << Result::MessageTestCaseSuccessWarn << Result::MessageTestCaseFail << Result::MessageTestCaseFailWarn << Result::MessageTestCaseEnd - << Result::MessageInfo << Result::MessageSystem; + << Result::MessageInfo << Result::MessageSystem << Result::Application; invalidateFilter(); } diff --git a/src/plugins/autotest/testsettings.cpp b/src/plugins/autotest/testsettings.cpp index c19ed8ecf4e..c825ea55733 100644 --- a/src/plugins/autotest/testsettings.cpp +++ b/src/plugins/autotest/testsettings.cpp @@ -42,6 +42,7 @@ static const char autoScrollKey[] = "AutoScrollResults"; static const char filterScanKey[] = "FilterScan"; static const char filtersKey[] = "WhiteListFilters"; static const char processArgsKey[] = "ProcessArgs"; +static const char displayApplicationKey[] = "DisplayApp"; static const char groupSuffix[] = ".group"; constexpr int defaultTimeout = 60000; @@ -60,6 +61,7 @@ void TestSettings::toSettings(QSettings *s) const s->setValue(limitResultOutputKey, limitResultOutput); s->setValue(autoScrollKey, autoScroll); s->setValue(processArgsKey, processArgs); + s->setValue(displayApplicationKey, displayApplication); s->setValue(filterScanKey, filterScan); s->setValue(filtersKey, whiteListFilters); // store frameworks and their current active and grouping state @@ -79,6 +81,7 @@ void TestSettings::fromSettings(QSettings *s) limitResultOutput = s->value(limitResultOutputKey, true).toBool(); autoScroll = s->value(autoScrollKey, true).toBool(); processArgs = s->value(processArgsKey, false).toBool(); + displayApplication = s->value(displayApplicationKey, false).toBool(); filterScan = s->value(filterScanKey, false).toBool(); whiteListFilters = s->value(filtersKey, QStringList()).toStringList(); // try to get settings for registered frameworks diff --git a/src/plugins/autotest/testsettings.h b/src/plugins/autotest/testsettings.h index 657ec4c0e27..6eff083e599 100644 --- a/src/plugins/autotest/testsettings.h +++ b/src/plugins/autotest/testsettings.h @@ -49,6 +49,7 @@ struct TestSettings bool autoScroll = true; bool filterScan = false; bool processArgs = false; + bool displayApplication = false; QHash frameworks; QHash frameworksGrouping; QStringList whiteListFilters; diff --git a/src/plugins/autotest/testsettingspage.cpp b/src/plugins/autotest/testsettingspage.cpp index 7c69be15106..e2bf15ae6c5 100644 --- a/src/plugins/autotest/testsettingspage.cpp +++ b/src/plugins/autotest/testsettingspage.cpp @@ -152,6 +152,7 @@ void TestSettingsWidget::setSettings(const TestSettings &settings) m_ui.limitResultOutputCB->setChecked(settings.limitResultOutput); m_ui.autoScrollCB->setChecked(settings.autoScroll); m_ui.processArgsCB->setChecked(settings.processArgs); + m_ui.displayAppCB->setChecked(settings.displayApplication); m_ui.filterGroupBox->setChecked(settings.filterScan); populateFrameworksListWidget(settings.frameworks); populateFiltersWidget(settings.whiteListFilters); @@ -166,6 +167,7 @@ TestSettings TestSettingsWidget::settings() const result.limitResultOutput = m_ui.limitResultOutputCB->isChecked(); result.autoScroll = m_ui.autoScrollCB->isChecked(); result.processArgs = m_ui.processArgsCB->isChecked(); + result.displayApplication = m_ui.displayAppCB->isChecked(); result.filterScan = m_ui.filterGroupBox->isChecked(); frameworkSettings(result); result.whiteListFilters = filters(); diff --git a/src/plugins/autotest/testsettingspage.ui b/src/plugins/autotest/testsettingspage.ui index bef08a5a285..dbdf49842a6 100644 --- a/src/plugins/autotest/testsettingspage.ui +++ b/src/plugins/autotest/testsettingspage.ui @@ -7,7 +7,7 @@ 0 0 585 - 431 + 458 @@ -73,6 +73,13 @@ + + + + Group results by application + + +