forked from qt-creator/qt-creator
AutoTest: Modernize code
* remove unnecessary QLatin1String where possible * foreach * nullptr * bad naming of static members Change-Id: If0f7c6839be4d2efbfef6f7f0775d2034775bd90 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -31,12 +31,12 @@ namespace Autotest {
|
||||
namespace Icons {
|
||||
|
||||
const Utils::Icon SORT_ALPHABETICALLY({
|
||||
{QLatin1String(":/images/sort.png"), Utils::Theme::IconsBaseColor}});
|
||||
{":/images/sort.png", Utils::Theme::IconsBaseColor}});
|
||||
const Utils::Icon SORT_NATURALLY({
|
||||
{QLatin1String(":/images/leafsort.png"), Utils::Theme::IconsBaseColor}});
|
||||
{":/images/leafsort.png", Utils::Theme::IconsBaseColor}});
|
||||
const Utils::Icon RUN_SELECTED_OVERLAY({
|
||||
{QLatin1String(":/images/runselected_boxes.png"), Utils::Theme::BackgroundColorDark},
|
||||
{QLatin1String(":/images/runselected_tickmarks.png"), Utils::Theme::IconsBaseColor}});
|
||||
{":/images/runselected_boxes.png", Utils::Theme::BackgroundColorDark},
|
||||
{":/images/runselected_tickmarks.png", Utils::Theme::IconsBaseColor}});
|
||||
|
||||
const Utils::Icon RESULT_PASS({
|
||||
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestPassTextColor}},
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
using namespace Autotest::Internal;
|
||||
using namespace Core;
|
||||
|
||||
static AutotestPlugin *m_instance = 0;
|
||||
static AutotestPlugin *s_instance = nullptr;
|
||||
|
||||
AutotestPlugin::AutotestPlugin()
|
||||
: m_settings(new TestSettings)
|
||||
@@ -73,7 +73,7 @@ AutotestPlugin::AutotestPlugin()
|
||||
qRegisterMetaType<TestTreeItem *>();
|
||||
qRegisterMetaType<TestCodeLocationAndType>();
|
||||
|
||||
m_instance = this;
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
AutotestPlugin::~AutotestPlugin()
|
||||
@@ -83,7 +83,7 @@ AutotestPlugin::~AutotestPlugin()
|
||||
|
||||
AutotestPlugin *AutotestPlugin::instance()
|
||||
{
|
||||
return m_instance;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
QSharedPointer<TestSettings> AutotestPlugin::settings() const
|
||||
|
||||
@@ -73,7 +73,7 @@ void AutoTestUnitTests::initTestCase()
|
||||
if (!toolchain)
|
||||
QSKIP("This test requires that there is a kit with a toolchain.");
|
||||
|
||||
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(QLatin1String(":/unit_test"));
|
||||
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(":/unit_test");
|
||||
}
|
||||
|
||||
void AutoTestUnitTests::cleanupTestCase()
|
||||
@@ -117,16 +117,16 @@ void AutoTestUnitTests::testCodeParser_data()
|
||||
|
||||
|
||||
QTest::newRow("plainAutoTest")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.pro"))
|
||||
<< QString(m_tmpDir->path() + "/plain/plain.pro")
|
||||
<< 1 << 0 << 0 << 0;
|
||||
QTest::newRow("mixedAutoTestAndQuickTests")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.pro"))
|
||||
<< QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.pro")
|
||||
<< 4 << 5 << 3 << 10;
|
||||
QTest::newRow("plainAutoTestQbs")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.qbs"))
|
||||
<< QString(m_tmpDir->path() + "/plain/plain.qbs")
|
||||
<< 1 << 0 << 0 << 0;
|
||||
QTest::newRow("mixedAutoTestAndQuickTestsQbs")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.qbs"))
|
||||
<< QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs")
|
||||
<< 4 << 5 << 3 << 10;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ void AutoTestUnitTests::testCodeParserGTest()
|
||||
|
||||
QMultiMap<QString, int> foundNamesAndSets = m_model->gtestNamesAndSets();
|
||||
QCOMPARE(expectedNamesAndSets.size(), foundNamesAndSets.size());
|
||||
foreach (const QString &name, expectedNamesAndSets.keys())
|
||||
for (const QString &name : expectedNamesAndSets.keys())
|
||||
QCOMPARE(expectedNamesAndSets.values(name), foundNamesAndSets.values(name));
|
||||
|
||||
// check also that no Qt related tests have been found
|
||||
@@ -224,9 +224,9 @@ void AutoTestUnitTests::testCodeParserGTest_data()
|
||||
{
|
||||
QTest::addColumn<QString>("projectFilePath");
|
||||
QTest::newRow("simpleGoogletest")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/simple_gt/simple_gt.pro"));
|
||||
<< QString(m_tmpDir->path() + "/simple_gt/simple_gt.pro");
|
||||
QTest::newRow("simpleGoogletestQbs")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/simple_gt/simple_gt.qbs"));
|
||||
<< QString(m_tmpDir->path() + "/simple_gt/simple_gt.qbs");
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -140,8 +140,8 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine)
|
||||
m_description.chop(1);
|
||||
testResult->setDescription(m_description);
|
||||
|
||||
foreach (const QString &output, m_description.split('\n')) {
|
||||
QRegExp *match = 0;
|
||||
for (const QString &output : m_description.split('\n')) {
|
||||
QRegExp *match = nullptr;
|
||||
if (failureLocation.exactMatch(output))
|
||||
match = &failureLocation;
|
||||
else if (errorLocation.exactMatch(output))
|
||||
|
||||
@@ -47,7 +47,7 @@ TestTreeItem *GTestParseResult::createTestTreeItem() const
|
||||
item->setState(GTestTreeItem::Typed);
|
||||
if (disabled)
|
||||
item->setState(GTestTreeItem::Disabled);
|
||||
foreach (const TestParseResult *testSet, children)
|
||||
for (const TestParseResult *testSet : children)
|
||||
item->appendChild(testSet->createTestTreeItem());
|
||||
return item;
|
||||
}
|
||||
@@ -56,12 +56,12 @@ static bool includesGTest(const CPlusPlus::Document::Ptr &doc,
|
||||
const CPlusPlus::Snapshot &snapshot)
|
||||
{
|
||||
static const QString gtestH("gtest/gtest.h");
|
||||
foreach (const CPlusPlus::Document::Include &inc, doc->resolvedIncludes()) {
|
||||
for (const CPlusPlus::Document::Include &inc : doc->resolvedIncludes()) {
|
||||
if (inc.resolvedFileName().endsWith(gtestH))
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (const QString &include, snapshot.allIncludesForDocument(doc->fileName())) {
|
||||
for (const QString &include : snapshot.allIncludesForDocument(doc->fileName())) {
|
||||
if (include.endsWith(gtestH))
|
||||
return true;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static bool includesGTest(const CPlusPlus::Document::Ptr &doc,
|
||||
|
||||
static bool hasGTestNames(const CPlusPlus::Document::Ptr &document)
|
||||
{
|
||||
foreach (const CPlusPlus::Document::MacroUse ¯o, document->macroUses()) {
|
||||
for (const CPlusPlus::Document::MacroUse ¯o : document->macroUses()) {
|
||||
if (!macro.isFunctionLike())
|
||||
continue;
|
||||
if (GTestUtils::isGTestMacro(QLatin1String(macro.macro().name()))) {
|
||||
@@ -106,7 +106,7 @@ static bool handleGTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
else
|
||||
return false; // happens if shutting down while parsing
|
||||
|
||||
foreach (const GTestCaseSpec &testSpec, result.keys()) {
|
||||
for (const GTestCaseSpec &testSpec : result.keys()) {
|
||||
GTestParseResult *parseResult = new GTestParseResult(id);
|
||||
parseResult->itemType = TestTreeItem::TestCase;
|
||||
parseResult->fileName = filePath;
|
||||
@@ -116,7 +116,7 @@ static bool handleGTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
parseResult->disabled = testSpec.disabled;
|
||||
parseResult->proFile = proFile;
|
||||
|
||||
foreach (const GTestCodeLocationAndType &location, result.value(testSpec)) {
|
||||
for (const GTestCodeLocationAndType &location : result.value(testSpec)) {
|
||||
GTestParseResult *testSet = new GTestParseResult(id);
|
||||
testSet->name = location.m_name;
|
||||
testSet->fileName = filePath;
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace Internal {
|
||||
static QString gtestFilter(GTestTreeItem::TestStates states)
|
||||
{
|
||||
if ((states & GTestTreeItem::Parameterized) && (states & GTestTreeItem::Typed))
|
||||
return QLatin1String("*/%1/*.%2");
|
||||
return QString("*/%1/*.%2");
|
||||
if (states & GTestTreeItem::Parameterized)
|
||||
return QLatin1String("*/%1.%2/*");
|
||||
return QString("*/%1.%2/*");
|
||||
if (states & GTestTreeItem::Typed)
|
||||
return QLatin1String("%1/*.%2");
|
||||
return QLatin1String("%1.%2");
|
||||
return QString("%1/*.%2");
|
||||
return QString("%1.%2");
|
||||
}
|
||||
|
||||
QVariant GTestTreeItem::data(int column, int role) const
|
||||
@@ -76,9 +76,9 @@ QVariant GTestTreeItem::data(int column, int role) const
|
||||
TestConfiguration *GTestTreeItem::testConfiguration() const
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
QTC_ASSERT(project, return 0);
|
||||
QTC_ASSERT(project, return nullptr);
|
||||
|
||||
GTestConfiguration *config = 0;
|
||||
GTestConfiguration *config = nullptr;
|
||||
switch (type()) {
|
||||
case TestCase: {
|
||||
const QString &testSpecifier = gtestFilter(state()).arg(name()).arg('*');
|
||||
@@ -97,7 +97,7 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
|
||||
case TestFunctionOrSet: {
|
||||
GTestTreeItem *parent = static_cast<GTestTreeItem *>(parentItem());
|
||||
if (!parent)
|
||||
return 0;
|
||||
return nullptr;
|
||||
const QString &testSpecifier = gtestFilter(parent->state()).arg(parent->name()).arg(name());
|
||||
config = new GTestConfiguration;
|
||||
config->setTestCases(QStringList(testSpecifier));
|
||||
@@ -108,7 +108,7 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
|
||||
|
||||
TestTreeItem *GTestTreeItem::find(const TestParseResult *result)
|
||||
{
|
||||
QTC_ASSERT(result, return 0);
|
||||
QTC_ASSERT(result, return nullptr);
|
||||
|
||||
const GTestParseResult *parseResult = static_cast<const GTestParseResult *>(result);
|
||||
GTestTreeItem::TestStates states = parseResult->disabled ? GTestTreeItem::Disabled
|
||||
@@ -269,7 +269,7 @@ TestTreeItem *GTestTreeItem::find(const TestParseResult *result)
|
||||
case TestCase:
|
||||
return findChildByNameAndFile(result->name, result->fileName);
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,9 +315,9 @@ QString GTestTreeItem::nameSuffix() const
|
||||
QCoreApplication::translate("GTestTreeItem", "typed") };
|
||||
QString suffix;
|
||||
if (m_state & Parameterized)
|
||||
suffix = QLatin1String(" [") + markups[0];
|
||||
suffix = QString(" [") + markups[0];
|
||||
if (m_state & Typed)
|
||||
suffix += (suffix.isEmpty() ? QLatin1String(" [") : QLatin1String(", ")) + markups[1];
|
||||
suffix += (suffix.isEmpty() ? QString(" [") : QString(", ")) + markups[1];
|
||||
if (!suffix.isEmpty())
|
||||
suffix += ']';
|
||||
return suffix;
|
||||
|
||||
@@ -40,7 +40,7 @@ GTestVisitor::GTestVisitor(CPlusPlus::Document::Ptr doc)
|
||||
|
||||
bool GTestVisitor::visit(CPlusPlus::FunctionDefinitionAST *ast)
|
||||
{
|
||||
static QString disabledPrefix = QString::fromLatin1("DISABLED_");
|
||||
static const QString disabledPrefix("DISABLED_");
|
||||
if (!ast || !ast->declarator || !ast->declarator->core_declarator)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static CppParser *s_parserInstance = 0;
|
||||
static CppParser *s_parserInstance = nullptr;
|
||||
|
||||
CppParser::CppParser()
|
||||
{
|
||||
|
||||
@@ -59,9 +59,9 @@ static QString formatResult(double value)
|
||||
{
|
||||
//NAN is not supported with visual studio 2010
|
||||
if (value < 0)// || value == NAN)
|
||||
return QLatin1String("NAN");
|
||||
return QString("NAN");
|
||||
if (value == 0)
|
||||
return QLatin1String("0");
|
||||
return QString("0");
|
||||
|
||||
int significantDigits = 0;
|
||||
qreal divisor = 1;
|
||||
@@ -83,7 +83,7 @@ static QString formatResult(double value)
|
||||
beforeDecimalPoint.append('0');
|
||||
|
||||
int afterUse = significantDigits - beforeUse;
|
||||
if (beforeDecimalPoint == QLatin1String("0") && !afterDecimalPoint.isEmpty()) {
|
||||
if (beforeDecimalPoint == QString("0") && !afterDecimalPoint.isEmpty()) {
|
||||
++afterUse;
|
||||
int i = 0;
|
||||
while (i < afterDecimalPoint.count() && afterDecimalPoint.at(i) == '0')
|
||||
|
||||
@@ -46,7 +46,7 @@ TestTreeItem *QtTestParseResult::createTestTreeItem() const
|
||||
item->setColumn(column);
|
||||
item->setInherited(m_inherited);
|
||||
|
||||
foreach (const TestParseResult *funcParseResult, children)
|
||||
for (const TestParseResult *funcParseResult : children)
|
||||
item->appendChild(funcParseResult->createTestTreeItem());
|
||||
return item;
|
||||
}
|
||||
@@ -59,11 +59,11 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc, const CPlusPlus:
|
||||
|
||||
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
|
||||
|
||||
foreach (const CPlusPlus::Document::Include &inc, includes) {
|
||||
for (const CPlusPlus::Document::Include &inc : includes) {
|
||||
// TODO this short cut works only for #include <QtTest>
|
||||
// bad, as there could be much more different approaches
|
||||
if (inc.unresolvedFileName() == QLatin1String("QtTest")) {
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
if (inc.unresolvedFileName() == QString("QtTest")) {
|
||||
for (const QString &prefix : expectedHeaderPrefixes) {
|
||||
if (inc.resolvedFileName().endsWith(QString("%1/QtTest").arg(prefix)))
|
||||
return true;
|
||||
}
|
||||
@@ -71,8 +71,8 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc, const CPlusPlus:
|
||||
}
|
||||
|
||||
const QSet<QString> allIncludes = snapshot.allIncludesForDocument(doc->fileName());
|
||||
foreach (const QString &include, allIncludes) {
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
for (const QString &include : allIncludes) {
|
||||
for (const QString &prefix : expectedHeaderPrefixes) {
|
||||
if (include.endsWith(QString("%1/qtest.h").arg(prefix)))
|
||||
return true;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ static QString testClass(const CppTools::CppModelManager *modelManager,
|
||||
|
||||
const QList<CPlusPlus::Document::MacroUse> macros = document->macroUses();
|
||||
|
||||
foreach (const CPlusPlus::Document::MacroUse ¯o, macros) {
|
||||
for (const CPlusPlus::Document::MacroUse ¯o : macros) {
|
||||
if (!macro.isFunctionLike())
|
||||
continue;
|
||||
const QByteArray name = macro.macro().name();
|
||||
@@ -303,7 +303,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
|
||||
// TODO: change to QHash<>
|
||||
QMap<QString, QtTestCodeLocationList> dataTags;
|
||||
foreach (const QString &file, files)
|
||||
for (const QString &file : files)
|
||||
dataTags.unite(checkForDataTags(file, snapshot));
|
||||
|
||||
QtTestParseResult *parseResult = new QtTestParseResult(id);
|
||||
@@ -333,7 +333,7 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||
func->setInherited(location.m_inherited);
|
||||
|
||||
const QtTestCodeLocationList &tagLocations = tagLocationsFor(func, dataTags);
|
||||
foreach (const QtTestCodeLocationAndType &tag, tagLocations) {
|
||||
for (const QtTestCodeLocationAndType &tag : tagLocations) {
|
||||
QtTestParseResult *dataTag = new QtTestParseResult(id);
|
||||
dataTag->itemType = tag.m_type;
|
||||
dataTag->name = tag.m_name;
|
||||
|
||||
@@ -106,7 +106,7 @@ bool QtTestResult::isIntermediateFor(const TestResult *other) const
|
||||
|
||||
TestResult *QtTestResult::createIntermediateResultFor(const TestResult *other)
|
||||
{
|
||||
QTC_ASSERT(other, return 0);
|
||||
QTC_ASSERT(other, return nullptr);
|
||||
const QtTestResult *qtOther = static_cast<const QtTestResult *>(other);
|
||||
QtTestResult *intermediate = new QtTestResult(qtOther->name());
|
||||
intermediate->m_function = qtOther->m_function;
|
||||
|
||||
@@ -72,13 +72,13 @@ QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
||||
case MetricsType::Walltime:
|
||||
return QString();
|
||||
case MetricsType::TickCounter:
|
||||
return QLatin1String("-tickcounter");
|
||||
return QString("-tickcounter");
|
||||
case MetricsType::EventCounter:
|
||||
return QLatin1String("-eventcounter");
|
||||
return QString("-eventcounter");
|
||||
case MetricsType::CallGrind:
|
||||
return QLatin1String("-callgrind");
|
||||
return QString("-callgrind");
|
||||
case MetricsType::Perf:
|
||||
return QLatin1String("-perf");
|
||||
return QString("-perf");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ bool QtTestTreeItem::canProvideDebugConfiguration() const
|
||||
TestConfiguration *QtTestTreeItem::testConfiguration() const
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
QTC_ASSERT(project, return 0);
|
||||
QTC_ASSERT(project, return nullptr);
|
||||
|
||||
QtTestConfiguration *config = 0;
|
||||
QtTestConfiguration *config = nullptr;
|
||||
switch (type()) {
|
||||
case TestCase:
|
||||
config = new QtTestConfiguration;
|
||||
@@ -125,9 +125,9 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
|
||||
}
|
||||
case TestDataTag: {
|
||||
const TestTreeItem *function = parentItem();
|
||||
const TestTreeItem *parent = function ? function->parentItem() : 0;
|
||||
const TestTreeItem *parent = function ? function->parentItem() : nullptr;
|
||||
if (!parent)
|
||||
return 0;
|
||||
return nullptr;
|
||||
const QString functionWithTag = function->name() + ':' + name();
|
||||
config = new QtTestConfiguration();
|
||||
config->setTestCases(QStringList(functionWithTag));
|
||||
@@ -138,7 +138,7 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
|
||||
if (!project || type() != Root)
|
||||
return result;
|
||||
|
||||
QtTestConfiguration *testConfiguration = 0;
|
||||
QtTestConfiguration *testConfiguration = nullptr;
|
||||
|
||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
||||
const TestTreeItem *child = childItem(row);
|
||||
@@ -231,7 +231,7 @@ QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
|
||||
|
||||
TestTreeItem *QtTestTreeItem::find(const TestParseResult *result)
|
||||
{
|
||||
QTC_ASSERT(result, return 0);
|
||||
QTC_ASSERT(result, return nullptr);
|
||||
|
||||
switch (type()) {
|
||||
case Root:
|
||||
@@ -245,7 +245,7 @@ TestTreeItem *QtTestTreeItem::find(const TestParseResult *result)
|
||||
case TestSpecialFunction:
|
||||
return findChildByName(result->name);
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,9 +277,9 @@ TestTreeItem *QtTestTreeItem::findChildByNameAndInheritance(const QString &name,
|
||||
|
||||
QString QtTestTreeItem::nameSuffix() const
|
||||
{
|
||||
static QString inheritedSuffix = QLatin1String(" [")
|
||||
static QString inheritedSuffix = QString(" [")
|
||||
+ QCoreApplication::translate("QtTestTreeItem", "inherited")
|
||||
+ QLatin1String("]");
|
||||
+ QString("]");
|
||||
return m_inherited ? inheritedSuffix : QString();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ bool TestAstVisitor::visit(CPlusPlus::CallAST *ast)
|
||||
bool TestAstVisitor::visit(CPlusPlus::CompoundStatementAST *ast)
|
||||
{
|
||||
if (!ast || !ast->symbol) {
|
||||
m_currentScope = 0;
|
||||
m_currentScope = nullptr;
|
||||
return false;
|
||||
}
|
||||
m_currentScope = ast->symbol->asScope();
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
|
||||
private:
|
||||
QString m_className;
|
||||
CPlusPlus::Scope *m_currentScope = 0;
|
||||
CPlusPlus::Scope *m_currentScope = nullptr;
|
||||
CPlusPlus::Document::Ptr m_currentDoc;
|
||||
CPlusPlus::Snapshot m_snapshot;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ TestTreeItem *QuickTestParseResult::createTestTreeItem() const
|
||||
item->setProFile(proFile);
|
||||
item->setLine(line);
|
||||
item->setColumn(column);
|
||||
foreach (const TestParseResult *funcResult, children)
|
||||
for (const TestParseResult *funcResult : children)
|
||||
item->appendChild(funcResult->createTestTreeItem());
|
||||
return item;
|
||||
}
|
||||
@@ -62,9 +62,9 @@ static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
|
||||
|
||||
const QList<CPlusPlus::Document::Include> includes = doc->resolvedIncludes();
|
||||
|
||||
foreach (const CPlusPlus::Document::Include &inc, includes) {
|
||||
for (const CPlusPlus::Document::Include &inc : includes) {
|
||||
if (inc.unresolvedFileName() == "QtQuickTest/quicktest.h") {
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
for (const QString &prefix : expectedHeaderPrefixes) {
|
||||
if (inc.resolvedFileName().endsWith(
|
||||
QString("%1/quicktest.h").arg(prefix))) {
|
||||
return true;
|
||||
@@ -73,8 +73,8 @@ static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const QString &include, snapshot.allIncludesForDocument(doc->fileName())) {
|
||||
foreach (const QString &prefix, expectedHeaderPrefixes) {
|
||||
for (const QString &include : snapshot.allIncludesForDocument(doc->fileName())) {
|
||||
for (const QString &prefix : expectedHeaderPrefixes) {
|
||||
if (include.endsWith(QString("%1/quicktest.h").arg(prefix)))
|
||||
return true;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ static QString quickTestSrcDir(const CppTools::CppModelManager *cppMM,
|
||||
const QList<CppTools::ProjectPart::Ptr> parts = cppMM->projectPart(fileName);
|
||||
if (parts.size() > 0) {
|
||||
QByteArray projDefines(parts.at(0)->projectDefines);
|
||||
foreach (const QByteArray &line, projDefines.split('\n')) {
|
||||
for (const QByteArray &line : projDefines.split('\n')) {
|
||||
if (line.contains(qtsd)) {
|
||||
QByteArray result = line.mid(line.indexOf(qtsd) + qtsd.length());
|
||||
if (result.startsWith('"'))
|
||||
@@ -107,7 +107,7 @@ static QString quickTestName(const CPlusPlus::Document::Ptr &doc)
|
||||
{
|
||||
const QList<CPlusPlus::Document::MacroUse> macros = doc->macroUses();
|
||||
|
||||
foreach (const CPlusPlus::Document::MacroUse ¯o, macros) {
|
||||
for (const CPlusPlus::Document::MacroUse ¯o : macros) {
|
||||
if (!macro.isFunctionLike())
|
||||
continue;
|
||||
const QByteArray name = macro.macro().name();
|
||||
@@ -142,9 +142,9 @@ static QList<QmlJS::Document::Ptr> scanDirectoryForQuickTestQmlFiles(const QStri
|
||||
}
|
||||
QList<QmlJS::Document::Ptr> foundDocs;
|
||||
|
||||
foreach (const QString &path, dirs) {
|
||||
for (const QString &path : dirs) {
|
||||
const QList<QmlJS::Document::Ptr> docs = snapshot.documentsInDirectory(path);
|
||||
foreach (const QmlJS::Document::Ptr &doc, docs) {
|
||||
for (const QmlJS::Document::Ptr &doc : docs) {
|
||||
const QString fileName(QFileInfo(doc->fileName()).fileName());
|
||||
if (fileName.startsWith("tst_") && fileName.endsWith(".qml"))
|
||||
foundDocs << doc;
|
||||
@@ -218,7 +218,7 @@ static bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterfa
|
||||
|
||||
const QList<QmlJS::Document::Ptr> qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir);
|
||||
bool result = false;
|
||||
foreach (const QmlJS::Document::Ptr &qmlJSDoc, qmlDocs)
|
||||
for (const QmlJS::Document::Ptr &qmlJSDoc : qmlDocs)
|
||||
result |= checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id, proFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -112,9 +112,9 @@ bool QuickTestTreeItem::canProvideTestConfiguration() const
|
||||
TestConfiguration *QuickTestTreeItem::testConfiguration() const
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
QTC_ASSERT(project, return 0);
|
||||
QTC_ASSERT(project, return nullptr);
|
||||
|
||||
QuickTestConfiguration *config = 0;
|
||||
QuickTestConfiguration *config = nullptr;
|
||||
switch (type()) {
|
||||
case TestCase: {
|
||||
QStringList testFunctions;
|
||||
@@ -136,7 +136,7 @@ TestConfiguration *QuickTestTreeItem::testConfiguration() const
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
|
||||
if (!project || type() != Root)
|
||||
return result;
|
||||
|
||||
QuickTestConfiguration *tc = 0;
|
||||
QuickTestConfiguration *tc = nullptr;
|
||||
QHash<QString, QuickTestConfiguration *> foundProFiles;
|
||||
// unnamed Quick Tests must be handled first
|
||||
if (TestTreeItem *unnamed = unnamedQuickTests()) {
|
||||
@@ -266,7 +266,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
|
||||
|
||||
TestTreeItem *QuickTestTreeItem::find(const TestParseResult *result)
|
||||
{
|
||||
QTC_ASSERT(result, return 0);
|
||||
QTC_ASSERT(result, return nullptr);
|
||||
|
||||
switch (type()) {
|
||||
case Root:
|
||||
@@ -275,7 +275,7 @@ TestTreeItem *QuickTestTreeItem::find(const TestParseResult *result)
|
||||
return name().isEmpty() ? findChildByNameAndFile(result->name, result->fileName)
|
||||
: findChildByName(result->name);
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,14 +310,14 @@ bool QuickTestTreeItem::lessThan(const TestTreeItem *other, TestTreeItem::SortMo
|
||||
TestTreeItem *QuickTestTreeItem::unnamedQuickTests() const
|
||||
{
|
||||
if (type() != Root)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
||||
TestTreeItem *child = childItem(row);
|
||||
if (child->name().isEmpty())
|
||||
return child;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -123,7 +123,7 @@ void TestCodeParser::syncTestFrameworks(const QVector<Core::Id> &frameworkIds)
|
||||
m_testCodeParsers.clear();
|
||||
TestFrameworkManager *frameworkManager = TestFrameworkManager::instance();
|
||||
qCDebug(LOG) << "Setting" << frameworkIds << "as current parsers";
|
||||
foreach (const Core::Id &id, frameworkIds) {
|
||||
for (const Core::Id &id : frameworkIds) {
|
||||
ITestParser *testParser = frameworkManager->testParserForTestFramework(id);
|
||||
QTC_ASSERT(testParser, continue);
|
||||
m_testCodeParsers.append(testParser);
|
||||
@@ -292,7 +292,7 @@ bool TestCodeParser::postponed(const QStringList &fileList)
|
||||
if (m_fullUpdatePostponed)
|
||||
return true;
|
||||
// partial parse triggered, postpone or add current files to already postponed partial
|
||||
foreach (const QString &file, fileList)
|
||||
for (const QString &file : fileList)
|
||||
m_postponedFiles.insert(file);
|
||||
m_partialUpdatePostponed = true;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ static void parseFileForTests(const QVector<ITestParser *> &parsers,
|
||||
QFutureInterface<TestParseResultPtr> &futureInterface,
|
||||
const QString &fileName)
|
||||
{
|
||||
foreach (ITestParser *parser, parsers) {
|
||||
for (ITestParser *parser : parsers) {
|
||||
if (futureInterface.isCanceled())
|
||||
return;
|
||||
if (parser->processDocument(futureInterface, fileName))
|
||||
@@ -357,7 +357,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
|
||||
});
|
||||
m_model->markAllForRemoval();
|
||||
} else {
|
||||
foreach (const QString &filePath, list)
|
||||
for (const QString &filePath : list)
|
||||
m_model->markForRemoval(filePath);
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList)
|
||||
return;
|
||||
}
|
||||
qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "StartParsing";
|
||||
foreach (ITestParser *parser, m_testCodeParsers)
|
||||
for (ITestParser *parser : m_testCodeParsers)
|
||||
parser->init(list);
|
||||
|
||||
QFuture<TestParseResultPtr> future = Utils::map(list,
|
||||
|
||||
@@ -46,7 +46,7 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.frameworkmanager")
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
TestFrameworkManager *s_instance = 0;
|
||||
TestFrameworkManager *s_instance = nullptr;
|
||||
|
||||
TestFrameworkManager::TestFrameworkManager()
|
||||
{
|
||||
@@ -100,7 +100,7 @@ void TestFrameworkManager::activateFrameworksFromSettings(QSharedPointer<TestSet
|
||||
|
||||
QString TestFrameworkManager::frameworkNameForId(const Core::Id &id) const
|
||||
{
|
||||
ITestFramework *framework = m_registeredFrameworks.value(id, 0);
|
||||
ITestFramework *framework = m_registeredFrameworks.value(id, nullptr);
|
||||
return framework ? QString::fromLatin1(framework->name()) : QString();
|
||||
}
|
||||
|
||||
@@ -143,15 +143,15 @@ QVector<Core::Id> TestFrameworkManager::sortedActiveFrameworkIds() const
|
||||
|
||||
TestTreeItem *TestFrameworkManager::rootNodeForTestFramework(const Core::Id &frameworkId) const
|
||||
{
|
||||
ITestFramework *framework = m_registeredFrameworks.value(frameworkId, 0);
|
||||
return framework ? framework->rootNode() : 0;
|
||||
ITestFramework *framework = m_registeredFrameworks.value(frameworkId, nullptr);
|
||||
return framework ? framework->rootNode() : nullptr;
|
||||
}
|
||||
|
||||
ITestParser *TestFrameworkManager::testParserForTestFramework(const Core::Id &frameworkId) const
|
||||
{
|
||||
ITestFramework *framework = m_registeredFrameworks.value(frameworkId, 0);
|
||||
ITestFramework *framework = m_registeredFrameworks.value(frameworkId, nullptr);
|
||||
if (!framework)
|
||||
return 0;
|
||||
return nullptr;
|
||||
ITestParser *testParser = framework->testParser();
|
||||
qCDebug(LOG) << "Setting" << frameworkId << "as Id for test parser";
|
||||
testParser->setId(frameworkId);
|
||||
|
||||
@@ -118,10 +118,10 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
const bool hasTests = m_model->hasTests();
|
||||
|
||||
QMenu menu;
|
||||
QAction *runThisTest = 0;
|
||||
QAction *runWithoutDeploy = 0;
|
||||
QAction *debugThisTest = 0;
|
||||
QAction *debugWithoutDeploy = 0;
|
||||
QAction *runThisTest = nullptr;
|
||||
QAction *runWithoutDeploy = nullptr;
|
||||
QAction *debugThisTest = nullptr;
|
||||
QAction *debugWithoutDeploy = nullptr;
|
||||
const QModelIndexList list = m_view->selectionModel()->selectedIndexes();
|
||||
if (list.size() == 1) {
|
||||
const QModelIndex index = list.first();
|
||||
@@ -312,7 +312,7 @@ void TestNavigationWidget::onRunThisTestTriggered(TestRunner::Mode runMode)
|
||||
configuration = item->debugConfiguration();
|
||||
break;
|
||||
default:
|
||||
configuration = 0;
|
||||
configuration = nullptr;
|
||||
}
|
||||
|
||||
if (configuration) {
|
||||
|
||||
@@ -95,37 +95,37 @@ QString TestResult::resultToString(const Result::Type type)
|
||||
switch (type) {
|
||||
case Result::Pass:
|
||||
case Result::MessageTestCaseSuccess:
|
||||
return QLatin1String("PASS");
|
||||
return QString("PASS");
|
||||
case Result::Fail:
|
||||
case Result::MessageTestCaseFail:
|
||||
return QLatin1String("FAIL");
|
||||
return QString("FAIL");
|
||||
case Result::ExpectedFail:
|
||||
return QLatin1String("XFAIL");
|
||||
return QString("XFAIL");
|
||||
case Result::UnexpectedPass:
|
||||
return QLatin1String("XPASS");
|
||||
return QString("XPASS");
|
||||
case Result::Skip:
|
||||
return QLatin1String("SKIP");
|
||||
return QString("SKIP");
|
||||
case Result::Benchmark:
|
||||
return QLatin1String("BENCH");
|
||||
return QString("BENCH");
|
||||
case Result::MessageDebug:
|
||||
return QLatin1String("DEBUG");
|
||||
return QString("DEBUG");
|
||||
case Result::MessageInfo:
|
||||
return QLatin1String("INFO");
|
||||
return QString("INFO");
|
||||
case Result::MessageWarn:
|
||||
case Result::MessageTestCaseWarn:
|
||||
return QLatin1String("WARN");
|
||||
return QString("WARN");
|
||||
case Result::MessageFatal:
|
||||
return QLatin1String("FATAL");
|
||||
return QString("FATAL");
|
||||
case Result::MessageSystem:
|
||||
return QLatin1String("SYSTEM");
|
||||
return QString("SYSTEM");
|
||||
case Result::BlacklistedPass:
|
||||
return QLatin1String("BPASS");
|
||||
return QString("BPASS");
|
||||
case Result::BlacklistedFail:
|
||||
return QLatin1String("BFAIL");
|
||||
return QString("BFAIL");
|
||||
default:
|
||||
if (type >= Result::INTERNAL_MESSAGES_BEGIN && type <= Result::INTERNAL_MESSAGES_END)
|
||||
return QString();
|
||||
return QLatin1String("UNKNOWN");
|
||||
return QString("UNKNOWN");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ bool TestResult::isIntermediateFor(const TestResult *other) const
|
||||
|
||||
TestResult *TestResult::createIntermediateResultFor(const TestResult *other)
|
||||
{
|
||||
QTC_ASSERT(other, return 0);
|
||||
QTC_ASSERT(other, return nullptr);
|
||||
TestResult *intermediate = new TestResult(other->m_name);
|
||||
return intermediate;
|
||||
}
|
||||
|
||||
@@ -149,13 +149,13 @@ TestResultItem *TestResultItem::intermediateFor(const TestResultItem *item) cons
|
||||
if (testResult->isIntermediateFor(otherResult))
|
||||
return child;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TestResultItem *TestResultItem::createAndAddIntermediateFor(const TestResultItem *child)
|
||||
{
|
||||
TestResultPtr result(m_testResult->createIntermediateResultFor(child->testResult()));
|
||||
QTC_ASSERT(!result.isNull(), return 0);
|
||||
QTC_ASSERT(!result.isNull(), return nullptr);
|
||||
result->setResult(Result::MessageIntermediate);
|
||||
TestResultItem *intermediate = new TestResultItem(result);
|
||||
appendChild(intermediate);
|
||||
|
||||
@@ -165,7 +165,7 @@ void TestResultsPane::createToolButtons()
|
||||
|
||||
m_runSelected = new QToolButton(m_treeView);
|
||||
Utils::Icon runSelectedIcon = Utils::Icons::RUN_SMALL_TOOLBAR;
|
||||
foreach (const Utils::IconMaskAndColor &maskAndColor, Icons::RUN_SELECTED_OVERLAY)
|
||||
for (const Utils::IconMaskAndColor &maskAndColor : Icons::RUN_SELECTED_OVERLAY)
|
||||
runSelectedIcon.append(maskAndColor);
|
||||
m_runSelected->setIcon(runSelectedIcon.icon());
|
||||
m_runSelected->setToolTip(tr("Run Selected Tests"));
|
||||
@@ -190,19 +190,19 @@ void TestResultsPane::createToolButtons()
|
||||
m_filterButton->setMenu(m_filterMenu);
|
||||
}
|
||||
|
||||
static TestResultsPane *m_instance = 0;
|
||||
static TestResultsPane *s_instance = nullptr;
|
||||
|
||||
TestResultsPane *TestResultsPane::instance()
|
||||
{
|
||||
if (!m_instance)
|
||||
m_instance = new TestResultsPane;
|
||||
return m_instance;
|
||||
if (!s_instance)
|
||||
s_instance = new TestResultsPane;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
TestResultsPane::~TestResultsPane()
|
||||
{
|
||||
delete m_treeView;
|
||||
m_instance = 0;
|
||||
s_instance = nullptr;
|
||||
}
|
||||
|
||||
void TestResultsPane::addTestResult(const TestResultPtr &result)
|
||||
@@ -419,7 +419,7 @@ void TestResultsPane::initializeFilterMenu()
|
||||
textAndType.insert(Result::MessageDebug, tr("Debug Messages"));
|
||||
textAndType.insert(Result::MessageWarn, tr("Warning Messages"));
|
||||
textAndType.insert(Result::MessageInternal, tr("Internal Messages"));
|
||||
foreach (Result::Type result, textAndType.keys()) {
|
||||
for (Result::Type result : textAndType.keys()) {
|
||||
QAction *action = new QAction(m_filterMenu);
|
||||
action->setText(textAndType.value(result));
|
||||
action->setCheckable(true);
|
||||
@@ -464,7 +464,7 @@ void TestResultsPane::updateSummaryLabel()
|
||||
|
||||
void TestResultsPane::enableAllFilter()
|
||||
{
|
||||
foreach (QAction *action, m_filterMenu->actions()) {
|
||||
for (QAction *action : m_filterMenu->actions()) {
|
||||
if (action->isCheckable())
|
||||
action->setChecked(true);
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static TestRunner *m_instance = 0;
|
||||
static TestRunner *s_instance = nullptr;
|
||||
|
||||
TestRunner *TestRunner::instance()
|
||||
{
|
||||
if (!m_instance)
|
||||
m_instance = new TestRunner;
|
||||
return m_instance;
|
||||
if (!s_instance)
|
||||
s_instance = new TestRunner;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
TestRunner::TestRunner(QObject *parent) :
|
||||
@@ -85,7 +85,7 @@ TestRunner::~TestRunner()
|
||||
{
|
||||
qDeleteAll(m_selectedTests);
|
||||
m_selectedTests.clear();
|
||||
m_instance = 0;
|
||||
s_instance = nullptr;
|
||||
}
|
||||
|
||||
void TestRunner::setSelectedTests(const QList<TestConfiguration *> &selected)
|
||||
@@ -102,7 +102,7 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
|
||||
const int timeout = settings.timeout;
|
||||
QEventLoop eventLoop;
|
||||
int testCaseCount = 0;
|
||||
foreach (TestConfiguration *config, selectedTests) {
|
||||
for (TestConfiguration *config : selectedTests) {
|
||||
config->completeTestInformation(TestRunner::Run);
|
||||
if (config->project()) {
|
||||
testCaseCount += config->testCaseCount();
|
||||
@@ -119,7 +119,7 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
|
||||
futureInterface.setProgressRange(0, testCaseCount);
|
||||
futureInterface.setProgressValue(0);
|
||||
|
||||
foreach (const TestConfiguration *testConfiguration, selectedTests) {
|
||||
for (const TestConfiguration *testConfiguration : selectedTests) {
|
||||
QScopedPointer<TestOutputReader> outputReader;
|
||||
outputReader.reset(testConfiguration->outputReader(futureInterface, &testProcess));
|
||||
QTC_ASSERT(outputReader, continue);
|
||||
@@ -166,11 +166,11 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
|
||||
}
|
||||
} else {
|
||||
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
||||
QString::fromLatin1("Failed to start test for project \"%1\".").arg(testConfiguration->displayName()))));
|
||||
QString("Failed to start test for project \"%1\".").arg(testConfiguration->displayName()))));
|
||||
}
|
||||
if (testProcess.exitStatus() == QProcess::CrashExit) {
|
||||
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
|
||||
QString::fromLatin1("Test for project \"%1\" crashed.").arg(testConfiguration->displayName()))));
|
||||
QString("Test for project \"%1\" crashed.").arg(testConfiguration->displayName()))));
|
||||
}
|
||||
|
||||
if (canceledByTimeout) {
|
||||
@@ -204,7 +204,7 @@ void TestRunner::prepareToRunTests(Mode mode)
|
||||
// clear old log and output pane
|
||||
TestResultsPane::instance()->clearContents();
|
||||
|
||||
foreach (TestConfiguration *config, m_selectedTests) {
|
||||
for (TestConfiguration *config : m_selectedTests) {
|
||||
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
|
||||
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
|
||||
tr("Project's run configuration was guessed for \"%1\".\n"
|
||||
|
||||
@@ -51,7 +51,7 @@ static QIcon testTreeIcon(TestTreeItem::Type type)
|
||||
QIcon(),
|
||||
CPlusPlus::Icons::iconForType(CPlusPlus::Icons::ClassIconType),
|
||||
CPlusPlus::Icons::iconForType(CPlusPlus::Icons::SlotPrivateIconType),
|
||||
QIcon(QLatin1String(":/images/data.png"))
|
||||
QIcon(":/images/data.png")
|
||||
};
|
||||
|
||||
if (int(type) >= int(sizeof icons / sizeof *icons))
|
||||
@@ -344,7 +344,7 @@ TestTreeItem *TestTreeItem::findChildBy(CompareFunction compare) const
|
||||
if (compare(child))
|
||||
return child;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -56,13 +56,13 @@ TestTreeModel::TestTreeModel(QObject *parent) :
|
||||
setupParsingConnections();
|
||||
}
|
||||
|
||||
static TestTreeModel *m_instance = 0;
|
||||
static TestTreeModel *s_instance = nullptr;
|
||||
|
||||
TestTreeModel *TestTreeModel::instance()
|
||||
{
|
||||
if (!m_instance)
|
||||
m_instance = new TestTreeModel;
|
||||
return m_instance;
|
||||
if (!s_instance)
|
||||
s_instance = new TestTreeModel;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
TestTreeModel::~TestTreeModel()
|
||||
@@ -75,7 +75,7 @@ TestTreeModel::~TestTreeModel()
|
||||
takeItem(item); // do NOT delete the item as it's still a ptr hold by TestFrameworkManager
|
||||
}
|
||||
|
||||
m_instance = 0;
|
||||
s_instance = nullptr;
|
||||
}
|
||||
|
||||
void TestTreeModel::setupParsingConnections()
|
||||
@@ -177,7 +177,7 @@ void TestTreeModel::syncTestFrameworks()
|
||||
|
||||
TestFrameworkManager *frameworkManager = TestFrameworkManager::instance();
|
||||
QVector<Core::Id> sortedIds = frameworkManager->sortedActiveFrameworkIds();
|
||||
foreach (const Core::Id &id, sortedIds)
|
||||
for (const Core::Id &id : sortedIds)
|
||||
rootItem()->appendChild(frameworkManager->rootNodeForTestFramework(id));
|
||||
|
||||
m_parser->syncTestFrameworks(sortedIds);
|
||||
@@ -186,7 +186,7 @@ void TestTreeModel::syncTestFrameworks()
|
||||
|
||||
void TestTreeModel::removeFiles(const QStringList &files)
|
||||
{
|
||||
foreach (const QString &file, files)
|
||||
for (const QString &file : files)
|
||||
markForRemoval(file);
|
||||
sweep();
|
||||
}
|
||||
@@ -268,7 +268,7 @@ void TestTreeModel::handleParseResult(const TestParseResult *result, TestTreeIte
|
||||
emit dataChanged(idx, idx);
|
||||
}
|
||||
// recursively handle children of this item
|
||||
foreach (const TestParseResult *child, result->children)
|
||||
for (const TestParseResult *child : result->children)
|
||||
handleParseResult(child, toBeModified);
|
||||
return;
|
||||
}
|
||||
@@ -324,14 +324,14 @@ TestTreeItem *TestTreeModel::unnamedQuickTests() const
|
||||
{
|
||||
TestTreeItem *rootNode = quickRootNode();
|
||||
if (!rootNode)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
|
||||
TestTreeItem *child = rootNode->childItem(row);
|
||||
if (child->name().isEmpty())
|
||||
return child;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int TestTreeModel::namedQuickTestsCount() const
|
||||
|
||||
Reference in New Issue
Block a user