diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-07-13 10:44:39 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-13 08:06:06 +0200 |
commit | d166e34bade3b7c82f610f5df209b6418df9e178 (patch) | |
tree | c8a9eca854635a25245994db852c0e452849e87d /tests/auto/quick/qquickbehaviors | |
parent | cf507172d6aa281036cde02ded9493535685fd80 (diff) |
Update multiple value type properties despite interceptor
When an interceptor is present on a value type, ensure that multiple
properties of that value can be updated simultaneously.
Task-number: QTBUG-25139
Change-Id: I3042b9883d404aed4b6507e6d2f38a76caee1196
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickbehaviors')
-rw-r--r-- | tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml | 19 | ||||
-rw-r--r-- | tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp | 27 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml b/tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml new file mode 100644 index 0000000000..029a439607 --- /dev/null +++ b/tests/auto/quick/qquickbehaviors/data/multipleChangesToValueType.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 400 + + Text { + id: text + anchors.centerIn: parent + font.pointSize: 24 + Behavior on font.pointSize { NumberAnimation {} } + } + + function updateFontProperties() { + text.font.italic = true + text.font.pointSize = 48 + text.font.weight = Font.Bold + } +} diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index bd17bf4143..be7ad304b6 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -80,6 +80,7 @@ private slots: void sameValue(); void delayedRegistration(); void startOnCompleted(); + void multipleChangesToValueType(); }; void tst_qquickbehaviors::simpleBehavior() @@ -468,6 +469,32 @@ void tst_qquickbehaviors::startOnCompleted() delete rect; } +//QTBUG-25139 +void tst_qquickbehaviors::multipleChangesToValueType() +{ + QQmlEngine engine; + + QQmlComponent c(&engine, testFileUrl("multipleChangesToValueType.qml")); + QScopedPointer<QQuickRectangle> rect(qobject_cast<QQuickRectangle *>(c.create())); + QVERIFY(rect != 0); + + QQuickText *text = rect->findChild<QQuickText *>(); + QVERIFY(text != 0); + + QFont value; + value.setPointSize(24); + QCOMPARE(text->property("font").value<QFont>(), value); + + QVERIFY(QMetaObject::invokeMethod(rect.data(), "updateFontProperties")); + + value.setItalic(true); + value.setWeight(QFont::Bold); + QCOMPARE(text->property("font").value<QFont>(), value); + + value.setPointSize(48); + QTRY_COMPARE(text->property("font").value<QFont>(), value); +} + QTEST_MAIN(tst_qquickbehaviors) #include "tst_qquickbehaviors.moc" |