diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-25 10:30:59 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-14 08:03:38 +0000 |
commit | 35da68a15c12586415484def802839e67372eac1 (patch) | |
tree | 76639f2eba2999e519511d51a42c8693b4f27299 /tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | |
parent | 9e15fb156a0ef58584661a0599f1f85d7597e87c (diff) |
Provide a threaded TestHTTPServer
This allows us to do blocking operations that interact with the test
server in the main thread. The threaded server is used in tests that
don't explicitly require asynchronous operation.
Change-Id: Ibcb28e79a1114cb9cfb812e86aae0a1af71c569e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp')
-rw-r--r-- | tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index ece9a0841b..e4473b9540 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2599,9 +2599,7 @@ void tst_qquicktextedit::cursorDelegate() void tst_qquicktextedit::remoteCursorDelegate() { - TestHTTPServer server; - QVERIFY2(server.listen(), qPrintable(server.errorString())); - server.serveDirectory(dataDirectory(), TestHTTPServer::Delay); + ThreadedTestHTTPServer server(dataDirectory(), TestHTTPServer::Delay); QQuickView view; @@ -2737,20 +2735,21 @@ void tst_qquicktextedit::delegateLoading() QFETCH(QString, qmlfile); QFETCH(QString, error); - TestHTTPServer server; - QVERIFY2(server.listen(), qPrintable(server.errorString())); - server.serveDirectory(testFile("httpfail"), TestHTTPServer::Disconnect); - server.serveDirectory(testFile("httpslow"), TestHTTPServer::Delay); - server.serveDirectory(testFile("http")); + QHash<QString, TestHTTPServer::Mode> dirs; + dirs[testFile("httpfail")] = TestHTTPServer::Disconnect; + dirs[testFile("httpslow")] = TestHTTPServer::Delay; + dirs[testFile("http")] = TestHTTPServer::Normal; + ThreadedTestHTTPServer server(dirs); error.replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString()); + if (!error.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QQuickView view(server.url(qmlfile)); view.show(); view.requestActivate(); if (!error.isEmpty()) { - QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QTRY_VERIFY(view.status()==QQuickView::Error); QTRY_VERIFY(!view.rootObject()); // there is fail item inside this test } else { |