diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-04-29 12:29:45 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-04-29 12:40:46 +0000 |
commit | 8f7b36f8999f5f906d6a425d6e54c6c86be4c77e (patch) | |
tree | 7df1ad9ea1e42966dbcc8f64033c9857a7c195c3 /tests/auto/qml/qqmllanguage | |
parent | 2f6a7e1ee7e8765b447ded3221868e08486fd3cd (diff) |
Allow the use of uncreatable types for properties
It should be possible to write
property SomeUncreatableType blah;
It should not be possible to write:
property SomeUncreatableType blah: SomeUncreatableType {}
Task-number: QTBUG-36752
Change-Id: I2d1aa9f070a368f51844bbc0733d285022aab403
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
3 files changed, 18 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/singletonTest10.error.txt b/tests/auto/qml/qqmllanguage/data/singletonTest10.error.txt deleted file mode 100644 index 32d2ed857e..0000000000 --- a/tests/auto/qml/qqmllanguage/data/singletonTest10.error.txt +++ /dev/null @@ -1 +0,0 @@ -4:1:Composite Singleton Type SingletonType is not creatable. diff --git a/tests/auto/qml/qqmllanguage/data/uncreatableTypeAsProperty.qml b/tests/auto/qml/qqmllanguage/data/uncreatableTypeAsProperty.qml new file mode 100644 index 0000000000..8369ab1eea --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/uncreatableTypeAsProperty.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +import Test 1.0 + +QtObject { + property MyUncreateableBaseClass someProperty; +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index dd7410dfd3..1ac1661ea8 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -188,6 +188,8 @@ private slots: void subclassedUncreateableRevision_data(); void subclassedUncreateableRevision(); + void uncreatableTypesAsProperties(); + void propertyInit(); void remoteLoadCrash(); void signalWithDefaultArg(); @@ -3158,6 +3160,14 @@ void tst_qqmllanguage::subclassedUncreateableRevision() delete obj; } +void tst_qqmllanguage::uncreatableTypesAsProperties() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("uncreatableTypeAsProperty.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); +} + void tst_qqmllanguage::initTestCase() { QQmlDataTest::initTestCase(); @@ -3863,12 +3873,11 @@ void tst_qqmllanguage::compositeSingletonInstantiateError() VERIFY_ERRORS("singletonTest9.error.txt"); } -// Having a composite singleton type as dynamic property type fails -// (like C++ singleton) +// Having a composite singleton type as dynamic property type is allowed void tst_qqmllanguage::compositeSingletonDynamicPropertyError() { QQmlComponent component(&engine, testFile("singletonTest10.qml")); - VERIFY_ERRORS("singletonTest10.error.txt"); + VERIFY_ERRORS(0); } // Having a composite singleton type as dynamic signal parameter succeeds |