diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/publicapi/tst_publicapi.cpp | 3 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_notification.qml | 2 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 34 | ||||
-rw-r--r-- | tests/quicktestbrowser/ApplicationRoot.qml | 2 | ||||
-rw-r--r-- | tests/quicktestbrowser/BrowserWindow.qml | 2 |
5 files changed, 24 insertions, 19 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 0012249c8..90b768ac7 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -324,7 +324,7 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void" << "QQuickWebEngineProfile.downloadPath --> QString" << "QQuickWebEngineProfile.downloadPathChanged() --> void" - << "QQuickWebEngineProfile.userNotification(QWebEngineNotification*) --> void" + << "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void" << "QQuickWebEngineProfile.httpAcceptLanguage --> QString" << "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void" << "QQuickWebEngineProfile.httpCacheMaximumSize --> int" @@ -756,7 +756,6 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineRegisterProtocolHandlerRequest.reject() --> void" << "QWebEngineRegisterProtocolHandlerRequest.scheme --> QString" << "QWebEngineNotification.origin --> QUrl" - << "QWebEngineNotification.icon --> QIcon" << "QWebEngineNotification.title --> QString" << "QWebEngineNotification.message --> QString" << "QWebEngineNotification.tag --> QString" diff --git a/tests/auto/quick/qmltests/data/tst_notification.qml b/tests/auto/quick/qmltests/data/tst_notification.qml index af4aebafc..773bf4a8e 100644 --- a/tests/auto/quick/qmltests/data/tst_notification.qml +++ b/tests/auto/quick/qmltests/data/tst_notification.qml @@ -107,7 +107,7 @@ TestWebEngineView { verify(permissionRequested) let title = 'Title', message = 'Message', notification = null - view.profile.userNotification.connect(function (n) { notification = n }) + view.profile.presentNotification.connect(function (n) { notification = n }) view.runJavaScript('sendNotification("' + title + '", "' + message + '")') tryVerify(function () { return notification !== null }) diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index f73469d83..9ba242e68 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -3327,27 +3327,33 @@ void tst_QWebEnginePage::sendNotification() QVERIFY(page.spyRequest.wasCalled()); QCOMPARE(page.getPermission(), "granted"); - CallbackSpy<QWebEngineNotification> presenter; - page.profile()->setNotificationPresenter([callback = presenter.ref()] (const QWebEngineNotification ¬ification) mutable { callback(notification); }); + std::unique_ptr<QWebEngineNotification> activeNotification; + CallbackSpy<bool> presenter; + page.profile()->setNotificationPresenter( + [&] (std::unique_ptr<QWebEngineNotification> notification) + { + activeNotification = std::move(notification); + presenter(true); + }); QString title("Title"), message("Message"); page.sendNotification(title, message); - auto notification = presenter.waitForResult(); + presenter.waitForResult(); QVERIFY(presenter.wasCalled()); - QVERIFY(notification.isValid()); - QCOMPARE(notification.title(), title); - QCOMPARE(notification.message(), message); - QCOMPARE(notification.origin(), origin); - QCOMPARE(notification.direction(), Qt::RightToLeft); - QCOMPARE(notification.language(), "de"); - QCOMPARE(notification.tag(), "tst"); - - notification.show(); + QVERIFY(activeNotification); + QCOMPARE(activeNotification->title(), title); + QCOMPARE(activeNotification->message(), message); + QCOMPARE(activeNotification->origin(), origin); + QCOMPARE(activeNotification->direction(), Qt::RightToLeft); + QCOMPARE(activeNotification->language(), "de"); + QCOMPARE(activeNotification->tag(), "tst"); + + activeNotification->show(); QTRY_VERIFY2(page.messages.contains("onshow"), page.messages.join("\n").toLatin1().constData()); - notification.click(); + activeNotification->click(); QTRY_VERIFY2(page.messages.contains("onclick"), page.messages.join("\n").toLatin1().constData()); - notification.close(); + activeNotification->close(); QTRY_VERIFY2(page.messages.contains("onclose"), page.messages.join("\n").toLatin1().constData()); } diff --git a/tests/quicktestbrowser/ApplicationRoot.qml b/tests/quicktestbrowser/ApplicationRoot.qml index e2248e350..a2e83e1e6 100644 --- a/tests/quicktestbrowser/ApplicationRoot.qml +++ b/tests/quicktestbrowser/ApplicationRoot.qml @@ -53,7 +53,7 @@ QtObject { var newWindow = browserWindowComponent.createObject(root) newWindow.currentWebView.profile = profile profile.downloadRequested.connect(newWindow.onDownloadRequested) - profile.userNotification.connect(newWindow.onUserNotification) + profile.presentNotification.connect(newWindow.onPresentNotification) return newWindow } function createDialog(profile) { diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml index 381e9c142..6c3c160ac 100644 --- a/tests/quicktestbrowser/BrowserWindow.qml +++ b/tests/quicktestbrowser/BrowserWindow.qml @@ -511,7 +511,7 @@ ApplicationWindow { standardButtons: StandardButton.Ok } - function onUserNotification(notification) { + function onPresentNotification(notification) { notificationDialog.title = notification.title notificationDialog.text = notification.origin.toString() + '\n' + notification.message notificationDialog.open() |