diff options
Diffstat (limited to 'tests/auto/qml')
5 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmltypeloader/CMakeLists.txt b/tests/auto/qml/qqmltypeloader/CMakeLists.txt index 13a7e49b17..e3d59ee35c 100644 --- a/tests/auto/qml/qqmltypeloader/CMakeLists.txt +++ b/tests/auto/qml/qqmltypeloader/CMakeLists.txt @@ -42,6 +42,14 @@ qt_internal_extend_target(tst_qqmltypeloader CONDITION NOT ANDROID AND NOT IOS QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\" ) +qt_add_resources(tst_qqmltypeloader "typeloader" + PREFIX + "/" + FILES + "declarative/import/for/typeloader/test/qmldir" + "declarative/import/for/typeloader/test/Singleton.qml" +) + set_target_properties(tst_qqmltypeloader PROPERTIES QT_QML_MODULE_VERSION 3.2 QT_QML_MODULE_URI declarative.import.for.typeloader.test diff --git a/tests/auto/qml/qqmltypeloader/data/cppAndQmlDir.qml b/tests/auto/qml/qqmltypeloader/data/cppAndQmlDir.qml new file mode 100644 index 0000000000..9d2ea9650e --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/data/cppAndQmlDir.qml @@ -0,0 +1,7 @@ +import QtQml 2.0 +import declarative.import.for.typeloader.test 3.2 + +DeclarativeTestType { + Component.onCompleted: console.log(Singleton, Singleton.objectName) + objectName: Singleton.objectName +} diff --git a/tests/auto/qml/qqmltypeloader/declarative/import/for/typeloader/test/Singleton.qml b/tests/auto/qml/qqmltypeloader/declarative/import/for/typeloader/test/Singleton.qml new file mode 100644 index 0000000000..ace0d6f438 --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/declarative/import/for/typeloader/test/Singleton.qml @@ -0,0 +1,7 @@ +pragma Singleton + +import QtQml + +QtObject { + objectName: "Singleton" +} diff --git a/tests/auto/qml/qqmltypeloader/declarative/import/for/typeloader/test/qmldir b/tests/auto/qml/qqmltypeloader/declarative/import/for/typeloader/test/qmldir new file mode 100644 index 0000000000..c246d8de30 --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/declarative/import/for/typeloader/test/qmldir @@ -0,0 +1 @@ +singleton Singleton 3.2 Singleton.qml diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 750f9ff402..be5f44dc90 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -64,6 +64,7 @@ private slots: void compositeSingletonCycle(); void declarativeCppType(); void circularDependency(); + void declarativeCppAndQmlDir(); private: void checkSingleton(const QString & dataDirectory); }; @@ -649,6 +650,16 @@ void tst_QQMLTypeLoader::circularDependency() QCOMPARE(component.status(), QQmlComponent::Null); } +void tst_QQMLTypeLoader::declarativeCppAndQmlDir() +{ + QQmlEngine engine; + engine.addImportPath("qrc:/"); + QQmlComponent component(&engine, testFileUrl("cppAndQmlDir.qml")); + QVERIFY2(!component.isError(), qPrintable(component.errorString())); + QScopedPointer<QObject> root(component.create()); + QCOMPARE(root->objectName(), "Singleton"); +} + QTEST_MAIN(tst_QQMLTypeLoader) #include "tst_qqmltypeloader.moc" |