diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-06-21 19:10:32 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-06-22 14:34:47 +0000 |
commit | ac946f204fffbe887b4c7f911aef5f3a3c369dd2 (patch) | |
tree | 5388a597069514b595574c1444c65c2577b3981c /tests | |
parent | c28dc66845464953d27cb4a91bb4829af2029b02 (diff) |
Renamings before QWindowCapture integration
QPlatformScreenCapture will be used for both, screens and windows.
Change-Id: I987dfc39f9558f9719b41e490c67de036cb07a5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit aff72ee9082ae770746b4da9ddafa1a867ba31d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/unit/mockbackend/qmockintegration.cpp | 6 | ||||
-rw-r--r-- | tests/auto/unit/mockbackend/qmockintegration.h | 8 | ||||
-rw-r--r-- | tests/auto/unit/mockbackend/qmockmediacapturesession.h | 8 | ||||
-rw-r--r-- | tests/auto/unit/mockbackend/qmocksurfacecapture.h (renamed from tests/auto/unit/mockbackend/qmockscreencapture.h) | 16 | ||||
-rw-r--r-- | tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp | 8 |
5 files changed, 23 insertions, 23 deletions
diff --git a/tests/auto/unit/mockbackend/qmockintegration.cpp b/tests/auto/unit/mockbackend/qmockintegration.cpp index 21911f8db..ff739cdf4 100644 --- a/tests/auto/unit/mockbackend/qmockintegration.cpp +++ b/tests/auto/unit/mockbackend/qmockintegration.cpp @@ -9,7 +9,7 @@ #include "qmockvideosink.h" #include "qmockimagecapture.h" #include "qmockaudiooutput.h" -#include "qmockscreencapture.h" +#include "qmocksurfacecapture.h" #include <private/qcameradevice_p.h> #include <private/qplatformvideodevices_p.h> @@ -113,12 +113,12 @@ QMaybe<QPlatformMediaRecorder *> QMockIntegration::createRecorder(QMediaRecorder return new QMockMediaEncoder(recorder); } -QPlatformScreenCapture *QMockIntegration::createScreenCapture(QScreenCapture *capture) +QPlatformSurfaceCapture *QMockIntegration::createScreenCapture(QScreenCapture *capture) { if (m_flags & NoCaptureInterface) m_lastScreenCapture = nullptr; else - m_lastScreenCapture = new QMockScreenCapture(capture); + m_lastScreenCapture = new QMockSurfaceCapture(capture); return m_lastScreenCapture; } diff --git a/tests/auto/unit/mockbackend/qmockintegration.h b/tests/auto/unit/mockbackend/qmockintegration.h index d295d9c6a..a76008de3 100644 --- a/tests/auto/unit/mockbackend/qmockintegration.h +++ b/tests/auto/unit/mockbackend/qmockintegration.h @@ -24,7 +24,7 @@ class QMockAudioDecoder; class QMockCamera; class QMockMediaCaptureSession; class QMockVideoSink; -class QMockScreenCapture; +class QMockSurfaceCapture; class QMockIntegration : public QPlatformMediaIntegration { @@ -44,7 +44,7 @@ public: QMaybe<QPlatformAudioOutput *> createAudioOutput(QAudioOutput *) override; - QPlatformScreenCapture *createScreenCapture(QScreenCapture *) override; + QPlatformSurfaceCapture *createScreenCapture(QScreenCapture *) override; enum Flag { NoPlayerInterface = 0x1, NoAudioDecoderInterface = 0x2, NoCaptureInterface = 0x4 }; Q_DECLARE_FLAGS(Flags, Flag); @@ -58,7 +58,7 @@ public: // QMockMediaEncoder *lastEncoder const { return m_lastEncoder; } QMockMediaCaptureSession *lastCaptureService() const { return m_lastCaptureService; } QMockVideoSink *lastVideoSink() const { return m_lastVideoSink; } - QMockScreenCapture *lastScreenCapture() { return m_lastScreenCapture; } + QMockSurfaceCapture *lastScreenCapture() { return m_lastScreenCapture; } private: Flags m_flags = {}; @@ -68,7 +68,7 @@ private: // QMockMediaEncoder *m_lastEncoder = nullptr; QMockMediaCaptureSession *m_lastCaptureService = nullptr; QMockVideoSink *m_lastVideoSink = nullptr; - QMockScreenCapture *m_lastScreenCapture = nullptr; + QMockSurfaceCapture *m_lastScreenCapture = nullptr; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMockIntegration::Flags); diff --git a/tests/auto/unit/mockbackend/qmockmediacapturesession.h b/tests/auto/unit/mockbackend/qmockmediacapturesession.h index 6283de061..155a49201 100644 --- a/tests/auto/unit/mockbackend/qmockmediacapturesession.h +++ b/tests/auto/unit/mockbackend/qmockmediacapturesession.h @@ -8,7 +8,7 @@ #include "qmockimagecapture.h" #include "qmockcamera.h" #include "qmockimagecapture.h" -#include "qmockscreencapture.h" +#include "qmocksurfacecapture.h" #include <private/qplatformmediacapture_p.h> QT_BEGIN_NAMESPACE @@ -62,14 +62,14 @@ public: m_audioInput = input; } - QPlatformScreenCapture *screenCapture() override { return m_screenCapture; } - void setScreenCapture(QPlatformScreenCapture *capture) override { m_screenCapture = capture; } + QPlatformSurfaceCapture *screenCapture() override { return m_screenCapture; } + void setScreenCapture(QPlatformSurfaceCapture *capture) override { m_screenCapture = capture; } QMockCamera *mockCameraControl = nullptr; QPlatformImageCapture *mockImageCapture = nullptr; QMockMediaEncoder *mockControl = nullptr; QPlatformAudioInput *m_audioInput = nullptr; - QPlatformScreenCapture *m_screenCapture = nullptr; + QPlatformSurfaceCapture *m_screenCapture = nullptr; bool hasControls; }; diff --git a/tests/auto/unit/mockbackend/qmockscreencapture.h b/tests/auto/unit/mockbackend/qmocksurfacecapture.h index 732111e7a..88e618a4c 100644 --- a/tests/auto/unit/mockbackend/qmockscreencapture.h +++ b/tests/auto/unit/mockbackend/qmocksurfacecapture.h @@ -1,22 +1,22 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#ifndef QMOCKSCREENCAPTURE_H -#define QMOCKSCREENCAPTURE_H +#ifndef QMOCKSURFACECAPTURE_H +#define QMOCKSURFACECAPTURE_H -#include "private/qplatformscreencapture_p.h" +#include "private/qplatformsurfacecapture_p.h" #include "qmockvideobuffer.h" #include "qthread.h" QT_BEGIN_NAMESPACE -class QMockScreenCapture : public QPlatformScreenCapture +class QMockSurfaceCapture : public QPlatformSurfaceCapture { class Grabber : public QThread { public: - Grabber(QMockScreenCapture &capture) : QThread(&capture), m_capture(capture) { } + Grabber(QMockSurfaceCapture &capture) : QThread(&capture), m_capture(capture) { } void run() override { @@ -35,13 +35,13 @@ class QMockScreenCapture : public QPlatformScreenCapture } private: - QMockScreenCapture &m_capture; + QMockSurfaceCapture &m_capture; }; public: - using QPlatformScreenCapture::QPlatformScreenCapture; + using QPlatformSurfaceCapture::QPlatformSurfaceCapture; - ~QMockScreenCapture() { resetGrabber(); } + ~QMockSurfaceCapture() { resetGrabber(); } void setActive(bool active) override { diff --git a/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp b/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp index d3c75ddf6..93c26cc7a 100644 --- a/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp +++ b/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp @@ -8,7 +8,7 @@ #include "qmockintegration.h" #include "qscreencapture.h" -#include "qmockscreencapture.h" +#include "qmocksurfacecapture.h" #include "qatomic.h" QT_USE_NAMESPACE @@ -20,11 +20,11 @@ class tst_QScreenCapture : public QObject private: // Use custom waiting instead of QSignalSpy since the spy tries copying not sharable object // QVideoFrame to QVariant and gets an assert - bool waitForFrame(QPlatformScreenCapture &psc) + bool waitForFrame(QPlatformSurfaceCapture &psc) { QAtomicInteger<bool> newFrameReceived = false; QObject o; - auto connection = connect(&psc, &QPlatformScreenCapture::newVideoFrame, &o, + auto connection = connect(&psc, &QPlatformSurfaceCapture::newVideoFrame, &o, [&newFrameReceived]() { newFrameReceived = true; }); return QTest::qWaitFor([&newFrameReceived]() { return newFrameReceived; }); @@ -53,7 +53,7 @@ void tst_QScreenCapture::destructionOfActiveCapture() // Run a few times in order to catch random UB on deletion for (int i = 0; i < 10; ++i) { auto sc = std::make_unique<QScreenCapture>(); - QPointer<QPlatformScreenCapture> psc = integration.lastScreenCapture(); + QPointer<QPlatformSurfaceCapture> psc = integration.lastScreenCapture(); QVERIFY(psc); sc->setActive(true); |