From a4eeb9dbd995d598bd3a639dd450def7c242b383 Mon Sep 17 00:00:00 2001 From: Tamas Zakor Date: Thu, 9 May 2019 14:49:56 +0200 Subject: Add API to get the suggested download file name [ChangeLog][DownloadItem] Add functions and property to get the suggested download file name. Task-number: QTBUG-56978 Change-Id: I902870c6358271322da613a15ccc11639384e404 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/data/tst_download.qml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/quick/qmltests') diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml index 04838f57d..c8f783b03 100644 --- a/tests/auto/quick/qmltests/data/tst_download.qml +++ b/tests/auto/quick/qmltests/data/tst_download.qml @@ -43,6 +43,7 @@ TestWebEngineView { property var downloadState: [] property var downloadInterruptReason: null property url downloadUrl: "" + property string suggestedFileName: "" function urlToPath(url) { var path = url.toString() @@ -83,6 +84,7 @@ TestWebEngineView { download.accept() } downloadUrl = download.url + suggestedFileName = download.suggestedFileName } onDownloadFinished: { receivedBytes = download.receivedBytes; @@ -109,6 +111,7 @@ TestWebEngineView { downLoadRequestedSpy.wait() compare(downLoadRequestedSpy.count, 1) compare(downloadUrl, webEngineView.url) + compare(suggestedFileName, "download.zip") compare(downloadState[0], WebEngineDownloadItem.DownloadRequested) verify(!downloadInterruptReason) } @@ -119,6 +122,7 @@ TestWebEngineView { downLoadRequestedSpy.wait() compare(downLoadRequestedSpy.count, 1) compare(downloadUrl, webEngineView.url) + compare(suggestedFileName, "download.zip") compare(totalBytes, 325) verify(!downloadInterruptReason) } @@ -129,6 +133,7 @@ TestWebEngineView { downLoadRequestedSpy.wait() compare(downLoadRequestedSpy.count, 1) compare(downloadUrl, webEngineView.url) + compare(suggestedFileName, "download.zip") compare(downloadState[0], WebEngineDownloadItem.DownloadRequested) tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress) downloadFinishedSpy.wait() @@ -144,6 +149,7 @@ TestWebEngineView { downLoadRequestedSpy.wait() compare(downLoadRequestedSpy.count, 1) compare(downloadUrl, webEngineView.url) + compare(suggestedFileName, "download.zip") compare(downloadFinishedSpy.count, 1) tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadCancelled) tryCompare(webEngineView, "downloadInterruptReason", WebEngineDownloadItem.UserCanceled) -- cgit v1.2.3