diff options
author | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-10-14 17:42:10 +0200 |
---|---|---|
committer | Piotr Srebrny <piotr.srebrny@qt.io> | 2022-10-19 14:00:25 +0200 |
commit | ffa9d8974b67d39bb8a6b1a3975d3e56e3e5fae1 (patch) | |
tree | 5127dd05579ae572111cfd117f03fd3d54fc9f52 | |
parent | 5a29980de139e3a0cf9878f3e6c586acdd508f66 (diff) | |
download | qtmultimedia-ffa9d8974b67d39bb8a6b1a3975d3e56e3e5fae1.tar.gz |
Don't fail tests when recording does not start due to format error
Recorders don't handle all camera formats and we should not fail test
in such case. Specifically Windows encoders do not handle Y8 format
that is produced by IR cameras.
Change-Id: I964d7edc0cef294ceb92932b901af8f3c174fe11
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit 9aa6f08a92ecfefdbfd120940ee954eaa57080a4)
-rw-r--r-- | tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index 56a8a13e1..0c5ccc76e 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -545,7 +545,7 @@ void tst_QCameraBackend::testVideoRecording() session.setRecorder(&recorder); QSignalSpy errorSignal(camera.data(), SIGNAL(errorOccurred(QCamera::Error, const QString &))); - QSignalSpy recorderErrorSignal(&recorder, SIGNAL(errorOccurred(Error, const QString &))); + QSignalSpy recorderErrorSignal(&recorder, SIGNAL(errorOccurred(QMediaRecorder::Error, const QString &))); QSignalSpy recorderStateChanged(&recorder, SIGNAL(recorderStateChanged(RecorderState))); QSignalSpy durationChanged(&recorder, SIGNAL(durationChanged(qint64))); @@ -565,12 +565,16 @@ void tst_QCameraBackend::testVideoRecording() QTRY_VERIFY(camera->isActive()); QTRY_VERIFY(camera->isActive()); - for (int recordings = 0; recordings < 2; ++recordings) { //record 200ms clip recorder.record(); durationChanged.clear(); - QTRY_VERIFY(durationChanged.count()); + if (!recorderErrorSignal.empty() || recorderErrorSignal.wait(100)) { + QCOMPARE(recorderErrorSignal.last().first().toInt(), QMediaRecorder::FormatError); + break; + } + + QTRY_VERIFY(durationChanged.size()); QCOMPARE(recorder.metaData(), metaData); |