forked from qt-creator/qt-creator
Move TestType enum into constants...
...to avoid defining the enum in several places although almost having the same meaning. Additionally rename the values to ensure not to run in a name clash at some point. Change-Id: I0f23041b785c87efd3e7feebef855042595473f6 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
committed by
Niels Weber
parent
97011c6951
commit
54d753574e
@@ -36,8 +36,18 @@ const char TASK_PARSE[] = "AutoTest.Task.Parse";
|
|||||||
const char UNNAMED_QUICKTESTS[] = QT_TR_NOOP("<unnamed>");
|
const char UNNAMED_QUICKTESTS[] = QT_TR_NOOP("<unnamed>");
|
||||||
const char AUTOTEST_SETTINGS_CATEGORY[] = "ZY.Tests";
|
const char AUTOTEST_SETTINGS_CATEGORY[] = "ZY.Tests";
|
||||||
|
|
||||||
} // namespace Autotest
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
enum TestType
|
||||||
|
{
|
||||||
|
TestTypeQt,
|
||||||
|
TestTypeGTest
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Autotest
|
||||||
|
|
||||||
#endif // AUTOTESTCONSTANTS_H
|
#endif // AUTOTESTCONSTANTS_H
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ TestConfiguration::TestConfiguration(const QString &testClass, const QStringList
|
|||||||
m_unnamedOnly(false),
|
m_unnamedOnly(false),
|
||||||
m_project(0),
|
m_project(0),
|
||||||
m_guessedConfiguration(false),
|
m_guessedConfiguration(false),
|
||||||
m_type(Qt)
|
m_type(TestTypeQt)
|
||||||
{
|
{
|
||||||
if (testCases.size() != 0)
|
if (testCases.size() != 0)
|
||||||
m_testCaseCount = testCases.size();
|
m_testCaseCount = testCases.size();
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
#ifndef TESTCONFIGURATION_H
|
#ifndef TESTCONFIGURATION_H
|
||||||
#define TESTCONFIGURATION_H
|
#define TESTCONFIGURATION_H
|
||||||
|
|
||||||
|
#include "autotestconstants.h"
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -37,11 +39,6 @@ class TestConfiguration : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum TestType {
|
|
||||||
Qt,
|
|
||||||
GTest
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit TestConfiguration(const QString &testClass, const QStringList &testCases,
|
explicit TestConfiguration(const QString &testClass, const QStringList &testCases,
|
||||||
int testCaseCount = 0, QObject *parent = 0);
|
int testCaseCount = 0, QObject *parent = 0);
|
||||||
~TestConfiguration();
|
~TestConfiguration();
|
||||||
|
@@ -37,7 +37,7 @@ TestResult::TestResult(const QString &className)
|
|||||||
: m_class(className)
|
: m_class(className)
|
||||||
, m_result(Result::Invalid)
|
, m_result(Result::Invalid)
|
||||||
, m_line(0)
|
, m_line(0)
|
||||||
, m_type(Qt)
|
, m_type(TestTypeQt)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ QTestResult::QTestResult(const QString &className)
|
|||||||
GTestResult::GTestResult(const QString &className)
|
GTestResult::GTestResult(const QString &className)
|
||||||
: TestResult(className)
|
: TestResult(className)
|
||||||
{
|
{
|
||||||
setTestType(GTest);
|
setTestType(TestTypeGTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
#ifndef TESTRESULT_H
|
#ifndef TESTRESULT_H
|
||||||
#define TESTRESULT_H
|
#define TESTRESULT_H
|
||||||
|
|
||||||
|
#include "autotestconstants.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
@@ -58,12 +60,6 @@ enum Type {
|
|||||||
class TestResult
|
class TestResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum TestType
|
|
||||||
{
|
|
||||||
Qt,
|
|
||||||
GTest
|
|
||||||
};
|
|
||||||
|
|
||||||
TestResult();
|
TestResult();
|
||||||
TestResult(const QString &className);
|
TestResult(const QString &className);
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ QString TestResultDelegate::outputString(const TestResult &testResult, bool sele
|
|||||||
case Result::UnexpectedPass:
|
case Result::UnexpectedPass:
|
||||||
case Result::BlacklistedFail:
|
case Result::BlacklistedFail:
|
||||||
case Result::BlacklistedPass:
|
case Result::BlacklistedPass:
|
||||||
if (testResult.type() == TestResult::Qt)
|
if (testResult.type() == TestTypeQt)
|
||||||
output = testResult.className() + QLatin1String("::") + testResult.testCase();
|
output = testResult.className() + QLatin1String("::") + testResult.testCase();
|
||||||
else // TestResult::GTest
|
else // TestTypeGTest
|
||||||
output = testResult.testCase();
|
output = testResult.testCase();
|
||||||
if (!testResult.dataTag().isEmpty())
|
if (!testResult.dataTag().isEmpty())
|
||||||
output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag()));
|
output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag()));
|
||||||
|
@@ -142,8 +142,8 @@ void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
if (connection)
|
if (connection)
|
||||||
QObject::disconnect(connection);
|
QObject::disconnect(connection);
|
||||||
|
|
||||||
TestConfiguration::TestType testType = testConfiguration->testType();
|
TestType testType = testConfiguration->testType();
|
||||||
if (testType == TestConfiguration::Qt) {
|
if (testType == TestTypeQt) {
|
||||||
connection = QObject::connect(&testProcess, &QProcess::readyRead, &outputReader,
|
connection = QObject::connect(&testProcess, &QProcess::readyRead, &outputReader,
|
||||||
&TestOutputReader::processOutput);
|
&TestOutputReader::processOutput);
|
||||||
} else {
|
} else {
|
||||||
@@ -166,14 +166,14 @@ void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testType == TestConfiguration::Qt) {
|
if (testType == TestTypeQt) {
|
||||||
QStringList argumentList(QLatin1String("-xml"));
|
QStringList argumentList(QLatin1String("-xml"));
|
||||||
if (!metricsOption.isEmpty())
|
if (!metricsOption.isEmpty())
|
||||||
argumentList << metricsOption;
|
argumentList << metricsOption;
|
||||||
if (testConfiguration->testCases().count())
|
if (testConfiguration->testCases().count())
|
||||||
argumentList << testConfiguration->testCases();
|
argumentList << testConfiguration->testCases();
|
||||||
testProcess.setArguments(argumentList);
|
testProcess.setArguments(argumentList);
|
||||||
} else { // TestConfiguration::GTest
|
} else { // TestTypeGTest
|
||||||
const QStringList &testSets = testConfiguration->testCases();
|
const QStringList &testSets = testConfiguration->testCases();
|
||||||
if (testSets.size()) {
|
if (testSets.size()) {
|
||||||
QStringList argumentList;
|
QStringList argumentList;
|
||||||
|
@@ -256,7 +256,7 @@ QList<TestConfiguration *> TestTreeModel::getAllTestCases() const
|
|||||||
foundMains.value(proFile));
|
foundMains.value(proFile));
|
||||||
tc->setProFile(proFile);
|
tc->setProFile(proFile);
|
||||||
tc->setProject(project);
|
tc->setProject(project);
|
||||||
tc->setTestType(TestConfiguration::GTest);
|
tc->setTestType(TestTypeGTest);
|
||||||
result << tc;
|
result << tc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
|
|||||||
foreach (const QString &proFile, proFilesWithEnabledTestSets.keys()) {
|
foreach (const QString &proFile, proFilesWithEnabledTestSets.keys()) {
|
||||||
TestConfiguration *tc = new TestConfiguration(QString(),
|
TestConfiguration *tc = new TestConfiguration(QString(),
|
||||||
proFilesWithEnabledTestSets.value(proFile));
|
proFilesWithEnabledTestSets.value(proFile));
|
||||||
tc->setTestType(TestConfiguration::GTest);
|
tc->setTestType(TestTypeGTest);
|
||||||
tc->setProFile(proFile);
|
tc->setProFile(proFile);
|
||||||
tc->setProject(project);
|
tc->setProject(project);
|
||||||
result << tc;
|
result << tc;
|
||||||
@@ -468,7 +468,7 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item)
|
|||||||
config->setTestCaseCount(childCount);
|
config->setTestCaseCount(childCount);
|
||||||
config->setProFile(item->childItem(0)->mainFile());
|
config->setProFile(item->childItem(0)->mainFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
config->setTestType(TestConfiguration::GTest);
|
config->setTestType(TestTypeGTest);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -478,7 +478,7 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item)
|
|||||||
QStringList(parent->name() + QLatin1Char('.') + item->name()));
|
QStringList(parent->name() + QLatin1Char('.') + item->name()));
|
||||||
config->setProFile(item->mainFile());
|
config->setProFile(item->mainFile());
|
||||||
config->setProject(project);
|
config->setProject(project);
|
||||||
config->setTestType(TestConfiguration::GTest);
|
config->setTestType(TestTypeGTest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// not supported items
|
// not supported items
|
||||||
|
Reference in New Issue
Block a user