diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-13 17:25:16 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-13 17:25:16 +0200 |
commit | 2dce0008ce53d27d281ad2dc00eb32d25ae5fc84 (patch) | |
tree | 55d97b68f56b78f3388cdaaa4ae69648b7057f68 /tests/auto/quick/qmltests | |
parent | 919dd97e835f469609a0710eb91f829a6d70e88c (diff) | |
parent | 8fe660ecbbe1f126ce0da694adff956ad7159870 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia01415e5a44b1df9ed8b3966ff3b39a414b1563c
Diffstat (limited to 'tests/auto/quick/qmltests')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_navigationHistory.qml | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_navigationHistory.qml b/tests/auto/quick/qmltests/data/tst_navigationHistory.qml index 6ed232589..47be2f47d 100644 --- a/tests/auto/quick/qmltests/data/tst_navigationHistory.qml +++ b/tests/auto/quick/qmltests/data/tst_navigationHistory.qml @@ -26,7 +26,8 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.15 +import QtQuick.Controls 2.15 import QtTest 1.0 import QtWebEngine 1.2 @@ -59,11 +60,25 @@ TestWebEngineView { } } + Button { + id: backButton + text: "Back" + enabled: webEngineView.canGoBack + onClicked: webEngineView.goBack() + } + + Button { + id: forwardButton + text: "Forward" + enabled: webEngineView.canGoForward + onClicked: webEngineView.goForward() + } + TestCase { name: "WebEngineViewNavigationHistory" function test_navigationHistory() { - compare(webEngineView.loadProgress, 0) + webEngineView.navigationHistory.clear() webEngineView.url = Qt.resolvedUrl("test1.html") verify(webEngineView.waitForLoadSucceeded()) @@ -142,5 +157,34 @@ TestWebEngineView { compare(backItemsList.count, 0) compare(forwardItemsList.count, 0) } + + function test_navigationButtons() { + webEngineView.navigationHistory.clear() + + webEngineView.url = Qt.resolvedUrl("test1.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(backButton.enabled, false) + compare(forwardButton.enabled, false) + + webEngineView.url = Qt.resolvedUrl("test2.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(backButton.enabled, true) + compare(forwardButton.enabled, false) + + webEngineView.url = Qt.resolvedUrl("test3.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(backButton.enabled, true) + compare(forwardButton.enabled, false) + + backButton.clicked() + verify(webEngineView.waitForLoadSucceeded()) + compare(backButton.enabled, true) + compare(forwardButton.enabled, true) + + webEngineView.url = Qt.resolvedUrl("test1.html") + verify(webEngineView.waitForLoadSucceeded()) + compare(backButton.enabled, true) + compare(forwardButton.enabled, false) + } } } |