AutoTest: Shuffle namespaces for clearer separation

Change-Id: I6ac440c6d72c3d0dbcd75907f8a6ae756f3cf5ee
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2019-08-19 10:55:32 +02:00
parent df93c6c5a7
commit 03b80025a9
27 changed files with 56 additions and 66 deletions

View File

@@ -50,7 +50,6 @@ const char TASK_MARK_ID[] = "Autotest.TaskMark";
const char SK_USE_GLOBAL[] = "AutoTest.UseGlobal"; const char SK_USE_GLOBAL[] = "AutoTest.UseGlobal";
} // namespace Constants } // namespace Constants
namespace Internal {
enum class TestRunMode enum class TestRunMode
{ {
None, None,
@@ -60,5 +59,4 @@ enum class TestRunMode
DebugWithoutDeploy, DebugWithoutDeploy,
RunAfterBuild RunAfterBuild
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -30,10 +30,11 @@
namespace CppTools { namespace Tests { class TemporaryCopiedDir; } } namespace CppTools { namespace Tests { class TemporaryCopiedDir; } }
namespace Autotest { namespace Autotest {
namespace Internal {
class TestTreeModel; class TestTreeModel;
namespace Internal {
class AutoTestUnitTests : public QObject class AutoTestUnitTests : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -31,9 +31,11 @@
#include <QPointer> #include <QPointer>
namespace Autotest { namespace Autotest {
namespace Internal {
class IFrameworkSettings; class IFrameworkSettings;
namespace Internal {
class BoostTestSettings; class BoostTestSettings;
class BoostTestSettingsWidget : public QWidget class BoostTestSettingsWidget : public QWidget

View File

@@ -33,7 +33,6 @@ namespace Autotest {
namespace Internal { namespace Internal {
class GTestResult; class GTestResult;
class TestTreeItem;
class GTestOutputReader : public TestOutputReader class GTestOutputReader : public TestOutputReader
{ {

View File

@@ -32,9 +32,11 @@
#include <QPointer> #include <QPointer>
namespace Autotest { namespace Autotest {
namespace Internal {
class IFrameworkSettings; class IFrameworkSettings;
namespace Internal {
class GTestSettings; class GTestSettings;
class GTestSettingsWidget : public QWidget class GTestSettingsWidget : public QWidget

View File

@@ -30,7 +30,6 @@
#include <QSettings> #include <QSettings>
namespace Autotest { namespace Autotest {
namespace Internal {
class IFrameworkSettings class IFrameworkSettings
{ {
@@ -63,5 +62,4 @@ protected:
virtual void fromFrameworkSettings(const QSettings *s) = 0; virtual void fromFrameworkSettings(const QSettings *s) = 0;
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -29,7 +29,6 @@
#include "itestparser.h" #include "itestparser.h"
namespace Autotest { namespace Autotest {
namespace Internal {
class IFrameworkSettings; class IFrameworkSettings;
class ITestSettingsPage; class ITestSettingsPage;
@@ -84,5 +83,4 @@ private:
bool m_grouping = false; bool m_grouping = false;
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -30,7 +30,6 @@
#include <utils/textfileformat.h> #include <utils/textfileformat.h>
namespace Autotest { namespace Autotest {
namespace Internal {
static CppParser *s_parserInstance = nullptr; static CppParser *s_parserInstance = nullptr;
@@ -83,5 +82,4 @@ CPlusPlus::Document::Ptr CppParser::document(const QString &fileName)
return selectedForBuilding(fileName) ? m_cppSnapshot.document(fileName) : nullptr; return selectedForBuilding(fileName) ? m_cppSnapshot.document(fileName) : nullptr;
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -34,7 +34,6 @@
#include <qmljs/qmljsdocument.h> #include <qmljs/qmljsdocument.h>
namespace Autotest { namespace Autotest {
namespace Internal {
class TestParseResult class TestParseResult
{ {
@@ -88,7 +87,6 @@ protected:
CppTools::WorkingCopy m_workingCopy; CppTools::WorkingCopy m_workingCopy;
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest
Q_DECLARE_METATYPE(Autotest::Internal::TestParseResultPtr) Q_DECLARE_METATYPE(Autotest::TestParseResultPtr)

View File

@@ -31,7 +31,6 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
namespace Autotest { namespace Autotest {
namespace Internal {
class IFrameworkSettings; class IFrameworkSettings;
@@ -64,5 +63,4 @@ private:
} }
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -32,9 +32,11 @@
#include <QPointer> #include <QPointer>
namespace Autotest { namespace Autotest {
namespace Internal {
class IFrameworkSettings; class IFrameworkSettings;
namespace Internal {
class QtTestSettings; class QtTestSettings;
class QtTestSettingsWidget : public QWidget class QtTestSettingsWidget : public QWidget

View File

@@ -47,7 +47,6 @@ using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace Autotest { namespace Autotest {
namespace Internal {
TestConfiguration::~TestConfiguration() TestConfiguration::~TestConfiguration()
{ {
@@ -103,7 +102,7 @@ void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguratio
m_buildDir = QFileInfo(buildBase + m_projectFile.mid(projBase.length())).absolutePath(); m_buildDir = QFileInfo(buildBase + m_projectFile.mid(projBase.length())).absolutePath();
} }
if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy) if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy)
m_runConfig = new TestRunConfiguration(rc->target(), this); m_runConfig = new Internal::TestRunConfiguration(rc->target(), this);
} }
void TestConfiguration::completeTestInformation(TestRunMode runMode) void TestConfiguration::completeTestInformation(TestRunMode runMode)
@@ -202,7 +201,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
m_runnable.executable = currentExecutable; m_runnable.executable = currentExecutable;
m_displayName = runConfig->displayName(); m_displayName = runConfig->displayName();
if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy) if (runMode == TestRunMode::Debug || runMode == TestRunMode::DebugWithoutDeploy)
m_runConfig = new TestRunConfiguration(target, this); m_runConfig = new Internal::TestRunConfiguration(target, this);
break; break;
} }
} }
@@ -223,7 +222,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
m_deducedConfiguration = true; m_deducedConfiguration = true;
m_deducedFrom = rc->displayName(); m_deducedFrom = rc->displayName();
if (runMode == TestRunMode::Debug) if (runMode == TestRunMode::Debug)
m_runConfig = new TestRunConfiguration(rc->target(), this); m_runConfig = new Internal::TestRunConfiguration(rc->target(), this);
} else { } else {
qCDebug(LOG) << "not using the fallback as the current active run configuration " qCDebug(LOG) << "not using the fallback as the current active run configuration "
"appears to be non-Desktop"; "appears to be non-Desktop";
@@ -351,5 +350,4 @@ bool TestConfiguration::hasExecutable() const
return !m_runnable.executable.isEmpty(); return !m_runnable.executable.isEmpty();
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -42,10 +42,12 @@ QT_END_NAMESPACE
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
class TestRunConfiguration;
} // namespace Internal
class TestOutputReader; class TestOutputReader;
class TestResult; class TestResult;
class TestRunConfiguration; enum class TestRunMode;
using TestResultPtr = QSharedPointer<TestResult>; using TestResultPtr = QSharedPointer<TestResult>;
@@ -82,7 +84,7 @@ public:
ProjectExplorer::Project *project() const { return m_project.data(); } ProjectExplorer::Project *project() const { return m_project.data(); }
QSet<QString> internalTargets() const { return m_buildTargets; } QSet<QString> internalTargets() const { return m_buildTargets; }
ProjectExplorer::RunConfiguration *originalRunConfiguration() const { return m_origRunConfig; } ProjectExplorer::RunConfiguration *originalRunConfiguration() const { return m_origRunConfig; }
TestRunConfiguration *runConfiguration() const { return m_runConfig; } Internal::TestRunConfiguration *runConfiguration() const { return m_runConfig; }
bool hasExecutable() const; bool hasExecutable() const;
bool isDeduced() const { return m_deducedConfiguration; } bool isDeduced() const { return m_deducedConfiguration; }
QString runConfigDisplayName() const { return m_deducedConfiguration ? m_deducedFrom QString runConfigDisplayName() const { return m_deducedConfiguration ? m_deducedFrom
@@ -102,7 +104,7 @@ private:
QString m_deducedFrom; QString m_deducedFrom;
QPointer<ProjectExplorer::Project> m_project; QPointer<ProjectExplorer::Project> m_project;
bool m_deducedConfiguration = false; bool m_deducedConfiguration = false;
TestRunConfiguration *m_runConfig = nullptr; Internal::TestRunConfiguration *m_runConfig = nullptr;
QSet<QString> m_buildTargets; QSet<QString> m_buildTargets;
ProjectExplorer::RunConfiguration *m_origRunConfig = nullptr; ProjectExplorer::RunConfiguration *m_origRunConfig = nullptr;
ProjectExplorer::Runnable m_runnable; ProjectExplorer::Runnable m_runnable;
@@ -124,5 +126,4 @@ private:
bool m_mixedDebugging = false; bool m_mixedDebugging = false;
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -43,14 +43,13 @@
static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.frameworkmanager", QtWarningMsg) static Q_LOGGING_CATEGORY(LOG, "qtc.autotest.frameworkmanager", QtWarningMsg)
namespace Autotest { namespace Autotest {
namespace Internal {
static TestFrameworkManager *s_instance = nullptr; static TestFrameworkManager *s_instance = nullptr;
TestFrameworkManager::TestFrameworkManager() TestFrameworkManager::TestFrameworkManager()
{ {
m_testTreeModel = TestTreeModel::instance(); m_testTreeModel = TestTreeModel::instance();
m_testRunner = TestRunner::instance(); m_testRunner = Internal::TestRunner::instance();
s_instance = this; s_instance = this;
} }
@@ -89,7 +88,7 @@ bool TestFrameworkManager::registerTestFramework(ITestFramework *framework)
return true; return true;
} }
void TestFrameworkManager::activateFrameworksFromSettings(QSharedPointer<TestSettings> settings) void TestFrameworkManager::activateFrameworksFromSettings(QSharedPointer<Internal::TestSettings> settings)
{ {
FrameworkIterator it = m_registeredFrameworks.begin(); FrameworkIterator it = m_registeredFrameworks.begin();
FrameworkIterator end = m_registeredFrameworks.end(); FrameworkIterator end = m_registeredFrameworks.end();
@@ -168,7 +167,7 @@ QSharedPointer<IFrameworkSettings> TestFrameworkManager::settingsForTestFramewor
void TestFrameworkManager::synchronizeSettings(QSettings *s) void TestFrameworkManager::synchronizeSettings(QSettings *s)
{ {
AutotestPlugin::settings()->fromSettings(s); Internal::AutotestPlugin::settings()->fromSettings(s);
for (const Core::Id &id : m_frameworkSettings.keys()) { for (const Core::Id &id : m_frameworkSettings.keys()) {
QSharedPointer<IFrameworkSettings> fSettings = settingsForTestFramework(id); QSharedPointer<IFrameworkSettings> fSettings = settingsForTestFramework(id);
if (!fSettings.isNull()) if (!fSettings.isNull())
@@ -217,5 +216,4 @@ unsigned TestFrameworkManager::priority(const Core::Id &frameworkId) const
return unsigned(-1); return unsigned(-1);
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -39,11 +39,14 @@ namespace Core { class Id; }
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
class TestRunner;
struct TestSettings;
}
class IFrameworkSettings; class IFrameworkSettings;
class ITestParser; class ITestParser;
class ITestSettingsPage; class ITestSettingsPage;
class TestRunner;
struct TestSettings;
class TestTreeItem; class TestTreeItem;
class TestTreeModel; class TestTreeModel;
@@ -54,7 +57,7 @@ public:
virtual ~TestFrameworkManager(); virtual ~TestFrameworkManager();
bool registerTestFramework(ITestFramework *framework); bool registerTestFramework(ITestFramework *framework);
void activateFrameworksFromSettings(QSharedPointer<TestSettings> settings); void activateFrameworksFromSettings(QSharedPointer<Internal::TestSettings> settings);
QString frameworkNameForId(const Core::Id &id) const; QString frameworkNameForId(const Core::Id &id) const;
QList<Core::Id> registeredFrameworkIds() const; QList<Core::Id> registeredFrameworkIds() const;
QList<Core::Id> sortedRegisteredFrameworkIds() const; QList<Core::Id> sortedRegisteredFrameworkIds() const;
@@ -77,10 +80,9 @@ private:
QHash<Core::Id, QSharedPointer<IFrameworkSettings> > m_frameworkSettings; QHash<Core::Id, QSharedPointer<IFrameworkSettings> > m_frameworkSettings;
QVector<ITestSettingsPage *> m_frameworkSettingsPages; QVector<ITestSettingsPage *> m_frameworkSettingsPages;
TestTreeModel *m_testTreeModel; TestTreeModel *m_testTreeModel;
TestRunner *m_testRunner; Internal::TestRunner *m_testRunner;
typedef QHash<Core::Id, ITestFramework *>::ConstIterator FrameworkIterator; typedef QHash<Core::Id, ITestFramework *>::ConstIterator FrameworkIterator;
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -47,9 +47,11 @@ class ProgressIndicator;
} }
namespace Autotest { namespace Autotest {
namespace Internal {
class TestTreeModel; class TestTreeModel;
namespace Internal {
class TestTreeSortFilterModel; class TestTreeSortFilterModel;
class TestTreeView; class TestTreeView;

View File

@@ -33,7 +33,6 @@
#include <QProcess> #include <QProcess>
namespace Autotest { namespace Autotest {
namespace Internal {
TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface, TestOutputReader::TestOutputReader(const QFutureInterface<TestResultPtr> &futureInterface,
QProcess *testApplication, const QString &buildDirectory) QProcess *testApplication, const QString &buildDirectory)
@@ -102,5 +101,4 @@ void TestOutputReader::reportResult(const TestResultPtr &result)
m_hadValidOutput = true; m_hadValidOutput = true;
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -33,7 +33,6 @@
#include <QString> #include <QString>
namespace Autotest { namespace Autotest {
namespace Internal {
class TestOutputReader : public QObject class TestOutputReader : public QObject
{ {
@@ -72,5 +71,4 @@ private:
bool m_hadValidOutput = false; bool m_hadValidOutput = false;
}; };
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -29,7 +29,6 @@
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
namespace Autotest { namespace Autotest {
namespace Internal {
TestResult::TestResult(const QString &id, const QString &name) TestResult::TestResult(const QString &id, const QString &name)
: m_id(id) : m_id(id)
@@ -189,5 +188,4 @@ TestResult *TestResult::createIntermediateResultFor(const TestResult *other)
return intermediate; return intermediate;
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -33,7 +33,6 @@
#include <QSharedPointer> #include <QSharedPointer>
namespace Autotest { namespace Autotest {
namespace Internal {
class TestTreeItem; class TestTreeItem;
@@ -119,8 +118,7 @@ private:
using TestResultPtr = QSharedPointer<TestResult>; using TestResultPtr = QSharedPointer<TestResult>;
} // namespace Internal
} // namespace Autotest } // namespace Autotest
Q_DECLARE_METATYPE(Autotest::Internal::TestResult) Q_DECLARE_METATYPE(Autotest::TestResult)
Q_DECLARE_METATYPE(Autotest::Internal::ResultType) Q_DECLARE_METATYPE(Autotest::ResultType)

View File

@@ -48,11 +48,13 @@ class IContext;
} }
namespace Autotest { namespace Autotest {
class TestResult;
namespace Internal { namespace Internal {
class TestResultModel; class TestResultModel;
class TestResultFilterModel; class TestResultFilterModel;
class TestResult;
class TestEditorMark; class TestEditorMark;
class ResultsTreeView : public Utils::TreeView class ResultsTreeView : public Utils::TreeView

View File

@@ -313,8 +313,8 @@ void TestRunner::prepareToRunTests(TestRunMode mode)
m_runMode = mode; m_runMode = mode;
ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings = ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings =
ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings(); ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings();
if (mode != TestRunMode::RunAfterBuild && if (mode != TestRunMode::RunAfterBuild && projectExplorerSettings.buildBeforeDeploy
projectExplorerSettings.buildBeforeDeploy && !projectExplorerSettings.saveBeforeBuild) { && !projectExplorerSettings.saveBeforeBuild) {
if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles()) if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
return; return;
} }

View File

@@ -48,6 +48,9 @@ class Project;
} }
namespace Autotest { namespace Autotest {
enum class TestRunMode;
namespace Internal { namespace Internal {
class AUTOTESTSHARED_EXPORT TestRunner : public QObject class AUTOTESTSHARED_EXPORT TestRunner : public QObject

View File

@@ -37,7 +37,6 @@
#include <QIcon> #include <QIcon>
namespace Autotest { namespace Autotest {
namespace Internal {
TestTreeItem::TestTreeItem(const QString &name, const QString &filePath, Type type) TestTreeItem::TestTreeItem(const QString &name, const QString &filePath, Type type)
: m_name(name), : m_name(name),
@@ -379,5 +378,4 @@ QSet<QString> TestTreeItem::dependingInternalTargets(CppTools::CppModelManager *
return result; return result;
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -45,10 +45,9 @@ namespace CppTools { class CppModelManager; }
namespace Utils { class FilePath; } namespace Utils { class FilePath; }
namespace Autotest { namespace Autotest {
namespace Internal {
class TestParseResult;
class TestConfiguration; class TestConfiguration;
class TestParseResult;
enum class TestRunMode; enum class TestRunMode;
class TestTreeItem : public Utils::TypedTreeItem<TestTreeItem> class TestTreeItem : public Utils::TypedTreeItem<TestTreeItem>
@@ -170,8 +169,7 @@ public:
typedef QVector<TestCodeLocationAndType> TestCodeLocationList; typedef QVector<TestCodeLocationAndType> TestCodeLocationList;
} // namespace Internal
} // namespace Autotest } // namespace Autotest
Q_DECLARE_METATYPE(Autotest::Internal::TestTreeItem *) Q_DECLARE_METATYPE(Autotest::TestTreeItem *)
Q_DECLARE_METATYPE(Autotest::Internal::TestCodeLocationAndType) Q_DECLARE_METATYPE(Autotest::TestCodeLocationAndType)

View File

@@ -40,7 +40,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
namespace Autotest { namespace Autotest {
namespace Internal {
using namespace Internal;
TestTreeModel::TestTreeModel(QObject *parent) : TestTreeModel::TestTreeModel(QObject *parent) :
TreeModel<>(parent), TreeModel<>(parent),
@@ -720,5 +721,4 @@ bool TestTreeSortFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex
} }
} }
} // namespace Internal
} // namespace Autotest } // namespace Autotest

View File

@@ -37,10 +37,10 @@
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
class TestCodeParser; class TestCodeParser;
class TestParseResult; } // namespace Internal
class TestParseResult;
using TestParseResultPtr = QSharedPointer<TestParseResult>; using TestParseResultPtr = QSharedPointer<TestParseResult>;
class AUTOTESTSHARED_EXPORT TestTreeModel : public Utils::TreeModel<> class AUTOTESTSHARED_EXPORT TestTreeModel : public Utils::TreeModel<>
@@ -53,7 +53,7 @@ public:
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;
TestCodeParser *parser() const { return m_parser; } Internal::TestCodeParser *parser() const { return m_parser; }
bool hasTests() const; bool hasTests() const;
QList<TestConfiguration *> getAllTestCases() const; QList<TestConfiguration *> getAllTestCases() const;
QList<TestConfiguration *> getSelectedTests() const; QList<TestConfiguration *> getSelectedTests() const;
@@ -103,10 +103,12 @@ private:
void syncFrameworks(const QList<Core::Id> &sortedIds); void syncFrameworks(const QList<Core::Id> &sortedIds);
QList<TestTreeItem *> testItemsByName(TestTreeItem *root, const QString &testName); QList<TestTreeItem *> testItemsByName(TestTreeItem *root, const QString &testName);
TestCodeParser *m_parser; Internal::TestCodeParser *m_parser = nullptr;
QTimer m_syncFrameworksTimer; QTimer m_syncFrameworksTimer;
}; };
namespace Internal {
class TestTreeSortFilterModel : public QSortFilterProxyModel class TestTreeSortFilterModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
@@ -119,7 +121,7 @@ public:
}; };
explicit TestTreeSortFilterModel(TestTreeModel *sourceModel, QObject *parent = nullptr); explicit TestTreeSortFilterModel(TestTreeModel *sourceModel, QObject *parent = nullptr);
void setSortMode(TestTreeItem::SortMode sortMode); void setSortMode(Autotest::TestTreeItem::SortMode sortMode);
void setFilterMode(FilterMode filterMode); void setFilterMode(FilterMode filterMode);
void toggleFilter(FilterMode filterMode); void toggleFilter(FilterMode filterMode);
static FilterMode toFilterMode(int f); static FilterMode toFilterMode(int f);
@@ -129,7 +131,7 @@ protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
private: private:
TestTreeItem::SortMode m_sortMode = TestTreeItem::Alphabetically; Autotest::TestTreeItem::SortMode m_sortMode = Autotest::TestTreeItem::Alphabetically;
FilterMode m_filterMode = Basic; FilterMode m_filterMode = Basic;
}; };