forked from qt-creator/qt-creator
AutoTest: Code cosmetics
* use nullptr * override * remove old style casts * fix most of the code model warnings Change-Id: Ia08e846f9326ae28ca7e7d66748e25a8b817b9b1 Reviewed-by: Xing Xiong Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -46,7 +46,7 @@ class AutotestPlugin : public ExtensionSystem::IPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AutotestPlugin();
|
AutotestPlugin();
|
||||||
~AutotestPlugin();
|
~AutotestPlugin() override;
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||||
void extensionsInitialized() override;
|
void extensionsInitialized() override;
|
||||||
|
@@ -54,7 +54,7 @@ namespace Internal {
|
|||||||
AutoTestUnitTests::AutoTestUnitTests(TestTreeModel *model, QObject *parent)
|
AutoTestUnitTests::AutoTestUnitTests(TestTreeModel *model, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_model(model),
|
m_model(model),
|
||||||
m_tmpDir(0),
|
m_tmpDir(nullptr),
|
||||||
m_isQt4(false)
|
m_isQt4(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ class AutoTestUnitTests : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AutoTestUnitTests(TestTreeModel *model, QObject *parent = 0);
|
explicit AutoTestUnitTests(TestTreeModel *model, QObject *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
|
|||||||
TestResultPtr testResult = TestResultPtr(new GTestResult(m_projectFile));
|
TestResultPtr testResult = TestResultPtr(new GTestResult(m_projectFile));
|
||||||
testResult->setResult(Result::MessageDisabledTests);
|
testResult->setResult(Result::MessageDisabledTests);
|
||||||
int disabled = disabledTests.cap(1).toInt();
|
int disabled = disabledTests.cap(1).toInt();
|
||||||
testResult->setDescription(tr("You have %n disabled test(s).", 0, disabled));
|
testResult->setDescription(tr("You have %n disabled test(s).", nullptr, disabled));
|
||||||
testResult->setLine(disabled); // misuse line property to hold number of disabled
|
testResult->setLine(disabled); // misuse line property to hold number of disabled
|
||||||
reportResult(testResult);
|
reportResult(testResult);
|
||||||
m_description.clear();
|
m_description.clear();
|
||||||
|
@@ -59,7 +59,6 @@ public:
|
|||||||
|
|
||||||
QWidget *widget() override;
|
QWidget *widget() override;
|
||||||
void apply() override;
|
void apply() override;
|
||||||
void finish() override { }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<GTestSettings> m_settings;
|
QSharedPointer<GTestSettings> m_settings;
|
||||||
|
@@ -468,7 +468,7 @@ QSet<QString> GTestTreeItem::internalTargets() const
|
|||||||
const QVector<CppTools::ProjectPart::Ptr> projectParts = projectInfo.projectParts();
|
const QVector<CppTools::ProjectPart::Ptr> projectParts = projectInfo.projectParts();
|
||||||
if (projectParts.isEmpty())
|
if (projectParts.isEmpty())
|
||||||
return TestTreeItem::dependingInternalTargets(cppMM, file);
|
return TestTreeItem::dependingInternalTargets(cppMM, file);
|
||||||
for (const CppTools::ProjectPart::Ptr projectPart : projectParts) {
|
for (const CppTools::ProjectPart::Ptr &projectPart : projectParts) {
|
||||||
if (projectPart->projectFile == proFile()
|
if (projectPart->projectFile == proFile()
|
||||||
&& Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) {
|
&& Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) {
|
||||||
return pf.path == file;
|
return pf.path == file;
|
||||||
|
@@ -58,7 +58,7 @@ class GTestVisitor : public CPlusPlus::ASTVisitor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit GTestVisitor(CPlusPlus::Document::Ptr doc);
|
explicit GTestVisitor(CPlusPlus::Document::Ptr doc);
|
||||||
bool visit(CPlusPlus::FunctionDefinitionAST *ast);
|
bool visit(CPlusPlus::FunctionDefinitionAST *ast) override;
|
||||||
|
|
||||||
QMap<GTestCaseSpec, GTestCodeLocationList> gtestFunctions() const { return m_gtestFunctions; }
|
QMap<GTestCaseSpec, GTestCodeLocationList> gtestFunctions() const { return m_gtestFunctions; }
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ITestSettingsPage() {}
|
void finish() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setId(Core::Id id)
|
void setId(Core::Id id)
|
||||||
|
@@ -47,9 +47,9 @@ static QString decode(const QString& original)
|
|||||||
while ((pos = regex.indexIn(original, pos)) != -1) {
|
while ((pos = regex.indexIn(original, pos)) != -1) {
|
||||||
const QString value = regex.cap(1);
|
const QString value = regex.cap(1);
|
||||||
if (value.startsWith('x'))
|
if (value.startsWith('x'))
|
||||||
result.replace(regex.cap(0), QChar(value.midRef(1).toInt(0, 16)));
|
result.replace(regex.cap(0), QChar(value.midRef(1).toInt(nullptr, 16)));
|
||||||
else
|
else
|
||||||
result.replace(regex.cap(0), QChar(value.toInt(0, 10)));
|
result.replace(regex.cap(0), QChar(value.toInt(nullptr, 10)));
|
||||||
pos += regex.matchedLength();
|
pos += regex.matchedLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ static QString constructBenchmarkInformation(const QString &metric, double value
|
|||||||
return QtTestOutputReader::tr("%1 %2 per iteration (total: %3, iterations: %4)")
|
return QtTestOutputReader::tr("%1 %2 per iteration (total: %3, iterations: %4)")
|
||||||
.arg(formatResult(value))
|
.arg(formatResult(value))
|
||||||
.arg(metricsText)
|
.arg(metricsText)
|
||||||
.arg(formatResult(value * (double)iterations))
|
.arg(formatResult(value * double(iterations)))
|
||||||
.arg(iterations);
|
.arg(iterations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,8 +109,8 @@ static QString testClass(const CppTools::CppModelManager *modelManager,
|
|||||||
const QByteArray name = macro.macro().name();
|
const QByteArray name = macro.macro().name();
|
||||||
if (QTestUtils::isQTestMacro(name)) {
|
if (QTestUtils::isQTestMacro(name)) {
|
||||||
const CPlusPlus::Document::Block arg = macro.arguments().at(0);
|
const CPlusPlus::Document::Block arg = macro.arguments().at(0);
|
||||||
return QLatin1String(fileContent.mid(arg.bytesBegin(),
|
return QLatin1String(fileContent.mid(int(arg.bytesBegin()),
|
||||||
arg.bytesEnd() - arg.bytesBegin()));
|
int(arg.bytesEnd() - arg.bytesBegin())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if one has used a self-defined macro or QTest::qExec() directly
|
// check if one has used a self-defined macro or QTest::qExec() directly
|
||||||
@@ -126,7 +126,8 @@ static CPlusPlus::Document::Ptr declaringDocument(CPlusPlus::Document::Ptr doc,
|
|||||||
const CPlusPlus::Snapshot &snapshot,
|
const CPlusPlus::Snapshot &snapshot,
|
||||||
const QString &testCaseName,
|
const QString &testCaseName,
|
||||||
const QStringList &alternativeFiles = {},
|
const QStringList &alternativeFiles = {},
|
||||||
unsigned *line = 0, unsigned *column = 0)
|
unsigned *line = nullptr,
|
||||||
|
unsigned *column = nullptr)
|
||||||
{
|
{
|
||||||
CPlusPlus::Document::Ptr declaringDoc;
|
CPlusPlus::Document::Ptr declaringDoc;
|
||||||
CPlusPlus::TypeOfExpression typeOfExpr;
|
CPlusPlus::TypeOfExpression typeOfExpr;
|
||||||
@@ -152,7 +153,7 @@ static CPlusPlus::Document::Ptr declaringDocument(CPlusPlus::Document::Ptr doc,
|
|||||||
if (CPlusPlus::Symbol *symbol = item.declaration()) {
|
if (CPlusPlus::Symbol *symbol = item.declaration()) {
|
||||||
if (CPlusPlus::Class *toeClass = symbol->asClass()) {
|
if (CPlusPlus::Class *toeClass = symbol->asClass()) {
|
||||||
const QString declFileName = QLatin1String(toeClass->fileId()->chars(),
|
const QString declFileName = QLatin1String(toeClass->fileId()->chars(),
|
||||||
toeClass->fileId()->size());
|
int(toeClass->fileId()->size()));
|
||||||
declaringDoc = snapshot.document(declFileName);
|
declaringDoc = snapshot.document(declFileName);
|
||||||
if (line)
|
if (line)
|
||||||
*line = toeClass->line();
|
*line = toeClass->line();
|
||||||
|
@@ -88,9 +88,8 @@ QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
|||||||
return QString("-callgrind");
|
return QString("-callgrind");
|
||||||
case MetricsType::Perf:
|
case MetricsType::Perf:
|
||||||
return QString("-perf");
|
return QString("-perf");
|
||||||
default:
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -65,8 +65,6 @@ void QtTestSettingsWidget::setSettings(const QtTestSettings &settings)
|
|||||||
case MetricsType::Perf:
|
case MetricsType::Perf:
|
||||||
m_ui.perfRB->setChecked(true);
|
m_ui.perfRB->setChecked(true);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
m_ui.walltimeRB->setChecked(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ class QtTestSettingsWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QtTestSettingsWidget(QWidget *parent = 0);
|
explicit QtTestSettingsWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void setSettings(const QtTestSettings &settings);
|
void setSettings(const QtTestSettings &settings);
|
||||||
QtTestSettings settings() const;
|
QtTestSettings settings() const;
|
||||||
@@ -58,7 +58,6 @@ public:
|
|||||||
|
|
||||||
QWidget *widget() override;
|
QWidget *widget() override;
|
||||||
void apply() override;
|
void apply() override;
|
||||||
void finish() override { }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<QtTestSettings> m_settings;
|
QSharedPointer<QtTestSettings> m_settings;
|
||||||
|
@@ -167,7 +167,6 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
|||||||
testConfigurations << testConfig;
|
testConfigurations << testConfig;
|
||||||
return;
|
return;
|
||||||
case Qt::PartiallyChecked:
|
case Qt::PartiallyChecked:
|
||||||
default:
|
|
||||||
QStringList testCases;
|
QStringList testCases;
|
||||||
item->forFirstLevelChildren([&testCases](TestTreeItem *grandChild) {
|
item->forFirstLevelChildren([&testCases](TestTreeItem *grandChild) {
|
||||||
if (grandChild->checked() == Qt::Checked) {
|
if (grandChild->checked() == Qt::Checked) {
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
QSet<QString> baseClasses() const { return m_baseClasses; }
|
QSet<QString> baseClasses() const { return m_baseClasses; }
|
||||||
bool resultValid() const { return m_valid; }
|
bool resultValid() const { return m_valid; }
|
||||||
|
|
||||||
bool visit(CPlusPlus::Class *symbol);
|
bool visit(CPlusPlus::Class *symbol) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CppTools::SymbolFinder m_symbolFinder;
|
CppTools::SymbolFinder m_symbolFinder;
|
||||||
@@ -67,8 +67,8 @@ class TestAstVisitor : public CPlusPlus::ASTVisitor
|
|||||||
public:
|
public:
|
||||||
explicit TestAstVisitor(CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot);
|
explicit TestAstVisitor(CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot);
|
||||||
|
|
||||||
bool visit(CPlusPlus::CallAST *ast);
|
bool visit(CPlusPlus::CallAST *ast) override;
|
||||||
bool visit(CPlusPlus::CompoundStatementAST *ast);
|
bool visit(CPlusPlus::CompoundStatementAST *ast) override;
|
||||||
|
|
||||||
QString className() const { return m_className; }
|
QString className() const { return m_className; }
|
||||||
|
|
||||||
@@ -84,11 +84,11 @@ class TestDataFunctionVisitor : public CPlusPlus::ASTVisitor
|
|||||||
public:
|
public:
|
||||||
explicit TestDataFunctionVisitor(CPlusPlus::Document::Ptr doc);
|
explicit TestDataFunctionVisitor(CPlusPlus::Document::Ptr doc);
|
||||||
|
|
||||||
bool visit(CPlusPlus::UsingDirectiveAST *ast);
|
bool visit(CPlusPlus::UsingDirectiveAST *ast) override;
|
||||||
bool visit(CPlusPlus::FunctionDefinitionAST *ast);
|
bool visit(CPlusPlus::FunctionDefinitionAST *ast) override;
|
||||||
bool visit(CPlusPlus::CallAST *ast);
|
bool visit(CPlusPlus::CallAST *ast) override;
|
||||||
bool preVisit(CPlusPlus::AST *ast);
|
bool preVisit(CPlusPlus::AST *ast) override;
|
||||||
void postVisit(CPlusPlus::AST *ast);
|
void postVisit(CPlusPlus::AST *ast) override;
|
||||||
QMap<QString, QtTestCodeLocationList> dataTags() const { return m_dataTags; }
|
QMap<QString, QtTestCodeLocationList> dataTags() const { return m_dataTags; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -120,7 +120,7 @@ static QString quickTestName(const CPlusPlus::Document::Ptr &doc,
|
|||||||
if (QuickTestUtils::isQuickTestMacro(name)) {
|
if (QuickTestUtils::isQuickTestMacro(name)) {
|
||||||
CPlusPlus::Document::Block arg = macro.arguments().at(0);
|
CPlusPlus::Document::Block arg = macro.arguments().at(0);
|
||||||
return QLatin1String(CppParser::getFileContent(doc->fileName())
|
return QLatin1String(CppParser::getFileContent(doc->fileName())
|
||||||
.mid(arg.bytesBegin(), arg.bytesEnd() - arg.bytesBegin()));
|
.mid(int(arg.bytesBegin()), int(arg.bytesEnd() - arg.bytesBegin())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,10 +311,6 @@ QuickTestParser::QuickTestParser()
|
|||||||
this, &QuickTestParser::doUpdateWatchPaths, Qt::QueuedConnection);
|
this, &QuickTestParser::doUpdateWatchPaths, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickTestParser::~QuickTestParser()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickTestParser::init(const QStringList &filesToParse, bool fullParse)
|
void QuickTestParser::init(const QStringList &filesToParse, bool fullParse)
|
||||||
{
|
{
|
||||||
m_qmlSnapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot();
|
m_qmlSnapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot();
|
||||||
|
@@ -46,7 +46,6 @@ class QuickTestParser : public QObject, public CppParser
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QuickTestParser();
|
QuickTestParser();
|
||||||
virtual ~QuickTestParser();
|
|
||||||
void init(const QStringList &filesToParse, bool fullParse) override;
|
void init(const QStringList &filesToParse, bool fullParse) override;
|
||||||
void release() override;
|
void release() override;
|
||||||
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
bool processDocument(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||||
|
@@ -416,7 +416,7 @@ QSet<QString> QuickTestTreeItem::internalTargets() const
|
|||||||
QSet<QString> result;
|
QSet<QString> result;
|
||||||
const auto cppMM = CppTools::CppModelManager::instance();
|
const auto cppMM = CppTools::CppModelManager::instance();
|
||||||
const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject());
|
const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject());
|
||||||
for (const CppTools::ProjectPart::Ptr projectPart : projectInfo.projectParts()) {
|
for (const CppTools::ProjectPart::Ptr &projectPart : projectInfo.projectParts()) {
|
||||||
if (projectPart->buildTargetType != CppTools::ProjectPart::Executable)
|
if (projectPart->buildTargetType != CppTools::ProjectPart::Executable)
|
||||||
continue;
|
continue;
|
||||||
if (projectPart->projectFile == proFile()) {
|
if (projectPart->projectFile == proFile()) {
|
||||||
|
@@ -48,10 +48,6 @@ using namespace ProjectExplorer;
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
TestConfiguration::TestConfiguration()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TestConfiguration::~TestConfiguration()
|
TestConfiguration::~TestConfiguration()
|
||||||
{
|
{
|
||||||
m_testCases.clear();
|
m_testCases.clear();
|
||||||
|
@@ -52,7 +52,7 @@ using TestResultPtr = QSharedPointer<TestResult>;
|
|||||||
class TestConfiguration
|
class TestConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestConfiguration();
|
explicit TestConfiguration() = default;
|
||||||
virtual ~TestConfiguration();
|
virtual ~TestConfiguration();
|
||||||
|
|
||||||
void completeTestInformation(TestRunMode runMode);
|
void completeTestInformation(TestRunMode runMode);
|
||||||
@@ -113,7 +113,6 @@ class DebuggableTestConfiguration : public TestConfiguration
|
|||||||
public:
|
public:
|
||||||
explicit DebuggableTestConfiguration(TestRunMode runMode = TestRunMode::Run)
|
explicit DebuggableTestConfiguration(TestRunMode runMode = TestRunMode::Run)
|
||||||
: m_runMode(runMode) {}
|
: m_runMode(runMode) {}
|
||||||
~DebuggableTestConfiguration() {}
|
|
||||||
|
|
||||||
void setRunMode(TestRunMode mode) { m_runMode = mode; }
|
void setRunMode(TestRunMode mode) { m_runMode = mode; }
|
||||||
TestRunMode runMode() const { return m_runMode; }
|
TestRunMode runMode() const { return m_runMode; }
|
||||||
|
@@ -108,10 +108,6 @@ TestNavigationWidget::TestNavigationWidget(QWidget *parent) :
|
|||||||
m_progressIndicator, &Utils::ProgressIndicator::show);
|
m_progressIndicator, &Utils::ProgressIndicator::show);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestNavigationWidget::~TestNavigationWidget()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
const bool enabled = !ProjectExplorer::BuildManager::isBuilding()
|
const bool enabled = !ProjectExplorer::BuildManager::isBuilding()
|
||||||
|
@@ -58,8 +58,7 @@ class TestNavigationWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TestNavigationWidget(QWidget *parent = 0);
|
explicit TestNavigationWidget(QWidget *parent = nullptr);
|
||||||
~TestNavigationWidget();
|
|
||||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
QList<QToolButton *> createToolButtons();
|
QList<QToolButton *> createToolButtons();
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ Result::Type TestResult::toResultType(int rt)
|
|||||||
if (rt < Result::FIRST_TYPE || rt > Result::LAST_TYPE)
|
if (rt < Result::FIRST_TYPE || rt > Result::LAST_TYPE)
|
||||||
return Result::Invalid;
|
return Result::Invalid;
|
||||||
|
|
||||||
return (Result::Type)rt;
|
return Result::Type(rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TestResult::resultToString(const Result::Type type)
|
QString TestResult::resultToString(const Result::Type type)
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
const static int outputLimit = 100000;
|
constexpr int outputLimit = 100000;
|
||||||
|
|
||||||
static bool isSummaryItem(Result::Type type)
|
static bool isSummaryItem(Result::Type type)
|
||||||
{
|
{
|
||||||
|
@@ -42,10 +42,6 @@ TestResultItem::TestResultItem(const TestResultPtr &testResult)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResultItem::~TestResultItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static QIcon testResultIcon(Result::Type result) {
|
static QIcon testResultIcon(Result::Type result) {
|
||||||
const static QIcon icons[] = {
|
const static QIcon icons[] = {
|
||||||
Icons::RESULT_PASS.icon(),
|
Icons::RESULT_PASS.icon(),
|
||||||
|
@@ -41,7 +41,6 @@ class TestResultItem : public Utils::TreeItem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestResultItem(const TestResultPtr &testResult);
|
explicit TestResultItem(const TestResultPtr &testResult);
|
||||||
~TestResultItem();
|
|
||||||
QVariant data(int column, int role) const override;
|
QVariant data(int column, int role) const override;
|
||||||
const TestResult *testResult() const { return m_testResult.data(); }
|
const TestResult *testResult() const { return m_testResult.data(); }
|
||||||
void updateDescription(const QString &description);
|
void updateDescription(const QString &description);
|
||||||
|
@@ -72,7 +72,7 @@ class TestResultsPane : public Core::IOutputPane
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual ~TestResultsPane();
|
~TestResultsPane() override;
|
||||||
static TestResultsPane *instance();
|
static TestResultsPane *instance();
|
||||||
|
|
||||||
// IOutputPane interface
|
// IOutputPane interface
|
||||||
@@ -119,7 +119,7 @@ private:
|
|||||||
void toggleOutputStyle();
|
void toggleOutputStyle();
|
||||||
QString getWholeOutput(const QModelIndex &parent = QModelIndex());
|
QString getWholeOutput(const QModelIndex &parent = QModelIndex());
|
||||||
|
|
||||||
void createMarks(const QModelIndex& parent = QModelIndex());
|
void createMarks(const QModelIndex &parent = QModelIndex());
|
||||||
void clearMarks();
|
void clearMarks();
|
||||||
|
|
||||||
QStackedWidget *m_outputWidget;
|
QStackedWidget *m_outputWidget;
|
||||||
|
@@ -28,12 +28,12 @@
|
|||||||
#include "autotestplugin.h"
|
#include "autotestplugin.h"
|
||||||
#include "testconfiguration.h"
|
#include "testconfiguration.h"
|
||||||
|
|
||||||
|
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||||
#include <projectexplorer/applicationlauncher.h>
|
#include <projectexplorer/applicationlauncher.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
@@ -564,15 +564,14 @@ void TestRunner::runOrDebugTests()
|
|||||||
case TestRunMode::Run:
|
case TestRunMode::Run:
|
||||||
case TestRunMode::RunWithoutDeploy:
|
case TestRunMode::RunWithoutDeploy:
|
||||||
runTests();
|
runTests();
|
||||||
break;
|
return;
|
||||||
case TestRunMode::Debug:
|
case TestRunMode::Debug:
|
||||||
case TestRunMode::DebugWithoutDeploy:
|
case TestRunMode::DebugWithoutDeploy:
|
||||||
debugTests();
|
debugTests();
|
||||||
break;
|
return;
|
||||||
default:
|
|
||||||
onFinished();
|
|
||||||
QTC_ASSERT(false, return); // unexpected run mode
|
|
||||||
}
|
}
|
||||||
|
onFinished();
|
||||||
|
QTC_ASSERT(false, return); // unexpected run mode
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::buildProject(ProjectExplorer::Project *project)
|
void TestRunner::buildProject(ProjectExplorer::Project *project)
|
||||||
|
@@ -52,12 +52,11 @@ namespace Internal {
|
|||||||
class AUTOTESTSHARED_EXPORT TestRunner : public QObject
|
class AUTOTESTSHARED_EXPORT TestRunner : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum CancelReason { UserCanceled, Timeout, KitChanged };
|
enum CancelReason { UserCanceled, Timeout, KitChanged };
|
||||||
|
|
||||||
static TestRunner* instance();
|
static TestRunner* instance();
|
||||||
~TestRunner();
|
~TestRunner() override;
|
||||||
|
|
||||||
void setSelectedTests(const QList<TestConfiguration *> &selected);
|
void setSelectedTests(const QList<TestConfiguration *> &selected);
|
||||||
void runTest(TestRunMode mode, const TestTreeItem *item);
|
void runTest(TestRunMode mode, const TestTreeItem *item);
|
||||||
|
@@ -44,7 +44,7 @@ static const char filtersKey[] = "WhiteListFilters";
|
|||||||
static const char processArgsKey[] = "ProcessArgs";
|
static const char processArgsKey[] = "ProcessArgs";
|
||||||
static const char groupSuffix[] = ".group";
|
static const char groupSuffix[] = ".group";
|
||||||
|
|
||||||
static const int defaultTimeout = 60000;
|
constexpr int defaultTimeout = 60000;
|
||||||
|
|
||||||
TestSettings::TestSettings()
|
TestSettings::TestSettings()
|
||||||
: timeout(defaultTimeout)
|
: timeout(defaultTimeout)
|
||||||
|
@@ -45,7 +45,7 @@ namespace Internal {
|
|||||||
class TestFilterDialog : public QDialog
|
class TestFilterDialog : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TestFilterDialog(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
|
explicit TestFilterDialog(QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||||
QString filterPath() const;
|
QString filterPath() const;
|
||||||
void setDetailsText(const QString &details) { m_details->setText(details); }
|
void setDetailsText(const QString &details) { m_details->setText(details); }
|
||||||
void setDefaultFilterPath(const QString &defaultPath);
|
void setDefaultFilterPath(const QString &defaultPath);
|
||||||
@@ -286,10 +286,6 @@ TestSettingsPage::TestSettingsPage(const QSharedPointer<TestSettings> &settings)
|
|||||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||||
}
|
}
|
||||||
|
|
||||||
TestSettingsPage::~TestSettingsPage()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *TestSettingsPage::widget()
|
QWidget *TestSettingsPage::widget()
|
||||||
{
|
{
|
||||||
if (!m_widget) {
|
if (!m_widget) {
|
||||||
|
@@ -63,7 +63,6 @@ class TestSettingsPage : public Core::IOptionsPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TestSettingsPage(const QSharedPointer<TestSettings> &settings);
|
explicit TestSettingsPage(const QSharedPointer<TestSettings> &settings);
|
||||||
~TestSettingsPage();
|
|
||||||
|
|
||||||
QWidget *widget() override;
|
QWidget *widget() override;
|
||||||
void apply() override;
|
void apply() override;
|
||||||
|
@@ -90,7 +90,7 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
|
|||||||
if (m_type == GroupNode)
|
if (m_type == GroupNode)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
QVariant itemLink;
|
QVariant itemLink;
|
||||||
itemLink.setValue(Utils::Link(m_filePath, m_line, m_column));
|
itemLink.setValue(Utils::Link(m_filePath, int(m_line), int(m_column)));
|
||||||
return itemLink;
|
return itemLink;
|
||||||
}
|
}
|
||||||
case ItalicRole:
|
case ItalicRole:
|
||||||
@@ -107,7 +107,7 @@ bool TestTreeItem::setData(int /*column*/, const QVariant &data, int role)
|
|||||||
{
|
{
|
||||||
if (role == Qt::CheckStateRole) {
|
if (role == Qt::CheckStateRole) {
|
||||||
Qt::CheckState old = m_checked;
|
Qt::CheckState old = m_checked;
|
||||||
m_checked = (Qt::CheckState)data.toInt();
|
m_checked = Qt::CheckState(data.toInt());
|
||||||
return m_checked != old;
|
return m_checked != old;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -124,9 +124,6 @@ Qt::ItemFlags TestTreeItem::flags(int /*column*/) const
|
|||||||
return defaultFlags | Qt::ItemIsAutoTristate | Qt::ItemIsUserCheckable;
|
return defaultFlags | Qt::ItemIsAutoTristate | Qt::ItemIsUserCheckable;
|
||||||
case TestFunctionOrSet:
|
case TestFunctionOrSet:
|
||||||
return defaultFlags | Qt::ItemIsUserCheckable;
|
return defaultFlags | Qt::ItemIsUserCheckable;
|
||||||
case TestDataFunction:
|
|
||||||
case TestSpecialFunction:
|
|
||||||
case TestDataTag:
|
|
||||||
default:
|
default:
|
||||||
return defaultFlags;
|
return defaultFlags;
|
||||||
}
|
}
|
||||||
@@ -244,9 +241,8 @@ TestConfiguration *TestTreeItem::asConfiguration(TestRunMode mode) const
|
|||||||
case TestRunMode::Debug:
|
case TestRunMode::Debug:
|
||||||
case TestRunMode::DebugWithoutDeploy:
|
case TestRunMode::DebugWithoutDeploy:
|
||||||
return debugConfiguration();
|
return debugConfiguration();
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TestConfiguration *> TestTreeItem::getAllTestConfigurations() const
|
QList<TestConfiguration *> TestTreeItem::getAllTestConfigurations() const
|
||||||
@@ -287,9 +283,8 @@ bool TestTreeItem::lessThan(const TestTreeItem *other, SortMode mode) const
|
|||||||
}
|
}
|
||||||
return leftLink.targetFileName > rightLink.targetFileName;
|
return leftLink.targetFileName > rightLink.targetFileName;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestTreeItem::isGroupNodeFor(const TestTreeItem *other) const
|
bool TestTreeItem::isGroupNodeFor(const TestTreeItem *other) const
|
||||||
@@ -310,7 +305,7 @@ QSet<QString> TestTreeItem::internalTargets() const
|
|||||||
if (projectParts.isEmpty())
|
if (projectParts.isEmpty())
|
||||||
return TestTreeItem::dependingInternalTargets(cppMM, m_filePath);
|
return TestTreeItem::dependingInternalTargets(cppMM, m_filePath);
|
||||||
QSet<QString> targets;
|
QSet<QString> targets;
|
||||||
for (const CppTools::ProjectPart::Ptr part : projectParts) {
|
for (const CppTools::ProjectPart::Ptr &part : projectParts) {
|
||||||
targets.insert(part->buildSystemTarget);
|
targets.insert(part->buildSystemTarget);
|
||||||
if (part->buildTargetType != CppTools::ProjectPart::Executable)
|
if (part->buildTargetType != CppTools::ProjectPart::Executable)
|
||||||
targets.unite(TestTreeItem::dependingInternalTargets(cppMM, m_filePath));
|
targets.unite(TestTreeItem::dependingInternalTargets(cppMM, m_filePath));
|
||||||
@@ -367,7 +362,7 @@ QSet<QString> TestTreeItem::dependingInternalTargets(CppTools::CppModelManager *
|
|||||||
const Utils::FileNameList dependingFiles = snapshot.filesDependingOn(
|
const Utils::FileNameList dependingFiles = snapshot.filesDependingOn(
|
||||||
wasHeader ? file : correspondingFile);
|
wasHeader ? file : correspondingFile);
|
||||||
for (const Utils::FileName &fn : dependingFiles) {
|
for (const Utils::FileName &fn : dependingFiles) {
|
||||||
for (const CppTools::ProjectPart::Ptr part : cppMM->projectPart(fn))
|
for (const CppTools::ProjectPart::Ptr &part : cppMM->projectPart(fn))
|
||||||
result.insert(part->buildSystemTarget);
|
result.insert(part->buildSystemTarget);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@@ -50,6 +50,7 @@ namespace Internal {
|
|||||||
class TestParseResult;
|
class TestParseResult;
|
||||||
class TestConfiguration;
|
class TestConfiguration;
|
||||||
enum class TestRunMode;
|
enum class TestRunMode;
|
||||||
|
|
||||||
class TestTreeItem : public Utils::TypedTreeItem<TestTreeItem>
|
class TestTreeItem : public Utils::TypedTreeItem<TestTreeItem>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -157,7 +158,7 @@ private:
|
|||||||
class TestCodeLocationAndType
|
class TestCodeLocationAndType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString m_name; // tag name for m_type == TEST_DATATAG, file name for other values
|
QString m_name; // tag name for m_type == TestDataTag, file name for other values
|
||||||
unsigned m_line = 0;
|
unsigned m_line = 0;
|
||||||
unsigned m_column = 0;
|
unsigned m_column = 0;
|
||||||
TestTreeItem::Type m_type = TestTreeItem::Root;
|
TestTreeItem::Type m_type = TestTreeItem::Root;
|
||||||
|
@@ -36,10 +36,6 @@ TestTreeItemDelegate::TestTreeItemDelegate(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItemDelegate::~TestTreeItemDelegate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestTreeItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void TestTreeItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItem opt = option;
|
QStyleOptionViewItem opt = option;
|
||||||
|
@@ -35,7 +35,6 @@ class TestTreeItemDelegate : public QStyledItemDelegate
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TestTreeItemDelegate(QObject *parent = nullptr);
|
explicit TestTreeItemDelegate(QObject *parent = nullptr);
|
||||||
~TestTreeItemDelegate();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
|
@@ -383,7 +383,7 @@ void TestTreeModel::revalidateCheckState(TestTreeItem *item)
|
|||||||
|| type == TestTreeItem::TestDataTag) {
|
|| type == TestTreeItem::TestDataTag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const Qt::CheckState oldState = (Qt::CheckState)item->data(0, Qt::CheckStateRole).toInt();
|
const Qt::CheckState oldState = Qt::CheckState(item->data(0, Qt::CheckStateRole).toInt());
|
||||||
Qt::CheckState newState = Qt::Checked;
|
Qt::CheckState newState = Qt::Checked;
|
||||||
bool foundChecked = false;
|
bool foundChecked = false;
|
||||||
bool foundUnchecked = false;
|
bool foundUnchecked = false;
|
||||||
|
@@ -47,7 +47,7 @@ class AUTOTESTSHARED_EXPORT TestTreeModel : public Utils::TreeModel<>
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static TestTreeModel* instance();
|
static TestTreeModel* instance();
|
||||||
~TestTreeModel();
|
~TestTreeModel() override;
|
||||||
|
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
|
Reference in New Issue
Block a user