Commit 35939ac4 authored by Christian Stenger's avatar Christian Stenger
Browse files

Avoid executing unnamed Quick Tests if no related main is executed anyway



Change-Id: I521065577c195713bc252e6762a88011996f045c
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent ba8979d0
...@@ -29,6 +29,7 @@ TestConfiguration::TestConfiguration(const QString &testClass, const QStringList ...@@ -29,6 +29,7 @@ TestConfiguration::TestConfiguration(const QString &testClass, const QStringList
m_testClass(testClass), m_testClass(testClass),
m_testCases(testCases), m_testCases(testCases),
m_testCaseCount(testCaseCount), m_testCaseCount(testCaseCount),
m_unnamedOnly(false),
m_project(0) m_project(0)
{ {
if (testCases.size() != 0) { if (testCases.size() != 0) {
...@@ -96,5 +97,10 @@ void TestConfiguration::setProject(ProjectExplorer::Project *project) ...@@ -96,5 +97,10 @@ void TestConfiguration::setProject(ProjectExplorer::Project *project)
m_project = project; m_project = project;
} }
void TestConfiguration::setUnnamedOnly(bool unnamedOnly)
{
m_unnamedOnly = unnamedOnly;
}
} // namespace Internal } // namespace Internal
} // namespace Autotest } // namespace Autotest
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
void setDisplayName(const QString &displayName); void setDisplayName(const QString &displayName);
void setEnvironment(const Utils::Environment &env); void setEnvironment(const Utils::Environment &env);
void setProject(ProjectExplorer::Project *project); void setProject(ProjectExplorer::Project *project);
void setUnnamedOnly(bool unnamedOnly);
QString testClass() const { return m_testClass; } QString testClass() const { return m_testClass; }
QStringList testCases() const { return m_testCases; } QStringList testCases() const { return m_testCases; }
...@@ -60,6 +61,7 @@ public: ...@@ -60,6 +61,7 @@ public:
QString displayName() const { return m_displayName; } QString displayName() const { return m_displayName; }
Utils::Environment environment() const { return m_environment; } Utils::Environment environment() const { return m_environment; }
ProjectExplorer::Project *project() const { return m_project; } ProjectExplorer::Project *project() const { return m_project; }
bool unnamedOnly() const { return m_unnamedOnly; }
signals: signals:
...@@ -70,6 +72,7 @@ private: ...@@ -70,6 +72,7 @@ private:
QString m_testClass; QString m_testClass;
QStringList m_testCases; QStringList m_testCases;
int m_testCaseCount; int m_testCaseCount;
bool m_unnamedOnly;
QString m_proFile; QString m_proFile;
QString m_targetFile; QString m_targetFile;
QString m_targetName; QString m_targetName;
......
...@@ -465,6 +465,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const ...@@ -465,6 +465,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
} else { } else {
TestConfiguration *tc = new TestConfiguration(QString(), QStringList()); TestConfiguration *tc = new TestConfiguration(QString(), QStringList());
tc->setTestCaseCount(1); tc->setTestCaseCount(1);
tc->setUnnamedOnly(true);
addProjectInformation(tc, mainFile); addProjectInformation(tc, mainFile);
foundMains.insert(mainFile, tc); foundMains.insert(mainFile, tc);
} }
...@@ -499,6 +500,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const ...@@ -499,6 +500,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
// unnamed test case // unnamed test case
if (oldFunctions.size() == 0) { if (oldFunctions.size() == 0) {
tc->setTestCaseCount(tc->testCaseCount() + testFunctions.size()); tc->setTestCaseCount(tc->testCaseCount() + testFunctions.size());
tc->setUnnamedOnly(false);
} else { } else {
oldFunctions << testFunctions; oldFunctions << testFunctions;
tc->setTestCases(oldFunctions); tc->setTestCases(oldFunctions);
...@@ -513,7 +515,8 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const ...@@ -513,7 +515,8 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
} }
foreach (TestConfiguration *config, foundMains.values()) foreach (TestConfiguration *config, foundMains.values())
result << config; if (!config->unnamedOnly())
result << config;
return result; return result;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment