diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-19 17:54:45 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-20 12:07:34 +0100 |
commit | bf573ad295fbc1eee9379bfaafcded293c4b81f4 (patch) | |
tree | 330a69b72e7de269753c4563c8d59bac5a533d3d /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | e9997bc96911923355af2e1dd081cc039a2b2b8f (diff) |
QML_SINGLETON: Handle local create() functions with foreign types
Previously only the foreign type was searched for a create method.
Now the wrapping type can also contain it.
Change-Id: I05fb9e0c0a54c14530eb9adcae5a44df5c208be3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 4f4ee45f68..454ae59ad3 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -313,6 +313,7 @@ private slots: void typeWrapperToVariant(); void extendedForeignTypes(); + void foreignTypeSingletons(); void inlineComponent(); void inlineComponent_data(); @@ -5496,6 +5497,16 @@ void tst_qqmllanguage::extendedForeignTypes() QCOMPARE(o->property("foreignExtendedObjectName").toString(), QLatin1String("foreignExtended")); } +void tst_qqmllanguage::foreignTypeSingletons() { + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("foreignSingleton.qml")); + VERIFY_ERRORS(0); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + + QCOMPARE(o->property("number").toInt(), 42); +} + void tst_qqmllanguage::selfReference() { QQmlEngine engine; |