diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-02-25 23:35:43 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-02-25 23:35:43 (GMT) |
commit | 31c8459d65aaca9131a8aa32e29e0591ed7892cb (patch) | |
tree | 5339f4b4291c17a9a765a70990ec3c12f4055de7 /tests/auto/declarative/qdeclarativestates | |
parent | 5c82031a7357f4f3d100be30c0bfe4e878712829 (diff) | |
parent | 61811d9b43828c1cc53c773fd66b78313f4fb942 (diff) | |
download | Qt-31c8459d65aaca9131a8aa32e29e0591ed7892cb.zip Qt-31c8459d65aaca9131a8aa32e29e0591ed7892cb.tar.gz Qt-31c8459d65aaca9131a8aa32e29e0591ed7892cb.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Conflicts:
src/declarative/qml/qdeclarativeproperty.cpp
Diffstat (limited to 'tests/auto/declarative/qdeclarativestates')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/reset.qml | 20 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 31 |
2 files changed, 45 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/reset.qml b/tests/auto/declarative/qdeclarativestates/data/reset.qml new file mode 100644 index 0000000..a0a2b8c --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/reset.qml @@ -0,0 +1,20 @@ +import Qt 4.6 + +Rectangle { + width: 640 + height: 480 + Text { + id: theText + width: 50 + wrap: true + text: "a text string that is longer than 50 pixels" + } + + states: State { + name: "state1" + PropertyChanges { + target: theText + width: undefined + } + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index feac9c2..8d3ca7a 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -43,6 +43,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativeanchors_p_p.h> #include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativetext_p.h> #include <private/qdeclarativepropertychanges_p.h> #include <private/qdeclarativestategroup_p.h> @@ -104,6 +105,7 @@ private slots: void tempState(); void illegalTempState(); void nonExistantProperty(); + void reset(); }; void tst_qdeclarativestates::initTestCase() @@ -476,10 +478,8 @@ void tst_qdeclarativestates::parentChange() rect->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(15)); QCOMPARE(innerRect->scale(), qreal(.5)); - QEXPECT_FAIL("", "QTBUG-2919", Continue); - QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(12.4148145657)); - QEXPECT_FAIL("", "QTBUG-2919", Continue); - QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(10.6470476128)); + QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-19.9075)); + QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-8.73433)); } { @@ -500,8 +500,8 @@ void tst_qdeclarativestates::parentChange() QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); QCOMPARE(innerRect->x(), qreal(5)); - QEXPECT_FAIL("", "QTBUG-2919", Continue); - QCOMPARE(innerRect->y(), qreal(0)); + //do a non-qFuzzyCompare fuzzy compare + QVERIFY(innerRect->y() < qreal(0.00001) && innerRect->y() > qreal(-0.00001)); } } @@ -945,6 +945,25 @@ void tst_qdeclarativestates::nonExistantProperty() QCOMPARE(rect->state(), QLatin1String("blue")); } +void tst_qdeclarativestates::reset() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/reset.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + + QDeclarativeText *text = rect->findChild<QDeclarativeText*>(); + QVERIFY(text != 0); + QCOMPARE(text->width(), qreal(50.)); + QVERIFY(text->width() < text->height()); + + rect->setState("state1"); + + QVERIFY(text->width() > 51); + QVERIFY(text->width() > text->height()); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" |