forked from qt-creator/qt-creator
AutoTest: Code cosmetics
Change-Id: I49a73b83b1b6857c34913db8f7c6818cf7a1a129 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
%{Cpp:LicenseTemplate}\
|
||||
#pragma once
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Internal {
|
||||
class GTestResult : public TestResult
|
||||
{
|
||||
public:
|
||||
GTestResult(const QString &projectFile, const QString &name = QString());
|
||||
explicit GTestResult(const QString &projectFile, const QString &name = QString());
|
||||
GTestResult(const QString &id, const QString &projectFile, const QString &name);
|
||||
const QString outputString(bool selected) const override;
|
||||
|
||||
|
||||
@@ -91,8 +91,7 @@ GTestSettings GTestSettingsWidget::settings() const
|
||||
GTestSettingsPage::GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||
const ITestFramework *framework)
|
||||
: ITestSettingsPage(framework),
|
||||
m_settings(qSharedPointerCast<GTestSettings>(settings)),
|
||||
m_widget(0)
|
||||
m_settings(qSharedPointerCast<GTestSettings>(settings))
|
||||
{
|
||||
setDisplayName(QCoreApplication::translate("GTestFramework",
|
||||
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
|
||||
@@ -41,7 +41,7 @@ class GTestSettingsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GTestSettingsWidget(QWidget *parent = 0);
|
||||
explicit GTestSettingsWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setSettings(const GTestSettings &settings);
|
||||
GTestSettings settings() const;
|
||||
|
||||
@@ -47,11 +47,11 @@ public:
|
||||
virtual const char *name() const = 0;
|
||||
virtual unsigned priority() const = 0; // should this be modifyable?
|
||||
virtual bool hasFrameworkSettings() const { return false; }
|
||||
virtual IFrameworkSettings *createFrameworkSettings() const { return 0; }
|
||||
virtual IFrameworkSettings *createFrameworkSettings() const { return nullptr; }
|
||||
virtual ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||
{
|
||||
Q_UNUSED(settings);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TestTreeItem *rootNode()
|
||||
@@ -78,8 +78,8 @@ protected:
|
||||
virtual TestTreeItem *createRootNode() const = 0;
|
||||
|
||||
private:
|
||||
TestTreeItem *m_rootNode = 0;
|
||||
ITestParser *m_testParser = 0;
|
||||
TestTreeItem *m_rootNode = nullptr;
|
||||
ITestParser *m_testParser = nullptr;
|
||||
bool m_active = false;
|
||||
bool m_grouping = false;
|
||||
};
|
||||
|
||||
@@ -95,8 +95,7 @@ QtTestSettings QtTestSettingsWidget::settings() const
|
||||
QtTestSettingsPage::QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||
const ITestFramework *framework)
|
||||
: ITestSettingsPage(framework),
|
||||
m_settings(qSharedPointerCast<QtTestSettings>(settings)),
|
||||
m_widget(0)
|
||||
m_settings(qSharedPointerCast<QtTestSettings>(settings))
|
||||
{
|
||||
setDisplayName(QCoreApplication::translate("QtTestFramework",
|
||||
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
Shutdown
|
||||
};
|
||||
|
||||
explicit TestCodeParser(TestTreeModel *parent = 0);
|
||||
explicit TestCodeParser(TestTreeModel *parent = nullptr);
|
||||
virtual ~TestCodeParser();
|
||||
void setState(State state);
|
||||
State state() const { return m_parserState; }
|
||||
|
||||
@@ -59,8 +59,8 @@ TestConfiguration::~TestConfiguration()
|
||||
|
||||
static bool isLocal(RunConfiguration *runConfiguration)
|
||||
{
|
||||
Target *target = runConfiguration ? runConfiguration->target() : 0;
|
||||
Kit *kit = target ? target->kit() : 0;
|
||||
Target *target = runConfiguration ? runConfiguration->target() : nullptr;
|
||||
Kit *kit = target ? target->kit() : nullptr;
|
||||
return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class TestResultDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestResultDelegate(QObject *parent = 0);
|
||||
explicit TestResultDelegate(QObject *parent = nullptr);
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
|
||||
@@ -266,7 +266,7 @@ const TestResult *TestResultModel::testResult(const QModelIndex &idx)
|
||||
if (idx.isValid())
|
||||
return static_cast<TestResultItem *>(itemForIndex(idx))->testResult();
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TestResultModel::recalculateMaxWidthOfFileName(const QFont &font)
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
class TestResultModel : public Utils::TreeModel<>
|
||||
{
|
||||
public:
|
||||
explicit TestResultModel(QObject *parent = 0);
|
||||
explicit TestResultModel(QObject *parent = nullptr);
|
||||
|
||||
void addTestResult(const TestResultPtr &testResult, bool autoExpand = false);
|
||||
void removeCurrentTestMessage();
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
void recalculateMaxWidthOfFileName(const QFont &font);
|
||||
void addFileName(const QString &fileName);
|
||||
TestResultItem *findParentItemFor(const TestResultItem *item,
|
||||
const TestResultItem *startItem = 0) const;
|
||||
const TestResultItem *startItem = nullptr) const;
|
||||
void updateParent(const TestResultItem *item);
|
||||
QMap<Result::Type, int> m_testResultCount;
|
||||
int m_widthOfLineNumber = 0;
|
||||
@@ -89,7 +89,7 @@ class TestResultFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestResultFilterModel(TestResultModel *sourceModel, QObject *parent = 0);
|
||||
explicit TestResultFilterModel(TestResultModel *sourceModel, QObject *parent = nullptr);
|
||||
|
||||
void enableAllResultTypes();
|
||||
void toggleTestResultType(Result::Type type);
|
||||
|
||||
@@ -59,7 +59,7 @@ class ResultsTreeView : public Utils::TreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResultsTreeView(QWidget *parent = 0);
|
||||
explicit ResultsTreeView(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void copyShortcutTriggered();
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
void showTestResult(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
explicit TestResultsPane(QObject *parent = 0);
|
||||
explicit TestResultsPane(QObject *parent = nullptr);
|
||||
|
||||
void onItemActivated(const QModelIndex &index);
|
||||
void onRunAllTriggered();
|
||||
|
||||
@@ -74,8 +74,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget *createConfigurationWidget() override { return 0; }
|
||||
TestConfiguration *m_testConfig = 0;
|
||||
QWidget *createConfigurationWidget() override { return nullptr; }
|
||||
TestConfiguration *m_testConfig = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -514,7 +514,7 @@ void TestRunner::debugTests()
|
||||
m_futureWatcher.setFuture(futureInterface->future());
|
||||
|
||||
if (useOutputProcessor) {
|
||||
TestOutputReader *outputreader = config->outputReader(*futureInterface, 0);
|
||||
TestOutputReader *outputreader = config->outputReader(*futureInterface, nullptr);
|
||||
outputreader->setId(inferior.executable);
|
||||
connect(outputreader, &TestOutputReader::newOutputAvailable,
|
||||
TestResultsPane::instance(), &TestResultsPane::addOutput);
|
||||
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
void runTests();
|
||||
void debugTests();
|
||||
void runOrDebugTests();
|
||||
explicit TestRunner(QObject *parent = 0);
|
||||
explicit TestRunner(QObject *parent = nullptr);
|
||||
|
||||
QFutureWatcher<TestResultPtr> m_futureWatcher;
|
||||
QFutureInterface<TestResultPtr> *m_fakeFutureInterface = nullptr;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Internal {
|
||||
class TestFilterDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
explicit TestFilterDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||
explicit TestFilterDialog(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
|
||||
QString filterPath() const;
|
||||
void setDetailsText(const QString &details) { m_details->setText(details); }
|
||||
void setDefaultFilterPath(const QString &defaultPath);
|
||||
@@ -276,7 +276,7 @@ void TestSettingsWidget::onRemoveFilterClicked()
|
||||
}
|
||||
|
||||
TestSettingsPage::TestSettingsPage(const QSharedPointer<TestSettings> &settings)
|
||||
: m_settings(settings), m_widget(0)
|
||||
: m_settings(settings)
|
||||
{
|
||||
setId("A.AutoTest.0.General");
|
||||
setDisplayName(tr("General"));
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestSettingsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestSettingsWidget(QWidget *parent = 0);
|
||||
explicit TestSettingsWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setSettings(const TestSettings &settings);
|
||||
TestSettings settings() const;
|
||||
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
|
||||
virtual bool canProvideTestConfiguration() const { return false; }
|
||||
virtual bool canProvideDebugConfiguration() const { return false; }
|
||||
virtual TestConfiguration *testConfiguration() const { return 0; }
|
||||
virtual TestConfiguration *debugConfiguration() const { return 0; }
|
||||
virtual TestConfiguration *testConfiguration() const { return nullptr; }
|
||||
virtual TestConfiguration *debugConfiguration() const { return nullptr; }
|
||||
TestConfiguration *asConfiguration(TestRunMode mode) const;
|
||||
virtual QList<TestConfiguration *> getAllTestConfigurations() const;
|
||||
virtual QList<TestConfiguration *> getSelectedTestConfigurations() const;
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestTreeItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestTreeItemDelegate(QObject *parent = 0);
|
||||
explicit TestTreeItemDelegate(QObject *parent = nullptr);
|
||||
~TestTreeItemDelegate();
|
||||
|
||||
public:
|
||||
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
bool sweepChildren(TestTreeItem *item);
|
||||
void insertItemInParent(TestTreeItem *item, TestTreeItem *root, bool groupingEnabled);
|
||||
void revalidateCheckState(TestTreeItem *item);
|
||||
explicit TestTreeModel(QObject *parent = 0);
|
||||
explicit TestTreeModel(QObject *parent = nullptr);
|
||||
void setupParsingConnections();
|
||||
void filterAndInsert(TestTreeItem *item, TestTreeItem *root, bool groupingEnabled);
|
||||
QList<TestTreeItem *> testItemsByName(TestTreeItem *root, const QString &testName);
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
ShowAll = ShowInitAndCleanup | ShowTestData
|
||||
};
|
||||
|
||||
explicit TestTreeSortFilterModel(TestTreeModel *sourceModel, QObject *parent = 0);
|
||||
explicit TestTreeSortFilterModel(TestTreeModel *sourceModel, QObject *parent = nullptr);
|
||||
void setSortMode(TestTreeItem::SortMode sortMode);
|
||||
void setFilterMode(FilterMode filterMode);
|
||||
void toggleFilter(FilterMode filterMode);
|
||||
|
||||
@@ -39,7 +39,7 @@ class TestTreeView : public Utils::NavigationTreeView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TestTreeView(QWidget *parent = 0);
|
||||
explicit TestTreeView(QWidget *parent = nullptr);
|
||||
|
||||
void selectAll() override;
|
||||
void deselectAll();
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef FOO_H_INCLUDED
|
||||
#define FOO_H_INCLUDED
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@@ -46,5 +46,3 @@ private slots:
|
||||
void test_case4();
|
||||
void test_case5() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QQueue>
|
||||
|
||||
class QueueTest : public ::testing::Test
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
Reference in New Issue
Block a user