summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qmltests
diff options
context:
space:
mode:
authorTamas Zakor <ztamas@inf.u-szeged.hu>2019-09-12 09:41:21 +0200
committerTamas Zakor <ztamas@inf.u-szeged.hu>2019-09-16 09:13:29 +0200
commit7ab606e2e4ed3655e9362276f14ede4846308097 (patch)
tree575e9357772906352db6f378cd590637ae1bcc6b /tests/auto/quick/qmltests
parentffbb8cd7cd6bc8b6ff0c73e3fc45cb2f74e0f4c2 (diff)
Fix Q(Quick)WebEngineDownloadItem::setPath() path conversion
Also extend auto test with path checking Task-number: QTBUG-78213 Change-Id: Icb5d4ec831d8a665894d5890f983752c3af60ce8 Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org> Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'tests/auto/quick/qmltests')
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml35
1 files changed, 32 insertions, 3 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index c38018ffd..e049f3621 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -47,6 +47,7 @@ TestWebEngineView {
property string downloadDirectory: ""
property string downloadFileName: ""
property string downloadedPath: ""
+ property string downloadedSetPath: ""
property int downloadDirectoryChanged: 0
property int downloadFileNameChanged: 0
property int downloadPathChanged: 0
@@ -94,14 +95,19 @@ TestWebEngineView {
} else {
totalBytes = download.totalBytes
- download.downloadDirectory = downloadDirectory.length != 0 ? testDownloadProfile.downloadPath + downloadDirectory : testDownloadProfile.downloadPath
- download.downloadFileName = downloadFileName.length != 0 ? downloadFileName : "testfile.zip"
+ if (downloadedSetPath.length != 0) {
+ download.path = testDownloadProfile.downloadPath + downloadedSetPath
+ downloadedPath = download.path
+ } else {
+ download.downloadDirectory = downloadDirectory.length != 0 ? testDownloadProfile.downloadPath + downloadDirectory : testDownloadProfile.downloadPath
+ download.downloadFileName = downloadFileName.length != 0 ? downloadFileName : "testfile.zip"
+ downloadedPath = download.downloadDirectory + download.downloadFileName
+ }
download.accept()
}
downloadUrl = download.url
suggestedFileName = download.suggestedFileName
- downloadedPath = download.downloadDirectory + download.downloadFileName
}
onDownloadFinished: {
receivedBytes = download.receivedBytes;
@@ -126,6 +132,7 @@ TestWebEngineView {
downloadDirectory = ""
downloadFileName = ""
downloadedPath = ""
+ downloadedSetPath = ""
}
function test_downloadRequest() {
@@ -211,5 +218,27 @@ TestWebEngineView {
tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
verify(!downloadInterruptReason);
}
+
+ function test_downloadWithSetPath() {
+ compare(downLoadRequestedSpy.count, 0);
+ compare(downloadDirectoryChanged, 0);
+ compare(downloadFileNameChanged, 0);
+ downloadedSetPath = "/test/test.zip";
+ webEngineView.url = Qt.resolvedUrl("download.zip");
+ downLoadRequestedSpy.wait();
+ compare(downLoadRequestedSpy.count, 1);
+ compare(downloadUrl, webEngineView.url);
+ compare(suggestedFileName, "download.zip");
+ compare(downloadState[0], WebEngineDownloadItem.DownloadRequested);
+ tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
+ compare(downloadedPath, testDownloadProfile.downloadPath + downloadedSetPath);
+ compare(downloadDirectoryChanged, 1);
+ compare(downloadFileNameChanged, 1);
+ compare(downloadPathChanged, 2);
+ downloadFinishedSpy.wait();
+ compare(totalBytes, receivedBytes);
+ tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
+ verify(!downloadInterruptReason);
+ }
}
}