summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2021-09-24 16:43:18 +0200
committerPiotr Srebrny <piotr.srebrny@qt.io>2021-09-29 18:28:51 +0200
commite9e79019fd015d0b4753b21cb851f7d215e0ee20 (patch)
treeaa30972d01a7877d71e37464d6b8bd07fd80fba7 /tests
parentb4879defbca4594854e5a8e730e1061e217a7b44 (diff)
Handover recorder between session
This patch enable a proper handover of QMediaRecorder between session. When the recorder is set to one session it will automatically disconnect from the owning session. Pick-to: 6.2 Change-Id: I7bc210134dee98126fea9da8d68c55cfa72a57f8 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp b/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp
index 71a006ef5..61c0be23f 100644
--- a/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp
+++ b/tests/auto/integration/qmediacapturesession/tst_qmediacapturesession.cpp
@@ -80,6 +80,7 @@ private slots:
void can_change_VideoOutput_when_recording();
void can_add_and_remove_recorders();
+ void can_move_Recorder_between_sessions();
void cannot_record_without_Camera_and_AudioInput();
void can_record_AudioInput_with_null_AudioDevice();
void can_record_Camera_with_null_CameraDevice();
@@ -578,6 +579,38 @@ void tst_QMediaCaptureSession::can_add_and_remove_recorders()
QVERIFY(!QTest::currentTestFailed());
}
+void tst_QMediaCaptureSession::can_move_Recorder_between_sessions()
+{
+ QMediaCaptureSession session0;
+ QMediaCaptureSession session1;
+ QSignalSpy recorderChanged0(&session0, SIGNAL(recorderChanged()));
+ QSignalSpy recorderChanged1(&session1, SIGNAL(recorderChanged()));
+ {
+ QMediaRecorder recorder;
+ {
+ QMediaCaptureSession session2;
+ QSignalSpy recorderChanged2(&session2, SIGNAL(recorderChanged()));
+ session2.setRecorder(&recorder);
+ QTRY_COMPARE(recorderChanged2.count(), 1);
+ }
+ QVERIFY(recorder.captureSession() == nullptr);
+
+ session0.setRecorder(&recorder);
+ QTRY_COMPARE(recorderChanged0.count(), 1);
+ QVERIFY(session0.recorder() == &recorder);
+ QVERIFY(recorder.captureSession() == &session0);
+
+ session1.setRecorder(&recorder);
+ QTRY_COMPARE(recorderChanged0.count(), 2);
+ QVERIFY(session0.recorder() == nullptr);
+ QTRY_COMPARE(recorderChanged1.count(), 1);
+ QVERIFY(session1.recorder() == &recorder);
+ QVERIFY(recorder.captureSession() == &session1);
+ }
+ QTRY_COMPARE(recorderChanged1.count(), 2);
+ QVERIFY(session1.recorder() == nullptr);
+}
+
void tst_QMediaCaptureSession::cannot_record_without_Camera_and_AudioInput()
{
QMediaCaptureSession session;