summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-01 07:21:47 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-03 04:26:20 (GMT)
commit350f749d1e760f32b8ff21a254bb9b9989174f71 (patch)
treed3f4b0b4b5bed5cd33c3d40e382041d6086d80af /tests
parent67c3a18b13eeadf60e9a07b9667ece5c17e9ab7e (diff)
downloadQt-350f749d1e760f32b8ff21a254bb9b9989174f71.zip
Qt-350f749d1e760f32b8ff21a254bb9b9989174f71.tar.gz
Qt-350f749d1e760f32b8ff21a254bb9b9989174f71.tar.bz2
Test for default property ordering
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml29
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp20
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)
{