2014-10-07 12:30:54 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2014 Digia Plc
|
|
|
|
|
** All rights reserved.
|
|
|
|
|
** For any questions to Digia, please use contact form at http://qt.digia.com
|
|
|
|
|
**
|
|
|
|
|
** This file is part of the Qt Creator Enterprise Auto Test Add-on.
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Enterprise licenses may use this file in
|
|
|
|
|
** accordance with the Qt Enterprise License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please use
|
|
|
|
|
** contact form at http://qt.digia.com
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TESTVISITOR_H
|
|
|
|
|
#define TESTVISITOR_H
|
|
|
|
|
|
2014-11-13 12:31:58 +01:00
|
|
|
#include "testtreeitem.h"
|
|
|
|
|
|
2014-10-28 15:57:13 +01:00
|
|
|
#include <cplusplus/ASTVisitor.h>
|
|
|
|
|
#include <cplusplus/CppDocument.h>
|
|
|
|
|
#include <cplusplus/Scope.h>
|
2014-10-07 12:30:54 +02:00
|
|
|
#include <cplusplus/SymbolVisitor.h>
|
|
|
|
|
|
2014-11-06 16:01:06 +01:00
|
|
|
#include <qmljs/parser/qmljsastvisitor_p.h>
|
|
|
|
|
#include <qmljs/qmljsdocument.h>
|
|
|
|
|
|
2014-10-07 12:30:54 +02:00
|
|
|
#include <QMap>
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TestVisitor : public CPlusPlus::SymbolVisitor
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TestVisitor(const QString &fullQualifiedClassName);
|
|
|
|
|
virtual ~TestVisitor();
|
|
|
|
|
|
2014-11-13 12:31:58 +01:00
|
|
|
QMap<QString, TestCodeLocationAndType> privateSlots() const { return m_privSlots; }
|
2014-10-07 12:30:54 +02:00
|
|
|
|
|
|
|
|
bool visit(CPlusPlus::Class *symbol);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_className;
|
2014-11-13 12:31:58 +01:00
|
|
|
QMap<QString, TestCodeLocationAndType> m_privSlots;
|
2014-10-07 12:30:54 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-28 15:57:13 +01:00
|
|
|
class TestAstVisitor : public CPlusPlus::ASTVisitor
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TestAstVisitor(CPlusPlus::Document::Ptr doc);
|
|
|
|
|
virtual ~TestAstVisitor();
|
|
|
|
|
|
|
|
|
|
bool visit(CPlusPlus::CallAST *ast);
|
|
|
|
|
bool visit(CPlusPlus::CompoundStatementAST *ast);
|
|
|
|
|
|
|
|
|
|
QString className() const { return m_className; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_className;
|
|
|
|
|
CPlusPlus::Scope *m_currentScope;
|
|
|
|
|
CPlusPlus::Document::Ptr m_currentDoc;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2014-11-06 16:01:06 +01:00
|
|
|
class TestQmlVisitor : public QmlJS::AST::Visitor
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TestQmlVisitor(QmlJS::Document::Ptr doc);
|
|
|
|
|
virtual ~TestQmlVisitor();
|
|
|
|
|
|
|
|
|
|
bool visit(QmlJS::AST::UiObjectDefinition *ast);
|
|
|
|
|
bool visit(QmlJS::AST::ExpressionStatement *ast);
|
|
|
|
|
bool visit(QmlJS::AST::UiScriptBinding *ast);
|
|
|
|
|
bool visit(QmlJS::AST::FunctionDeclaration *ast);
|
|
|
|
|
bool visit(QmlJS::AST::StringLiteral *ast);
|
|
|
|
|
|
|
|
|
|
QString testCaseName() const { return m_currentTestCaseName; }
|
2014-11-13 12:31:58 +01:00
|
|
|
TestCodeLocationAndType testCaseLocation() const { return m_testCaseLocation; }
|
|
|
|
|
QMap<QString, TestCodeLocationAndType> testFunctions() const { return m_testFunctions; }
|
2014-11-06 16:01:06 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QmlJS::Document::Ptr m_currentDoc;
|
|
|
|
|
QString m_currentTestCaseName;
|
2014-11-13 12:31:58 +01:00
|
|
|
TestCodeLocationAndType m_testCaseLocation;
|
|
|
|
|
QMap<QString, TestCodeLocationAndType> m_testFunctions;
|
2014-11-06 16:01:06 +01:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-07 12:30:54 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
|
|
|
|
#endif // TESTVISITOR_H
|