diff options
author | Evgeniy A. Dushistov <dushistov@mail.ru> | 2020-08-21 15:50:52 +0300 |
---|---|---|
committer | Evgeniy A. Dushistov <dushistov@mail.ru> | 2020-08-22 15:36:44 +0300 |
commit | a29eb1c15200363a175c1b3a9ad2189b63b9765f (patch) | |
tree | c2dbe0ddf5e6268fdd0f1ae03d7ce0b67f569d0c /tests | |
parent | 538f1b7dd65b1aa6133e1adb8b6d893ab366173e (diff) |
qmllint: fix import java scripts from module
Fixes: QTBUG-86183
Change-Id: I4809cb5a408eb4e668f802cf0d7b7a872d1ed4b7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
5 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/ModuleWithJS/Foo.js b/tests/auto/qml/qmllint/data/ModuleWithJS/Foo.js new file mode 100644 index 0000000000..ee355979e7 --- /dev/null +++ b/tests/auto/qml/qmllint/data/ModuleWithJS/Foo.js @@ -0,0 +1,6 @@ +.pragma library + +function somefunc(name) +{ + return "Hi, " + name; +} diff --git a/tests/auto/qml/qmllint/data/ModuleWithJS/qmldir b/tests/auto/qml/qmllint/data/ModuleWithJS/qmldir new file mode 100644 index 0000000000..375510769c --- /dev/null +++ b/tests/auto/qml/qmllint/data/ModuleWithJS/qmldir @@ -0,0 +1,2 @@ +module ModuleWithJS +Foo 1.0 Foo.js
\ No newline at end of file diff --git a/tests/auto/qml/qmllint/data/javascriptMethodsInModuleBad.qml b/tests/auto/qml/qmllint/data/javascriptMethodsInModuleBad.qml new file mode 100644 index 0000000000..40edbd3aff --- /dev/null +++ b/tests/auto/qml/qmllint/data/javascriptMethodsInModuleBad.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +import ModuleWithJS + +QtObject { + objectName: Foo.unknownFunc() +} diff --git a/tests/auto/qml/qmllint/data/javascriptMethodsInModuleGood.qml b/tests/auto/qml/qmllint/data/javascriptMethodsInModuleGood.qml new file mode 100644 index 0000000000..d0ee66bf4d --- /dev/null +++ b/tests/auto/qml/qmllint/data/javascriptMethodsInModuleGood.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +import ModuleWithJS + +QtObject { + objectName: Foo.somefunc() +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 705ff7686f..02740e7ecf 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -187,6 +187,9 @@ void TestQmllint::dirtyQmlCode_data() << QStringLiteral("qmldirImportAndDepend/bad.qml") << QString("warning: Item was not found. Did you add all import paths?") << QString(); + QTest::newRow("javascriptMethodsInModule") + << QStringLiteral("javascriptMethodsInModuleBad.qml") + << QString("Warning: Property \"unknownFunc\" not found on type \"Foo\"") << QString(); } void TestQmllint::dirtyQmlCode() @@ -231,6 +234,8 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("qmldirImportAndDepend") << QStringLiteral("qmldirImportAndDepend/good.qml"); QTest::newRow("ParentEnum") << QStringLiteral("parentEnum.qml"); QTest::newRow("Signals") << QStringLiteral("Signal.qml"); + QTest::newRow("javascriptMethodsInModule") + << QStringLiteral("javascriptMethodsInModuleGood.qml"); } void TestQmllint::cleanQmlCode() |