Skip to content
Snippets Groups Projects
Commit 87afbf39 authored by Christian Kamm's avatar Christian Kamm
Browse files

Add simple stub non-functional autotest.

Done-with: Thomas Hartmann
parent f3667544
No related branches found
No related tags found
No related merge requests found
TEMPLATE = app
# this build works only in-source or inside a qtcreator shadow
# build if the test's shadow build directory is QTC-BUILD/tests/auto/qml/codemodel/basic
QTCREATOR_SOURCE=$$PWD/../../../../..
QTCREATOR_BUILD=$$OUT_PWD/../../../../..
# can we check that this is a valid build dir?
OUT_PWD_SAVE=$$OUT_PWD
OUT_PWD=QTCREATOR_BUILD
include($$QTCREATOR_SOURCE/qtcreator.pri)
OUT_PWD=$$OUT_PWD_SAVE
LIBS += -L$$IDE_PLUGIN_PATH/Nokia
unix: QMAKE_LFLAGS += \'-Wl,-rpath,$${IDE_LIBRARY_PATH}\' \'-Wl,-rpath,$${IDE_PLUGIN_PATH}/Nokia\'
QT += core network
CONFIG += qtestlib testcase
# DEFINES+=QTCREATOR_UTILS_STATIC_LIB QML_BUILD_STATIC_LIB
DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\"
DEFINES+=QT_CREATOR QTCREATOR_TEST
DEPENDPATH += ..
include($$IDE_SOURCE_TREE/src/libs/utils/utils-lib.pri)
include($$IDE_SOURCE_TREE/src/plugins/qmljstools/qmljstools.pri)
TARGET = tst_codemodel_basic
win32: TARGET = $$IDE_APP_PATH/$$TARGET
CONFIG += console
CONFIG -= app_bundle
SOURCES += \
tst_basic.cpp
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include <QScopedPointer>
#include <QLatin1String>
#include <QGraphicsObject>
#include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljslookupcontext.h>
#include <qmljstools/qmljsrefactoringchanges.h>
#include <qmljstools/qmljsmodelmanager.h>
#include <QtTest>
using namespace QmlJS;
using namespace QmlJSTools;
class tst_Basic : public QObject
{
Q_OBJECT
public:
tst_Basic();
private slots:
void initTestCase();
void cleanupTestCase();
void testMetaInfo();
};
class TestModelManager : public Internal::ModelManager
{
public:
virtual ~TestModelManager() {}
void loadFile(QString fileName)
{
refreshSourceFiles(QStringList() << fileName, false).waitForFinished();
}
};
tst_Basic::tst_Basic()
{
}
void tst_Basic::initTestCase()
{
}
void tst_Basic::cleanupTestCase()
{
}
void tst_Basic::testMetaInfo()
{
TestModelManager modelManager;
modelManager.loadFile(QString(QTCREATORDIR) + "/tests/auto/qml/qmldesigner/data/fx/usingmybutton.qml");
Snapshot snapshot = modelManager.snapshot();
Document::Ptr doc = snapshot.document(QString(QTCREATORDIR) + "/tests/auto/qml/qmldesigner/data/fx/usingmybutton.qml");
QVERIFY(doc && doc->isQmlDocument());
LookupContext::Ptr lookupContext = LookupContext::create(doc, snapshot, QList<AST::Node>());
Interpreter::Value *v = lookupContext->evaluate();
Interpreter::ObjectValue *ov = lookupContext->context()->lookupType(doc, QStringList() << "Qt" << "Rectangle");
qDebug() << ov->className();
doc->bind(); // per-doc data
qDebug() << lookupContext->context()->scopeChain().qmlTypes->importInfo("Rectangle", lookupContext->context()).name();
// Snapshot snapshot;
// QmlJSRefactoringChanges changes(&modelManager, snapshot);
// QmlJSRefactoringFile file = changes.file(QString(QTCREATORDIR) + "/tests/auto/qml/qmldesigner/data/fx/usingmybutton.qml");
// QVERIFY(file.isValid());
// snapshot.insert(file.qmljsDocument());
}
QTEST_MAIN(tst_Basic);
#include "tst_basic.moc"
TEMPLATE = subdirs
SUBDIRS += basic
......@@ -2,4 +2,5 @@ TEMPLATE = subdirs
SUBDIRS += qmldesigner \
# qmleditor \
qmlprojectmanager
qmlprojectmanager \
codemodel
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment