From b104487f072cd04ca4301ba1f10d3ad2e874569e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Oct 2022 15:27:23 +0200 Subject: Adaptations for 106-based Change-Id: I2fe91c06ce91dfaace7825a0589b56ee375479b6 Reviewed-by: Peter Varga Reviewed-by: Michal Klocek --- .../widgets/qwebenginehistory/tst_qwebenginehistory.cpp | 4 ++-- tests/auto/widgets/qwebenginepage/CMakeLists.txt | 1 + tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 13 +++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'tests/auto/widgets') diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp index 9589e83e1..6ddc031d5 100644 --- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp +++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp @@ -487,9 +487,9 @@ void tst_QWebEngineHistory::clear() QWebEnginePage page2(this); QWebEngineHistory* hist2 = page2.history(); - QVERIFY(hist2->count() == 0); + QCOMPARE(hist2->count(), 1); hist2->clear(); - QVERIFY(hist2->count() == 0); // Do not change anything. + QCOMPARE(hist2->count(), 1); // Do not change anything. } void tst_QWebEngineHistory::historyItemFromDeletedPage() diff --git a/tests/auto/widgets/qwebenginepage/CMakeLists.txt b/tests/auto/widgets/qwebenginepage/CMakeLists.txt index f9a24b2c7..a15bb6e06 100644 --- a/tests/auto/widgets/qwebenginepage/CMakeLists.txt +++ b/tests/auto/widgets/qwebenginepage/CMakeLists.txt @@ -9,6 +9,7 @@ qt_internal_add_test(tst_qwebenginepage tst_qwebenginepage.cpp LIBRARIES Qt::CorePrivate + Qt::NetworkPrivate Qt::WebEngineCorePrivate Qt::WebEngineWidgets Test::HttpServer diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index c76da443e..64acdb3d5 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -20,6 +20,7 @@ */ #include +#include #include #include #include @@ -2060,14 +2061,14 @@ void tst_QWebEnginePage::symmetricUrl() QVERIFY(view.url().isEmpty()); - QCOMPARE(view.history()->count(), 0); + QCOMPARE(view.history()->count(), 1); QUrl dataUrl("data:text/html,

Test"); view.setUrl(dataUrl); view.show(); QCOMPARE(view.url(), dataUrl); - QCOMPARE(view.history()->count(), 0); + QCOMPARE(view.history()->count(), 1); // loading is _not_ immediate, so the text isn't set just yet. QVERIFY(toPlainTextSync(view.page()).isEmpty()); @@ -2380,7 +2381,7 @@ void tst_QWebEnginePage::setHtmlWithBaseURL() QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128); // no history item has to be added. - QCOMPARE(m_view->page()->history()->count(), 0); + QCOMPARE(m_view->page()->history()->count(), 1); } class MyPage : public QWebEnginePage @@ -2810,7 +2811,7 @@ void tst_QWebEnginePage::setUrlHistory() int expectedLoadFinishedCount = 0; QSignalSpy spy(m_page, SIGNAL(loadFinished(bool))); - QCOMPARE(m_page->history()->count(), 0); + QCOMPARE(m_page->history()->count(), 1); m_page->setUrl(QUrl()); expectedLoadFinishedCount++; @@ -2884,7 +2885,7 @@ void tst_QWebEnginePage::setUrlUsingStateObject() QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool))); int expectedUrlChangeCount = 0; - QCOMPARE(m_page->history()->count(), 0); + QCOMPARE(m_page->history()->count(), 1); url = QUrl("qrc:/resources/test1.html"); m_page->setUrl(url); @@ -3709,7 +3710,7 @@ void tst_QWebEnginePage::openLinkInNewPage() QCOMPARE(page1.history()->count(), 1); else QCOMPARE(page1.history()->count(), 2); - QCOMPARE(page2.history()->count(), 0); + QCOMPARE(page2.history()->count(), 1); break; case Effect::LoadInOther: QTRY_COMPARE(page2.spy.size(), 1); -- cgit v1.2.3