diff options
Diffstat (limited to 'tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp')
-rw-r--r-- | tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
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. |