AutoTest: Handle sub-typed TestCases correctly

Furthermore ensure that TestCase is really the Qml type
to avoid handling self-defined types as Quick Tests.

Task-number: QTCREATORBUG-17787
Change-Id: I08a6c70c3c166eefec6f24669cc225f568e51c7a
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
Christian Stenger
2017-02-27 09:30:16 +01:00
parent e69c2eb2d5
commit 5708f3aa34
14 changed files with 195 additions and 13 deletions

View File

@@ -36,7 +36,7 @@ namespace Internal {
class TestQmlVisitor : public QmlJS::AST::Visitor
{
public:
explicit TestQmlVisitor(QmlJS::Document::Ptr doc);
explicit TestQmlVisitor(QmlJS::Document::Ptr doc, const QmlJS::Snapshot &snapshot);
bool visit(QmlJS::AST::UiObjectDefinition *ast);
bool visit(QmlJS::AST::ExpressionStatement *ast);
@@ -47,12 +47,15 @@ public:
QString testCaseName() const { return m_currentTestCaseName; }
TestCodeLocationAndType testCaseLocation() const { return m_testCaseLocation; }
QMap<QString, TestCodeLocationAndType> testFunctions() const { return m_testFunctions; }
bool isValid() const { return m_typeIsTestCase; }
private:
QmlJS::Document::Ptr m_currentDoc;
QmlJS::Snapshot m_snapshot;
QString m_currentTestCaseName;
TestCodeLocationAndType m_testCaseLocation;
QMap<QString, TestCodeLocationAndType> m_testFunctions;
bool m_typeIsTestCase = false;
};
} // namespace Internal