diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-09-09 15:55:48 +0200 |
---|---|---|
committer | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-10-06 09:44:58 +0200 |
commit | 5cc60401eef22ebfc9406d85c563db3f395d0c53 (patch) | |
tree | 3e84c43e7227d0480d5c5722ba6e1248edf25aa8 /tests | |
parent | 9dd61fb5f5912444374450278d44e5b320e880c4 (diff) |
Enable error reporting when failed to initialize backend element
This patch adds an option to report error message when a backend
component cannot be instantiated. This error message is then
displayed in the console with qWarning and in some cases reported
to the app user with error signals. We need further improvements
on the error reporting side.
Additionally, this patch cleans up the code in the .cpp API
classes.
Change-Id: Id39865cc8f1e9b52804bf5b9d9b15e738508f860
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit f1aa625049a08519d52ba87958e25cb80e47fd1e)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/unit/mockbackend/qmockintegration.cpp | 16 | ||||
-rw-r--r-- | tests/auto/unit/mockbackend/qmockintegration_p.h | 18 |
2 files changed, 17 insertions, 17 deletions
diff --git a/tests/auto/unit/mockbackend/qmockintegration.cpp b/tests/auto/unit/mockbackend/qmockintegration.cpp index dd64bd5ae..49b3ac202 100644 --- a/tests/auto/unit/mockbackend/qmockintegration.cpp +++ b/tests/auto/unit/mockbackend/qmockintegration.cpp @@ -75,7 +75,7 @@ QMockIntegration::~QMockIntegration() setIntegration(nullptr); } -QPlatformAudioDecoder *QMockIntegration::createAudioDecoder(QAudioDecoder *decoder) +QMaybe<QPlatformAudioDecoder *> QMockIntegration::createAudioDecoder(QAudioDecoder *decoder) { if (m_flags & NoAudioDecoderInterface) m_lastAudioDecoderControl = nullptr; @@ -84,7 +84,7 @@ QPlatformAudioDecoder *QMockIntegration::createAudioDecoder(QAudioDecoder *decod return m_lastAudioDecoderControl; } -QPlatformMediaPlayer *QMockIntegration::createPlayer(QMediaPlayer *parent) +QMaybe<QPlatformMediaPlayer *> QMockIntegration::createPlayer(QMediaPlayer *parent) { if (m_flags & NoPlayerInterface) m_lastPlayer = nullptr; @@ -93,7 +93,7 @@ QPlatformMediaPlayer *QMockIntegration::createPlayer(QMediaPlayer *parent) return m_lastPlayer; } -QPlatformCamera *QMockIntegration::createCamera(QCamera *parent) +QMaybe<QPlatformCamera *> QMockIntegration::createCamera(QCamera *parent) { if (m_flags & NoCaptureInterface) m_lastCamera = nullptr; @@ -102,17 +102,17 @@ QPlatformCamera *QMockIntegration::createCamera(QCamera *parent) return m_lastCamera; } -QPlatformImageCapture *QMockIntegration::createImageCapture(QImageCapture *capture) +QMaybe<QPlatformImageCapture *> QMockIntegration::createImageCapture(QImageCapture *capture) { return new QMockImageCapture(capture); } -QPlatformMediaRecorder *QMockIntegration::createRecorder(QMediaRecorder *recorder) +QMaybe<QPlatformMediaRecorder *> QMockIntegration::createRecorder(QMediaRecorder *recorder) { return new QMockMediaEncoder(recorder); } -QPlatformMediaCaptureSession *QMockIntegration::createCaptureSession() +QMaybe<QPlatformMediaCaptureSession *> QMockIntegration::createCaptureSession() { if (m_flags & NoCaptureInterface) m_lastCaptureService = nullptr; @@ -121,13 +121,13 @@ QPlatformMediaCaptureSession *QMockIntegration::createCaptureSession() return m_lastCaptureService; } -QPlatformVideoSink *QMockIntegration::createVideoSink(QVideoSink *sink) +QMaybe<QPlatformVideoSink *> QMockIntegration::createVideoSink(QVideoSink *sink) { m_lastVideoSink = new QMockVideoSink(sink); return m_lastVideoSink; } -QPlatformAudioOutput *QMockIntegration::createAudioOutput(QAudioOutput *q) +QMaybe<QPlatformAudioOutput *> QMockIntegration::createAudioOutput(QAudioOutput *q) { return new QMockAudioOutput(q); } diff --git a/tests/auto/unit/mockbackend/qmockintegration_p.h b/tests/auto/unit/mockbackend/qmockintegration_p.h index d07532a3f..cba6f4e15 100644 --- a/tests/auto/unit/mockbackend/qmockintegration_p.h +++ b/tests/auto/unit/mockbackend/qmockintegration_p.h @@ -33,15 +33,15 @@ public: QPlatformMediaFormatInfo *formatInfo() override { return nullptr; } - QPlatformAudioDecoder *createAudioDecoder(QAudioDecoder *decoder) override; - QPlatformMediaPlayer *createPlayer(QMediaPlayer *) override; - QPlatformCamera *createCamera(QCamera *) override; - QPlatformMediaRecorder *createRecorder(QMediaRecorder *) override; - QPlatformImageCapture *createImageCapture(QImageCapture *) override; - QPlatformMediaCaptureSession *createCaptureSession() override; - QPlatformVideoSink *createVideoSink(QVideoSink *) override; - - QPlatformAudioOutput *createAudioOutput(QAudioOutput *) override; + QMaybe<QPlatformAudioDecoder *> createAudioDecoder(QAudioDecoder *decoder) override; + QMaybe<QPlatformMediaPlayer *> createPlayer(QMediaPlayer *) override; + QMaybe<QPlatformCamera *> createCamera(QCamera *) override; + QMaybe<QPlatformMediaRecorder *> createRecorder(QMediaRecorder *) override; + QMaybe<QPlatformImageCapture *> createImageCapture(QImageCapture *) override; + QMaybe<QPlatformMediaCaptureSession *> createCaptureSession() override; + QMaybe<QPlatformVideoSink *> createVideoSink(QVideoSink *) override; + + QMaybe<QPlatformAudioOutput *> createAudioOutput(QAudioOutput *) override; enum Flag { NoPlayerInterface = 0x1, |