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