From 3ade772efd07fe342c10274b5fc6387965ac0c9d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Sat, 9 Jan 2010 19:04:15 +1000 Subject: Another dynamic method autotest --- tests/auto/declarative/qmlecmascript/data/MethodsObject.qml | 6 ++++++ tests/auto/declarative/qmlecmascript/data/methods.4.qml | 11 +++++++++++ tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 9 +++++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/MethodsObject.qml create mode 100644 tests/auto/declarative/qmlecmascript/data/methods.4.qml diff --git a/tests/auto/declarative/qmlecmascript/data/MethodsObject.qml b/tests/auto/declarative/qmlecmascript/data/MethodsObject.qml new file mode 100644 index 0000000..f51ca86 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/MethodsObject.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +QtObject { + function testFunction() { return 19; } + function testFunction2() { return 18; } +} diff --git a/tests/auto/declarative/qmlecmascript/data/methods.4.qml b/tests/auto/declarative/qmlecmascript/data/methods.4.qml new file mode 100644 index 0000000..aac711c --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/methods.4.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +MethodsObject { + function testFunction2() { return 17; } + function testFunction3() { return 16; } + + property int test: testFunction() + property int test2: testFunction2() + property int test3: testFunction3() +} + diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index f560a90..6f7832a 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -206,6 +206,15 @@ void tst_qmlecmascript::methods() QVERIFY(object != 0); QCOMPARE(object->property("test").toInt(), 19); } + + { + QmlComponent component(&engine, TEST_FILE("methods.4.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toInt(), 19); + QCOMPARE(object->property("test2").toInt(), 17); + QCOMPARE(object->property("test3").toInt(), 16); + } } void tst_qmlecmascript::bindingLoop() -- cgit v0.12