diff options
author | Doris Verria <doris.verria@qt.io> | 2021-08-19 20:41:28 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-20 08:22:39 +0000 |
commit | 2412b25350e6d8d4c20d8bac87c51bfab045019c (patch) | |
tree | 5e7c7eb6a09d0c5ec3dcc70a3a735e80a500e619 /tests | |
parent | ba46ae827d1beca5e015a67658de1e1f942437f8 (diff) |
tst_qcamerabackend: Fix test case for setting camera format
Remove framerate comparison between the camera's format and the video
buffer's. The QVideoFrame coming from the newVideoFrame signal, doesn't
have a framerate set.
Also, we are not checking reliably for a format mismatch with QTRY_
VERIFY as it will timeout before even processing a frame (when
formatMismatch is 0 upon initialization). Initialize it to -1 and set
the value of formatMismatch to 1 in case of a mismatch, 0 otherwise.
Blacklist test case for macOS and iOS as viewfinder frame is always
set to be in Format_BGRA8888 for now.
Change-Id: Ia299900fe8f66b0a5613635cc112d14d5ca10b2e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit ad1bf0d2e8a5b908301f0ab2ad214a62667e4eea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/integration/qcamerabackend/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp | 21 |
2 files changed, 14 insertions, 11 deletions
diff --git a/tests/auto/integration/qcamerabackend/BLACKLIST b/tests/auto/integration/qcamerabackend/BLACKLIST index e61221d49..0521c9fbd 100644 --- a/tests/auto/integration/qcamerabackend/BLACKLIST +++ b/tests/auto/integration/qcamerabackend/BLACKLIST @@ -5,3 +5,7 @@ ios [testCameraStartParallel] ios + +[testCameraFormat] +osx +ios diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index 43d3dd2d8..a8fab90b1 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -100,11 +100,11 @@ public: void setCameraFormatToTest(const QCameraFormat &format) { - formatMismatch = 0; + formatMismatch = -1; cameraFormat = format; } - int formatMismatch = 0; + int formatMismatch = -1; private: QCameraFormat cameraFormat; @@ -114,12 +114,11 @@ public Q_SLOTS: { QVideoFrameFormat surfaceFormat = frame.surfaceFormat(); if (surfaceFormat.pixelFormat() == cameraFormat.pixelFormat() - && surfaceFormat.frameSize() == cameraFormat.resolution() - && surfaceFormat.frameRate() >= cameraFormat.minFrameRate() - && surfaceFormat.frameRate() <= cameraFormat.maxFrameRate()) { - return; + && surfaceFormat.frameSize() == cameraFormat.resolution()) { + formatMismatch = 0; + } else { + formatMismatch = 1; } - formatMismatch++; } }; @@ -274,7 +273,7 @@ void tst_QCameraBackend::testCameraFormat() TestVideoFormat videoFormatTester(cameraFormat); session.setVideoOutput(&videoFormatTester); camera.start(); - QTRY_VERIFY(!videoFormatTester.formatMismatch); + QTRY_VERIFY(videoFormatTester.formatMismatch == 0); spy.clear(); camera.stop(); @@ -287,11 +286,11 @@ void tst_QCameraBackend::testCameraFormat() QCOMPARE(camera.cameraFormat(), secondFormat); videoFormatTester.setCameraFormatToTest(secondFormat); camera.start(); - QTRY_VERIFY(!videoFormatTester.formatMismatch); + QTRY_VERIFY(videoFormatTester.formatMismatch == 0); // check that frame format is not same as previous camera format videoFormatTester.setCameraFormatToTest(cameraFormat); - QTRY_VERIFY(videoFormatTester.formatMismatch); + QTRY_VERIFY(videoFormatTester.formatMismatch == 1); } // Set null format @@ -303,7 +302,7 @@ void tst_QCameraBackend::testCameraFormat() camera.start(); // In case of a null format, the backend should have picked // a decent format to render frames - QTRY_VERIFY(videoFormatTester.formatMismatch); + QTRY_VERIFY(videoFormatTester.formatMismatch == 1); camera.stop(); spy.clear(); |