forked from qt-creator/qt-creator
AutoTest: Redo reporting of disabled tests
Provide a proper way of reporting disabled tests instead of the hacky one. Change-Id: Id3a775d57ac20c9db8ad0f504cb708021117aa2f Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -92,12 +92,7 @@ void GTestOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
|
||||
reportResult(testResult);
|
||||
m_description.clear();
|
||||
} else if (disabledTests.exactMatch(line)) {
|
||||
TestResultPtr testResult = TestResultPtr(new GTestResult(m_projectFile));
|
||||
testResult->setResult(Result::MessageDisabledTests);
|
||||
int disabled = disabledTests.cap(1).toInt();
|
||||
testResult->setDescription(tr("You have %n disabled test(s).", nullptr, disabled));
|
||||
testResult->setLine(disabled); // misuse line property to hold number of disabled
|
||||
reportResult(testResult);
|
||||
m_disabled = disabledTests.cap(1).toInt();
|
||||
m_description.clear();
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
void reportCrash();
|
||||
void createAndReportResult(const QString &message, Result::Type type);
|
||||
bool hadValidOutput() const { return m_hadValidOutput; }
|
||||
int disabledTests() const { return m_disabled; }
|
||||
void setId(const QString &id) { m_id = id; }
|
||||
QString id() const { return m_id; }
|
||||
|
||||
@@ -63,6 +64,7 @@ protected:
|
||||
QProcess *m_testApplication; // not owned
|
||||
QString m_buildDir;
|
||||
QString m_id;
|
||||
int m_disabled = -1;
|
||||
private:
|
||||
bool m_hadValidOutput = false;
|
||||
};
|
||||
|
||||
@@ -57,7 +57,6 @@ enum Type {
|
||||
MessageLocation,
|
||||
|
||||
MessageInternal, INTERNAL_MESSAGES_BEGIN = MessageInternal,
|
||||
MessageDisabledTests,
|
||||
MessageTestCaseStart,
|
||||
MessageTestCaseSuccess,
|
||||
MessageTestCaseSuccessWarn,
|
||||
|
||||
@@ -224,12 +224,9 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
return;
|
||||
}
|
||||
|
||||
if (testResult->result() == Result::MessageDisabledTests)
|
||||
m_disabled += testResult->line();
|
||||
m_testResultCount[testResult->result()]++;
|
||||
|
||||
TestResultItem *newItem = new TestResultItem(testResult);
|
||||
|
||||
TestResultItem *root = nullptr;
|
||||
if (AutotestPlugin::settings()->displayApplication) {
|
||||
const QString application = testResult->id();
|
||||
|
||||
@@ -69,6 +69,7 @@ public:
|
||||
|
||||
int resultTypeCount(Result::Type type) const { return m_testResultCount.value(type, 0); }
|
||||
int disabledTests() const { return m_disabled; }
|
||||
void raiseDisabledTests(int amount) { m_disabled += amount; }
|
||||
|
||||
private:
|
||||
void recalculateMaxWidthOfFileName(const QFont &font);
|
||||
|
||||
@@ -157,6 +157,8 @@ TestResultsPane::TestResultsPane(QObject *parent) :
|
||||
this, &TestResultsPane::onTestRunFinished);
|
||||
connect(TestRunner::instance(), &TestRunner::testResultReady,
|
||||
this, &TestResultsPane::addTestResult);
|
||||
connect(TestRunner::instance(), &TestRunner::hadDisabledTests,
|
||||
m_model, &TestResultModel::raiseDisabledTests);
|
||||
}
|
||||
|
||||
void TestResultsPane::createToolButtons()
|
||||
|
||||
@@ -273,6 +273,9 @@ void TestRunner::onProcessFinished()
|
||||
}
|
||||
}
|
||||
}
|
||||
const int disabled = m_currentOutputReader->disabledTests();
|
||||
if (disabled > 0)
|
||||
emit hadDisabledTests(disabled);
|
||||
resetInternalPointers();
|
||||
|
||||
if (!m_fakeFutureInterface) {
|
||||
|
||||
@@ -70,6 +70,7 @@ signals:
|
||||
void testRunFinished();
|
||||
void requestStopTestRun();
|
||||
void testResultReady(const TestResultPtr &result);
|
||||
void hadDisabledTests(int disabled);
|
||||
|
||||
private:
|
||||
void buildProject(ProjectExplorer::Project *project);
|
||||
|
||||
Reference in New Issue
Block a user