From 15765bc59d2569803d5b1b200e26919e27d00bcd Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 4 May 2009 15:07:56 +0200 Subject: Added (failing) testcase for QmlDomValueValueSource. --- tests/auto/declarative/qmldom/tst_qmldom.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp index 390e79a..91fe7a6 100644 --- a/tests/auto/declarative/qmldom/tst_qmldom.cpp +++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp @@ -16,6 +16,8 @@ private slots: void loadProperties(); void loadChildObject(); + void testValueSource(); + private: QmlEngine engine; }; @@ -85,6 +87,23 @@ void tst_qmldom::loadChildObject() QVERIFY(childItem.objectType() == "Item"); } +void tst_qmldom::testValueSource() +{ + QByteArray qml = "Rect { height: Follow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; + + QmlEngine freshEngine; + QmlDomDocument document; + QVERIFY(document.load(&freshEngine, qml)); + + QmlDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QmlDomProperty heightProperty = rootItem.properties().at(0); + QVERIFY(heightProperty.propertyName() == "height"); + QVERIFY(heightProperty.value().isValueSource()); + const QmlDomValueValueSource valueSource = heightProperty.value().toValueSource(); + QVERIFY(valueSource.object().isValid()); +} + QTEST_MAIN(tst_qmldom) #include "tst_qmldom.moc" -- cgit v0.12