diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-06-06 13:51:01 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-06-14 12:41:36 +0000 |
commit | ce5da3f31cd8d5a422053f003be2f5b1b432b1bb (patch) | |
tree | 3f6dceacfc8c082e35b0d74a7c505f0b7533d455 | |
parent | b50ad69de28ae3aac9d374d95514a759339cd31a (diff) |
Auto test adaptations for Chromium 58
Adjustments to auto tests to pass with Chromium 58
Change-Id: I7f6905e5344c528c608734bc660cbf43c89d4a63
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
8 files changed, 26 insertions, 16 deletions
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 89ebbac62..daf4d811e 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -106,6 +106,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest() { QWebEngineView view; TestRequestInterceptor interceptor(/* intercept */ true); + view.page()->settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false); QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool))); view.page()->profile()->setRequestInterceptor(&interceptor); @@ -193,21 +194,19 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl() page.setUrl(QUrl("qrc:///resources/__placeholder__")); QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); QCOMPARE(interceptor.observedUrls.at(0), QUrl("qrc:///resources/content.html")); QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__")); QCOMPARE(page.url(), QUrl("qrc:///resources/content.html")); page.setUrl(QUrl("qrc:/non-existent.html")); - QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 2); + QTRY_COMPARE(spy.count(), 2); QCOMPARE(interceptor.observedUrls.at(2), QUrl("qrc:/non-existent.html")); QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__")); QCOMPARE(page.url(), QUrl("qrc:///resources/content.html")); page.setUrl(QUrl("http://abcdef.abcdef")); - QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 3); + QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 12000); QCOMPARE(interceptor.observedUrls.at(3), QUrl("http://abcdef.abcdef/")); QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__")); QCOMPARE(page.url(), QUrl("qrc:///resources/content.html")); diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml index f8ad998ef..ea474e0dc 100644 --- a/tests/auto/quick/qmltests/data/tst_favicon.qml +++ b/tests/auto/quick/qmltests/data/tst_favicon.qml @@ -152,6 +152,7 @@ TestWebEngineView { var url = Qt.resolvedUrl("invalid://url") webEngineView.url = url + verify(webEngineView.waitForLoadFailed()) verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded()) compare(iconChangedSpy.count, 0) diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 2cb9f6b81..84509eb01 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -217,7 +217,7 @@ TestWebEngineView { } webEngineView.loadingChanged.connect(handleLoadFailed); webEngineView.url = bogusSite - tryCompare(loadRequestArray, "length", 4, 12000); + tryCompare(loadRequestArray, "length", 5, 12000); webEngineView.loadingChanged.disconnect(handleLoadFailed); loadRequest = loadRequestArray[0]; @@ -231,7 +231,12 @@ TestWebEngineView { loadRequest = loadRequestArray[2]; compare(loadRequest.status, WebEngineView.LoadStartedStatus); compare(loadRequest.activeUrl, aboutBlank); + // FIXME: This 4th request probably shouldn't be here as it an error-page of sorts in dataUrl form + // Appeared with Chromium 58 loadRequest = loadRequestArray[3]; + compare(loadRequest.status, WebEngineView.LoadStartedStatus); + compare(loadRequest.activeUrl, aboutBlank); + loadRequest = loadRequestArray[4]; compare(loadRequest.status, WebEngineView.LoadSucceededStatus); compare(loadRequest.activeUrl, bogusSite); webEngineView.clear(); diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index 2f9063ea5..49f1a0f2a 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -36,6 +36,7 @@ #include <QtTest/QtTest> #include <QtWebEngine/QQuickWebEngineProfile> #include <private/qquickwebengineview_p.h> +#include <private/qquickwebenginesettings_p.h> #include <functional> @@ -383,7 +384,8 @@ void tst_QQuickWebEngineView::titleUpdate() titleSpy.clear(); - // No titleChanged signal for failed load + // No titleChanged signal for failed load (with no error-page) + webEngineView()->settings()->setErrorPageEnabled(false); webEngineView()->setUrl(urlFromTestPath("html/file_that_does_not_exist.html")); QVERIFY(waitForLoadFailed(webEngineView())); QCOMPARE(titleSpy.size(), 0); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index bef77d3f1..cd80db9a3 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -4090,10 +4090,10 @@ void tst_QWebEnginePage::toPlainTextLoadFinishedRace() QVERIFY(s.contains("foobarbaz") == !enableErrorPage); page->load(QUrl("data:text/plain,lalala")); - QTRY_VERIFY(spy.count() == 3); - QCOMPARE(toPlainTextSync(page.data()), QString("lalala")); + QTRY_COMPARE(spy.count(), 3); + QTRY_COMPARE(toPlainTextSync(page.data()), QString("lalala")); page.reset(); - QVERIFY(spy.count() == 3); + QCOMPARE(spy.count(), 3); } void tst_QWebEnginePage::setZoomFactor() diff --git a/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic b/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic index d10ae2600..a57ab15b4 100644 --- a/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic +++ b/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic @@ -8,6 +8,7 @@ liebe/Q lieben/Q liebst/Q liebt/Q +löwe/Q qt/Q sie/Q Sie/Q diff --git a/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic index 3d4ecdfa4..63e9164cc 100644 --- a/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic +++ b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic @@ -4,6 +4,7 @@ I/Q it/Q love/Q loves/Q +low/Q qt/Q she/Q they/Q diff --git a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp index c7b083660..2e1392c89 100644 --- a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp +++ b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp @@ -148,19 +148,20 @@ void tst_QWebEngineSpellcheck::spellcheck() profile->setSpellCheckLanguages(languages); profile->setSpellCheckEnabled(true); load(); + QCOMPARE(profile->spellCheckLanguages(), languages); // make textarea editable evaluateJavaScriptSync(m_view->page(), "makeEditable();"); // calcuate position of misspelled word - QVariantList list = evaluateJavaScriptSync(m_view->page(), "findWordPosition('I lovee Qt ....','lovee');").toList(); + QVariantList list = evaluateJavaScriptSync(m_view->page(), "findWordPosition('I lowe Qt ....','lowe');").toList(); QRect rect(list[0].value<int>(),list[1].value<int>(),list[2].value<int>(),list[3].value<int>()); //type text, spellchecker needs time QTest::mouseMove(m_view->focusWidget(), QPoint(20,20)); QTest::mousePress(m_view->focusWidget(), Qt::LeftButton, 0, QPoint(20,20)); QTest::mouseRelease(m_view->focusWidget(), Qt::LeftButton, 0, QPoint(20,20)); - QString text("I lovee Qt ...."); + QString text("I lowe Qt ...."); for (int i = 0; i < text.length(); i++) { QTest::keyClicks(m_view->focusWidget(), text.at(i)); QTest::qWait(60); @@ -180,10 +181,10 @@ void tst_QWebEngineSpellcheck::spellcheck() QVERIFY(m_view->data().isContentEditable()); // check misspelled word - QVERIFY(m_view->data().misspelledWord() == "lovee"); + QCOMPARE(m_view->data().misspelledWord(), "lowe"); // check suggestions - QVERIFY(m_view->data().spellCheckerSuggestions() == suggestions); + QCOMPARE(m_view->data().spellCheckerSuggestions(), suggestions); // check replace word m_view->page()->replaceMisspelledWord("love"); @@ -195,8 +196,8 @@ void tst_QWebEngineSpellcheck::spellcheck_data() { QTest::addColumn<QStringList>("languages"); QTest::addColumn<QStringList>("suggestions"); - QTest::newRow("en-US") << QStringList({"en-US"}) << QStringList({"love", "loves"}); - QTest::newRow("en-US,de-DE") << QStringList({"en-US","de-DE"}) << QStringList({"love", "liebe", "loves"}); + QTest::newRow("en-US") << QStringList({"en-US"}) << QStringList({"low", "love"}); + QTest::newRow("en-US,de-DE") << QStringList({"en-US", "de-DE"}) << QStringList({"low", "löwe", "love"}); } QTEST_MAIN(tst_QWebEngineSpellcheck) |