diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-09-08 15:22:22 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-09 01:07:55 +0200 |
commit | de868c71b7ec5f463ed9b1a142f3b805d1c3d627 (patch) | |
tree | a3051237c9f3c0d019b6df94266d3bb5346bfcb1 /tests | |
parent | eb567b03b5e29bd0cd52c87cc1a59cc96ecfd7e8 (diff) |
Only fast-foward states when there is a transition.
Fast-forwarding is only required when we are animating a state change.
Task-number: QTBUG-16662
Change-Id: I20e1a056cb3268b92b606be34809bcd0e2bfb898
Reviewed-on: http://codereview.qt-project.org/4390
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/avoidFastForward.qml | 17 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/avoidFastForward.qml b/tests/auto/declarative/qdeclarativestates/data/avoidFastForward.qml new file mode 100644 index 0000000000..519befc31e --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/avoidFastForward.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Rectangle { + id: rect + width: 200 + height: 200 + + property int updateCount: 0 + onColorChanged: updateCount++ + + property color aColor: "green" + + states: State { + name: "a" + PropertyChanges { target: rect; color: aColor } + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index e13a6c4305..165179e35d 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -149,6 +149,7 @@ private slots: void extendsBug(); void editProperties(); void QTBUG_14830(); + void avoidFastForward(); }; void tst_qdeclarativestates::initTestCase() @@ -1513,6 +1514,20 @@ void tst_qdeclarativestates::QTBUG_14830() QCOMPARE(item->width(), qreal(171)); } +void tst_qdeclarativestates::avoidFastForward() +{ + QDeclarativeEngine engine; + + //shouldn't fast forward if there isn't a transition + QDeclarativeComponent c(&engine, SRCDIR "/data/avoidFastForward.qml"); + QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); + QVERIFY(rect != 0); + + QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); + rectPrivate->setState("a"); + QCOMPARE(rect->property("updateCount").toInt(), 1); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" |