diff options
author | Christian Stenger <christian.stenger@qt.io> | 2019-02-01 12:24:56 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2019-02-05 08:57:35 +0000 |
commit | 1a58a30685a7acb386989f8edbcd497d9472acf1 (patch) | |
tree | b45f275df59e6c13ca0dcd22176a1c161a207964 /src/plugins/autotest | |
parent | a5317cdaa51386eba406b65ab2d440d5b87a967d (diff) | |
download | qt-creator-1a58a30685a7acb386989f8edbcd497d9472acf1.tar.gz |
AutoTest: Allow grouping of results by application
Add an option to group test results by the application
that contains the test cases.
Fixes: QTCREATORBUG-21740
Change-Id: If4e5c8118cd5dd81b1b75891b4eca85b08e76848
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/autotest')
-rw-r--r-- | src/plugins/autotest/testresult.cpp | 3 | ||||
-rw-r--r-- | src/plugins/autotest/testresult.h | 2 | ||||
-rw-r--r-- | src/plugins/autotest/testresultmodel.cpp | 35 | ||||
-rw-r--r-- | src/plugins/autotest/testsettings.cpp | 3 | ||||
-rw-r--r-- | src/plugins/autotest/testsettings.h | 1 | ||||
-rw-r--r-- | src/plugins/autotest/testsettingspage.cpp | 2 | ||||
-rw-r--r-- | src/plugins/autotest/testsettingspage.ui | 9 |
7 files changed, 52 insertions, 3 deletions
diff --git a/src/plugins/autotest/testresult.cpp b/src/plugins/autotest/testresult.cpp index 11d4ecb936..ea4261a453 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 2632be9e30..a1e1d2e7bf 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 6cabd39cbc..0a1ee0c616 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 <projectexplorer/projectexplorericons.h> #include <utils/qtcassert.h> #include <QFontMetrics> @@ -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<TestResultItem *>(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 c19ed8ecf4..c825ea5573 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 657ec4c0e2..6eff083e59 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<Core::Id, bool> frameworks; QHash<Core::Id, bool> frameworksGrouping; QStringList whiteListFilters; diff --git a/src/plugins/autotest/testsettingspage.cpp b/src/plugins/autotest/testsettingspage.cpp index 7c69be1510..e2bf15ae6c 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 bef08a5a28..dbdf49842a 100644 --- a/src/plugins/autotest/testsettingspage.ui +++ b/src/plugins/autotest/testsettingspage.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>585</width> - <height>431</height> + <height>458</height> </rect> </property> <property name="windowTitle"> @@ -74,6 +74,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="displayAppCB"> + <property name="text"> + <string>Group results by application</string> + </property> + </widget> + </item> + <item> <widget class="QCheckBox" name="processArgsCB"> <property name="toolTip"> <string>Allow passing arguments specified on the respective run configuration. |