diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-16 03:50:00 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-16 03:50:00 (GMT) |
commit | efb25bac3131b4ca39a44a16526d88c814986d60 (patch) | |
tree | 21483188d9e1cb2008ff95c88b20bfc3fbdebc62 /tests/auto/declarative/states/tst_states.cpp | |
parent | ee4278059939902482c7f457089aaf484358113b (diff) | |
download | Qt-efb25bac3131b4ca39a44a16526d88c814986d60.zip Qt-efb25bac3131b4ca39a44a16526d88c814986d60.tar.gz Qt-efb25bac3131b4ca39a44a16526d88c814986d60.tar.bz2 |
Autotests.
Diffstat (limited to 'tests/auto/declarative/states/tst_states.cpp')
-rw-r--r-- | tests/auto/declarative/states/tst_states.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index 3d8f303..fe90191 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -42,6 +42,7 @@ #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> #include <private/qmlgraphicsrectangle_p.h> +#include <private/qmlpropertychanges_p.h> class tst_states : public QObject { @@ -61,6 +62,7 @@ private slots: void script(); void restoreEntryValues(); void explicitChanges(); + void propertyErrors(); }; void tst_states::basicChanges() @@ -544,6 +546,10 @@ void tst_states::explicitChanges() QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); + QmlPropertyChanges *changes = qobject_cast<QmlPropertyChanges*>(rect->findChild<QmlPropertyChanges*>("changes")); + QVERIFY(changes != 0); + QVERIFY(changes->isExplicit()); + QCOMPARE(rect->color(),QColor("red")); rect->setState("blue"); @@ -561,6 +567,20 @@ void tst_states::explicitChanges() QCOMPARE(rect->color(),QColor("yellow")); } +void tst_states::propertyErrors() +{ + QmlEngine engine; + QmlComponent rectComponent(&engine, SRCDIR "/data/propertyErrors.qml"); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + QTest::ignoreMessage(QtWarningMsg, "QML QmlPropertyChanges (file://" SRCDIR "/data/propertyErrors.qml:8:9) Cannot assign to non-existant property \"colr\""); + QTest::ignoreMessage(QtWarningMsg, "QML QmlPropertyChanges (file://" SRCDIR "/data/propertyErrors.qml:8:9) Cannot assign to read-only property \"wantsFocus\""); + rect->setState("blue"); +} + QTEST_MAIN(tst_states) #include "tst_states.moc" |