summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetextedit
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-13 03:06:21 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-13 03:06:21 (GMT)
commit6a9a804919599764bb183380a1d5885c3658444f (patch)
treec832347db923931a765ada46d74161df29515742 /tests/auto/declarative/qdeclarativetextedit
parentff0020481398e7c109973949260a42711c4cdcdc (diff)
downloadQt-6a9a804919599764bb183380a1d5885c3658444f.zip
Qt-6a9a804919599764bb183380a1d5885c3658444f.tar.gz
Qt-6a9a804919599764bb183380a1d5885c3658444f.tar.bz2
Fix and test remote root component with qmldir-specified content.
6ed43975f6733265b8b91b00a9a212076d896ef9 was not correct fix (just invalidated the test)
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml1
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp62
2 files changed, 41 insertions, 22 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml
index de4de00..a44e867 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml
+++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml
@@ -1,5 +1,4 @@
import Qt 4.6
-import "http://localhost:42332"
Rectangle { width: 300; height: 300; color: "white"
resources: [
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index d578f68..6ef1f9f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -79,6 +79,7 @@ private slots:
void inputMethodHints();
void cursorDelegate();
+ void delegateLoading_data();
void delegateLoading();
void navigation();
void readOnly();
@@ -641,41 +642,60 @@ void tst_qdeclarativetextedit::cursorDelegate()
QVERIFY(!textEditObject->findChild<QDeclarativeItem*>("cursorInstance"));
}
+void tst_qdeclarativetextedit::delegateLoading_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<QString>("error");
+
+ // import installed
+ QTest::newRow("pass") << "cursorHttpTestPass.qml" << "";
+ QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << ":-1: Network error for URL http://localhost:42332/FailItem.qml ";
+ QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type ";
+}
+
void tst_qdeclarativetextedit::delegateLoading()
{
+ QFETCH(QString, qmlfile);
+ QFETCH(QString, error);
+
TestHTTPServer server(42332);
server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect);
server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay);
server.serveDirectory(SRCDIR "/data/http");
+
QDeclarativeView* view = new QDeclarativeView(0);
- view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml"));
- view->show();
- view->setFocus();
- QTRY_VERIFY(view->rootObject());//Wait for loading to finish.
- QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject");
- // view->rootObject()->dumpObjectTree();
- QVERIFY(textEditObject != 0);
- textEditObject->setFocus(true);
- QDeclarativeItem *delegate;
- delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay");
- QVERIFY(delegate);
- delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow");
- QVERIFY(delegate);
- view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
- view->show();
- QTRY_VERIFY(view->status()==QDeclarativeView::Error);
- view->setFocus();
- QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
- view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
+
+ view->setSource(QUrl(QLatin1String("http://localhost:42332/") + qmlfile));
view->show();
- QTRY_VERIFY(view->status()==QDeclarativeView::Error);
view->setFocus();
- QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
+
+ if (!error.isEmpty()) {
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+ QTRY_VERIFY(view->status()==QDeclarativeView::Error);
+ QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
+ } else {
+ QTRY_VERIFY(view->rootObject());//Wait for loading to finish.
+ QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject");
+ // view->rootObject()->dumpObjectTree();
+ QVERIFY(textEditObject != 0);
+ textEditObject->setFocus(true);
+ QDeclarativeItem *delegate;
+ delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay");
+ QVERIFY(delegate);
+ delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow");
+ QVERIFY(delegate);
+
+ delete delegate;
+ }
+
+
//A test should be added here with a component which is ready but component.create() returns null
//Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate
//###This was only needed for code coverage, and could be a case of overzealous defensive programming
//delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateErrorB");
//QVERIFY(!delegate);
+
+ delete view;
}
/*