diff options
Diffstat (limited to 'tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp')
-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 a399f5565..579a0f776 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -35,6 +35,7 @@ #include <QtWebEngineWidgets/qwebenginepage.h> #include <QtWebEngineWidgets/qwebenginesettings.h> #include <QtWebEngineWidgets/qwebengineview.h> +#include <QtWebEngineWidgets/qwebenginedownloaditem.h> class tst_QWebEngineProfile : public QObject { @@ -50,6 +51,7 @@ private Q_SLOTS: void urlSchemeHandlerFailOnRead(); void customUserAgent(); void httpAcceptLanguage(); + void downloadItem(); }; void tst_QWebEngineProfile::defaultProfile() @@ -362,5 +364,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" |