From 4f007625bf98077d1913f004ffff62383c3d9379 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 25 Jan 2010 16:06:59 +1000 Subject: Test QML doesn't hijack JS Object QTBUG-5759 --- tests/auto/declarative/qmlecmascript/data/jsObject.qml | 12 ++++++++++++ tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/jsObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/jsObject.qml b/tests/auto/declarative/qmlecmascript/data/jsObject.qml new file mode 100644 index 0000000..4128c92 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/jsObject.qml @@ -0,0 +1,12 @@ +import Qt 4.6 + +QtObject { + property int test + + Component.onCompleted: { + var o = new Object; + o.test = 92; + test = o.test; + } +} + diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index ba23ef8..4c9721a 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -115,6 +115,7 @@ private slots: void shutdownErrors(); void externalScript(); void compositePropertyType(); + void jsObject(); void bug1(); @@ -1062,6 +1063,18 @@ void tst_qmlecmascript::compositePropertyType() delete object; } +// QTBUG-5759 +void tst_qmlecmascript::jsObject() +{ + QmlComponent component(&engine, TEST_FILE("jsObject.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 92); + + delete object; +} + // QTBUG-6781 void tst_qmlecmascript::bug1() { -- cgit v0.12