summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-02-01 21:53:47 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-02-01 21:53:47 (GMT)
commite93f76cc533751944e66c02d868f3c527814efa0 (patch)
tree9a79f06ad7be400ff432a7edae33be4599a0658c /tests
parentbd95a353c621cb7dba2f0991e742ddbde0bb9a54 (diff)
parent652be80c25f61aa4fbf28d75ba9971fc709f29c9 (diff)
downloadQt-e93f76cc533751944e66c02d868f3c527814efa0.zip
Qt-e93f76cc533751944e66c02d868f3c527814efa0.tar.gz
Qt-e93f76cc533751944e66c02d868f3c527814efa0.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/animations/data/attached.qml34
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp12
-rw-r--r--tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp16
3 files changed, 53 insertions, 9 deletions
diff --git a/tests/auto/declarative/animations/data/attached.qml b/tests/auto/declarative/animations/data/attached.qml
new file mode 100644
index 0000000..0fb6f8c
--- /dev/null
+++ b/tests/auto/declarative/animations/data/attached.qml
@@ -0,0 +1,34 @@
+import Qt 4.6
+
+Rectangle {
+ width: 180; height: 200;
+
+ Component {
+ id: delegate
+ Rectangle {
+ id: wrapper
+ width: 180; height: 200
+ color: "blue"
+
+ states: State {
+ name: "otherState"
+ PropertyChanges { target: wrapper; color: "green" }
+ }
+
+ transitions: Transition {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ ScriptAction { script: console.log(ListView.delayRemove ? "on" : "off") }
+ }
+
+ Component.onCompleted: {
+ console.log(ListView.delayRemove ? "on" : "off");
+ wrapper.state = "otherState"
+ }
+ }
+ }
+
+ ListView {
+ model: 1
+ delegate: delegate
+ }
+}
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
index 35eae73..7f043ba 100644
--- a/tests/auto/declarative/animations/tst_animations.cpp
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -67,6 +67,7 @@ private slots:
void propertiesTransition();
void easingStringConversion();
void invalidDuration();
+ void attached();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -563,6 +564,17 @@ void tst_animations::invalidDuration()
QCOMPARE(pauseAnimation->duration(), 250);
}
+void tst_animations::attached()
+{
+ QmlEngine engine;
+
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/attached.qml"));
+ QTest::ignoreMessage(QtDebugMsg, "off");
+ QTest::ignoreMessage(QtDebugMsg, "on");
+ QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create());
+ QVERIFY(rect);
+}
+
QTEST_MAIN(tst_animations)
#include "tst_animations.moc"
diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
index 23ecf2b..0ff5ff4 100644
--- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
+++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
@@ -176,7 +176,6 @@ void tst_qmlgraphicstextedit::text()
actual.replace(QRegExp(".*<body[^>]*>"),"");
actual.replace(QRegExp("(<[^>]*>)+"),"<>");
expected.replace(QRegExp("(<[^>]*>)+"),"<>");
- expected = "<> <> <> " + expected;
QCOMPARE(actual.simplified(),expected.simplified());
}
}
@@ -631,21 +630,19 @@ void tst_qmlgraphicstextedit::delegateLoading()
server.serveDirectory("data/httpfail", TestHTTPServer::Disconnect);
server.serveDirectory("data/httpslow", TestHTTPServer::Delay);
server.serveDirectory("data/http");
- QmlView* view= new QmlView(0);
+ QmlView* view = new QmlView(0);
view->setUrl(QUrl("http://localhost:42332/cursorHttpTestPass.qml"));
view->execute();
view->show();
view->setFocus();
- QTest::qWait(500);
+ QTRY_VERIFY(view->root());//Wait for loading to finish.
QmlGraphicsTextEdit *textEditObject = view->root()->findChild<QmlGraphicsTextEdit*>("textEditObject");
- QEXPECT_FAIL("","QT-2498", Continue);
+ // view->root()->dumpObjectTree();
QVERIFY(textEditObject != 0);
- //textEditObject->setFocus(true);
+ textEditObject->setFocus(true);
QmlGraphicsItem *delegate;
- QEXPECT_FAIL("","QT-2498", Continue);
delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay");
QVERIFY(delegate);
- QEXPECT_FAIL("","QT-2498", Continue);
delegate = view->root()->findChild<QmlGraphicsItem*>("delegateSlow");
QVERIFY(delegate);
view->setUrl(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
@@ -653,7 +650,7 @@ void tst_qmlgraphicstextedit::delegateLoading()
view->show();
view->setFocus();
delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay");
- QVERIFY(!delegate);
+ QVERIFY(delegate);
delegate = view->root()->findChild<QmlGraphicsItem*>("delegateFail");
QVERIFY(!delegate);
view->setUrl(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
@@ -661,11 +658,12 @@ void tst_qmlgraphicstextedit::delegateLoading()
view->show();
view->setFocus();
delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay");
- QVERIFY(!delegate);
+ QVERIFY(delegate);
delegate = view->root()->findChild<QmlGraphicsItem*>("delegateErrorA");
QVERIFY(!delegate);
//ErrorB should get a component which is ready but component.create() returns null
//Not sure how to accomplish this with QmlGraphicsTextEdits cursor delegate
+ //###This could be a case of overzealous defensive programming
//delegate = view->root()->findChild<QmlGraphicsItem*>("delegateErrorB");
//QVERIFY(!delegate);
}