Commit 30d0eb63 authored by Fawzi Mohamed's avatar Fawzi Mohamed

qmljs: fixing tests

Change-Id: I8f2eaa64f3cb923753234de76f3491d4daa034fa
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 14e645df
......@@ -94,3 +94,5 @@ contains(QT, gui) {
$$PWD/qmljscodeformatter.h \
$$PWD/qmljsreformatter.h
}
QT += xml
......@@ -206,15 +206,17 @@ bool Bind::visit(UiImport *ast)
importId, ast);
if (_doc->language() == Language::Qml) {
const QString importStr = import.name() + importId;
QmlLanguageBundles langBundles = ModelManagerInterface::instance()->extendedBundles();
QmlBundle qq1 = langBundles.bundleForLanguage(Language::QmlQtQuick1);
QmlBundle qq2 = langBundles.bundleForLanguage(Language::QmlQtQuick2);
bool isQQ1 = qq1.supportedImports().contains(importStr);
bool isQQ2 = qq2.supportedImports().contains(importStr);
if (isQQ1 && ! isQQ2)
_doc->setLanguage(Language::QmlQtQuick1);
if (isQQ2 && ! isQQ1)
_doc->setLanguage(Language::QmlQtQuick2);
if (ModelManagerInterface::instance()) {
QmlLanguageBundles langBundles = ModelManagerInterface::instance()->extendedBundles();
QmlBundle qq1 = langBundles.bundleForLanguage(Language::QmlQtQuick1);
QmlBundle qq2 = langBundles.bundleForLanguage(Language::QmlQtQuick2);
bool isQQ1 = qq1.supportedImports().contains(importStr);
bool isQQ2 = qq2.supportedImports().contains(importStr);
if (isQQ1 && ! isQQ2)
_doc->setLanguage(Language::QmlQtQuick1);
if (isQQ2 && ! isQQ1)
_doc->setLanguage(Language::QmlQtQuick2);
}
}
_imports += import;
} else if (!ast->fileName.isEmpty()) {
......
......@@ -3,9 +3,9 @@ include(../../../qttest.pri)
DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\"
DEFINES+=TESTSRCDIR=\\\"$$PWD\\\"
include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri)
include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils.pri)
include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs.pri)
include($$IDE_SOURCE_TREE/src/libs/utils/utils-lib.pri)
include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils-lib.pri)
include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs-lib.pri)
TARGET = tst_codemodel_check
......
......@@ -122,7 +122,9 @@ void tst_Check::test()
QVERIFY(!doc->source().isEmpty());
QVERIFY(doc->diagnosticMessages().isEmpty());
ContextPtr context = Link(snapshot, QStringList(), LibraryInfo())();
ViewerContext vContext;
vContext.flags = ViewerContext::Complete;
ContextPtr context = Link(snapshot, vContext, LibraryInfo())();
Check checker(doc, context);
QList<Message> messages = checker();
......
......@@ -2,9 +2,9 @@ include(../../../qttest.pri)
SRCDIR = ../../../../../src
include($$SRCDIR/libs/qmljs/qmljs.pri)
include($$SRCDIR/libs/utils/utils.pri)
include($$SRCDIR/libs/languageutils/languageutils.pri)
include($$SRCDIR/libs/qmljs/qmljs-lib.pri)
include($$SRCDIR/libs/utils/utils-lib.pri)
include($$SRCDIR/libs/languageutils/languageutils-lib.pri)
SOURCES += \
tst_qmlcodeformatter.cpp \
......
......@@ -6,7 +6,7 @@ QT += script \
PLUGIN_DIR=../../../../../src/plugins/qmlprojectmanager
include($$PLUGIN_DIR/fileformat/fileformat.pri)
include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri)
include($$IDE_SOURCE_TREE/src/libs/utils/utils-lib.pri)
INCLUDEPATH += $$PLUGIN_DIR/fileformat
......
......@@ -3,8 +3,8 @@ include(../../qttest.pri)
DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\"
DEFINES+=TESTSRCDIR=\\\"$$PWD\\\"
include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri)
include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs.pri)
include($$IDE_SOURCE_TREE/src/libs/utils/utils-lib.pri)
include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs-lib.pri)
TARGET = tst_reformatter
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment