From 0761786fc96ff68550697e5386274c7418c73031 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Feb 2018 15:01:52 +0100 Subject: Disallow the use of id properties with value type group properties While it is valid to assign an id to group properties that are QObjects, it is not possible to support this with group properties that are value types, as we do not have QObject instances and id references are limited to those. Change-Id: I7601d0fe00d1261dd711e34f45550db797773f9a Task-number: QTBUG-51525 Reviewed-by: Michael Brasser --- tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt | 1 + tests/auto/qml/qqmllanguage/data/invalidID.10.qml | 7 +++++++ tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 1 + 3 files changed, 9 insertions(+) create mode 100644 tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt create mode 100644 tests/auto/qml/qqmllanguage/data/invalidID.10.qml (limited to 'tests') diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt new file mode 100644 index 0000000000..d9dcb32f8e --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt @@ -0,0 +1 @@ +4:9:Invalid use of id property with a value type diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.10.qml b/tests/auto/qml/qqmllanguage/data/invalidID.10.qml new file mode 100644 index 0000000000..4f1817dba4 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/invalidID.10.qml @@ -0,0 +1,7 @@ +import Test 1.0 +MyQmlObject { + rect { + id: notPossible + width: 100 + } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 6a3418f1ab..d08ad47310 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -433,6 +433,7 @@ void tst_qqmllanguage::errors_data() QTest::newRow("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false; QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false; QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false; + QTest::newRow("invalidID.10") << "invalidID.10.qml" << "invalidID.10.errors.txt" << false; QTest::newRow("scriptString.1") << "scriptString.1.qml" << "scriptString.1.errors.txt" << false; QTest::newRow("scriptString.2") << "scriptString.2.qml" << "scriptString.2.errors.txt" << false; -- cgit v1.2.3