From 0f08a0fc028eb647c435ffe95d5d673ed75b058b Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 4 Feb 2014 13:42:40 +0100 Subject: Add the Sync suffix to testing sync wrapper Change-Id: I0c6594a9758edc97f658717388c20f9e79be0f70 Reviewed-by: Pierre Rossi --- .../auto/widgets/qwebengineframe/tst_qwebengineframe.cpp | 16 ++++++++-------- .../widgets/qwebenginehistory/tst_qwebenginehistory.cpp | 8 ++++---- tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 2 +- tests/auto/widgets/util.h | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp index 92b91967e..a163d7e24 100644 --- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp +++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp @@ -140,12 +140,12 @@ void tst_QWebEngineFrame::symmetricUrl() QCOMPARE(view.history()->count(), 0); // loading is _not_ immediate, so the text isn't set just yet. - QVERIFY(toPlainText(view.page()).isEmpty()); + QVERIFY(toPlainTextSync(view.page()).isEmpty()); ::waitForSignal(m_view, SIGNAL(loadFinished(bool))); QCOMPARE(view.history()->count(), 1); - QCOMPARE(toPlainText(view.page()), QString("Test")); + QCOMPARE(toPlainTextSync(view.page()), QString("Test")); QUrl dataUrl2("data:text/html,

Test2"); QUrl dataUrl3("data:text/html,

Test3"); @@ -160,7 +160,7 @@ void tst_QWebEngineFrame::symmetricUrl() QCOMPARE(view.history()->count(), 2); - QCOMPARE(toPlainText(view.page()), QString("Test3")); + QCOMPARE(toPlainTextSync(view.page()), QString("Test3")); } void tst_QWebEngineFrame::progressSignal() @@ -421,7 +421,7 @@ void tst_QWebEngineFrame::asyncAndDelete() void tst_QWebEngineFrame::earlyToHtml() { QString html(""); - QCOMPARE(toHtml(m_view->page()), html); + QCOMPARE(toHtmlSync(m_view->page()), html); } void tst_QWebEngineFrame::setHtml() @@ -430,7 +430,7 @@ void tst_QWebEngineFrame::setHtml() QSignalSpy spy(m_view->page(), SIGNAL(loadFinished(bool))); m_view->page()->setHtml(html); QVERIFY(spy.wait()); - QCOMPARE(toHtml(m_view->page()), html); + QCOMPARE(toHtmlSync(m_view->page()), html); } void tst_QWebEngineFrame::setHtmlWithImageResource() @@ -554,7 +554,7 @@ void tst_QWebEngineFrame::setHtmlWithJSAlert() waitForSignal(&page, SIGNAL(loadFinished(bool))); QCOMPARE(page.alerts, 1); QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118663", Continue); - QCOMPARE(toHtml(m_view->page()), html); + QCOMPARE(toHtmlSync(m_view->page()), html); } class TestNetworkManager : public QNetworkAccessManager @@ -1156,7 +1156,7 @@ void tst_QWebEngineFrame::setContent() QSignalSpy loadSpy(m_page, SIGNAL(loadFinished(bool))); m_view->setContent(testContents, mimeType); QVERIFY(loadSpy.wait()); - QCOMPARE(toPlainText(m_view->page()), expected); + QCOMPARE(toPlainTextSync(m_view->page()), expected); } class CacheNetworkAccessManager : public QNetworkAccessManager { @@ -1254,7 +1254,7 @@ void tst_QWebEngineFrame::setUrlWithFragment() ::waitForSignal(&page, SIGNAL(loadFinished(bool))); QCOMPARE(spy.count(), 1); - QVERIFY(!page.toPlainText().isEmpty()); + QVERIFY(!toPlainTextSync(&page).isEmpty()); QCOMPARE(page.requestedUrl(), url); QCOMPARE(page.url(), url); } diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp index e84702df3..2b5f4101c 100644 --- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp +++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp @@ -125,13 +125,13 @@ void tst_QWebEngineHistory::count() void tst_QWebEngineHistory::back() { for (int i = histsize;i > 1;i--) { - QCOMPARE(toPlainText(page), QString("page") + QString::number(i)); + QCOMPARE(toPlainTextSync(page), QString("page") + QString::number(i)); hist->back(); loadFinishedBarrier->ensureSignalEmitted(); } //try one more time (too many). crash test hist->back(); - QCOMPARE(toPlainText(page), QString("page1")); + QCOMPARE(toPlainTextSync(page), QString("page1")); } /** @@ -146,13 +146,13 @@ void tst_QWebEngineHistory::forward() } for (int i = 1;i < histsize;i++) { - QCOMPARE(toPlainText(page), QString("page") + QString::number(i)); + QCOMPARE(toPlainTextSync(page), QString("page") + QString::number(i)); hist->forward(); loadFinishedBarrier->ensureSignalEmitted(); } //try one more time (too many). crash test hist->forward(); - QCOMPARE(toPlainText(page), QString("page") + QString::number(histsize)); + QCOMPARE(toPlainTextSync(page), QString("page") + QString::number(histsize)); } /** diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index c6c217a39..8a4e9d3e4 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -2757,7 +2757,7 @@ void tst_QWebEnginePage::errorPageExtension() page.setUrl(QUrl("http://non.existent/url")); QTRY_COMPARE(spyLoadFinished.count(), 2); - QCOMPARE(toPlainText(&page), QString("error")); + QCOMPARE(toPlainTextSync(&page), QString("error")); QCOMPARE(page.history()->count(), 2); QCOMPARE(page.history()->currentItem().url(), QUrl("http://non.existent/url")); QCOMPARE(page.history()->canGoBack(), true); diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h index 1e60d3e0e..0b146aedc 100644 --- a/tests/auto/widgets/util.h +++ b/tests/auto/widgets/util.h @@ -128,14 +128,14 @@ private: T result; }; -static inline QString toPlainText(QWebEnginePage *page) +static inline QString toPlainTextSync(QWebEnginePage *page) { CallbackSpy spy; page->toPlainText(spy.ref()); return spy.waitForResult(); } -static inline QString toHtml(QWebEnginePage *page) +static inline QString toHtmlSync(QWebEnginePage *page) { CallbackSpy spy; page->toHtml(spy.ref()); -- cgit v1.2.3