summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2017-05-08 12:09:11 +0200
committerChristian Stenger <christian.stenger@qt.io>2017-05-19 10:02:55 +0000
commitcccc6b37ecc02feae653160e436bc245f42750bf (patch)
treecb02fa7ede2419cc2aab1d3a5f1dd7e6a540d38d
parent36ec37b29d22a5128d1ab088a73d6b5237ac56f5 (diff)
downloadqt-creator-cccc6b37ecc02feae653160e436bc245f42750bf.tar.gz
AutoTest: Remove not needed code
As this functionality had been simplified GTest* classes had been ignored. Continue the simplification and finally remove now useless code and file. Change-Id: I89170cd5f05bb93bf30a05fdbf5370012bc9741a Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/autotest/autotest.pro1
-rw-r--r--src/plugins/autotest/autotest.qbs1
-rw-r--r--src/plugins/autotest/autotest_utils.h55
-rw-r--r--src/plugins/autotest/gtest/gtestparser.cpp4
-rw-r--r--src/plugins/autotest/gtest/gtesttreeitem.cpp63
-rw-r--r--src/plugins/autotest/qtest/qttestparser.cpp3
-rw-r--r--src/plugins/autotest/qtest/qttesttreeitem.cpp1
-rw-r--r--src/plugins/autotest/quick/quicktestparser.cpp3
-rw-r--r--src/plugins/autotest/testcodeparser.cpp1
-rw-r--r--src/plugins/autotest/testtreeitem.cpp1
10 files changed, 18 insertions, 115 deletions
diff --git a/src/plugins/autotest/autotest.pro b/src/plugins/autotest/autotest.pro
index a22a584ff3..f8ae42d746 100644
--- a/src/plugins/autotest/autotest.pro
+++ b/src/plugins/autotest/autotest.pro
@@ -59,7 +59,6 @@ HEADERS += \
testcodeparser.h \
autotestplugin.h \
autotest_global.h \
- autotest_utils.h \
autotestconstants.h \
testrunner.h \
testconfiguration.h \
diff --git a/src/plugins/autotest/autotest.qbs b/src/plugins/autotest/autotest.qbs
index 6f6354e00c..4b8c13f257 100644
--- a/src/plugins/autotest/autotest.qbs
+++ b/src/plugins/autotest/autotest.qbs
@@ -33,7 +33,6 @@ QtcPlugin {
"autotest.qrc",
"autotesticons.h",
"autotest_global.h",
- "autotest_utils.h",
"autotestconstants.h",
"autotestplugin.cpp",
"autotestplugin.h",
diff --git a/src/plugins/autotest/autotest_utils.h b/src/plugins/autotest/autotest_utils.h
deleted file mode 100644
index 15982d6129..0000000000
--- a/src/plugins/autotest/autotest_utils.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include <cpptools/cppmodelmanager.h>
-#include <cpptools/projectpart.h>
-
-#include <QString>
-
-namespace Autotest {
-namespace Internal {
-
-class TestUtils
-{
-public:
- static QString getCMakeDisplayNameIfNecessary(const QString &filePath, const QString &proFile)
- {
- static const QString CMAKE_LISTS("CMakeLists.txt");
- if (!proFile.endsWith(CMAKE_LISTS))
- return QString();
-
- const QList<CppTools::ProjectPart::Ptr> &projectParts
- = CppTools::CppModelManager::instance()->projectPart(filePath);
- if (projectParts.size())
- return projectParts.first()->displayName;
-
- return QString();
- }
-};
-
-} // namespace Internal
-} // namespace Autotest
diff --git a/src/plugins/autotest/gtest/gtestparser.cpp b/src/plugins/autotest/gtest/gtestparser.cpp
index 83e84a5092..b21f161f06 100644
--- a/src/plugins/autotest/gtest/gtestparser.cpp
+++ b/src/plugins/autotest/gtest/gtestparser.cpp
@@ -27,7 +27,9 @@
#include "gtesttreeitem.h"
#include "gtestvisitors.h"
#include "gtest_utils.h"
-#include "../autotest_utils.h"
+
+#include <cpptools/cppmodelmanager.h>
+#include <cpptools/projectpart.h>
namespace Autotest {
namespace Internal {
diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp
index 540f7c6679..e3a44fc964 100644
--- a/src/plugins/autotest/gtest/gtesttreeitem.cpp
+++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp
@@ -26,7 +26,6 @@
#include "gtesttreeitem.h"
#include "gtestconfiguration.h"
#include "gtestparser.h"
-#include "../autotest_utils.h"
#include <projectexplorer/session.h>
#include <utils/qtcassert.h>
@@ -116,34 +115,6 @@ TestConfiguration *GTestTreeItem::debugConfiguration() const
return config;
}
-// used as key inside getAllTestCases()/getSelectedTestCases() for Google Tests
-class ProFileWithDisplayName
-{
-public:
- ProFileWithDisplayName(const QString &file, const QString &name)
- : proFile(file), displayName(name) {}
- QString proFile;
- QString displayName;
-
- bool operator==(const ProFileWithDisplayName &rhs) const
- {
- return proFile == rhs.proFile && displayName == rhs.displayName;
- }
-};
-
-// needed as ProFileWithDisplayName is used as key inside a QHash
-bool operator<(const ProFileWithDisplayName &lhs, const ProFileWithDisplayName &rhs)
-{
- return lhs.proFile == rhs.proFile ? lhs.displayName < rhs.displayName
- : lhs.proFile < rhs.proFile;
-}
-
-// needed as ProFileWithDisplayName is used as a key inside a QHash
-uint qHash(const ProFileWithDisplayName &lhs)
-{
- return ::qHash(lhs.proFile) ^ ::qHash(lhs.displayName);
-}
-
QList<TestConfiguration *> GTestTreeItem::getAllTestConfigurations() const
{
QList<TestConfiguration *> result;
@@ -152,28 +123,24 @@ QList<TestConfiguration *> GTestTreeItem::getAllTestConfigurations() const
if (!project || type() != Root)
return result;
- QHash<ProFileWithDisplayName, int> proFilesWithTestSets;
+ QHash<QString, int> proFilesWithTestSets;
for (int row = 0, count = childCount(); row < count; ++row) {
const GTestTreeItem *child = static_cast<const GTestTreeItem *>(childItem(row));
const int grandChildCount = child->childCount();
for (int grandChildRow = 0; grandChildRow < grandChildCount; ++grandChildRow) {
const TestTreeItem *grandChild = child->childItem(grandChildRow);
- ProFileWithDisplayName key(grandChild->proFile(),
- TestUtils::getCMakeDisplayNameIfNecessary(grandChild->filePath(),
- grandChild->proFile()));
-
+ const QString &key = grandChild->proFile();
proFilesWithTestSets.insert(key, proFilesWithTestSets[key] + 1);
}
}
- QHash<ProFileWithDisplayName, int>::ConstIterator it = proFilesWithTestSets.begin();
- QHash<ProFileWithDisplayName, int>::ConstIterator end = proFilesWithTestSets.end();
+ QHash<QString, int>::ConstIterator it = proFilesWithTestSets.begin();
+ QHash<QString, int>::ConstIterator end = proFilesWithTestSets.end();
for ( ; it != end; ++it) {
- const ProFileWithDisplayName &key = it.key();
GTestConfiguration *tc = new GTestConfiguration;
tc->setTestCaseCount(it.value());
- tc->setProjectFile(key.proFile);
+ tc->setProjectFile(it.key());
tc->setProject(project);
result << tc;
}
@@ -187,13 +154,6 @@ struct TestCases
int additionalTestCaseCount = 0;
};
-static const ProFileWithDisplayName createProfile(const TestTreeItem *item)
-{
- return ProFileWithDisplayName(
- item->proFile(),
- TestUtils::getCMakeDisplayNameIfNecessary(item->filePath(), item->proFile()));
-}
-
QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
{
QList<TestConfiguration *> result;
@@ -201,7 +161,7 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
if (!project || type() != Root)
return result;
- QHash<ProFileWithDisplayName, TestCases> proFilesWithCheckedTestSets;
+ QHash<QString, TestCases> proFilesWithCheckedTestSets;
for (int row = 0, count = childCount(); row < count; ++row) {
const GTestTreeItem *child = static_cast<const GTestTreeItem *>(childItem(row));
@@ -212,7 +172,7 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
case Qt::Unchecked:
continue;
case Qt::Checked: {
- auto &testCases = proFilesWithCheckedTestSets[createProfile(child->childItem(0))];
+ auto &testCases = proFilesWithCheckedTestSets[child->childItem(0)->proFile()];
testCases.filters.append(gtestFilter(child->state()).arg(child->name()).arg('*'));
testCases.additionalTestCaseCount += grandChildCount - 1;
break;
@@ -221,7 +181,7 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
for (int grandChildRow = 0; grandChildRow < grandChildCount; ++grandChildRow) {
const TestTreeItem *grandChild = child->childItem(grandChildRow);
if (grandChild->checked() == Qt::Checked) {
- proFilesWithCheckedTestSets[createProfile(grandChild)].filters.append(
+ proFilesWithCheckedTestSets[grandChild->proFile()].filters.append(
gtestFilter(child->state()).arg(child->name()).arg(grandChild->name()));
}
}
@@ -230,14 +190,13 @@ QList<TestConfiguration *> GTestTreeItem::getSelectedTestConfigurations() const
}
}
- QHash<ProFileWithDisplayName, TestCases>::ConstIterator it = proFilesWithCheckedTestSets.begin();
- QHash<ProFileWithDisplayName, TestCases>::ConstIterator end = proFilesWithCheckedTestSets.end();
+ QHash<QString, TestCases>::ConstIterator it = proFilesWithCheckedTestSets.begin();
+ QHash<QString, TestCases>::ConstIterator end = proFilesWithCheckedTestSets.end();
for ( ; it != end; ++it) {
- const ProFileWithDisplayName &proFileWithDisplayName = it.key();
GTestConfiguration *tc = new GTestConfiguration;
tc->setTestCases(it.value().filters);
tc->setTestCaseCount(tc->testCaseCount() + it.value().additionalTestCaseCount);
- tc->setProjectFile(proFileWithDisplayName.proFile);
+ tc->setProjectFile(it.key());
tc->setProject(project);
result << tc;
}
diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp
index 8371f6d614..93376cba7c 100644
--- a/src/plugins/autotest/qtest/qttestparser.cpp
+++ b/src/plugins/autotest/qtest/qttestparser.cpp
@@ -27,8 +27,9 @@
#include "qttesttreeitem.h"
#include "qttestvisitors.h"
#include "qttest_utils.h"
-#include "../autotest_utils.h"
+#include <cpptools/cppmodelmanager.h>
+#include <cpptools/projectpart.h>
#include <cplusplus/TypeOfExpression.h>
#include <utils/algorithm.h>
diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp
index 9236b79631..53f60b22fe 100644
--- a/src/plugins/autotest/qtest/qttesttreeitem.cpp
+++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp
@@ -26,7 +26,6 @@
#include "qttesttreeitem.h"
#include "qttestconfiguration.h"
#include "qttestparser.h"
-#include "../autotest_utils.h"
#include <projectexplorer/session.h>
#include <utils/qtcassert.h>
diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp
index cb7e5a0464..b7528f414c 100644
--- a/src/plugins/autotest/quick/quicktestparser.cpp
+++ b/src/plugins/autotest/quick/quicktestparser.cpp
@@ -27,9 +27,10 @@
#include "quicktesttreeitem.h"
#include "quicktestvisitors.h"
#include "quicktest_utils.h"
-#include "../autotest_utils.h"
#include "../testcodeparser.h"
+#include <cpptools/cppmodelmanager.h>
+#include <cpptools/projectpart.h>
#include <projectexplorer/session.h>
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsdialect.h>
diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp
index 001ea5d48b..6f444da8b4 100644
--- a/src/plugins/autotest/testcodeparser.cpp
+++ b/src/plugins/autotest/testcodeparser.cpp
@@ -24,7 +24,6 @@
****************************************************************************/
#include "autotestconstants.h"
-#include "autotest_utils.h"
#include "autotestplugin.h"
#include "testcodeparser.h"
#include "testframeworkmanager.h"
diff --git a/src/plugins/autotest/testtreeitem.cpp b/src/plugins/autotest/testtreeitem.cpp
index 7b912b8085..bbba24cfb3 100644
--- a/src/plugins/autotest/testtreeitem.cpp
+++ b/src/plugins/autotest/testtreeitem.cpp
@@ -24,7 +24,6 @@
****************************************************************************/
#include "autotestconstants.h"
-#include "autotest_utils.h"
#include "itestparser.h"
#include "testconfiguration.h"
#include "testtreeitem.h"