AutoTest: Unify handling of test tree items...

...and let specialized items handle its specialization by itself.

Change-Id: I988ce3c610bef68933b9102bb39ae4723add3a99
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Christian Stenger
2016-02-23 15:56:52 +01:00
parent 009eef4e0d
commit 36f6a5580f
10 changed files with 314 additions and 394 deletions

View File

@@ -94,8 +94,7 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol)
else if (name.endsWith(QLatin1String("_data")))
locationAndType.m_type = TestTreeItem::TestDataFunction;
else
locationAndType.m_type = TestTreeItem::TestFunction;
locationAndType.m_state = TestTreeItem::Enabled;
locationAndType.m_type = TestTreeItem::TestFunctionOrSet;
m_privSlots.insert(name, locationAndType);
}
}
@@ -225,7 +224,6 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::CallAST *ast)
locationAndType.m_column = column - 1;
locationAndType.m_line = line;
locationAndType.m_type = TestTreeItem::TestDataTag;
locationAndType.m_state = TestTreeItem::Enabled;
m_currentTags.append(locationAndType);
}
}
@@ -302,7 +300,7 @@ bool TestQmlVisitor::visit(QmlJS::AST::UiObjectDefinition *ast)
m_testCaseLocation.m_name = m_currentDoc->fileName();
m_testCaseLocation.m_line = sourceLocation.startLine;
m_testCaseLocation.m_column = sourceLocation.startColumn - 1;
m_testCaseLocation.m_type = TestTreeItem::TestClass;
m_testCaseLocation.m_type = TestTreeItem::TestCase;
return true;
}
@@ -335,9 +333,8 @@ bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast)
else if (name.endsWith(QLatin1String("_data")))
locationAndType.m_type = TestTreeItem::TestDataFunction;
else
locationAndType.m_type = TestTreeItem::TestFunction;
locationAndType.m_type = TestTreeItem::TestFunctionOrSet;
locationAndType.m_state = TestTreeItem::Enabled;
m_testFunctions.insert(name.toString(), locationAndType);
}
return false;
@@ -389,9 +386,9 @@ bool GTestVisitor::visit(CPlusPlus::FunctionDefinitionAST *ast)
locationAndType.m_name = disabled ? testName.mid(9) : testName;
locationAndType.m_line = line;
locationAndType.m_column = column - 1;
locationAndType.m_type = TestTreeItem::GTestName;
locationAndType.m_state = (disabled || disabledCase) ? TestTreeItem::Disabled
: TestTreeItem::Enabled;
locationAndType.m_type = TestTreeItem::TestFunctionOrSet;
locationAndType.m_state = (disabled || disabledCase) ? GoogleTestTreeItem::Disabled
: GoogleTestTreeItem::Enabled;
GTestCaseSpec spec;
spec.testCaseName = disabledCase ? testCaseName.mid(9) : testCaseName;
spec.parameterized = TestUtils::isGTestParameterized(prettyName);