diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 287e2364a..23a56a9cb 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -42,6 +42,7 @@ #include <QtWebEngineWidgets/qwebengineprofile.h> #include <QtWebEngineWidgets/qwebenginesettings.h> #include <QtWebEngineWidgets/qwebengineview.h> +#include <QtWebEngineWidgets/qwebenginedownloaditem.h> class tst_QWebEngineProfile : public QObject { @@ -54,6 +55,7 @@ private Q_SLOTS: void urlSchemeHandlerFailRequest(); void customUserAgent(); void httpAcceptLanguage(); + void downloadItem(); }; void tst_QWebEngineProfile::defaultProfile() @@ -245,5 +247,16 @@ void tst_QWebEngineProfile::httpAcceptLanguage() QCOMPARE(evaluateJavaScriptSync(&page, QStringLiteral("navigator.languages")).toStringList(), QStringList(testLang)); } +void tst_QWebEngineProfile::downloadItem() +{ + qRegisterMetaType<QWebEngineDownloadItem *>(); + QWebEngineProfile testProfile; + QWebEnginePage page(&testProfile); + QSignalSpy downloadSpy(&testProfile, SIGNAL(downloadRequested(QWebEngineDownloadItem *))); + connect(&testProfile, &QWebEngineProfile::downloadRequested, this, [=] (QWebEngineDownloadItem *item) { item->accept(); }); + page.load(QUrl::fromLocalFile(QCoreApplication::applicationFilePath())); + QTRY_COMPARE(downloadSpy.count(), 1); +} + QTEST_MAIN(tst_QWebEngineProfile) #include "tst_qwebengineprofile.moc" |