diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-13 00:37:41 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-13 00:37:41 (GMT) |
commit | e0a137cd1b138e63804756f897a20bf8178efb84 (patch) | |
tree | af495868d66869eeac6e6dc5868d514539cfb2d7 /tests/auto/declarative/qmlgraphicstextedit | |
parent | abb70694334a770d4acb0ec607bb9b02defd1204 (diff) | |
parent | 1e09535438b5dc7d2961b9bb22340a86a80f8856 (diff) | |
download | Qt-e0a137cd1b138e63804756f897a20bf8178efb84.zip Qt-e0a137cd1b138e63804756f897a20bf8178efb84.tar.gz Qt-e0a137cd1b138e63804756f897a20bf8178efb84.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto/declarative/qmlgraphicstextedit')
10 files changed, 149 insertions, 2 deletions
diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/ErrItem.qml b/tests/auto/declarative/qmlgraphicstextedit/data/http/ErrItem.qml new file mode 100644 index 0000000..34b3883 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/http/ErrItem.qml @@ -0,0 +1,7 @@ +import Qt 4.6 + +Item{ + Fungus{ + palatable: false; + } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/NormItem.qml b/tests/auto/declarative/qmlgraphicstextedit/data/http/NormItem.qml new file mode 100644 index 0000000..718cb71 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/http/NormItem.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Item { + objectName: "delegateOkay" + Rectangle { } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTest.qml b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTest.qml new file mode 100644 index 0000000..3c31e11 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTest.qml @@ -0,0 +1,22 @@ +import Qt 4.6 + +Rectangle { width: 300; height: 300; color: "white" + resources: [ + Component { id:cursorFail; FailItem { objectName: "delegateFail" } }, + Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, + Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } }, + Component { id:cursorErr; ErrItem { objectName: "delegateErrorA" } } + ] + TextEdit { + cursorDelegate: cursorFail + } + TextEdit { + cursorDelegate: cursorWait + } + TextEdit { + cursorDelegate: cursorNorm + } + TextEdit { + cursorDelegate: cursorErr + } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail1.qml b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail1.qml new file mode 100644 index 0000000..a44aec2 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail1.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Rectangle { width: 300; height: 300; color: "white" + resources: [ + Component { id:cursorFail; FailItem { objectName: "delegateFail" } }, + Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, + Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } } + ] + TextEdit { + cursorDelegate: cursorFail + } + TextEdit { + cursorDelegate: cursorWait + } + TextEdit { + cursorDelegate: cursorNorm + } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail2.qml b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail2.qml new file mode 100644 index 0000000..57d3e47 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail2.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Rectangle { width: 300; height: 300; color: "white" + resources: [ + Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, + Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } }, + Component { id:cursorErr; ErrItem { objectName: "delegateErrorA" } } + ] + TextEdit { + cursorDelegate: cursorWait + } + TextEdit { + cursorDelegate: cursorNorm + } + TextEdit { + cursorDelegate: cursorErr + } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestPass.qml b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestPass.qml new file mode 100644 index 0000000..a44e867 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestPass.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Rectangle { width: 300; height: 300; color: "white" + resources: [ + Component { id:cursorWait; WaitItem { objectName: "delegateSlow" } }, + Component { id:cursorNorm; NormItem { objectName: "delegateOkay" } } + ] + TextEdit { + cursorDelegate: cursorWait + text: "Hello" + } + TextEdit { + objectName: "textEditObject" + cursorDelegate: cursorNorm + focus: true; + text: "Hello" + } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/httpfail/FailItem.qml b/tests/auto/declarative/qmlgraphicstextedit/data/httpfail/FailItem.qml new file mode 100644 index 0000000..ddbf526 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/httpfail/FailItem.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Item { + Rectangle { } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/httpslow/WaitItem.qml b/tests/auto/declarative/qmlgraphicstextedit/data/httpslow/WaitItem.qml new file mode 100644 index 0000000..ddbf526 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicstextedit/data/httpslow/WaitItem.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Item { + Rectangle { } +} diff --git a/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro b/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro index 9e6a71a..a129120 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro +++ b/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro @@ -1,8 +1,9 @@ load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui +contains(QT_CONFIG,declarative): QT += declarative gui network macx:CONFIG -= app_bundle -SOURCES += tst_qmlgraphicstextedit.cpp +SOURCES += tst_qmlgraphicstextedit.cpp ../shared/testhttpserver.cpp +HEADERS += ../shared/testhttpserver.h # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp index 4dc036d..543c650 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qtest.h> #include "../../../shared/util.h" +#include "../shared/testhttpserver.h" #include <math.h> #include <QFile> #include <QTextDocument> @@ -75,6 +76,7 @@ private slots: void selection(); void cursorDelegate(); + void delegateLoading(); void navigation(); void readOnly(); @@ -592,6 +594,51 @@ void tst_qmlgraphicstextedit::cursorDelegate() QVERIFY(!textEditObject->findChild<QmlGraphicsItem*>("cursorInstance")); } +void tst_qmlgraphicstextedit::delegateLoading() +{ + TestHTTPServer server(42332); + server.serveDirectory("data/httpfail", TestHTTPServer::Disconnect); + server.serveDirectory("data/httpslow", TestHTTPServer::Delay); + server.serveDirectory("data/http"); + QmlView* view= new QmlView(0); + view->setUrl(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); + view->execute(); + view->show(); + view->setFocus(); + QTest::qWait(500); + QmlGraphicsTextEdit *textEditObject = view->root()->findChild<QmlGraphicsTextEdit*>("textEditObject"); + QEXPECT_FAIL("","QT-2498", Continue); + QVERIFY(textEditObject != 0); + //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")); + view->execute(); + view->show(); + view->setFocus(); + delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay"); + QVERIFY(!delegate); + delegate = view->root()->findChild<QmlGraphicsItem*>("delegateFail"); + QVERIFY(!delegate); + view->setUrl(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); + view->execute(); + view->show(); + view->setFocus(); + delegate = view->root()->findChild<QmlGraphicsItem*>("delegateOkay"); + 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 + //delegate = view->root()->findChild<QmlGraphicsItem*>("delegateErrorB"); + //QVERIFY(!delegate); +} + /* TextEdit element should only handle left/right keys until the cursor reaches the extent of the text, then they should ignore the keys. |