diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-12-18 10:25:43 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-12-18 10:46:46 +0100 |
commit | 90178924ee7dda26e5f9b07c21eb6b3c7b802c98 (patch) | |
tree | 47a4e72b173e5e2ad10aacbb726931f03e358e27 /tests/auto/widgets/qwebenginehistory | |
parent | 168867aac8789f00adad08e574b16569084cb9cd (diff) | |
parent | 6f9ecd0a4675b0e1a7ef6851cbda7e43c05e9536 (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: I9ddd2bdd830a862cd81dc1af5616d43e652a1c0e
Diffstat (limited to 'tests/auto/widgets/qwebenginehistory')
-rw-r--r-- | tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp index 7c8497fef..3c8025672 100644 --- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp +++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp @@ -40,6 +40,7 @@ protected : loadFinishedSpy->clear(); page->load(QUrl("qrc:/resources/page" + QString::number(nr) + ".html")); QTRY_COMPARE(loadFinishedSpy->count(), 1); + loadFinishedSpy->clear(); } public Q_SLOTS: @@ -161,7 +162,7 @@ void tst_QWebEngineHistory::forward() while (hist->canGoBack()) { hist->back(); histBackCount++; - QTRY_COMPARE(loadFinishedSpy->count(), histBackCount+1); + QTRY_COMPARE(loadFinishedSpy->count(), histBackCount); } QSignalSpy titleChangedSpy(page, SIGNAL(titleChanged(const QString&))); @@ -198,15 +199,15 @@ void tst_QWebEngineHistory::goToItem() QWebEngineHistoryItem current = hist->currentItem(); hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 2); + QTRY_COMPARE(loadFinishedSpy->count(), 1); hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 3); + QTRY_COMPARE(loadFinishedSpy->count(), 2); QVERIFY(hist->currentItem().title() != current.title()); hist->goToItem(current); - QTRY_COMPARE(loadFinishedSpy->count(), 3); + QTRY_COMPARE(loadFinishedSpy->count(), 2); QTRY_COMPARE(hist->currentItem().title(), current.title()); } @@ -229,10 +230,10 @@ void tst_QWebEngineHistory::items() void tst_QWebEngineHistory::backForwardItems() { hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 2); + QTRY_COMPARE(loadFinishedSpy->count(), 1); hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 3); + QTRY_COMPARE(loadFinishedSpy->count(), 2); QTRY_COMPARE(hist->items().size(), 5); QTRY_COMPARE(hist->backItems(100).size(), 2); @@ -282,16 +283,17 @@ void tst_QWebEngineHistory::serialize_2() // Force a "same document" navigation. page->load(page->url().toString() + QLatin1String("#dummyAnchor")); - QTRY_COMPARE(loadFinishedSpy->count(), 1); + // "same document" navigation doesn't trigger loadFinished signal. + QTRY_COMPARE(evaluateJavaScriptSync(page, "location.hash").toString(), QStringLiteral("#dummyAnchor")); int initialCurrentIndex = hist->currentItemIndex(); hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 2); + QTRY_VERIFY(evaluateJavaScriptSync(page, "location.hash").toString().isEmpty()); hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 3); + QTRY_COMPARE(loadFinishedSpy->count(), 1); hist->back(); - QTRY_COMPARE(loadFinishedSpy->count(), 4); + QTRY_COMPARE(loadFinishedSpy->count(), 2); //check if current index was changed (make sure that it is not last item) QVERIFY(hist->currentItemIndex() != initialCurrentIndex); //save current index @@ -302,17 +304,17 @@ void tst_QWebEngineHistory::serialize_2() load >> *hist; QVERIFY(load.status() == QDataStream::Ok); // Restoring the history will trigger a load. - QTRY_COMPARE(loadFinishedSpy->count(), 5); + QTRY_COMPARE(loadFinishedSpy->count(), 3); //check current index QTRY_COMPARE(hist->currentItemIndex(), oldCurrentIndex); hist->forward(); - QTRY_COMPARE(loadFinishedSpy->count(), 6); + QTRY_COMPARE(loadFinishedSpy->count(), 4); hist->forward(); - QTRY_COMPARE(loadFinishedSpy->count(), 7); + QTRY_COMPARE(loadFinishedSpy->count(), 5); hist->forward(); - QTRY_COMPARE(loadFinishedSpy->count(), 8); + QTRY_COMPARE(loadFinishedSpy->count(), 6); QTRY_COMPARE(hist->currentItemIndex(), initialCurrentIndex); } |