diff options
author | Balazs Egedi <egedib@inf.u-szeged.hu> | 2021-05-05 14:23:38 +0200 |
---|---|---|
committer | Balazs Egedi <egedib@inf.u-szeged.hu> | 2021-05-07 01:31:58 +0200 |
commit | 2250a262fa3ecc68706e5e5905d44c3c04a482a9 (patch) | |
tree | 19e5561d70b0c9d226ebebd8de84c1b7325296e1 /tests/auto/widgets | |
parent | a5c7b4d4f16574e35ce36550bda2d45baf345c79 (diff) |
Fix QWebEngineDownloadRequest signals
downloadFileNameChanged and downloadDirectoryChanged signals were removed in
08375ee7 Rename QWebEngineDownloadItem -> QWebEngineDownloadRequest.
Reintroduce these signals because they are still part of the API.
Also test these in Widgets auto test.
QQuickWebEngineDownloadItem::pathChanged were also removed in
75393077 Remove obsolete, deprecated api from qwebenginedownloaditem.
Remove the pathChanged signal checks from the test because it was deprecated.
The test tst_download.qml does not have quickcontrols1 dependency.
Update it in the project file and re-enable the test.
Change-Id: I702e04dfe2179beafc558a628bfa07f4090fede2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp index 545f062c1..a69ceaed0 100644 --- a/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp +++ b/tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp @@ -1147,20 +1147,28 @@ void tst_QWebEngineDownloadRequest::downloadToDirectoryWithFileName() // Set up profile and download handler ScopedConnection sc2 = connect(m_profile, &QWebEngineProfile::downloadRequested, [&](QWebEngineDownloadRequest *item) { - + QSignalSpy fileNameSpy(item, &QWebEngineDownloadRequest::downloadFileNameChanged); + QSignalSpy directorySpy(item, &QWebEngineDownloadRequest::downloadDirectoryChanged); + bool isUniquifiedFileName = false; if (!downloadDirectory.isEmpty() && setDirectoryFirst) { + const QString &originalFileName = item->downloadFileName(); item->setDownloadDirectory(downloadDirectory); QCOMPARE(item->downloadDirectory(), downloadDirectory); + QCOMPARE(directorySpy.count(), 1); + isUniquifiedFileName = (originalFileName != item->downloadFileName()); + QCOMPARE(fileNameSpy.count(), isUniquifiedFileName ? 1 : 0); } if (!downloadFileName.isEmpty()) { item->setDownloadFileName(downloadFileName); QCOMPARE(item->downloadFileName(), downloadFileName); + QCOMPARE(fileNameSpy.count(), isUniquifiedFileName ? 2 : 1); } if (!downloadDirectory.isEmpty() && !setDirectoryFirst) { item->setDownloadDirectory(downloadDirectory); QCOMPARE(item->downloadDirectory(), downloadDirectory); + QCOMPARE(directorySpy.count(), 1); } item->accept(); |