aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-09-25 13:31:11 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-09-26 05:57:22 +0000
commit930aea8b9ca59a24838cf7f279653e3b2ee40cee (patch)
treee76557a11ee9ed31e09005924dfa9ff6a9adc423 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
parent112d668c0fded8c6ab7bf40fd3800cf43e005f95 (diff)
Fix implicit loading of internal types when using explicit imports
The QQC Android style has a type that is intended to be internal only and it's loaded implictly (see bug report for details). However the qml file also has to import the module explicitly in order to get access to the singleton the module provides. The documentation says that types of a module are to be specified in the qmldir file, otherwise they are derived from the file name. With commit 22a2cc43387ec3b9f74a6c01f8665378a4541147 that become an exclusive relationship with regards to types from implicit imports. The proposed solution for the JIRA task is to mark the types that are needed internally as "internal" in the qmldir file and fix support for loading internal types through implicit imports (which is what this commit fixes). Task-number: QTBUG-63309 Change-Id: Id696a691f1af1d335c7c8d72f2627064c3d7b9ac Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index e5366b5c48..eb462979ed 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -179,6 +179,7 @@ private slots:
void importJs_data();
void importJs();
void explicitSelfImport();
+ void importInternalType();
void qmlAttachedPropertiesObjectMethod();
void customOnProperty();
@@ -3086,6 +3087,29 @@ void tst_qqmllanguage::explicitSelfImport()
engine.setImportPathList(defaultImportPathList);
}
+void tst_qqmllanguage::importInternalType()
+{
+ QQmlEngine engine;
+ engine.addImportPath(dataDirectory());
+
+ {
+ QQmlComponent component(&engine);
+ component.setData("import modulewithinternaltypes 1.0\nPublicType{}", QUrl());
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QVERIFY(obj->property("myInternalType").value<QObject*>() != 0);
+ }
+ {
+ QQmlComponent component(&engine);
+ component.setData("import modulewithinternaltypes 1.0\nPublicTypeWithExplicitImport{}", QUrl());
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QVERIFY(obj->property("myInternalType").value<QObject*>() != 0);
+ }
+}
+
void tst_qqmllanguage::qmlAttachedPropertiesObjectMethod()
{
QObject object;