aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2011-05-12 11:31:31 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2011-05-12 11:31:31 +0200
commitf31d94f2d4438106558dede0de1a423cade960a9 (patch)
tree4adc37849f713cf7e343b43fab030630369aa01f /tests/auto
parent35559a2f00fc9bf609144a6bba3f0a678f61cd12 (diff)
Fix the QML front-end to allow side effects in the initializer.
Task-number: QTBUG-15117
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index f9684b90a4..a2c4936719 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -157,6 +157,8 @@ private slots:
void revisions();
void revisionOverloads();
+ void propertyInit();
+
// regression tests for crashes
void crash1();
void crash2();
@@ -2017,6 +2019,34 @@ void tst_qdeclarativelanguage::aliasPropertyChangeSignals()
}
}
+// Tests property initializers
+void tst_qdeclarativelanguage::propertyInit()
+{
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("propertyInit.1.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toInt(), 1);
+
+ delete o;
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("propertyInit.2.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("test").toInt(), 123);
+
+ delete o;
+ }
+}
+
QTEST_MAIN(tst_qdeclarativelanguage)
#include "tst_qdeclarativelanguage.moc"