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

Change-Id: I521065577c195713bc252e6762a88011996f045c
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-01-07 09:33:57 +01:00
parent ba8979d066
commit 35939ac402
3 changed files with 13 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ TestConfiguration::TestConfiguration(const QString &testClass, const QStringList
m_testClass(testClass),
m_testCases(testCases),
m_testCaseCount(testCaseCount),
m_unnamedOnly(false),
m_project(0)
{
if (testCases.size() != 0) {
@@ -96,5 +97,10 @@ void TestConfiguration::setProject(ProjectExplorer::Project *project)
m_project = project;
}
void TestConfiguration::setUnnamedOnly(bool unnamedOnly)
{
m_unnamedOnly = unnamedOnly;
}
} // namespace Internal
} // namespace Autotest

View File

@@ -49,6 +49,7 @@ public:
void setDisplayName(const QString &displayName);
void setEnvironment(const Utils::Environment &env);
void setProject(ProjectExplorer::Project *project);
void setUnnamedOnly(bool unnamedOnly);
QString testClass() const { return m_testClass; }
QStringList testCases() const { return m_testCases; }
@@ -60,6 +61,7 @@ public:
QString displayName() const { return m_displayName; }
Utils::Environment environment() const { return m_environment; }
ProjectExplorer::Project *project() const { return m_project; }
bool unnamedOnly() const { return m_unnamedOnly; }
signals:
@@ -70,6 +72,7 @@ private:
QString m_testClass;
QStringList m_testCases;
int m_testCaseCount;
bool m_unnamedOnly;
QString m_proFile;
QString m_targetFile;
QString m_targetName;

View File

@@ -465,6 +465,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
} else {
TestConfiguration *tc = new TestConfiguration(QString(), QStringList());
tc->setTestCaseCount(1);
tc->setUnnamedOnly(true);
addProjectInformation(tc, mainFile);
foundMains.insert(mainFile, tc);
}
@@ -499,6 +500,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
// unnamed test case
if (oldFunctions.size() == 0) {
tc->setTestCaseCount(tc->testCaseCount() + testFunctions.size());
tc->setUnnamedOnly(false);
} else {
oldFunctions << testFunctions;
tc->setTestCases(oldFunctions);
@@ -513,6 +515,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
}
foreach (TestConfiguration *config, foundMains.values())
if (!config->unnamedOnly())
result << config;
return result;