From 0e0c2ca91c53e7bca3c8ea0a1c047a87b0873ac7 Mon Sep 17 00:00:00 2001 From: Bernhard Beschow Date: Fri, 29 Jan 2021 19:32:39 +0100 Subject: [PATCH] AutoTest: Improve type safety in TestTreeItem Ensures that the static_cast<>() in framework() always succeeds. Change-Id: I6aff0cf12a565bd6f9791c67979698729d7143e5 Reviewed-by: Christian Stenger --- src/plugins/autotest/boost/boosttesttreeitem.h | 4 ++-- src/plugins/autotest/catch/catchtreeitem.h | 4 ++-- src/plugins/autotest/gtest/gtesttreeitem.h | 4 ++-- src/plugins/autotest/qtest/qttesttreeitem.cpp | 4 ++-- src/plugins/autotest/qtest/qttesttreeitem.h | 2 +- src/plugins/autotest/quick/quicktesttreeitem.h | 4 ++-- src/plugins/autotest/testtreeitem.cpp | 4 ++-- src/plugins/autotest/testtreeitem.h | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/plugins/autotest/boost/boosttesttreeitem.h b/src/plugins/autotest/boost/boosttesttreeitem.h index 15f8c3c113d..5bcdf5cf19c 100644 --- a/src/plugins/autotest/boost/boosttesttreeitem.h +++ b/src/plugins/autotest/boost/boosttesttreeitem.h @@ -48,11 +48,11 @@ public: Q_FLAGS(TestState) Q_DECLARE_FLAGS(TestStates, TestState) - explicit BoostTestTreeItem(ITestBase *base, + explicit BoostTestTreeItem(ITestFramework *framework, const QString &name = QString(), const QString &filePath = QString(), Type type = Root) - : TestTreeItem(base, name, filePath, type) + : TestTreeItem(framework, name, filePath, type) {} public: diff --git a/src/plugins/autotest/catch/catchtreeitem.h b/src/plugins/autotest/catch/catchtreeitem.h index 5b8b339dc6a..72256cdb133 100644 --- a/src/plugins/autotest/catch/catchtreeitem.h +++ b/src/plugins/autotest/catch/catchtreeitem.h @@ -41,9 +41,9 @@ public: Q_FLAGS(TestState) Q_DECLARE_FLAGS(TestStates, TestState) - explicit CatchTreeItem(ITestBase *testBase, const QString &name = QString(), + explicit CatchTreeItem(ITestFramework *testFramework, const QString &name = QString(), const QString &filePath = QString(), Type type = Root) - : TestTreeItem(testBase, name, filePath, type) {} + : TestTreeItem(testFramework, name, filePath, type) {} void setStates(CatchTreeItem::TestStates state) { m_state = state; } CatchTreeItem::TestStates states() const { return m_state; } diff --git a/src/plugins/autotest/gtest/gtesttreeitem.h b/src/plugins/autotest/gtest/gtesttreeitem.h index 35edc4313f5..dd6741cca8d 100644 --- a/src/plugins/autotest/gtest/gtesttreeitem.h +++ b/src/plugins/autotest/gtest/gtesttreeitem.h @@ -46,11 +46,11 @@ public: Q_FLAGS(TestState) Q_DECLARE_FLAGS(TestStates, TestState) - explicit GTestTreeItem(ITestBase *testBase, + explicit GTestTreeItem(ITestFramework *testFramework, const QString &name = QString(), const QString &filePath = QString(), Type type = Root) - : TestTreeItem(testBase, name, filePath, type), m_state(Enabled) + : TestTreeItem(testFramework, name, filePath, type), m_state(Enabled) {} TestTreeItem *copyWithoutChildren() override; diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp index 8a2dc3a19ec..909ee82d074 100644 --- a/src/plugins/autotest/qtest/qttesttreeitem.cpp +++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp @@ -34,9 +34,9 @@ namespace Autotest { namespace Internal { -QtTestTreeItem::QtTestTreeItem(ITestBase *testBase, const QString &name, +QtTestTreeItem::QtTestTreeItem(ITestFramework *testFramework, const QString &name, const QString &filePath, TestTreeItem::Type type) - : TestTreeItem(testBase, name, filePath, type) + : TestTreeItem(testFramework, name, filePath, type) { if (type == TestDataTag) setData(0, Qt::Checked, Qt::CheckStateRole); diff --git a/src/plugins/autotest/qtest/qttesttreeitem.h b/src/plugins/autotest/qtest/qttesttreeitem.h index 9ad6c10f165..d3583c4a92d 100644 --- a/src/plugins/autotest/qtest/qttesttreeitem.h +++ b/src/plugins/autotest/qtest/qttesttreeitem.h @@ -33,7 +33,7 @@ namespace Internal { class QtTestTreeItem : public TestTreeItem { public: - explicit QtTestTreeItem(ITestBase *framework, const QString &name = QString(), + explicit QtTestTreeItem(ITestFramework *framework, const QString &name = QString(), const QString &filePath = QString(), Type type = Root); TestTreeItem *copyWithoutChildren() override; diff --git a/src/plugins/autotest/quick/quicktesttreeitem.h b/src/plugins/autotest/quick/quicktesttreeitem.h index 3cbae53ba43..a599c6ceab0 100644 --- a/src/plugins/autotest/quick/quicktesttreeitem.h +++ b/src/plugins/autotest/quick/quicktesttreeitem.h @@ -33,11 +33,11 @@ namespace Internal { class QuickTestTreeItem : public TestTreeItem { public: - explicit QuickTestTreeItem(ITestBase *testBase, + explicit QuickTestTreeItem(ITestFramework *testFramework, const QString &name = QString(), const QString &filePath = QString(), Type type = Root) - : TestTreeItem(testBase, name, filePath, type) + : TestTreeItem(testFramework, name, filePath, type) {} TestTreeItem *copyWithoutChildren() override; diff --git a/src/plugins/autotest/testtreeitem.cpp b/src/plugins/autotest/testtreeitem.cpp index f8888cefc5e..a5a40a8922e 100644 --- a/src/plugins/autotest/testtreeitem.cpp +++ b/src/plugins/autotest/testtreeitem.cpp @@ -164,9 +164,9 @@ ITestConfiguration *ITestTreeItem::asConfiguration(TestRunMode mode) const /****************************** TestTreeItem ********************************************/ -TestTreeItem::TestTreeItem(ITestBase *testBase, const QString &name, +TestTreeItem::TestTreeItem(ITestFramework *testFramework, const QString &name, const QString &filePath, Type type) - : ITestTreeItem(testBase, name, filePath, type) + : ITestTreeItem(testFramework, name, filePath, type) { switch (type) { case Root: diff --git a/src/plugins/autotest/testtreeitem.h b/src/plugins/autotest/testtreeitem.h index ed5385e573a..21237146a64 100644 --- a/src/plugins/autotest/testtreeitem.h +++ b/src/plugins/autotest/testtreeitem.h @@ -120,7 +120,7 @@ private: class TestTreeItem : public ITestTreeItem { public: - explicit TestTreeItem(ITestBase *testBase, + explicit TestTreeItem(ITestFramework *testFramework, const QString &name = QString(), const QString &filePath = QString(), Type type = Root);