diff options
author | Christian Stenger <christian.stenger@qt.io> | 2019-08-19 14:46:20 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2019-09-02 09:04:28 +0000 |
commit | 265498cadcf2c5f5bce264296b86940a78ae7f83 (patch) | |
tree | 1314d7190357661e3341e626aa36e78915204093 /src/plugins/autotest | |
parent | 03b80025a94542e9f6dc09ace431f82cfabfabd6 (diff) | |
download | qt-creator-265498cadcf2c5f5bce264296b86940a78ae7f83.tar.gz |
AutoTest: De-noise code a bit
Change-Id: I4585ebfb53623221c713ab0e8e254ba59a4e5920
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/autotest')
-rw-r--r-- | src/plugins/autotest/boost/boostcodeparser.cpp | 2 | ||||
-rw-r--r-- | src/plugins/autotest/qtest/qttestvisitors.cpp | 56 | ||||
-rw-r--r-- | src/plugins/autotest/quick/quicktestparser.cpp | 50 | ||||
-rw-r--r-- | src/plugins/autotest/testframeworkmanager.cpp | 42 | ||||
-rw-r--r-- | src/plugins/autotest/testresultspane.cpp | 26 | ||||
-rw-r--r-- | src/plugins/autotest/testrunner.cpp | 50 |
6 files changed, 116 insertions, 110 deletions
diff --git a/src/plugins/autotest/boost/boostcodeparser.cpp b/src/plugins/autotest/boost/boostcodeparser.cpp index 79c612285b..42504a0562 100644 --- a/src/plugins/autotest/boost/boostcodeparser.cpp +++ b/src/plugins/autotest/boost/boostcodeparser.cpp @@ -70,7 +70,7 @@ static BoostTestCodeLocationAndType locationAndTypeFromToken(const Token &tkn, static Tokens tokensForSource(const QByteArray &source, const LanguageFeatures &features) { - CPlusPlus::SimpleLexer lexer; + SimpleLexer lexer; lexer.setPreprocessorMode(false); // or true? does not make a difference so far.. lexer.setLanguageFeatures(features); return lexer(QString::fromUtf8(source)); diff --git a/src/plugins/autotest/qtest/qttestvisitors.cpp b/src/plugins/autotest/qtest/qttestvisitors.cpp index 1992520438..48177921bf 100644 --- a/src/plugins/autotest/qtest/qttestvisitors.cpp +++ b/src/plugins/autotest/qtest/qttestvisitors.cpp @@ -32,6 +32,8 @@ #include <cpptools/cppmodelmanager.h> #include <utils/qtcassert.h> +using namespace CPlusPlus; + namespace Autotest { namespace Internal { @@ -39,21 +41,21 @@ static QStringList specialFunctions({"initTestCase", "cleanupTestCase", "init", /************************** Cpp Test Symbol Visitor ***************************/ -TestVisitor::TestVisitor(const QString &fullQualifiedClassName, const CPlusPlus::Snapshot &snapshot) +TestVisitor::TestVisitor(const QString &fullQualifiedClassName, const Snapshot &snapshot) : m_className(fullQualifiedClassName), m_snapshot(snapshot) { } -bool TestVisitor::visit(CPlusPlus::Class *symbol) +bool TestVisitor::visit(Class *symbol) { - const CPlusPlus::Overview o; - CPlusPlus::LookupContext lc; + const Overview o; + LookupContext lc; int count = symbol->memberCount(); for (int i = 0; i < count; ++i) { - CPlusPlus::Symbol *member = symbol->memberAt(i); - CPlusPlus::Type *type = member->type().type(); + Symbol *member = symbol->memberAt(i); + Type *type = member->type().type(); const QString className = o.prettyName(lc.fullyQualifiedName(member->enclosingClass())); if (className != m_className) @@ -66,7 +68,7 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol) const QString name = o.prettyName(func->name()); QtTestCodeLocationAndType locationAndType; - CPlusPlus::Function *functionDefinition = m_symbolFinder.findMatchingDefinition( + Function *functionDefinition = m_symbolFinder.findMatchingDefinition( func, m_snapshot, true); if (functionDefinition && functionDefinition->fileId()) { locationAndType.m_name = QString::fromUtf8(functionDefinition->fileName()); @@ -88,7 +90,7 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol) } } for (int counter = 0, end = symbol->baseClassCount(); counter < end; ++counter) { - if (CPlusPlus::BaseClass *base = symbol->baseClassAt(counter)) { + if (BaseClass *base = symbol->baseClassAt(counter)) { const QString &baseClassName = o.prettyName(lc.fullyQualifiedName(base)); if (baseClassName != "QObject") m_baseClasses.insert(baseClassName); @@ -100,14 +102,14 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol) /**************************** Cpp Test AST Visitor ****************************/ -TestAstVisitor::TestAstVisitor(CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot) +TestAstVisitor::TestAstVisitor(Document::Ptr doc, const Snapshot &snapshot) : ASTVisitor(doc->translationUnit()), m_currentDoc(doc), m_snapshot(snapshot) { } -bool TestAstVisitor::visit(CPlusPlus::CallAST *ast) +bool TestAstVisitor::visit(CallAST *ast) { if (!m_currentScope || m_currentDoc.isNull()) return false; @@ -115,15 +117,15 @@ bool TestAstVisitor::visit(CPlusPlus::CallAST *ast) if (const auto expressionAST = ast->base_expression) { if (const auto idExpressionAST = expressionAST->asIdExpression()) { if (const auto qualifiedNameAST = idExpressionAST->name->asQualifiedName()) { - const CPlusPlus::Overview o; + const Overview o; const QString prettyName = o.prettyName(qualifiedNameAST->name); if (prettyName == "QTest::qExec") { if (const auto expressionListAST = ast->expression_list) { // first argument is the one we need if (const auto argumentExpressionAST = expressionListAST->value) { - CPlusPlus::TypeOfExpression toe; + TypeOfExpression toe; toe.init(m_currentDoc, m_snapshot); - QList<CPlusPlus::LookupItem> toeItems + QList<LookupItem> toeItems = toe(argumentExpressionAST, m_currentDoc, m_currentScope); if (toeItems.size()) { @@ -139,7 +141,7 @@ bool TestAstVisitor::visit(CPlusPlus::CallAST *ast) return false; } -bool TestAstVisitor::visit(CPlusPlus::CompoundStatementAST *ast) +bool TestAstVisitor::visit(CompoundStatementAST *ast) { if (!ast || !ast->symbol) { m_currentScope = nullptr; @@ -151,13 +153,13 @@ bool TestAstVisitor::visit(CPlusPlus::CompoundStatementAST *ast) /********************** Test Data Function AST Visitor ************************/ -TestDataFunctionVisitor::TestDataFunctionVisitor(CPlusPlus::Document::Ptr doc) - : CPlusPlus::ASTVisitor(doc->translationUnit()), +TestDataFunctionVisitor::TestDataFunctionVisitor(Document::Ptr doc) + : ASTVisitor(doc->translationUnit()), m_currentDoc(doc) { } -bool TestDataFunctionVisitor::visit(CPlusPlus::UsingDirectiveAST *ast) +bool TestDataFunctionVisitor::visit(UsingDirectiveAST *ast) { if (auto nameAST = ast->name) { if (m_overview.prettyName(nameAST->name) == "QTest") { @@ -169,14 +171,14 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::UsingDirectiveAST *ast) return true; } -bool TestDataFunctionVisitor::visit(CPlusPlus::FunctionDefinitionAST *ast) +bool TestDataFunctionVisitor::visit(FunctionDefinitionAST *ast) { if (ast->declarator) { - CPlusPlus::DeclaratorIdAST *id = ast->declarator->core_declarator->asDeclaratorId(); + DeclaratorIdAST *id = ast->declarator->core_declarator->asDeclaratorId(); if (!id || !ast->symbol || ast->symbol->argumentCount() != 0) return false; - CPlusPlus::LookupContext lc; + LookupContext lc; const QString prettyName = m_overview.prettyName(lc.fullyQualifiedName(ast->symbol)); // do not handle functions that aren't real test data functions if (!prettyName.endsWith("_data")) @@ -190,7 +192,7 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::FunctionDefinitionAST *ast) return false; } -QString TestDataFunctionVisitor::extractNameFromAST(CPlusPlus::StringLiteralAST *ast, bool *ok) const +QString TestDataFunctionVisitor::extractNameFromAST(StringLiteralAST *ast, bool *ok) const { auto token = m_currentDoc->translationUnit()->tokenAt(ast->literal_token); if (!token.isStringLiteral()) { @@ -200,7 +202,7 @@ QString TestDataFunctionVisitor::extractNameFromAST(CPlusPlus::StringLiteralAST *ok = true; QString name = QString::fromUtf8(token.spell()); if (ast->next) { - CPlusPlus::StringLiteralAST *current = ast; + StringLiteralAST *current = ast; do { auto nextToken = m_currentDoc->translationUnit()->tokenAt(current->next->literal_token); name.append(QString::fromUtf8(nextToken.spell())); @@ -210,7 +212,7 @@ QString TestDataFunctionVisitor::extractNameFromAST(CPlusPlus::StringLiteralAST return name; } -bool TestDataFunctionVisitor::visit(CPlusPlus::CallAST *ast) +bool TestDataFunctionVisitor::visit(CallAST *ast) { if (m_currentFunction.isEmpty()) return true; @@ -242,13 +244,13 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::CallAST *ast) return true; } -bool TestDataFunctionVisitor::preVisit(CPlusPlus::AST *) +bool TestDataFunctionVisitor::preVisit(AST *) { ++m_currentAstDepth; return true; } -void TestDataFunctionVisitor::postVisit(CPlusPlus::AST *ast) +void TestDataFunctionVisitor::postVisit(AST *ast) { --m_currentAstDepth; m_insideUsingQTest &= m_currentAstDepth >= m_insideUsingQTestDepth; @@ -263,7 +265,7 @@ void TestDataFunctionVisitor::postVisit(CPlusPlus::AST *ast) m_currentTags.clear(); } -bool TestDataFunctionVisitor::newRowCallFound(CPlusPlus::CallAST *ast, unsigned *firstToken) const +bool TestDataFunctionVisitor::newRowCallFound(CallAST *ast, unsigned *firstToken) const { QTC_ASSERT(firstToken, return false); @@ -272,7 +274,7 @@ bool TestDataFunctionVisitor::newRowCallFound(CPlusPlus::CallAST *ast, unsigned bool found = false; - if (const CPlusPlus::IdExpressionAST *exp = ast->base_expression->asIdExpression()) { + if (const IdExpressionAST *exp = ast->base_expression->asIdExpression()) { if (!exp->name) return false; diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index 72592b32a0..478735048c 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -39,6 +39,8 @@ #include <utils/algorithm.h> #include <utils/qtcassert.h> +using namespace QmlJS; + namespace Autotest { namespace Internal { @@ -137,18 +139,18 @@ static QString quickTestName(const CPlusPlus::Document::Ptr &doc, return astVisitor.testBaseName(); } -QList<QmlJS::Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(const QString &srcDir) const +QList<Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(const QString &srcDir) const { QStringList dirs(srcDir); - QmlJS::ModelManagerInterface *qmlJsMM = QmlJSTools::Internal::ModelManager::instance(); + ModelManagerInterface *qmlJsMM = QmlJSTools::Internal::ModelManager::instance(); // make sure even files not listed in pro file are available inside the snapshot QFutureInterface<void> future; - QmlJS::PathsAndLanguages paths; - paths.maybeInsert(Utils::FilePath::fromString(srcDir), QmlJS::Dialect::Qml); - QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM, + PathsAndLanguages paths; + paths.maybeInsert(Utils::FilePath::fromString(srcDir), Dialect::Qml); + ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM, false /*emitDocumentChanges*/, false /*onlyTheLib*/, true /*forceRescan*/ ); - const QmlJS::Snapshot snapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot(); + const Snapshot snapshot = QmlJSTools::Internal::ModelManager::instance()->snapshot(); QDirIterator it(srcDir, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (it.hasNext()) { it.next(); @@ -157,11 +159,11 @@ QList<QmlJS::Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(c } emit updateWatchPaths(dirs); - QList<QmlJS::Document::Ptr> foundDocs; + QList<Document::Ptr> foundDocs; for (const QString &path : dirs) { - const QList<QmlJS::Document::Ptr> docs = snapshot.documentsInDirectory(path); - for (const QmlJS::Document::Ptr &doc : docs) { + const QList<Document::Ptr> docs = snapshot.documentsInDirectory(path); + for (const Document::Ptr &doc : docs) { const QFileInfo fi(doc->fileName()); // using working copy above might provide no more existing files if (!fi.exists()) @@ -176,17 +178,17 @@ QList<QmlJS::Document::Ptr> QuickTestParser::scanDirectoryForQuickTestQmlFiles(c } static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr> futureInterface, - const QmlJS::Document::Ptr &qmlJSDoc, + const Document::Ptr &qmlJSDoc, const Core::Id &id, const QString &proFile = QString()) { if (qmlJSDoc.isNull()) return false; - QmlJS::AST::Node *ast = qmlJSDoc->ast(); + AST::Node *ast = qmlJSDoc->ast(); QTC_ASSERT(ast, return false); - QmlJS::Snapshot snapshot = QmlJS::ModelManagerInterface::instance()->snapshot(); + Snapshot snapshot = ModelManagerInterface::instance()->snapshot(); TestQmlVisitor qmlVisitor(qmlJSDoc, snapshot); - QmlJS::AST::Node::accept(ast, &qmlVisitor); + AST::Node::accept(ast, &qmlVisitor); if (!qmlVisitor.isValid()) return false; @@ -243,9 +245,9 @@ bool QuickTestParser::handleQtQuickTest(QFutureInterface<TestParseResultPtr> fut if (futureInterface.isCanceled()) return false; - const QList<QmlJS::Document::Ptr> qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir); + const QList<Document::Ptr> qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir); bool result = false; - for (const QmlJS::Document::Ptr &qmlJSDoc : qmlDocs) { + for (const Document::Ptr &qmlJSDoc : qmlDocs) { if (futureInterface.isCanceled()) break; result |= checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id, proFile); @@ -276,14 +278,14 @@ void QuickTestParser::handleDirectoryChanged(const QString &directory) return filesAndDates.value(file) != watched.value(file); }); if (timestampChanged) { - QmlJS::PathsAndLanguages paths; - paths.maybeInsert(Utils::FilePath::fromString(directory), QmlJS::Dialect::Qml); + PathsAndLanguages paths; + paths.maybeInsert(Utils::FilePath::fromString(directory), Dialect::Qml); QFutureInterface<void> future; - QmlJS::ModelManagerInterface *qmlJsMM = QmlJS::ModelManagerInterface::instance(); - QmlJS::ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM, - true /*emitDocumentChanges*/, - false /*onlyTheLib*/, - true /*forceRescan*/ ); + ModelManagerInterface *qmlJsMM = ModelManagerInterface::instance(); + ModelManagerInterface::importScan(future, qmlJsMM->workingCopy(), paths, qmlJsMM, + true /*emitDocumentChanges*/, + false /*onlyTheLib*/, + true /*forceRescan*/ ); } } } @@ -335,7 +337,7 @@ void QuickTestParser::init(const QStringList &filesToParse, bool fullParse) void QuickTestParser::release() { - m_qmlSnapshot = QmlJS::Snapshot(); + m_qmlSnapshot = Snapshot(); m_proFilesForQmlFiles.clear(); CppParser::release(); } @@ -347,7 +349,7 @@ bool QuickTestParser::processDocument(QFutureInterface<TestParseResultPtr> futur const QString &proFile = m_proFilesForQmlFiles.value(fileName); if (proFile.isEmpty()) return false; - QmlJS::Document::Ptr qmlJSDoc = m_qmlSnapshot.document(fileName); + Document::Ptr qmlJSDoc = m_qmlSnapshot.document(fileName); return checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id(), proFile); } if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName)) diff --git a/src/plugins/autotest/testframeworkmanager.cpp b/src/plugins/autotest/testframeworkmanager.cpp index 97a264a894..c6233d6026 100644 --- a/src/plugins/autotest/testframeworkmanager.cpp +++ b/src/plugins/autotest/testframeworkmanager.cpp @@ -42,6 +42,8 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.frameworkmanager", QtWarningMsg) +using namespace Core; + namespace Autotest { static TestFrameworkManager *s_instance = nullptr; @@ -73,7 +75,7 @@ TestFrameworkManager::~TestFrameworkManager() bool TestFrameworkManager::registerTestFramework(ITestFramework *framework) { QTC_ASSERT(framework, return false); - Core::Id id = Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(framework->name()); + Id id = Id(Constants::FRAMEWORK_PREFIX).withSuffix(framework->name()); QTC_ASSERT(!m_registeredFrameworks.contains(id), delete framework; return false); // TODO check for unique priority before registering qCDebug(LOG) << "Registering" << id; @@ -98,30 +100,30 @@ void TestFrameworkManager::activateFrameworksFromSettings(QSharedPointer<Interna } } -QString TestFrameworkManager::frameworkNameForId(const Core::Id &id) const +QString TestFrameworkManager::frameworkNameForId(const Id &id) const { ITestFramework *framework = m_registeredFrameworks.value(id, nullptr); return framework ? QString::fromLatin1(framework->name()) : QString(); } -QList<Core::Id> TestFrameworkManager::registeredFrameworkIds() const +QList<Id> TestFrameworkManager::registeredFrameworkIds() const { return m_registeredFrameworks.keys(); } -QList<Core::Id> TestFrameworkManager::sortedRegisteredFrameworkIds() const +QList<Id> TestFrameworkManager::sortedRegisteredFrameworkIds() const { - QList<Core::Id> registered = m_registeredFrameworks.keys(); - Utils::sort(registered, [this] (const Core::Id &lhs, const Core::Id &rhs) { + QList<Id> registered = m_registeredFrameworks.keys(); + Utils::sort(registered, [this] (const Id &lhs, const Id &rhs) { return m_registeredFrameworks[lhs]->priority() < m_registeredFrameworks[rhs]->priority(); }); qCDebug(LOG) << "Registered frameworks sorted by priority" << registered; return registered; } -QList<Core::Id> TestFrameworkManager::activeFrameworkIds() const +QList<Id> TestFrameworkManager::activeFrameworkIds() const { - QList<Core::Id> active; + QList<Id> active; FrameworkIterator it = m_registeredFrameworks.begin(); FrameworkIterator end = m_registeredFrameworks.end(); for ( ; it != end; ++it) { @@ -131,23 +133,23 @@ QList<Core::Id> TestFrameworkManager::activeFrameworkIds() const return active; } -QList<Core::Id> TestFrameworkManager::sortedActiveFrameworkIds() const +QList<Id> TestFrameworkManager::sortedActiveFrameworkIds() const { - QList<Core::Id> active = activeFrameworkIds(); - Utils::sort(active, [this] (const Core::Id &lhs, const Core::Id &rhs) { + QList<Id> active = activeFrameworkIds(); + Utils::sort(active, [this] (const Id &lhs, const Id &rhs) { return m_registeredFrameworks[lhs]->priority() < m_registeredFrameworks[rhs]->priority(); }); qCDebug(LOG) << "Active frameworks sorted by priority" << active; return active; } -TestTreeItem *TestFrameworkManager::rootNodeForTestFramework(const Core::Id &frameworkId) const +TestTreeItem *TestFrameworkManager::rootNodeForTestFramework(const Id &frameworkId) const { ITestFramework *framework = m_registeredFrameworks.value(frameworkId, nullptr); return framework ? framework->rootNode() : nullptr; } -ITestParser *TestFrameworkManager::testParserForTestFramework(const Core::Id &frameworkId) const +ITestParser *TestFrameworkManager::testParserForTestFramework(const Id &frameworkId) const { ITestFramework *framework = m_registeredFrameworks.value(frameworkId, nullptr); if (!framework) @@ -159,7 +161,7 @@ ITestParser *TestFrameworkManager::testParserForTestFramework(const Core::Id &fr } QSharedPointer<IFrameworkSettings> TestFrameworkManager::settingsForTestFramework( - const Core::Id &frameworkId) const + const Id &frameworkId) const { return m_frameworkSettings.contains(frameworkId) ? m_frameworkSettings.value(frameworkId) : QSharedPointer<IFrameworkSettings>(); @@ -168,32 +170,32 @@ QSharedPointer<IFrameworkSettings> TestFrameworkManager::settingsForTestFramewor void TestFrameworkManager::synchronizeSettings(QSettings *s) { Internal::AutotestPlugin::settings()->fromSettings(s); - for (const Core::Id &id : m_frameworkSettings.keys()) { + for (const Id &id : m_frameworkSettings.keys()) { QSharedPointer<IFrameworkSettings> fSettings = settingsForTestFramework(id); if (!fSettings.isNull()) fSettings->fromSettings(s); } } -bool TestFrameworkManager::isActive(const Core::Id &frameworkId) const +bool TestFrameworkManager::isActive(const Id &frameworkId) const { ITestFramework *framework = m_registeredFrameworks.value(frameworkId); return framework ? framework->active() : false; } -bool TestFrameworkManager::groupingEnabled(const Core::Id &frameworkId) const +bool TestFrameworkManager::groupingEnabled(const Id &frameworkId) const { ITestFramework *framework = m_registeredFrameworks.value(frameworkId); return framework ? framework->grouping() : false; } -void TestFrameworkManager::setGroupingEnabledFor(const Core::Id &frameworkId, bool enabled) +void TestFrameworkManager::setGroupingEnabledFor(const Id &frameworkId, bool enabled) { if (ITestFramework *framework = m_registeredFrameworks.value(frameworkId)) framework->setGrouping(enabled); } -QString TestFrameworkManager::groupingToolTip(const Core::Id &frameworkId) const +QString TestFrameworkManager::groupingToolTip(const Id &frameworkId) const { if (ITestFramework *framework = m_registeredFrameworks.value(frameworkId)) return framework->groupingToolTip(); @@ -209,7 +211,7 @@ bool TestFrameworkManager::hasActiveFrameworks() const return false; } -unsigned TestFrameworkManager::priority(const Core::Id &frameworkId) const +unsigned TestFrameworkManager::priority(const Id &frameworkId) const { if (ITestFramework *framework = m_registeredFrameworks.value(frameworkId)) return framework->priority(); diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 468cc9e32c..be7b12657f 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -61,6 +61,8 @@ #include <QToolButton> #include <QVBoxLayout> +using namespace Core; + namespace Autotest { namespace Internal { @@ -80,8 +82,8 @@ void ResultsTreeView::keyPressEvent(QKeyEvent *event) } TestResultsPane::TestResultsPane(QObject *parent) : - Core::IOutputPane(parent), - m_context(new Core::IContext(this)) + IOutputPane(parent), + m_context(new IContext(this)) { m_outputWidget = new QStackedWidget; QWidget *visualOutputWidget = new QWidget; @@ -123,7 +125,7 @@ TestResultsPane::TestResultsPane(QObject *parent) : TestResultDelegate *trd = new TestResultDelegate(this); m_treeView->setItemDelegate(trd); - outputLayout->addWidget(Core::ItemViewFind::createSearchableWrapper(m_treeView)); + outputLayout->addWidget(ItemViewFind::createSearchableWrapper(m_treeView)); m_textOutput = new QPlainTextEdit; m_textOutput->setPalette(pal); @@ -136,7 +138,7 @@ TestResultsPane::TestResultsPane(QObject *parent) : auto agg = new Aggregation::Aggregate; agg->add(m_textOutput); - agg->add(new Core::BaseTextFind(m_textOutput)); + agg->add(new BaseTextFind(m_textOutput)); createToolButtons(); @@ -176,13 +178,13 @@ void TestResultsPane::createToolButtons() }); m_runAll = new QToolButton(m_treeView); - m_runAll->setDefaultAction(Core::ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()); + m_runAll->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()); m_runSelected = new QToolButton(m_treeView); - m_runSelected->setDefaultAction(Core::ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()); + m_runSelected->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()); m_runFile = new QToolButton(m_treeView); - m_runFile->setDefaultAction(Core::ActionManager::command(Constants::ACTION_RUN_FILE_ID)->action()); + m_runFile->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_FILE_ID)->action()); m_stopTestRun = new QToolButton(m_treeView); m_stopTestRun->setIcon(Utils::Icons::STOP_SMALL_TOOLBAR.icon()); @@ -402,7 +404,7 @@ void TestResultsPane::onItemActivated(const QModelIndex &index) const TestResult *testResult = m_filterModel->testResult(index); if (testResult && !testResult->fileName().isEmpty()) - Core::EditorManager::openEditorAt(testResult->fileName(), testResult->line(), 0); + EditorManager::openEditorAt(testResult->fileName(), testResult->line(), 0); } void TestResultsPane::onRunAllTriggered() @@ -530,7 +532,7 @@ void TestResultsPane::onTestRunFinished() this, &TestResultsPane::onScrollBarRangeChanged); if (AutotestPlugin::settings()->popupOnFinish && (!AutotestPlugin::settings()->popupOnFail || hasFailedTests(m_model))) { - popup(Core::IOutputPane::NoModeSwitch); + popup(IOutputPane::NoModeSwitch); } createMarks(); } @@ -608,14 +610,14 @@ void TestResultsPane::onCopyWholeTriggered() void TestResultsPane::onSaveWholeTriggered() { - const QString fileName = QFileDialog::getSaveFileName(Core::ICore::dialogParent(), + const QString fileName = QFileDialog::getSaveFileName(ICore::dialogParent(), tr("Save Output To")); if (fileName.isEmpty()) return; Utils::FileSaver saver(fileName, QIODevice::Text); if (!saver.write(getWholeOutput().toUtf8()) || !saver.finalize()) { - QMessageBox::critical(Core::ICore::dialogParent(), tr("Error"), + QMessageBox::critical(ICore::dialogParent(), tr("Error"), tr("Failed to write \"%1\".\n\n%2").arg(fileName) .arg(saver.errorString())); } @@ -692,7 +694,7 @@ void TestResultsPane::showTestResult(const QModelIndex &index) { QModelIndex mapped = m_filterModel->mapFromSource(index); if (mapped.isValid()) { - popup(Core::IOutputPane::NoModeSwitch); + popup(IOutputPane::NoModeSwitch); m_treeView->setCurrentIndex(mapped); } } diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 19611715f5..61ccde476b 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -97,8 +97,7 @@ TestRunner::TestRunner(QObject *parent) : cancelCurrent(UserCanceled); reportResult(ResultType::MessageFatal, tr("Test run canceled by user.")); }); - connect(ProjectExplorer::BuildManager::instance(), - &ProjectExplorer::BuildManager::buildQueueFinished, + connect(BuildManager::instance(), &BuildManager::buildQueueFinished, this, &TestRunner::onBuildQueueFinished); } @@ -312,10 +311,10 @@ void TestRunner::prepareToRunTests(TestRunMode mode) QTC_ASSERT(!m_executingTests, return); m_runMode = mode; ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings = - ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings(); + ProjectExplorerPlugin::projectExplorerSettings(); if (mode != TestRunMode::RunAfterBuild && projectExplorerSettings.buildBeforeDeploy && !projectExplorerSettings.saveBeforeBuild) { - if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles()) + if (!ProjectExplorerPlugin::saveModifiedFiles()) return; } @@ -332,7 +331,7 @@ void TestRunner::prepareToRunTests(TestRunMode mode) return; } - ProjectExplorer::Project *project = m_selectedTests.at(0)->project(); + Project *project = m_selectedTests.at(0)->project(); if (!project) { reportResult(ResultType::MessageWarn, tr("Project is null. Canceling test run.\n" @@ -342,7 +341,7 @@ void TestRunner::prepareToRunTests(TestRunMode mode) return; } - m_targetConnect = connect(project, &ProjectExplorer::Project::activeTargetChanged, + m_targetConnect = connect(project, &Project::activeTargetChanged, [this]() { cancelCurrent(KitChanged); }); if (!projectExplorerSettings.buildBeforeDeploy || mode == TestRunMode::DebugWithoutDeploy @@ -368,9 +367,8 @@ static QString firstNonEmptyTestCaseTarget(const TestConfiguration *config) }); } -static ProjectExplorer::RunConfiguration *getRunConfiguration(const QString &buildTargetKey) +static RunConfiguration *getRunConfiguration(const QString &buildTargetKey) { - using namespace ProjectExplorer; const Project *project = SessionManager::startupProject(); if (!project) return nullptr; @@ -556,7 +554,7 @@ void TestRunner::debugTests() } QString errorMessage; - auto runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE); + auto runControl = new RunControl(ProjectExplorer::Constants::DEBUG_RUN_MODE); runControl->setRunConfiguration(config->runConfiguration()); if (!runControl) { reportResult(ResultType::MessageFatal, @@ -566,7 +564,7 @@ void TestRunner::debugTests() } QStringList omitted; - ProjectExplorer::Runnable inferior = config->runnable(); + Runnable inferior = config->runnable(); inferior.executable = FilePath::fromString(commandFilePath); const QStringList args = config->argumentsForTestRunner(&omitted); @@ -591,7 +589,7 @@ void TestRunner::debugTests() debugger->setRunControlName(config->displayName()); bool useOutputProcessor = true; - if (ProjectExplorer::Target *targ = config->project()->activeTarget()) { + if (Target *targ = config->project()->activeTarget()) { if (Debugger::DebuggerKitAspect::engineType(targ->kit()) == Debugger::CdbEngineType) { reportResult(ResultType::MessageWarn, tr("Unable to display test results when using CDB.")); @@ -609,20 +607,20 @@ void TestRunner::debugTests() outputreader->setId(inferior.executable.toString()); connect(outputreader, &TestOutputReader::newOutputAvailable, TestResultsPane::instance(), &TestResultsPane::addOutput); - connect(runControl, &ProjectExplorer::RunControl::appendMessage, + connect(runControl, &RunControl::appendMessage, this, [outputreader](const QString &msg, Utils::OutputFormat format) { processOutput(outputreader, msg, format); }); - connect(runControl, &ProjectExplorer::RunControl::stopped, + connect(runControl, &RunControl::stopped, outputreader, &QObject::deleteLater); } m_stopDebugConnect = connect(this, &TestRunner::requestStopTestRun, - runControl, &ProjectExplorer::RunControl::initiateStop); + runControl, &RunControl::initiateStop); - connect(runControl, &ProjectExplorer::RunControl::stopped, this, &TestRunner::onFinished); - ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl); + connect(runControl, &RunControl::stopped, this, &TestRunner::onFinished); + ProjectExplorerPlugin::startRunControl(runControl); if (useOutputProcessor && AutotestPlugin::settings()->popupOnStart) AutotestPlugin::popupResultsPane(); } @@ -646,14 +644,14 @@ void TestRunner::runOrDebugTests() onFinished(); } -void TestRunner::buildProject(ProjectExplorer::Project *project) +void TestRunner::buildProject(Project *project) { - ProjectExplorer::BuildManager *buildManager = ProjectExplorer::BuildManager::instance(); + BuildManager *buildManager = BuildManager::instance(); m_buildConnect = connect(this, &TestRunner::requestStopTestRun, - buildManager, &ProjectExplorer::BuildManager::cancel); - connect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished, + buildManager, &BuildManager::cancel); + connect(buildManager, &BuildManager::buildQueueFinished, this, &TestRunner::buildFinished); - ProjectExplorer::ProjectExplorerPlugin::buildProject(project); + ProjectExplorerPlugin::buildProject(project); if (!buildManager->isBuilding()) buildFinished(false); } @@ -661,8 +659,8 @@ void TestRunner::buildProject(ProjectExplorer::Project *project) void TestRunner::buildFinished(bool success) { disconnect(m_buildConnect); - ProjectExplorer::BuildManager *buildManager = ProjectExplorer::BuildManager::instance(); - disconnect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished, + BuildManager *buildManager = BuildManager::instance(); + disconnect(buildManager, &BuildManager::buildQueueFinished, this, &TestRunner::buildFinished); if (success) { @@ -678,7 +676,7 @@ void TestRunner::buildFinished(bool success) static bool runAfterBuild() { - ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); + Project *project = SessionManager::startupProject(); if (!project) return false; @@ -805,9 +803,9 @@ void RunConfigurationSelectionDialog::populate() { m_rcCombo->addItem(QString(), QStringList({QString(), QString(), QString()})); // empty default - if (auto project = ProjectExplorer::SessionManager::startupProject()) { + if (auto project = SessionManager::startupProject()) { if (auto target = project->activeTarget()) { - for (ProjectExplorer::RunConfiguration *rc : target->runConfigurations()) { + for (RunConfiguration *rc : target->runConfigurations()) { auto runnable = rc->runnable(); const QStringList rcDetails = { runnable.executable.toString(), runnable.commandLineArguments, |