diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/extendsBug.qml | 26 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 16 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml b/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml new file mode 100644 index 0000000..a3c4827 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml @@ -0,0 +1,26 @@ +import Qt 4.7 + +Rectangle { + width: 200 + height: 200 + + Rectangle { + id: rect + objectName: "greenRect" + width: 100 + height: 100 + color: "green" + } + + states:[ + State { + name: "a" + PropertyChanges { target: rect; x: 100 } + }, + State { + name: "b" + extend:"a" + PropertyChanges { target: rect; y: 100 } + } + ] +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 3b6a420..6ae2759 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -139,6 +139,7 @@ private slots: void urlResolution(); void unnamedWhen(); void returnToBase(); + void extendsBug(); }; void tst_qdeclarativestates::initTestCase() @@ -1186,6 +1187,21 @@ void tst_qdeclarativestates::returnToBase() QCOMPARE(rect->property("stateString").toString(), QLatin1String("originalState")); } +//QTBUG-12559 +void tst_qdeclarativestates::extendsBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/extendsBug.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + QDeclarativeRectangle *greenRect = rect->findChild<QDeclarativeRectangle*>("greenRect"); + + rectPrivate->setState("b"); + QCOMPARE(greenRect->x(), qreal(100)); + QCOMPARE(greenRect->y(), qreal(100)); +} QTEST_MAIN(tst_qdeclarativestates) |