diff options
Diffstat (limited to 'tests/auto/widgets')
5 files changed, 31 insertions, 25 deletions
diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index 6efbf53ed..b0165cfbc 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -134,7 +134,7 @@ void tst_Accessibility::hierarchy() QVERIFY(windowRect.contains(inputRect)); QPoint inputCenter = inputRect.center(); QAccessibleInterface *hitTest = view; - QAccessibleInterface *child = Q_NULLPTR; + QAccessibleInterface *child = nullptr; while (hitTest) { child = hitTest; hitTest = hitTest->childAt(inputCenter.x(), inputCenter.y()); diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp index 8af559e21..8669c8f94 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -920,7 +920,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename() void tst_QWebEngineDownloadItem::downloadUniqueFileNameWithTimeStamp() { #ifdef Q_OS_WIN - QSKIP("QTBUG-74764: The download completes after the test fails thus would ruin subsequent tests on Windows.") + QSKIP("QTBUG-74764: The download completes after the test fails thus would ruin subsequent tests on Windows."); #endif // Set up HTTP server QString baseName("test(1.test)"); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 3792b5522..9ba242e68 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1550,7 +1550,7 @@ public: JavaScriptCallback() { } JavaScriptCallback(const QVariant& _expected) : expected(_expected) { } - void check(const QVariant& result) Q_DECL_OVERRIDE + void check(const QVariant& result) override { QVERIFY(result.isValid()); QCOMPARE(result, expected); @@ -1563,7 +1563,7 @@ private: class JavaScriptCallbackNull : public JavaScriptCallbackBase { public: - void check(const QVariant& result) Q_DECL_OVERRIDE + void check(const QVariant& result) override { QVERIFY(result.isNull()); // FIXME: Returned null values are currently invalid QVariants. @@ -1574,7 +1574,7 @@ public: class JavaScriptCallbackUndefined : public JavaScriptCallbackBase { public: - void check(const QVariant& result) Q_DECL_OVERRIDE + void check(const QVariant& result) override { QVERIFY(result.isNull()); QVERIFY(!result.isValid()); @@ -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/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 8bd68bb97..ebd25e892 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -374,17 +374,17 @@ public: { } - qint64 readData(char *, qint64) Q_DECL_OVERRIDE + qint64 readData(char *, qint64) override { m_job->fail(QWebEngineUrlRequestJob::RequestFailed); return -1; } - qint64 writeData(const char *, qint64) Q_DECL_OVERRIDE + qint64 writeData(const char *, qint64) override { m_job->fail(QWebEngineUrlRequestJob::RequestFailed); return -1; } - void close() Q_DECL_OVERRIDE + void close() override { QIODevice::close(); deleteLater(); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 17177c7fb..16a3d32b6 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -588,8 +588,8 @@ class KeyEventRecordingWidget : public QWidget { public: QList<QKeyEvent> pressEvents; QList<QKeyEvent> releaseEvents; - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE { pressEvents << *e; } - void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE { releaseEvents << *e; } + void keyPressEvent(QKeyEvent *e) override { pressEvents << *e; } + void keyReleaseEvent(QKeyEvent *e) override { releaseEvents << *e; } }; void tst_QWebEngineView::unhandledKeyEventPropagation() @@ -879,7 +879,7 @@ public: explicit KeyboardAndMouseEventRecordingWidget(QWidget *parent = 0) : QWidget(parent), m_eventCounter(0) {} - bool event(QEvent *event) Q_DECL_OVERRIDE + bool event(QEvent *event) override { QString eventString; switch (event->type()) { |