diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-11-09 13:01:56 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-09 08:23:57 +0100 |
commit | 28102d1935dfd7fc88c4bb3b656aadc44942f562 (patch) | |
tree | e96d213cb6b62d0e4061793d3a13006edbd38b17 /tests/auto/declarative/qdeclarativebehaviors | |
parent | 15547ac366bdfd6f35779995b5d56df669b5e564 (diff) |
Behavior on a value type should not cancel previous assignment.
The call to read the value type value causes the previously assigned
value to be overridden. This commit fixes the issue, but doesn't
solve the root cause, which would require changes at the
compiler/vme level.
Task-number: QTBUG-20827
Change-Id: I1a53ee7b777bea81c5929ab7e47e2932e6901967
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativebehaviors')
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/valueType.qml | 13 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/valueType.qml b/tests/auto/declarative/qdeclarativebehaviors/data/valueType.qml new file mode 100644 index 0000000000..7bc8297dc7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/valueType.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 +Rectangle { + width: 400 + height: 400 + + color.r: 1 + color.g: 0 + color.b: 1 + + Behavior on color.r { NumberAnimation { duration: 500; } } + + function changeR() { color.r = 0 } +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index e84cd580ce..608cdac3a8 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -66,6 +66,7 @@ private slots: void replaceBinding(); //void transitionOverrides(); void group(); + void valueType(); void emptyBehavior(); void explicitSelection(); void nonSelectingBehavior(); @@ -237,6 +238,19 @@ void tst_qdeclarativebehaviors::group() } } +void tst_qdeclarativebehaviors::valueType() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valueType.qml"))); + QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); + QVERIFY(rect); + + //QTBUG-20827 + QCOMPARE(rect->color(), QColor::fromRgb(255,0,255)); + + delete rect; +} + void tst_qdeclarativebehaviors::emptyBehavior() { QDeclarativeEngine engine; |