diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-11-02 00:41:25 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-11-02 00:41:25 (GMT) |
commit | 155065cd5c611e2d14357a8ff3180ac14a68e3a0 (patch) | |
tree | 2d5717696a035e107ecd28e097726170f9ffd387 /tests/auto/declarative | |
parent | d194ebdc199fdd85245bfecb766d836dfa79c3f3 (diff) | |
download | Qt-155065cd5c611e2d14357a8ff3180ac14a68e3a0.zip Qt-155065cd5c611e2d14357a8ff3180ac14a68e3a0.tar.gz Qt-155065cd5c611e2d14357a8ff3180ac14a68e3a0.tar.bz2 |
Removing a binding while it is being applied caused a crash.
Use a weak pointer to the binding in case applying
the binding (while fast forwarding) causes it to be removed.
Task-number: QTBUG-14830
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml | 29 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 13 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml b/tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml new file mode 100644 index 0000000..5eccdda --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/QTBUG-14830.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +Rectangle { + width: 1024 + height: 768 + + Item { + id: area + objectName: "area" + property int numx: 6 + property int cellwidth: 1024/numx + + onWidthChanged: { + width = width>1024?1024:width; + } + + state: 'minimal' + states: [ + State { + name: 'minimal' + PropertyChanges { + target: area + width: cellwidth + } + } + ] + + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 0d10c10..b8409a5 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -143,6 +143,7 @@ private slots: void returnToBase(); void extendsBug(); void editProperties(); + void QTBUG_14830(); }; void tst_qdeclarativestates::initTestCase() @@ -1375,6 +1376,18 @@ void tst_qdeclarativestates::editProperties() QCOMPARE(childRect->height(), qreal(40)); } +void tst_qdeclarativestates::QTBUG_14830() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/QTBUG-14830.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + QDeclarativeItem *item = rect->findChild<QDeclarativeItem*>("area"); + + QCOMPARE(item->width(), qreal(171)); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" |