summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-05-05 02:52:25 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-05-05 02:52:25 (GMT)
commit99502731c6f093c8db82189d46b949657ad83b25 (patch)
tree2b9a8341eb1873ed32de08c327efae36b63709b7 /tests
parent326dab74ba8df7707d1054ca5e0280c5f131c148 (diff)
parentdcee637a9f7a024803f0e5cc1bf57d878dca2ac3 (diff)
downloadQt-99502731c6f093c8db82189d46b949657ad83b25.zip
Qt-99502731c6f093c8db82189d46b949657ad83b25.tar.gz
Qt-99502731c6f093c8db82189d46b949657ad83b25.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml14
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp20
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml b/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml
new file mode 100644
index 0000000..a70840c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+Rectangle {
+ id: theRect
+ property bool triggerState: false
+ property string stateString: ""
+ states: State {
+ when: triggerState
+ PropertyChanges {
+ target: theRect
+ stateString: "inState"
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index d384d26..13992ad 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -110,6 +110,7 @@ private slots:
void illegalObjectCreation();
void whenOrdering();
void urlResolution();
+ void unnamedWhen();
};
void tst_qdeclarativestates::initTestCase()
@@ -1049,6 +1050,25 @@ void tst_qdeclarativestates::urlResolution()
QCOMPARE(image3->source(), resolved);
}
+void tst_qdeclarativestates::unnamedWhen()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, SRCDIR "/data/unnamedWhen.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
+
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
+ rect->setProperty("triggerState", true);
+ QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1"));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState"));
+ rect->setProperty("triggerState", false);
+ QCOMPARE(rectPrivate->state(), QLatin1String(""));
+ QCOMPARE(rect->property("stateString").toString(), QLatin1String(""));
+}
+
QTEST_MAIN(tst_qdeclarativestates)
#include "tst_qdeclarativestates.moc"