diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml | 29 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp | 20 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml b/tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml new file mode 100644 index 0000000..3651511 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml @@ -0,0 +1,29 @@ +import Test 1.0 +import Qt 4.6 + +MyContainer { + QtObject { + property int index: 0 + } + + QtObject { + property int index: 1 + } + + children: [ + QtObject { + property int index: 2 + }, + QtObject { + property int index: 3 + } + ] + + QtObject { + property int index: 4 + } + + QtObject { + property int index: 5 + } +} diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 0a636db..a36e7b9 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -109,6 +109,7 @@ private slots: void i18n_data(); void onCompleted(); void scriptString(); + void defaultPropertyListOrder(); void importsBuiltin_data(); void importsBuiltin(); @@ -1019,6 +1020,25 @@ void tst_qmllanguage::scriptString() QCOMPARE(object->grouped()->script().context(), qmlContext(object)); } +// Check that default property assignments are correctly spliced into explicit +// property assignments +void tst_qmllanguage::defaultPropertyListOrder() +{ + QmlComponent component(&engine, TEST_FILE("defaultPropertyListOrder.qml")); + VERIFY_ERRORS(0); + + MyContainer *container = qobject_cast<MyContainer *>(component.create()); + QVERIFY(container != 0); + + QCOMPARE(container->children()->count(), 6); + QCOMPARE(container->children()->at(0)->property("index"), QVariant(0)); + QCOMPARE(container->children()->at(1)->property("index"), QVariant(1)); + QCOMPARE(container->children()->at(2)->property("index"), QVariant(2)); + QCOMPARE(container->children()->at(3)->property("index"), QVariant(3)); + QCOMPARE(container->children()->at(4)->property("index"), QVariant(4)); + QCOMPARE(container->children()->at(5)->property("index"), QVariant(5)); +} + // Check that first child of qml is of given type. Empty type insists on error. void tst_qmllanguage::testType(const QString& qml, const QString& type) { |