summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit/multimedia
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/unit/multimedia')
-rw-r--r--tests/auto/unit/multimedia/CMakeLists.txt40
-rw-r--r--tests/auto/unit/multimedia/gstreamer_backend/CMakeLists.txt15
-rw-r--r--tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.cpp309
-rw-r--r--tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.h49
-rw-r--r--tests/auto/unit/multimedia/qabstractvideobuffer/CMakeLists.txt16
-rw-r--r--tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp113
-rw-r--r--tests/auto/unit/multimedia/qaudiobuffer/CMakeLists.txt18
-rw-r--r--tests/auto/unit/multimedia/qaudiobuffer/tst_qaudiobuffer.cpp314
-rw-r--r--tests/auto/unit/multimedia/qaudiodecoder/CMakeLists.txt21
-rw-r--r--tests/auto/unit/multimedia/qaudiodecoder/tst_qaudiodecoder.cpp337
-rw-r--r--tests/auto/unit/multimedia/qaudioformat/CMakeLists.txt16
-rw-r--r--tests/auto/unit/multimedia/qaudioformat/tst_qaudioformat.cpp267
-rw-r--r--tests/auto/unit/multimedia/qaudionamespace/CMakeLists.txt16
-rw-r--r--tests/auto/unit/multimedia/qaudionamespace/tst_qaudionamespace.cpp216
-rw-r--r--tests/auto/unit/multimedia/qaudiorecorder/CMakeLists.txt20
-rw-r--r--tests/auto/unit/multimedia/qaudiorecorder/tst_qaudiorecorder.cpp87
-rw-r--r--tests/auto/unit/multimedia/qaudiostatemachine/CMakeLists.txt11
-rw-r--r--tests/auto/unit/multimedia/qaudiostatemachine/tst_qaudiostatemachine.cpp661
-rw-r--r--tests/auto/unit/multimedia/qcamera/CMakeLists.txt20
-rw-r--r--tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp845
-rw-r--r--tests/auto/unit/multimedia/qcameradevice/CMakeLists.txt20
-rw-r--r--tests/auto/unit/multimedia/qcameradevice/tst_qcameradevice.cpp139
-rw-r--r--tests/auto/unit/multimedia/qerrorinfo/CMakeLists.txt10
-rw-r--r--tests/auto/unit/multimedia/qerrorinfo/tst_qerrorinfo.cpp117
-rw-r--r--tests/auto/unit/multimedia/qimagecapture/CMakeLists.txt20
-rw-r--r--tests/auto/unit/multimedia/qimagecapture/tst_qimagecapture.cpp284
-rw-r--r--tests/auto/unit/multimedia/qmaybe/CMakeLists.txt9
-rw-r--r--tests/auto/unit/multimedia/qmaybe/tst_qmaybe.cpp124
-rw-r--r--tests/auto/unit/multimedia/qmediacapture_gstreamer/CMakeLists.txt18
-rw-r--r--tests/auto/unit/multimedia/qmediacapture_gstreamer/tst_qmediacapture_gstreamer.cpp212
-rw-r--r--tests/auto/unit/multimedia/qmediadevices/CMakeLists.txt13
-rw-r--r--tests/auto/unit/multimedia/qmediadevices/tst_qmediadevices.cpp58
-rw-r--r--tests/auto/unit/multimedia/qmediaformat/CMakeLists.txt10
-rw-r--r--tests/auto/unit/multimedia/qmediaformat/tst_qmediaformat.cpp65
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer/CMakeLists.txt34
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer/testdata/nokia-tune.mp3bin0 -> 62715 bytes
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer/tst_qmediaplayer.cpp832
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer_gstreamer/CMakeLists.txt32
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer_gstreamer/testdata/color_matrix.mp4bin0 -> 21412 bytes
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.cpp153
-rw-r--r--tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.h46
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/CMakeLists.txt23
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/testdata/empty.pls2
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/testdata/test.m3u11
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/testdata/test.pls27
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile0
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile2#suffix0
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/testdata/totem-pl-example.pls5
-rw-r--r--tests/auto/unit/multimedia/qmediaplaylist/tst_qmediaplaylist.cpp903
-rw-r--r--tests/auto/unit/multimedia/qmediarecorder/CMakeLists.txt20
-rw-r--r--tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp492
-rw-r--r--tests/auto/unit/multimedia/qmediatimerange/CMakeLists.txt16
-rw-r--r--tests/auto/unit/multimedia/qmediatimerange/tst_qmediatimerange.cpp766
-rw-r--r--tests/auto/unit/multimedia/qmultimediautils/CMakeLists.txt9
-rw-r--r--tests/auto/unit/multimedia/qmultimediautils/tst_qmultimediautils.cpp184
-rw-r--r--tests/auto/unit/multimedia/qsamplecache/CMakeLists.txt23
-rw-r--r--tests/auto/unit/multimedia/qsamplecache/testdata/test.wavbin0 -> 88232 bytes
-rw-r--r--tests/auto/unit/multimedia/qsamplecache/testdata/test2.wavbin0 -> 88232 bytes
-rw-r--r--tests/auto/unit/multimedia/qsamplecache/tst_qsamplecache.cpp144
-rw-r--r--tests/auto/unit/multimedia/qscreencapture/CMakeLists.txt18
-rw-r--r--tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp64
-rw-r--r--tests/auto/unit/multimedia/qvideobuffers/CMakeLists.txt10
-rw-r--r--tests/auto/unit/multimedia/qvideobuffers/tst_qvideobuffers.cpp252
-rw-r--r--tests/auto/unit/multimedia/qvideoframe/CMakeLists.txt16
-rw-r--r--tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp1437
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt18
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpgbin0 -> 12786 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video.pngbin0 -> 40978 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full.pngbin0 -> 40854 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video.pngbin0 -> 40904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full.pngbin0 -> 40945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video.pngbin0 -> 40959 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full.pngbin0 -> 40934 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video.pngbin0 -> 40934 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full.pngbin0 -> 40912 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video.pngbin0 -> 41004 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full.pngbin0 -> 40870 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video.pngbin0 -> 40924 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full.pngbin0 -> 40966 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video.pngbin0 -> 40975 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video.pngbin0 -> 40978 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full.pngbin0 -> 40854 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video.pngbin0 -> 40904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full.pngbin0 -> 40945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video.pngbin0 -> 40959 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full.pngbin0 -> 40912 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video.pngbin0 -> 40987 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full.pngbin0 -> 40877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video.pngbin0 -> 40918 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full.pngbin0 -> 40967 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video.pngbin0 -> 40961 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video.pngbin0 -> 40978 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full.pngbin0 -> 40854 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video.pngbin0 -> 40904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full.pngbin0 -> 40945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video.pngbin0 -> 40959 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video.pngbin0 -> 40978 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full.pngbin0 -> 40854 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video.pngbin0 -> 40904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full.pngbin0 -> 40945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video.pngbin0 -> 40959 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full.pngbin0 -> 40927 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full_cpu.pngbin0 -> 35927 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video.pngbin0 -> 40927 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video_cpu.pngbin0 -> 35927 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full.pngbin0 -> 40923 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full_cpu.pngbin0 -> 35936 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video.pngbin0 -> 40964 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video_cpu.pngbin0 -> 35927 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full.pngbin0 -> 40897 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full_cpu.pngbin0 -> 35887 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video.pngbin0 -> 40914 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video_cpu.pngbin0 -> 35881 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full.pngbin0 -> 40936 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full_cpu.pngbin0 -> 35887 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video.pngbin0 -> 40991 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video_cpu.pngbin0 -> 35933 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full.pngbin0 -> 40913 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full_cpu.pngbin0 -> 35941 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video.pngbin0 -> 40913 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video_cpu.pngbin0 -> 35941 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full.pngbin0 -> 40969 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full_cpu.pngbin0 -> 35925 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video.pngbin0 -> 40951 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video_cpu.pngbin0 -> 35968 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full.pngbin0 -> 40860 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full_cpu.pngbin0 -> 35857 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video.pngbin0 -> 40946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video_cpu.pngbin0 -> 35908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full.pngbin0 -> 40942 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full_cpu.pngbin0 -> 35857 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video.pngbin0 -> 40966 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video_cpu.pngbin0 -> 35945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video_cpu.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full.pngbin0 -> 39859 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full_cpu.pngbin0 -> 36094 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video.pngbin0 -> 39859 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video_cpu.pngbin0 -> 36094 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full.pngbin0 -> 39864 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full_cpu.pngbin0 -> 36087 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video.pngbin0 -> 39919 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video_cpu.pngbin0 -> 36215 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full.pngbin0 -> 39789 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full_cpu.pngbin0 -> 36021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video.pngbin0 -> 39890 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video_cpu.pngbin0 -> 36258 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full.pngbin0 -> 39879 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full_cpu.pngbin0 -> 36021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video.pngbin0 -> 39951 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video_cpu.pngbin0 -> 36189 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video.pngbin0 -> 41243 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video_cpu.pngbin0 -> 36154 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full.pngbin0 -> 25240 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full_cpu.pngbin0 -> 23434 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video.pngbin0 -> 25240 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video_cpu.pngbin0 -> 23434 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full.pngbin0 -> 25544 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full_cpu.pngbin0 -> 23596 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video.pngbin0 -> 24030 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video_cpu.pngbin0 -> 22241 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full.pngbin0 -> 25557 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full_cpu.pngbin0 -> 23545 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video.pngbin0 -> 23884 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video_cpu.pngbin0 -> 22208 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full.pngbin0 -> 25557 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full_cpu.pngbin0 -> 23545 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video.pngbin0 -> 24021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video_cpu.pngbin0 -> 22392 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full.pngbin0 -> 25364 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full_cpu.pngbin0 -> 23481 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video.pngbin0 -> 25364 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video_cpu.pngbin0 -> 23481 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full.pngbin0 -> 25430 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full_cpu.pngbin0 -> 23425 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video.pngbin0 -> 23981 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video_cpu.pngbin0 -> 22350 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full.pngbin0 -> 25497 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full_cpu.pngbin0 -> 23568 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video.pngbin0 -> 23904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video_cpu.pngbin0 -> 22203 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full.pngbin0 -> 25497 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full_cpu.pngbin0 -> 23568 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video.pngbin0 -> 23979 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video_cpu.pngbin0 -> 22331 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_full.pngbin0 -> 40919 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_video.pngbin0 -> 40919 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_full.pngbin0 -> 40952 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_video.pngbin0 -> 40967 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_full.pngbin0 -> 40881 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_video.pngbin0 -> 40962 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_full.pngbin0 -> 40954 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_video.pngbin0 -> 40987 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video.pngbin0 -> 40978 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full.pngbin0 -> 40854 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video.pngbin0 -> 40904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full.pngbin0 -> 40945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video.pngbin0 -> 40959 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full.pngbin0 -> 41163 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full_cpu.pngbin0 -> 36094 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video.pngbin0 -> 41163 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video_cpu.pngbin0 -> 36094 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full.pngbin0 -> 41160 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full_cpu.pngbin0 -> 36087 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video.pngbin0 -> 41199 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video_cpu.pngbin0 -> 36215 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full.pngbin0 -> 41000 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full_cpu.pngbin0 -> 36021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video.pngbin0 -> 41177 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video_cpu.pngbin0 -> 36258 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full.pngbin0 -> 41183 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full_cpu.pngbin0 -> 36021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video.pngbin0 -> 41209 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video_cpu.pngbin0 -> 36189 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full.pngbin0 -> 39859 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full_cpu.pngbin0 -> 36094 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video.pngbin0 -> 39859 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video_cpu.pngbin0 -> 36094 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full.pngbin0 -> 39864 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full_cpu.pngbin0 -> 36087 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video.pngbin0 -> 39919 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video_cpu.pngbin0 -> 36215 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full.pngbin0 -> 39789 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full_cpu.pngbin0 -> 36021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video.pngbin0 -> 39890 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video_cpu.pngbin0 -> 36258 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full.pngbin0 -> 39879 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full_cpu.pngbin0 -> 36021 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video.pngbin0 -> 39951 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video_cpu.pngbin0 -> 36189 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video.pngbin0 -> 40898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video_cpu.pngbin0 -> 35874 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full.pngbin0 -> 40908 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full_cpu.pngbin0 -> 35882 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video.pngbin0 -> 40978 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video_cpu.pngbin0 -> 35946 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full.pngbin0 -> 40854 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video.pngbin0 -> 40904 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video_cpu.pngbin0 -> 35900 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full.pngbin0 -> 40945 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full_cpu.pngbin0 -> 35877 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video.pngbin0 -> 40959 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video_cpu.pngbin0 -> 35898 bytes
-rw-r--r--tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp475
-rw-r--r--tests/auto/unit/multimedia/qvideoframeformat/CMakeLists.txt16
-rw-r--r--tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp567
-rw-r--r--tests/auto/unit/multimedia/qvideotexturehelper/CMakeLists.txt10
-rw-r--r--tests/auto/unit/multimedia/qvideotexturehelper/tst_qvideotexturehelper.cpp260
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/CMakeLists.txt24
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wavbin0 -> 4044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wavbin0 -> 4044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wavbin0 -> 4044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/empty.wav0
-rwxr-xr-xtests/auto/unit/multimedia/qwavedecoder/data/gendata.sh30
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le.wavbin0 -> 22094 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le_2.wavbin0 -> 22096 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_8000_le.wavbin0 -> 4044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_44100_le.wavbin0 -> 44180 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_8000_le.wavbin0 -> 8080 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_44100.wavbin0 -> 11069 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000.wavbin0 -> 2044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_even_bext.wavbin0 -> 2064 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_odd_bext.wavbin0 -> 2064 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_44100_be.wavbin0 -> 44144 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_8000_be.wavbin0 -> 8044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_44100_be.wavbin0 -> 88280 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_8000_be.wavbin0 -> 16080 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_44100.wavbin0 -> 22094 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_8000.wavbin0 -> 4044 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/nosampledata.wavbin0 -> 44 bytes
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/notawav.wav1
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/data/onebyte.wav1
-rw-r--r--tests/auto/unit/multimedia/qwavedecoder/tst_qwavedecoder.cpp278
505 files changed, 11689 insertions, 0 deletions
diff --git a/tests/auto/unit/multimedia/CMakeLists.txt b/tests/auto/unit/multimedia/CMakeLists.txt
new file mode 100644
index 000000000..f259691d0
--- /dev/null
+++ b/tests/auto/unit/multimedia/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from multimedia.pro.
+
+add_subdirectory(qabstractvideobuffer)
+add_subdirectory(qaudiorecorder)
+add_subdirectory(qaudioformat)
+add_subdirectory(qaudionamespace)
+add_subdirectory(qaudiostatemachine)
+add_subdirectory(qcamera)
+add_subdirectory(qcameradevice)
+add_subdirectory(qimagecapture)
+add_subdirectory(qmediaformat)
+add_subdirectory(qmediaplayer)
+#add_subdirectory(qmediaplaylist)
+add_subdirectory(qmediarecorder)
+add_subdirectory(qmediatimerange)
+add_subdirectory(qmultimediautils)
+add_subdirectory(qvideoframe)
+add_subdirectory(qvideoframeformat)
+if(QT_FEATURE_ffmpeg)
+ add_subdirectory(qvideoframecolormanagement)
+endif()
+add_subdirectory(qaudiobuffer)
+add_subdirectory(qaudiodecoder)
+add_subdirectory(qsamplecache)
+add_subdirectory(qscreencapture)
+add_subdirectory(qvideotexturehelper)
+add_subdirectory(qmaybe)
+add_subdirectory(qmediadevices)
+add_subdirectory(qerrorinfo)
+add_subdirectory(qvideobuffers)
+add_subdirectory(qwavedecoder)
+
+if(QT_FEATURE_gstreamer)
+ add_subdirectory(gstreamer_backend)
+ add_subdirectory(qmediacapture_gstreamer)
+ add_subdirectory(qmediaplayer_gstreamer)
+endif()
diff --git a/tests/auto/unit/multimedia/gstreamer_backend/CMakeLists.txt b/tests/auto/unit/multimedia/gstreamer_backend/CMakeLists.txt
new file mode 100644
index 000000000..6d52d09e1
--- /dev/null
+++ b/tests/auto/unit/multimedia/gstreamer_backend/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_gstreamer_backend Test:
+#####################################################################
+
+qt_internal_add_test(tst_gstreamer_backend
+ SOURCES
+ tst_gstreamer_backend.cpp
+ tst_gstreamer_backend.h
+ LIBRARIES
+ Qt::MultimediaPrivate
+ Qt::QGstreamerMediaPluginPrivate
+)
diff --git a/tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.cpp b/tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.cpp
new file mode 100644
index 000000000..929c46b3e
--- /dev/null
+++ b/tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.cpp
@@ -0,0 +1,309 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "tst_gstreamer_backend.h"
+
+#include <QtTest/QtTest>
+#include <QtMultimedia/qmediaformat.h>
+
+#include <QtQGstreamerMediaPlugin/private/qgst_handle_types_p.h>
+#include <QtQGstreamerMediaPlugin/private/qgst_p.h>
+#include <QtQGstreamerMediaPlugin/private/qgst_debug_p.h>
+#include <QtQGstreamerMediaPlugin/private/qgstpipeline_p.h>
+#include <QtQGstreamerMediaPlugin/private/qgstreamermetadata_p.h>
+
+QT_USE_NAMESPACE
+
+// NOLINTBEGIN(readability-convert-member-functions-to-static)
+
+using namespace Qt::Literals;
+
+namespace {
+
+template <typename... Pairs>
+QMediaMetaData makeQMediaMetaData(Pairs &&...pairs)
+{
+ QMediaMetaData metadata;
+
+ auto addKeyValuePair = [&](auto &&pair) {
+ metadata.insert(pair.first, pair.second);
+ return;
+ };
+
+ (addKeyValuePair(pairs), ...);
+
+ return metadata;
+}
+
+} // namespace
+
+QGstTagListHandle tst_GStreamer::parseTagList(const char *str)
+{
+ QGstTagListHandle tagList{
+ gst_tag_list_new_from_string(str),
+ QGstTagListHandle::NeedsRef,
+ };
+ return tagList;
+}
+
+QGstTagListHandle tst_GStreamer::parseTagList(const QByteArray &ba)
+{
+ return parseTagList(ba.constData());
+}
+
+void tst_GStreamer::qGstCasts_withElement()
+{
+ QGstElement element = QGstElement::createFromFactory("identity", "myPipeline");
+ QVERIFY(element);
+
+ QVERIFY(!qIsGstObjectOfType<GstPipeline>(element.element()));
+ QVERIFY(!qIsGstObjectOfType<GstBin>(element.element()));
+}
+
+void tst_GStreamer::qGstCasts_withBin()
+{
+ QGstBin bin = QGstBin::create("bin");
+ QVERIFY(bin);
+
+ QVERIFY(!qIsGstObjectOfType<GstPipeline>(bin.element()));
+ QVERIFY(qIsGstObjectOfType<GstBin>(bin.element()));
+}
+
+void tst_GStreamer::qGstCasts_withPipeline()
+{
+ QGstPipeline pipeline = QGstPipeline::create("myPipeline");
+
+ QGstElement element{
+ qGstSafeCast<GstElement>(pipeline.pipeline()),
+ QGstElement::NeedsRef,
+ };
+
+ QVERIFY(element);
+ QVERIFY(qIsGstObjectOfType<GstPipeline>(element.element()));
+ QVERIFY(qIsGstObjectOfType<GstBin>(element.element()));
+}
+
+void tst_GStreamer::metadata_taglistToMetaData()
+{
+ QGstTagListHandle tagList = parseTagList(R"(taglist, title="My Video", comment="yada")");
+
+ QMediaMetaData parsed = taglistToMetaData(tagList);
+
+ QCOMPARE(parsed.stringValue(QMediaMetaData::Title), u"My Video"_s);
+ QCOMPARE(parsed.stringValue(QMediaMetaData::Comment), u"yada"_s);
+}
+
+void tst_GStreamer::metadata_taglistToMetaData_extractsOrientation()
+{
+ QFETCH(QByteArray, taglist);
+ QFETCH(QtVideo::Rotation, rotation);
+
+ QGstTagListHandle tagList = parseTagList(taglist);
+ QMediaMetaData parsed = taglistToMetaData(tagList);
+ QCOMPARE(parsed[QMediaMetaData::Orientation].value<QtVideo::Rotation>(), rotation);
+}
+
+void tst_GStreamer::metadata_taglistToMetaData_extractsOrientation_data()
+{
+ QTest::addColumn<QByteArray>("taglist");
+ QTest::addColumn<QtVideo::Rotation>("rotation");
+
+ QTest::newRow("no rotation") << R"(taglist, title="My Video", comment="yada")"_ba
+ << QtVideo::Rotation::None;
+ QTest::newRow("90 degree")
+ << R"(taglist, title="My Video", comment="yada", image-orientation=(string)rotate-90)"_ba
+ << QtVideo::Rotation::Clockwise90;
+ QTest::newRow("180 degree")
+ << R"(taglist, title="My Video", comment="yada", image-orientation=(string)rotate-180)"_ba
+ << QtVideo::Rotation::Clockwise180;
+ QTest::newRow("270 degree")
+ << R"(taglist, title="My Video", comment="yada", image-orientation=(string)rotate-270)"_ba
+ << QtVideo::Rotation::Clockwise270;
+}
+
+void tst_GStreamer::metadata_taglistToMetaData_extractsDuration()
+{
+ QGstTagListHandle tagList = parseTagList(
+ R"__(taglist, video-codec=(string)"On2\ VP9", container-specific-track-id=(string)1, extended-comment=(string){ "ALPHA_MODE\=1", "HANDLER_NAME\=Apple\ Video\ Media\ Handler", "VENDOR_ID\=appl", "TIMECODE\=00:00:00:00", "DURATION\=00:00:00.400000000" }, encoder=(string)"Lavc59.37.100\ libvpx-vp9")__");
+
+ QMediaMetaData parsed = taglistToMetaData(tagList);
+ QCOMPARE(parsed[QMediaMetaData::Duration].value<int>(), 400);
+}
+
+void tst_GStreamer::metadata_taglistToMetaData_extractsLanguage()
+{
+ QFETCH(QByteArray, tagListString);
+ QFETCH(QLocale::Language, language);
+
+ QGstTagListHandle tagList = parseTagList(tagListString);
+ QVERIFY(tagList);
+
+ QMediaMetaData parsed = taglistToMetaData(tagList);
+ QCOMPARE(parsed[QMediaMetaData::Language].value<QLocale::Language>(), language);
+}
+
+void tst_GStreamer::metadata_taglistToMetaData_extractsLanguage_data()
+{
+ QTest::addColumn<QByteArray>("tagListString");
+ QTest::addColumn<QLocale::Language>("language");
+
+ QTest::newRow("english, en")
+ << R"__(taglist, container-format=(string)Matroska, audio-codec=(string)"MPEG-4\ AAC", language-code=(string)en, container-specific-track-id=(string)5, encoder=(string)Lavf60.16.100, extended-comment=(string)"DURATION\=00:00:05.055000000")__"_ba
+ << QLocale::Language::English;
+ QTest::newRow("spanish, es")
+ << R"__(taglist, container-format=(string)Matroska, audio-codec=(string)"MPEG-4\ AAC", language-code=(string)es, container-specific-track-id=(string)5, encoder=(string)Lavf60.16.100, extended-comment=(string)"DURATION\=00:00:05.055000000")__"_ba
+ << QLocale::Language::Spanish;
+ QTest::newRow("english, eng")
+ << R"__(taglist, container-format=(string)Matroska, audio-codec=(string)"MPEG-4\ AAC", language-code=(string)eng, container-specific-track-id=(string)5, encoder=(string)Lavf60.16.100, extended-comment=(string)"DURATION\=00:00:05.055000000")__"_ba
+ << QLocale::Language::English;
+ QTest::newRow("spanish, spa")
+ << R"__(taglist, container-format=(string)Matroska, audio-codec=(string)"MPEG-4\ AAC", language-code=(string)spa, container-specific-track-id=(string)5, encoder=(string)Lavf60.16.100, extended-comment=(string)"DURATION\=00:00:05.055000000")__"_ba
+ << QLocale::Language::Spanish;
+}
+
+void tst_GStreamer::metadata_capsToMetaData()
+{
+ QFETCH(QByteArray, capsString);
+ QFETCH(QMediaMetaData, expectedMetadata);
+
+ QGstCaps caps{
+ gst_caps_from_string(capsString.constData()),
+ QGstCaps::HasRef,
+ };
+
+ QMediaMetaData md = capsToMetaData(caps);
+
+ QCOMPARE(md, expectedMetadata);
+}
+
+void tst_GStreamer::metadata_capsToMetaData_data()
+{
+ using Key = QMediaMetaData::Key;
+ using KVPair = std::pair<QMediaMetaData::Key, QVariant>;
+
+ auto makeKVPair = [](Key key, auto value) {
+ return KVPair{
+ key,
+ QVariant::fromValue(value),
+ };
+ };
+
+ QTest::addColumn<QByteArray>("capsString");
+ QTest::addColumn<QMediaMetaData>("expectedMetadata");
+
+ QTest::newRow("container") << R"(video/quicktime, variant=(string)iso)"_ba
+ << makeQMediaMetaData(makeKVPair(Key::FileFormat,
+ QMediaFormat::FileFormat::MPEG4));
+
+ QTest::newRow("video")
+ << R"(video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)main, codec_data=(buffer)014d401fffe10017674d401fda014016ec0440000003004000000c83c60ca801000468ef3c80, width=(int)1280, height=(int)720, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1)"_ba
+ << makeQMediaMetaData(makeKVPair(Key::VideoCodec, QMediaFormat::VideoCodec::H264),
+ makeKVPair(Key::VideoFrameRate, 25),
+ makeKVPair(Key::Resolution, QSize(1280, 720)));
+
+ QTest::newRow("audio")
+ << R"(audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)4, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)11b0, rate=(int)48000, channels=(int)6)"_ba
+ << makeQMediaMetaData(makeKVPair(Key::AudioCodec, QMediaFormat::AudioCodec::AAC));
+}
+
+void tst_GStreamer::QGstBin_createFromPipelineDescription()
+{
+ QGstBin bin = QGstBin::createFromPipelineDescription("identity name=foo ! identity name=bar");
+
+ QVERIFY(bin);
+ QVERIFY(bin.findByName("foo"));
+ QCOMPARE_EQ(bin.findByName("foo").getParent(), bin);
+ QVERIFY(bin.findByName("bar"));
+ QVERIFY(!bin.findByName("baz"));
+ bin.dumpGraph("QGstBin_createFromPipelineDescription");
+}
+
+void tst_GStreamer::QGstElement_createFromPipelineDescription()
+{
+ using namespace std::string_view_literals;
+ QGstElement element = QGstElement::createFromPipelineDescription("identity name=foo");
+ QCOMPARE_EQ(element.name(), "foo"sv);
+ QCOMPARE_EQ(element.typeName(), "GstIdentity"sv);
+}
+
+void tst_GStreamer::QGstElement_createFromPipelineDescription_multipleElementsCreatesBin()
+{
+ using namespace std::string_view_literals;
+ QGstElement element =
+ QGstElement::createFromPipelineDescription("identity name=foo ! identity name=bar");
+
+ QVERIFY(element);
+ QCOMPARE_EQ(element.typeName(), "GstPipeline"sv);
+
+ QGstBin bin{
+ qGstSafeCast<GstBin>(element.element()),
+ QGstBin::NeedsRef,
+ };
+
+ QVERIFY(bin);
+ QVERIFY(bin.findByName("foo"));
+ QCOMPARE_EQ(bin.findByName("foo").getParent(), bin);
+ QVERIFY(bin.findByName("bar"));
+ QVERIFY(!bin.findByName("baz"));
+
+ bin.dumpGraph("QGstElement_createFromPipelineDescription_multipleElements");
+}
+
+void tst_GStreamer::QGstPad_inferTypeFromName()
+{
+ auto makePad = [](const char *name, GstPadDirection direction) {
+ return QGstPad{
+ gst_pad_new(name, direction),
+ QGstPad::NeedsRef,
+ };
+ };
+
+ QVERIFY(makePad("audio_0", GST_PAD_SRC).inferTrackTypeFromName()
+ == QPlatformMediaPlayer::AudioStream);
+ QVERIFY(makePad("video_0", GST_PAD_SRC).inferTrackTypeFromName()
+ == QPlatformMediaPlayer::VideoStream);
+ QVERIFY(makePad("text_0", GST_PAD_SRC).inferTrackTypeFromName()
+ == QPlatformMediaPlayer::SubtitleStream);
+ QVERIFY(makePad("src_0", GST_PAD_SRC).inferTrackTypeFromName() == std::nullopt);
+ QVERIFY(makePad("text", GST_PAD_SRC).inferTrackTypeFromName() == std::nullopt);
+}
+
+void tst_GStreamer::qDebug_GstPadDirection()
+{
+ auto validate = [](GstPadDirection direction, QString expectedString) {
+ QString str;
+ QDebug dbg(&str);
+
+ dbg << direction;
+
+ QCOMPARE_EQ(str, expectedString);
+ };
+
+ validate(GST_PAD_UNKNOWN, u"GST_PAD_UNKNOWN "_s);
+ validate(GST_PAD_SRC, u"GST_PAD_SRC "_s);
+ validate(GST_PAD_SINK, u"GST_PAD_SINK "_s);
+}
+
+void tst_GStreamer::qDebug_GstStreamStatusType()
+{
+ auto validate = [](GstStreamStatusType type, QString expectedString) {
+ QString str;
+ QDebug dbg(&str);
+
+ dbg << type;
+
+ QCOMPARE_EQ(str, expectedString);
+ };
+
+ validate(GST_STREAM_STATUS_TYPE_CREATE, u"GST_STREAM_STATUS_TYPE_CREATE "_s);
+ validate(GST_STREAM_STATUS_TYPE_ENTER, u"GST_STREAM_STATUS_TYPE_ENTER "_s);
+ validate(GST_STREAM_STATUS_TYPE_LEAVE, u"GST_STREAM_STATUS_TYPE_LEAVE "_s);
+ validate(GST_STREAM_STATUS_TYPE_DESTROY, u"GST_STREAM_STATUS_TYPE_DESTROY "_s);
+ validate(GST_STREAM_STATUS_TYPE_START, u"GST_STREAM_STATUS_TYPE_START "_s);
+ validate(GST_STREAM_STATUS_TYPE_PAUSE, u"GST_STREAM_STATUS_TYPE_PAUSE "_s);
+ validate(GST_STREAM_STATUS_TYPE_STOP, u"GST_STREAM_STATUS_TYPE_STOP "_s);
+}
+
+QTEST_GUILESS_MAIN(tst_GStreamer)
+
+#include "moc_tst_gstreamer_backend.cpp"
diff --git a/tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.h b/tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.h
new file mode 100644
index 000000000..7252dffdd
--- /dev/null
+++ b/tests/auto/unit/multimedia/gstreamer_backend/tst_gstreamer_backend.h
@@ -0,0 +1,49 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TST_GSTREAMER_BACKEND_H
+#define TST_GSTREAMER_BACKEND_H
+
+#include <QtTest/QtTest>
+
+#include <QtQGstreamerMediaPlugin/private/qgstreamerintegration_p.h>
+#include <QtQGstreamerMediaPlugin/private/qgst_handle_types_p.h>
+
+QT_USE_NAMESPACE
+
+class tst_GStreamer : public QObject
+{
+ Q_OBJECT
+
+ QGstTagListHandle parseTagList(const char *);
+ QGstTagListHandle parseTagList(const QByteArray &);
+
+private slots:
+ void qGstCasts_withElement();
+ void qGstCasts_withBin();
+ void qGstCasts_withPipeline();
+
+ void metadata_taglistToMetaData();
+ void metadata_taglistToMetaData_extractsOrientation();
+ void metadata_taglistToMetaData_extractsOrientation_data();
+ void metadata_taglistToMetaData_extractsDuration();
+ void metadata_taglistToMetaData_extractsLanguage();
+ void metadata_taglistToMetaData_extractsLanguage_data();
+
+ void metadata_capsToMetaData();
+ void metadata_capsToMetaData_data();
+
+ void QGstBin_createFromPipelineDescription();
+ void QGstElement_createFromPipelineDescription();
+ void QGstElement_createFromPipelineDescription_multipleElementsCreatesBin();
+
+ void QGstPad_inferTypeFromName();
+
+ void qDebug_GstPadDirection();
+ void qDebug_GstStreamStatusType();
+
+private:
+ QGstreamerIntegration integration;
+};
+
+#endif // TST_GSTREAMER_BACKEND_H
diff --git a/tests/auto/unit/multimedia/qabstractvideobuffer/CMakeLists.txt b/tests/auto/unit/multimedia/qabstractvideobuffer/CMakeLists.txt
new file mode 100644
index 000000000..8f59a0e40
--- /dev/null
+++ b/tests/auto/unit/multimedia/qabstractvideobuffer/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qabstractvideobuffer.pro.
+
+#####################################################################
+## tst_qabstractvideobuffer Test:
+#####################################################################
+
+qt_internal_add_test(tst_qabstractvideobuffer
+ SOURCES
+ tst_qabstractvideobuffer.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp b/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
new file mode 100644
index 000000000..852c17f30
--- /dev/null
+++ b/tests/auto/unit/multimedia/qabstractvideobuffer/tst_qabstractvideobuffer.cpp
@@ -0,0 +1,113 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <private/qhwvideobuffer_p.h>
+
+class tst_QAbstractVideoBuffer : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QAbstractVideoBuffer();
+ ~tst_QAbstractVideoBuffer() override;
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void handleType_data();
+ void handleType();
+ void handle();
+ void mapModeDebug_data();
+ void mapModeDebug();
+};
+
+class QtTestVideoBuffer : public QHwVideoBuffer
+{
+public:
+ QtTestVideoBuffer(QVideoFrame::HandleType type) : QHwVideoBuffer(type) { }
+
+ MapData map(QtVideo::MapMode) override { return {}; }
+ void unmap() override {}
+};
+
+tst_QAbstractVideoBuffer::tst_QAbstractVideoBuffer()
+{
+}
+
+tst_QAbstractVideoBuffer::~tst_QAbstractVideoBuffer()
+{
+}
+
+void tst_QAbstractVideoBuffer::initTestCase()
+{
+}
+
+void tst_QAbstractVideoBuffer::cleanupTestCase()
+{
+}
+
+void tst_QAbstractVideoBuffer::init()
+{
+}
+
+void tst_QAbstractVideoBuffer::cleanup()
+{
+}
+
+void tst_QAbstractVideoBuffer::handleType_data()
+{
+ QTest::addColumn<QVideoFrame::HandleType>("type");
+ QTest::addColumn<QString>("stringized");
+
+ QTest::newRow("NoHandle") << QVideoFrame::NoHandle << QStringLiteral("NoHandle");
+ QTest::newRow("RhiTextureHandle") << QVideoFrame::RhiTextureHandle << QStringLiteral("RhiTextureHandle");
+}
+
+void tst_QAbstractVideoBuffer::handleType()
+{
+ QFETCH(QVideoFrame::HandleType, type);
+ QFETCH(QString, stringized);
+
+ QtTestVideoBuffer buffer(type);
+
+ QCOMPARE(buffer.handleType(), type);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << type;
+}
+
+void tst_QAbstractVideoBuffer::handle()
+{
+ QtTestVideoBuffer buffer(QVideoFrame::NoHandle);
+
+ QVERIFY(buffer.textureHandle(nullptr, 0) == 0);
+}
+
+void tst_QAbstractVideoBuffer::mapModeDebug_data()
+{
+ QTest::addColumn<QtVideo::MapMode>("mapMode");
+ QTest::addColumn<QString>("stringized");
+
+ QTest::newRow("NotMapped") << QtVideo::MapMode::NotMapped << QStringLiteral("NotMapped");
+ QTest::newRow("ReadOnly") << QtVideo::MapMode::ReadOnly << QStringLiteral("ReadOnly");
+ QTest::newRow("WriteOnly") << QtVideo::MapMode::WriteOnly << QStringLiteral("WriteOnly");
+ QTest::newRow("ReadWrite") << QtVideo::MapMode::ReadWrite << QStringLiteral("ReadWrite");
+}
+
+void tst_QAbstractVideoBuffer::mapModeDebug()
+{
+ QFETCH(QtVideo::MapMode, mapMode);
+ QFETCH(QString, stringized);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << mapMode;
+}
+
+QTEST_MAIN(tst_QAbstractVideoBuffer)
+
+#include "tst_qabstractvideobuffer.moc"
diff --git a/tests/auto/unit/multimedia/qaudiobuffer/CMakeLists.txt b/tests/auto/unit/multimedia/qaudiobuffer/CMakeLists.txt
new file mode 100644
index 000000000..807f3acaa
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiobuffer/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qaudiobuffer.pro.
+
+#####################################################################
+## tst_qaudiobuffer Test:
+#####################################################################
+
+qt_internal_add_test(tst_qaudiobuffer
+ SOURCES
+ tst_qaudiobuffer.cpp
+ LIBRARIES
+ Qt::Multimedia
+)
+
+#### Keys ignored in scope 1:.:.:qaudiobuffer.pro:<TRUE>:
+# TEMPLATE = "app"
diff --git a/tests/auto/unit/multimedia/qaudiobuffer/tst_qaudiobuffer.cpp b/tests/auto/unit/multimedia/qaudiobuffer/tst_qaudiobuffer.cpp
new file mode 100644
index 000000000..7c74fe994
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiobuffer/tst_qaudiobuffer.cpp
@@ -0,0 +1,314 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include <qaudiobuffer.h>
+
+class tst_QAudioBuffer : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QAudioBuffer();
+ ~tst_QAudioBuffer() override;
+
+private Q_SLOTS:
+ void ctors();
+ void assign();
+ void constData() const;
+ void data_const() const;
+ void data();
+ void durations();
+ void durations_data();
+ void stereoSample();
+
+private:
+ QAudioFormat mFormat;
+ QAudioBuffer *mNull;
+ QAudioBuffer *mEmpty;
+ QAudioBuffer *mFromArray;
+};
+
+tst_QAudioBuffer::tst_QAudioBuffer()
+{
+ // Initialize some common buffers
+ mFormat.setChannelCount(2);
+ mFormat.setSampleFormat(QAudioFormat::Int16);
+ mFormat.setSampleRate(10000);
+
+ QByteArray b(4000, char(0x80));
+ mNull = new QAudioBuffer;
+ mEmpty = new QAudioBuffer(500, mFormat); // 500 stereo frames of 16 bits -> 2KB
+ mFromArray = new QAudioBuffer(b, mFormat);
+}
+
+
+tst_QAudioBuffer::~tst_QAudioBuffer()
+{
+ delete mNull;
+ delete mEmpty;
+ delete mFromArray;
+}
+
+void tst_QAudioBuffer::ctors()
+{
+ // Null buffer
+ QVERIFY(!mNull->isValid());
+ QVERIFY(mNull->constData<char>() == nullptr);
+ QVERIFY(mNull->data<char>() == nullptr);
+ QVERIFY(((const QAudioBuffer*)mNull)->data<char>() == nullptr);
+ QCOMPARE(mNull->duration(), 0LL);
+ QCOMPARE(mNull->byteCount(), 0);
+ QCOMPARE(mNull->sampleCount(), 0);
+ QCOMPARE(mNull->frameCount(), 0);
+ QCOMPARE(mNull->startTime(), -1LL);
+
+ // Empty buffer
+ QVERIFY(mEmpty->isValid());
+ QVERIFY(mEmpty->constData<char>() != nullptr);
+ QVERIFY(mEmpty->data<char>() != nullptr);
+ QVERIFY(((const QAudioBuffer*)mEmpty)->data<char>() != nullptr);
+ QCOMPARE(mEmpty->sampleCount(), 1000);
+ QCOMPARE(mEmpty->frameCount(), 500);
+ QCOMPARE(mEmpty->duration(), 50000LL);
+ QCOMPARE(mEmpty->byteCount(), 2000);
+ QCOMPARE(mEmpty->startTime(), -1LL);
+
+ // bytearray buffer
+ QVERIFY(mFromArray->isValid());
+ QVERIFY(mFromArray->constData<char>() != nullptr);
+ QVERIFY(mFromArray->data<char>() != nullptr);
+ QVERIFY(((const QAudioBuffer*)mFromArray)->data<char>() != nullptr);
+ /// 4000 bytes at 10KHz, 2ch, 16bit = 40kBps -> 0.1s
+ QCOMPARE(mFromArray->duration(), 100000LL);
+ QCOMPARE(mFromArray->byteCount(), 4000);
+ QCOMPARE(mFromArray->sampleCount(), 2000);
+ QCOMPARE(mFromArray->frameCount(), 1000);
+ QCOMPARE(mFromArray->startTime(), -1LL);
+
+
+ // Now some invalid buffers
+ QAudioBuffer badFormat(1000, QAudioFormat());
+ QVERIFY(!badFormat.isValid());
+ QVERIFY(badFormat.constData<char>() == nullptr);
+ QVERIFY(badFormat.data<char>() == nullptr);
+ QVERIFY(((const QAudioBuffer*)&badFormat)->data<char>() == nullptr);
+ QCOMPARE(badFormat.duration(), 0LL);
+ QCOMPARE(badFormat.byteCount(), 0);
+ QCOMPARE(badFormat.sampleCount(), 0);
+ QCOMPARE(badFormat.frameCount(), 0);
+ QCOMPARE(badFormat.startTime(), -1LL);
+
+ QAudioBuffer badArray(QByteArray(), mFormat);
+ QVERIFY(!badArray.isValid());
+ QVERIFY(badArray.constData<char>() == nullptr);
+ QVERIFY(badArray.data<char>() == nullptr);
+ QVERIFY(((const QAudioBuffer*)&badArray)->data<char>() == nullptr);
+ QCOMPARE(badArray.duration(), 0LL);
+ QCOMPARE(badArray.byteCount(), 0);
+ QCOMPARE(badArray.sampleCount(), 0);
+ QCOMPARE(badArray.frameCount(), 0);
+ QCOMPARE(badArray.startTime(), -1LL);
+
+ QAudioBuffer badBoth = QAudioBuffer(QByteArray(), QAudioFormat());
+ QVERIFY(!badBoth.isValid());
+ QVERIFY(badBoth.constData<char>() == nullptr);
+ QVERIFY(badBoth.data<char>() == nullptr);
+ QVERIFY(((const QAudioBuffer*)&badBoth)->data<char>() == nullptr);
+ QCOMPARE(badBoth.duration(), 0LL);
+ QCOMPARE(badBoth.byteCount(), 0);
+ QCOMPARE(badBoth.sampleCount(), 0);
+ QCOMPARE(badBoth.frameCount(), 0);
+ QCOMPARE(badBoth.startTime(), -1LL);
+}
+
+void tst_QAudioBuffer::assign()
+{
+ // TODO Needs strong behaviour definition
+}
+
+void tst_QAudioBuffer::constData() const
+{
+ const void *data = mEmpty->constData<void *>();
+ QVERIFY(data != nullptr);
+
+ const unsigned int *idata = reinterpret_cast<const unsigned int*>(data);
+ QCOMPARE(*idata, 0U);
+
+ const QAudioBuffer::U8S *sdata = mEmpty->constData<QAudioBuffer::U8S>();
+ QVERIFY(sdata);
+ QCOMPARE(sdata->value(QAudioFormat::FrontLeft), (unsigned char)0);
+ QCOMPARE(sdata->value(QAudioFormat::FrontRight), (unsigned char)0);
+
+ // The bytearray one should be 0x80
+ data = mFromArray->constData<void *>();
+ QVERIFY(data != nullptr);
+
+ idata = reinterpret_cast<const unsigned int *>(data);
+ QCOMPARE(*idata, 0x80808080);
+
+ sdata = mFromArray->constData<QAudioBuffer::U8S>();
+ QCOMPARE(sdata->value(QAudioFormat::FrontLeft), (unsigned char)0x80);
+ QCOMPARE(sdata->value(QAudioFormat::FrontRight), (unsigned char)0x80);
+}
+
+void tst_QAudioBuffer::data_const() const
+{
+ const void *data = ((const QAudioBuffer*)mEmpty)->data<void *>();
+ QVERIFY(data != nullptr);
+
+ const unsigned int *idata = reinterpret_cast<const unsigned int*>(data);
+ QCOMPARE(*idata, 0U);
+
+ const QAudioBuffer::U8S *sdata = ((const QAudioBuffer*)mEmpty)->constData<QAudioBuffer::U8S>();
+ QVERIFY(sdata);
+ QCOMPARE(sdata->value(QAudioFormat::FrontLeft), (unsigned char)0);
+ QCOMPARE(sdata->value(QAudioFormat::FrontRight), (unsigned char)0);
+
+ // The bytearray one should be 0x80
+ data = ((const QAudioBuffer*)mFromArray)->data<void *>();
+ QVERIFY(data != nullptr);
+
+ idata = reinterpret_cast<const unsigned int *>(data);
+ QCOMPARE(*idata, 0x80808080);
+
+ sdata = ((const QAudioBuffer*)mFromArray)->constData<QAudioBuffer::U8S>();
+ QCOMPARE(sdata->value(QAudioFormat::FrontLeft), (unsigned char)0x80);
+ QCOMPARE(sdata->value(QAudioFormat::FrontRight), (unsigned char)0x80);
+}
+
+void tst_QAudioBuffer::data()
+{
+ void *data = mEmpty->data<void *>();
+ QVERIFY(data != nullptr);
+
+ unsigned int *idata = reinterpret_cast<unsigned int*>(data);
+ QCOMPARE(*idata, 0U);
+
+ QAudioBuffer::U8S *sdata = mEmpty->data<QAudioBuffer::U8S>();
+ QVERIFY(sdata);
+ QCOMPARE(sdata->value(QAudioFormat::FrontLeft), (unsigned char)0);
+ QCOMPARE(sdata->value(QAudioFormat::FrontRight), (unsigned char)0);
+
+ // The bytearray one should be 0x80
+ data = mFromArray->data<void *>();
+ QVERIFY(data != nullptr);
+
+ idata = reinterpret_cast<unsigned int *>(data);
+ QCOMPARE(*idata, 0x80808080);
+
+ sdata = mFromArray->data<QAudioBuffer::U8S>();
+ QCOMPARE(sdata->value(QAudioFormat::FrontLeft), (unsigned char)0x80);
+ QCOMPARE(sdata->value(QAudioFormat::FrontRight), (unsigned char)0x80);
+}
+
+void tst_QAudioBuffer::durations()
+{
+ QFETCH(int, channelCount);
+ QFETCH(int, frameCount);
+ int sampleCount = frameCount * channelCount;
+ QFETCH(QAudioFormat::SampleFormat, sampleFormat);
+ QFETCH(int, sampleRate);
+ QFETCH(qint64, duration);
+ QFETCH(int, byteCount);
+
+ QAudioFormat f;
+ f.setChannelCount(channelCount);
+ f.setSampleFormat(sampleFormat);
+ f.setSampleRate(sampleRate);
+
+ QAudioBuffer b(frameCount, f);
+
+ QCOMPARE(b.frameCount(), frameCount);
+ QCOMPARE(b.sampleCount(), sampleCount);
+ QCOMPARE(b.duration(), duration);
+ QCOMPARE(b.byteCount(), byteCount);
+}
+
+void tst_QAudioBuffer::durations_data()
+{
+ QTest::addColumn<int>("channelCount");
+ QTest::addColumn<int>("frameCount");
+ QTest::addColumn<QAudioFormat::SampleFormat>("sampleFormat");
+ QTest::addColumn<int>("sampleRate");
+ QTest::addColumn<qint64>("duration");
+ QTest::addColumn<int>("byteCount");
+ QTest::newRow("M8_1000_8K") << 1 << 1000 << QAudioFormat::UInt8 << 8000 << 125000LL << 1000;
+ QTest::newRow("M8_2000_8K") << 1 << 2000 << QAudioFormat::UInt8 << 8000 << 250000LL << 2000;
+ QTest::newRow("M8_1000_4K") << 1 << 1000 << QAudioFormat::UInt8 << 4000 << 250000LL << 1000;
+
+ QTest::newRow("S8_1000_8K") << 2 << 500 << QAudioFormat::UInt8 << 8000 << 62500LL << 1000;
+
+ QTest::newRow("SF_1000_8K") << 2 << 500 << QAudioFormat::Float << 8000 << 62500LL << 4000;
+
+ QTest::newRow("S32_1000_16K") << 4 << 250 << QAudioFormat::Int32 << 16000 << 15625LL << 4000;
+}
+
+void tst_QAudioBuffer::stereoSample()
+{
+ // Uninitialized (should default to zero level for type)
+ QAudioBuffer::U8S u8s;
+ QAudioBuffer::S16S s16s;
+ QAudioBuffer::F32S f32s;
+ u8s.clear();
+ s16s.clear();
+ f32s.clear();
+
+ QCOMPARE(u8s[QAudioFormat::FrontLeft], (unsigned char) 0x80);
+ QCOMPARE(u8s[QAudioFormat::FrontRight], (unsigned char) 0x80);
+
+ QCOMPARE(s16s[QAudioFormat::FrontLeft], (signed short) 0x0);
+ QCOMPARE(s16s[QAudioFormat::FrontRight], (signed short) 0x0);
+
+ QCOMPARE(f32s[QAudioFormat::FrontLeft], 0.0f);
+ QCOMPARE(f32s[QAudioFormat::FrontRight], 0.0f);
+
+ // Initialized
+ QAudioBuffer::U8S u8s2{34, 145};
+ QAudioBuffer::S16S s16s2{-10000, 346};
+ QAudioBuffer::F32S f32s2{500.7f, -123.1f};
+
+ QCOMPARE(u8s2[QAudioFormat::FrontLeft], (unsigned char) 34);
+ QCOMPARE(u8s2[QAudioFormat::FrontRight], (unsigned char) 145);
+
+ QCOMPARE(s16s2[QAudioFormat::FrontLeft], (signed short) -10000);
+ QCOMPARE(s16s2[QAudioFormat::FrontRight], (signed short) 346);
+
+ QCOMPARE(f32s2[QAudioFormat::FrontLeft], 500.7f);
+ QCOMPARE(f32s2[QAudioFormat::FrontRight], -123.1f);
+
+ // Assigned
+ u8s = u8s2;
+ s16s = s16s2;
+ f32s = f32s2;
+
+ QCOMPARE(u8s[QAudioFormat::FrontLeft], (unsigned char) 34);
+ QCOMPARE(u8s[QAudioFormat::FrontRight], (unsigned char) 145);
+
+ QCOMPARE(s16s[QAudioFormat::FrontLeft], (signed short) -10000);
+ QCOMPARE(s16s[QAudioFormat::FrontRight], (signed short) 346);
+
+ QCOMPARE(f32s[QAudioFormat::FrontLeft], 500.7f);
+ QCOMPARE(f32s[QAudioFormat::FrontRight], -123.1f);
+
+ // Cleared
+ u8s.clear();
+ s16s.clear();
+ f32s.clear();
+
+ QCOMPARE(u8s[QAudioFormat::FrontLeft], (unsigned char) 0x80);
+ QCOMPARE(u8s[QAudioFormat::FrontRight], (unsigned char) 0x80);
+
+ QCOMPARE(s16s[QAudioFormat::FrontLeft], (signed short) 0x0);
+ QCOMPARE(s16s[QAudioFormat::FrontRight], (signed short) 0x0);
+
+ QCOMPARE(f32s[QAudioFormat::FrontLeft], 0.0f);
+ QCOMPARE(f32s[QAudioFormat::FrontRight], 0.0f);
+}
+
+
+QTEST_APPLESS_MAIN(tst_QAudioBuffer);
+
+#include "tst_qaudiobuffer.moc"
diff --git a/tests/auto/unit/multimedia/qaudiodecoder/CMakeLists.txt b/tests/auto/unit/multimedia/qaudiodecoder/CMakeLists.txt
new file mode 100644
index 000000000..cced66bda
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiodecoder/CMakeLists.txt
@@ -0,0 +1,21 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qaudiodecoder.pro.
+
+#####################################################################
+## tst_qaudiodecoder Test:
+#####################################################################
+
+qt_internal_add_test(tst_qaudiodecoder
+ SOURCES
+ tst_qaudiodecoder.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::Multimedia
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qaudiodecoder/tst_qaudiodecoder.cpp b/tests/auto/unit/multimedia/qaudiodecoder/tst_qaudiodecoder.cpp
new file mode 100644
index 000000000..77e161fda
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiodecoder/tst_qaudiodecoder.cpp
@@ -0,0 +1,337 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include "qaudiodecoder.h"
+#include "qmockaudiodecoder.h"
+#include "qmockintegration.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QAudioDecoder : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ tst_QAudioDecoder();
+
+private Q_SLOTS:
+ void ctors();
+ void read();
+ void stop();
+ void format();
+ void source();
+ void readAll();
+ void nullControl();
+};
+
+tst_QAudioDecoder::tst_QAudioDecoder()
+{
+}
+
+void tst_QAudioDecoder::ctors()
+{
+ QAudioDecoder d;
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+ QCOMPARE(d.source(), QStringLiteral(""));
+
+ d.setSource(QUrl());
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+ QCOMPARE(d.source(), QUrl());
+}
+
+void tst_QAudioDecoder::read()
+{
+ QAudioDecoder d;
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+
+ QSignalSpy readySpy(&d, &QAudioDecoder::bufferReady);
+ QSignalSpy bufferChangedSpy(&d, &QAudioDecoder::bufferAvailableChanged);
+ QSignalSpy errorSpy(&d, SIGNAL(error(QAudioDecoder::Error)));
+
+ // Starting with empty source == error
+ d.start();
+
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+
+ QCOMPARE(readySpy.size(), 0);
+ QCOMPARE(bufferChangedSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 1);
+
+ // Set the source to something
+ d.setSource(QUrl::fromLocalFile("Blah"));
+ QCOMPARE(d.source(), QUrl::fromLocalFile("Blah"));
+
+ readySpy.clear();
+ errorSpy.clear();
+ bufferChangedSpy.clear();
+
+ d.start();
+ QVERIFY(d.isDecoding());
+ QCOMPARE(d.bufferAvailable(), false); // not yet
+
+ // Try to read
+ QAudioBuffer b = d.read();
+ QVERIFY(!b.isValid());
+
+ // Read again with no parameter
+ b = d.read();
+ QVERIFY(!b.isValid());
+
+ // Wait a while
+ QTRY_VERIFY(d.bufferAvailable());
+
+ QVERIFY(d.bufferAvailable());
+
+ b = d.read();
+ QVERIFY(b.format().isValid());
+ QVERIFY(b.isValid());
+ QVERIFY(b.format().channelCount() == 1);
+ QVERIFY(b.sampleCount() == 4);
+
+ QVERIFY(readySpy.size() >= 1);
+ QVERIFY(errorSpy.size() == 0);
+
+ if (d.bufferAvailable()) {
+ QVERIFY(bufferChangedSpy.size() == 1);
+ } else {
+ QVERIFY(bufferChangedSpy.size() == 2);
+ }
+}
+
+void tst_QAudioDecoder::stop()
+{
+ QAudioDecoder d;
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+
+ QSignalSpy readySpy(&d, &QAudioDecoder::bufferReady);
+ QSignalSpy bufferChangedSpy(&d, &QAudioDecoder::bufferAvailableChanged);
+ QSignalSpy errorSpy(&d, SIGNAL(error(QAudioDecoder::Error)));
+
+ // Starting with empty source == error
+ d.start();
+
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+
+ QCOMPARE(readySpy.size(), 0);
+ QCOMPARE(bufferChangedSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 1);
+
+ // Set the source to something
+ d.setSource(QUrl::fromLocalFile("Blah"));
+ QCOMPARE(d.source(), QUrl::fromLocalFile("Blah"));
+
+ readySpy.clear();
+ errorSpy.clear();
+ bufferChangedSpy.clear();
+
+ d.start();
+ QVERIFY(d.isDecoding());
+ QCOMPARE(d.bufferAvailable(), false); // not yet
+
+ // Try to read
+ QAudioBuffer b = d.read();
+ QVERIFY(!b.isValid());
+
+ // Read again with no parameter
+ b = d.read();
+ QVERIFY(!b.isValid());
+
+ // Wait a while
+ QTRY_VERIFY(d.bufferAvailable());
+
+ QVERIFY(d.bufferAvailable());
+
+ // Now stop
+ d.stop();
+
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+}
+
+void tst_QAudioDecoder::format()
+{
+ QAudioDecoder d;
+ QVERIFY(!d.isDecoding());
+ QVERIFY(d.bufferAvailable() == false);
+
+ QSignalSpy readySpy(&d, &QAudioDecoder::bufferReady);
+ QSignalSpy bufferChangedSpy(&d, &QAudioDecoder::bufferAvailableChanged);
+ QSignalSpy errorSpy(&d, SIGNAL(error(QAudioDecoder::Error)));
+
+ // Set the source to something
+ d.setSource(QUrl::fromLocalFile("Blah"));
+ QCOMPARE(d.source(), QUrl::fromLocalFile("Blah"));
+
+ readySpy.clear();
+ errorSpy.clear();
+ bufferChangedSpy.clear();
+
+ d.start();
+ QVERIFY(d.isDecoding());
+ QCOMPARE(d.bufferAvailable(), false); // not yet
+
+ // Try to read
+ QAudioBuffer b = d.read();
+ QVERIFY(!b.isValid());
+
+ // Read again with no parameter
+ b = d.read();
+ QVERIFY(!b.isValid());
+
+ // Wait a while
+ QTRY_VERIFY(d.bufferAvailable());
+
+ b = d.read();
+ QVERIFY(b.format().isValid());
+ QVERIFY(d.audioFormat() == b.format());
+
+ // Setting format while decoding is forbidden
+ QAudioFormat f(d.audioFormat());
+ f.setChannelCount(2);
+
+ d.setAudioFormat(f);
+ QVERIFY(d.audioFormat() != f);
+ QVERIFY(d.audioFormat() == b.format());
+
+ // Now stop, and set something specific
+ d.stop();
+ d.setAudioFormat(f);
+ QVERIFY(d.audioFormat() == f);
+
+ // Decode again
+ d.start();
+ QTRY_VERIFY(d.bufferAvailable());
+
+ b = d.read();
+ QVERIFY(d.audioFormat() == f);
+ QVERIFY(b.format() == f);
+}
+
+void tst_QAudioDecoder::source()
+{
+ QAudioDecoder d;
+
+ QVERIFY(d.source().isEmpty());
+ QVERIFY(d.sourceDevice() == nullptr);
+
+ QFile f;
+ d.setSourceDevice(&f);
+ QVERIFY(d.source().isEmpty());
+ QVERIFY(d.sourceDevice() == &f);
+
+ d.setSource(QUrl::fromLocalFile("Foo"));
+ QVERIFY(d.source() == QUrl::fromLocalFile("Foo"));
+ QVERIFY(d.sourceDevice() == nullptr);
+
+ d.setSourceDevice(nullptr);
+ QVERIFY(d.source().isEmpty());
+ QVERIFY(d.sourceDevice() == nullptr);
+
+ d.setSource(QUrl::fromLocalFile("Foo"));
+ QVERIFY(d.source() == QUrl::fromLocalFile("Foo"));
+ QVERIFY(d.sourceDevice() == nullptr);
+
+ d.setSource(QString());
+ QVERIFY(d.source() == QString());
+ QVERIFY(d.sourceDevice() == nullptr);
+}
+
+void tst_QAudioDecoder::readAll()
+{
+ QAudioDecoder d;
+ d.setSource(QUrl::fromLocalFile("Foo"));
+ QVERIFY(!d.isDecoding());
+
+ QSignalSpy durationSpy(&d, &QAudioDecoder::durationChanged);
+ QSignalSpy positionSpy(&d, &QAudioDecoder::positionChanged);
+ QSignalSpy isDecodingSpy(&d, &QAudioDecoder::isDecodingChanged);
+ QSignalSpy finishedSpy(&d, &QAudioDecoder::finished);
+ QSignalSpy bufferAvailableSpy(&d, &QAudioDecoder::bufferAvailableChanged);
+ d.start();
+ int i = 0;
+ forever {
+ QVERIFY(d.isDecoding());
+ QCOMPARE(isDecodingSpy.size(), 1);
+ QCOMPARE(durationSpy.size(), 1);
+ QVERIFY(finishedSpy.isEmpty());
+ QTRY_VERIFY(bufferAvailableSpy.size() >= 1);
+ if (d.bufferAvailable()) {
+ QAudioBuffer b = d.read();
+ QVERIFY(b.isValid());
+ QCOMPARE(b.startTime() / 1000, d.position());
+ QVERIFY(!positionSpy.isEmpty());
+ QList<QVariant> arguments = positionSpy.takeLast();
+ QCOMPARE(arguments.at(0).toLongLong(), b.startTime() / 1000);
+
+ i++;
+ if (i == MOCK_DECODER_MAX_BUFFERS) {
+ QCOMPARE(finishedSpy.size(), 1);
+ QCOMPARE(isDecodingSpy.size(), 2);
+ QVERIFY(!d.isDecoding());
+ QList<QVariant> arguments = isDecodingSpy.takeLast();
+ QVERIFY(arguments.at(0).toBool() == false);
+ QVERIFY(!d.bufferAvailable());
+ QVERIFY(!bufferAvailableSpy.isEmpty());
+ arguments = bufferAvailableSpy.takeLast();
+ QVERIFY(arguments.at(0).toBool() == false);
+ break;
+ }
+ } else
+ QTest::qWait(30);
+ }
+}
+
+void tst_QAudioDecoder::nullControl()
+{
+ QMockIntegration::instance()->setFlags(QMockIntegration::NoAudioDecoderInterface);
+ QAudioDecoder d;
+
+ QVERIFY(d.error() == QAudioDecoder::NotSupportedError);
+ QVERIFY(!d.errorString().isEmpty());
+
+ QVERIFY(!d.isDecoding());
+
+ QVERIFY(d.source().isEmpty());
+ d.setSource(QUrl::fromLocalFile("test"));
+ QVERIFY(d.source().isEmpty());
+
+ QFile f;
+ QVERIFY(d.sourceDevice() == nullptr);
+ d.setSourceDevice(&f);
+ QVERIFY(d.sourceDevice() == nullptr);
+
+ QAudioFormat format;
+ format.setChannelCount(2);
+ QVERIFY(!d.audioFormat().isValid());
+ d.setAudioFormat(format);
+ QVERIFY(!d.audioFormat().isValid());
+
+ QVERIFY(!d.read().isValid());
+ QVERIFY(!d.bufferAvailable());
+
+ QVERIFY(d.position() == -1);
+ QVERIFY(d.duration() == -1);
+
+ d.start();
+ QVERIFY(d.error() == QAudioDecoder::NotSupportedError);
+ QVERIFY(!d.errorString().isEmpty());
+ QVERIFY(!d.isDecoding());
+ d.stop();
+}
+
+QTEST_MAIN(tst_QAudioDecoder)
+
+#include "tst_qaudiodecoder.moc"
diff --git a/tests/auto/unit/multimedia/qaudioformat/CMakeLists.txt b/tests/auto/unit/multimedia/qaudioformat/CMakeLists.txt
new file mode 100644
index 000000000..5f4c47bd7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudioformat/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qaudioformat.pro.
+
+#####################################################################
+## tst_qaudioformat Test:
+#####################################################################
+
+qt_internal_add_test(tst_qaudioformat
+ SOURCES
+ tst_qaudioformat.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qaudioformat/tst_qaudioformat.cpp b/tests/auto/unit/multimedia/qaudioformat/tst_qaudioformat.cpp
new file mode 100644
index 000000000..c4f4e10cf
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudioformat/tst_qaudioformat.cpp
@@ -0,0 +1,267 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+
+#include <QtTest/QtTest>
+#include <QtCore/qlocale.h>
+#include <qaudioformat.h>
+
+#include <QStringList>
+#include <QList>
+
+class tst_QAudioFormat : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QAudioFormat(QObject* parent=nullptr) : QObject(parent) {}
+
+private slots:
+ void checkNull();
+ void checkSampleFormat();
+ void checkEquality();
+ void checkAssignment();
+ void checkSampleRate();
+ void checkChannelCount();
+
+ void channelConfig();
+
+ void checkSizes();
+ void checkSizes_data();
+};
+
+void tst_QAudioFormat::checkNull()
+{
+ // Default constructed QAudioFormat is invalid.
+ QAudioFormat audioFormat0;
+ QVERIFY(!audioFormat0.isValid());
+
+ // validity is transferred
+ QAudioFormat audioFormat1(audioFormat0);
+ QVERIFY(!audioFormat1.isValid());
+
+ audioFormat0.setSampleRate(44100);
+ audioFormat0.setChannelCount(2);
+ audioFormat0.setSampleFormat(QAudioFormat::Int16);
+ QVERIFY(audioFormat0.isValid());
+}
+
+void tst_QAudioFormat::checkSampleFormat()
+{
+ QAudioFormat audioFormat;
+ audioFormat.setSampleFormat(QAudioFormat::Int16);
+ QVERIFY(audioFormat.sampleFormat() == QAudioFormat::Int16);
+ QTest::ignoreMessage(QtDebugMsg, "Int16");
+ qDebug() << QAudioFormat::Int16;
+
+ audioFormat.setSampleFormat(QAudioFormat::Unknown);
+ QVERIFY(audioFormat.sampleFormat() == QAudioFormat::Unknown);
+ QTest::ignoreMessage(QtDebugMsg, "Unknown");
+ qDebug() << QAudioFormat::Unknown;
+
+ audioFormat.setSampleFormat(QAudioFormat::UInt8);
+ QVERIFY(audioFormat.sampleFormat() == QAudioFormat::UInt8);
+ QTest::ignoreMessage(QtDebugMsg, "UInt8");
+ qDebug() << QAudioFormat::UInt8;
+
+ audioFormat.setSampleFormat(QAudioFormat::Float);
+ QVERIFY(audioFormat.sampleFormat() == QAudioFormat::Float);
+ QTest::ignoreMessage(QtDebugMsg, "Float");
+ qDebug() << QAudioFormat::Float;
+}
+
+void tst_QAudioFormat::checkEquality()
+{
+ QAudioFormat audioFormat0;
+ QAudioFormat audioFormat1;
+
+ // Null formats are equivalent
+ QVERIFY(audioFormat0 == audioFormat1);
+ QVERIFY(!(audioFormat0 != audioFormat1));
+
+ // on filled formats
+ audioFormat0.setSampleRate(8000);
+ audioFormat0.setChannelCount(1);
+ audioFormat0.setSampleFormat(QAudioFormat::UInt8);
+
+ audioFormat1.setSampleRate(8000);
+ audioFormat1.setChannelCount(1);
+ audioFormat1.setSampleFormat(QAudioFormat::UInt8);
+
+ QVERIFY(audioFormat0 == audioFormat1);
+ QVERIFY(!(audioFormat0 != audioFormat1));
+
+ audioFormat0.setSampleRate(44100);
+ QVERIFY(audioFormat0 != audioFormat1);
+ QVERIFY(!(audioFormat0 == audioFormat1));
+}
+
+void tst_QAudioFormat::checkAssignment()
+{
+ QAudioFormat audioFormat0;
+ QAudioFormat audioFormat1;
+
+ audioFormat0.setSampleRate(8000);
+ audioFormat0.setChannelCount(1);
+ audioFormat0.setSampleFormat(QAudioFormat::UInt8);
+
+ audioFormat1 = audioFormat0;
+ QVERIFY(audioFormat1 == audioFormat0);
+
+ QAudioFormat audioFormat2(audioFormat0);
+ QVERIFY(audioFormat2 == audioFormat0);
+}
+
+/* sampleRate() API property test. */
+void tst_QAudioFormat::checkSampleRate()
+{
+ QAudioFormat audioFormat;
+ QVERIFY(audioFormat.sampleRate() == 0);
+
+ audioFormat.setSampleRate(123);
+ QVERIFY(audioFormat.sampleRate() == 123);
+}
+
+/* channelCount() API property test. */
+void tst_QAudioFormat::checkChannelCount()
+{
+ // channels is the old name for channelCount, so
+ // they should always be equal
+ QAudioFormat audioFormat;
+ QVERIFY(audioFormat.channelCount() == 0);
+
+ audioFormat.setChannelCount(123);
+ QVERIFY(audioFormat.channelCount() == 123);
+
+ audioFormat.setChannelCount(5);
+ QVERIFY(audioFormat.channelCount() == 5);
+}
+
+void tst_QAudioFormat::channelConfig()
+{
+ QAudioFormat format;
+ format.setChannelConfig(QAudioFormat::ChannelConfig2Dot1);
+ QVERIFY(format.channelConfig() == QAudioFormat::ChannelConfig2Dot1);
+ QVERIFY(format.channelCount() == 3);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontLeft) == 0);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontRight) == 1);
+ QVERIFY(format.channelOffset(QAudioFormat::BackCenter) == -1);
+
+ format.setChannelConfig(QAudioFormat::ChannelConfigSurround5Dot1);
+ QVERIFY(format.channelConfig() == QAudioFormat::ChannelConfigSurround5Dot1);
+ QVERIFY(format.channelCount() == 6);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontLeft) == 0);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontRight) == 1);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontCenter) == 2);
+ QVERIFY(format.channelOffset(QAudioFormat::LFE) == 3);
+ QVERIFY(format.channelOffset(QAudioFormat::BackLeft) == 4);
+ QVERIFY(format.channelOffset(QAudioFormat::BackRight) == 5);
+ QVERIFY(format.channelOffset(QAudioFormat::BackCenter) == -1);
+
+ auto config = QAudioFormat::channelConfig(QAudioFormat::FrontCenter, QAudioFormat::BackCenter, QAudioFormat::LFE);
+ format.setChannelConfig(config);
+ QVERIFY(format.channelConfig() == config);
+ QVERIFY(format.channelCount() == 3);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontLeft) == -1);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontRight) == -1);
+ QVERIFY(format.channelOffset(QAudioFormat::FrontCenter) == 0);
+ QVERIFY(format.channelOffset(QAudioFormat::LFE) == 1);
+ QVERIFY(format.channelOffset(QAudioFormat::BackLeft) == -1);
+ QVERIFY(format.channelOffset(QAudioFormat::BackRight) == -1);
+ QVERIFY(format.channelOffset(QAudioFormat::BackCenter) == 2);
+
+ format.setChannelCount(2);
+ QVERIFY(format.channelConfig() == QAudioFormat::ChannelConfigUnknown);
+}
+
+void tst_QAudioFormat::checkSizes()
+{
+ QFETCH(QAudioFormat, format);
+ QFETCH(int, frameSize);
+ QFETCH(int, byteCount);
+ QFETCH(int, frameCount);
+ QFETCH(qint64, durationForByte);
+ QFETCH(int, byteForFrame);
+ QFETCH(qint64, durationForByteForDuration);
+ QFETCH(int, byteForDuration);
+ QFETCH(int, framesForDuration);
+
+ QCOMPARE(format.bytesPerFrame(), frameSize);
+
+ // Byte input
+ QCOMPARE(format.framesForBytes(byteCount), frameCount);
+ QCOMPARE(format.durationForBytes(byteCount), durationForByte);
+
+ // Framecount input
+ QCOMPARE(format.bytesForFrames(frameCount), byteForFrame);
+ QCOMPARE(format.durationForFrames(frameCount), durationForByte);
+
+ // Duration input
+ QCOMPARE(format.bytesForDuration(durationForByteForDuration), byteForDuration);
+ QCOMPARE(format.framesForDuration(durationForByte), frameCount);
+ QCOMPARE(format.framesForDuration(durationForByteForDuration), framesForDuration);
+}
+
+void tst_QAudioFormat::checkSizes_data()
+{
+ QTest::addColumn<QAudioFormat>("format");
+ QTest::addColumn<int>("frameSize");
+ QTest::addColumn<int>("byteCount");
+ QTest::addColumn<qint64>("durationForByte");
+ QTest::addColumn<int>("frameCount"); // output of sampleCountforByte, input for byteForFrame
+ QTest::addColumn<int>("byteForFrame");
+ QTest::addColumn<qint64>("durationForByteForDuration"); // input for byteForDuration
+ QTest::addColumn<int>("byteForDuration");
+ QTest::addColumn<int>("framesForDuration");
+
+ QAudioFormat f;
+ QTest::newRow("invalid") << f << 0 << 0 << 0LL << 0 << 0 << 0LL << 0 << 0;
+
+ f.setChannelCount(1);
+ f.setSampleRate(8000);
+ f.setSampleFormat(QAudioFormat::UInt8);
+
+ qint64 qrtr = 250000LL;
+ qint64 half = 500000LL;
+ qint64 one = 1000000LL;
+ qint64 two = 2000000LL;
+
+ // No rounding errors with mono 8 bit
+ QTest::newRow("1ch_8b_8k_signed_4000") << f << 1 << 4000 << half << 4000 << 4000 << half << 4000 << 4000;
+ QTest::newRow("1ch_8b_8k_signed_8000") << f << 1 << 8000 << one << 8000 << 8000 << one << 8000 << 8000;
+ QTest::newRow("1ch_8b_8k_signed_16000") << f << 1 << 16000 << two << 16000 << 16000 << two << 16000 << 16000;
+
+ // Mono 16bit
+ f.setSampleFormat(QAudioFormat::Int16);
+ QTest::newRow("1ch_16b_8k_signed_8000") << f << 2 << 8000 << half << 4000 << 8000 << half << 8000 << 4000;
+ QTest::newRow("1ch_16b_8k_signed_16000") << f << 2 << 16000 << one << 8000 << 16000 << one << 16000 << 8000;
+
+ // Rounding errors
+ QTest::newRow("1ch_16b_8k_signed_8001") << f << 2 << 8001 << half << 4000 << 8000 << half << 8000 << 4000;
+ QTest::newRow("1ch_16b_8k_signed_8000_duration1") << f << 2 << 8000 << half << 4000 << 8000 << half + 1 << 8000 << 4000;
+ QTest::newRow("1ch_16b_8k_signed_8000_duration2") << f << 2 << 8000 << half << 4000 << 8000 << half + 124 << 8000 << 4000;
+ QTest::newRow("1ch_16b_8k_signed_8000_duration3") << f << 2 << 8000 << half << 4000 << 8000 << half + 125 << 8002 << 4001;
+ QTest::newRow("1ch_16b_8k_signed_8000_duration4") << f << 2 << 8000 << half << 4000 << 8000 << half + 126 << 8002 << 4001;
+
+ // Stereo 16 bit
+ f.setChannelCount(2);
+ QTest::newRow("2ch_16b_8k_signed_8000") << f << 4 << 8000 << qrtr << 2000 << 8000 << qrtr << 8000 << 2000;
+ QTest::newRow("2ch_16b_8k_signed_16000") << f << 4 << 16000 << half << 4000 << 16000 << half << 16000 << 4000;
+
+ // More rounding errors
+ // First rounding bytes
+ QTest::newRow("2ch_16b_8k_signed_8001") << f << 4 << 8001 << qrtr << 2000 << 8000 << qrtr << 8000 << 2000;
+ QTest::newRow("2ch_16b_8k_signed_8002") << f << 4 << 8002 << qrtr << 2000 << 8000 << qrtr << 8000 << 2000;
+ QTest::newRow("2ch_16b_8k_signed_8003") << f << 4 << 8003 << qrtr << 2000 << 8000 << qrtr << 8000 << 2000;
+
+ // Then rounding duration
+ // 8khz = 125us per frame
+ QTest::newRow("2ch_16b_8k_signed_8000_duration1") << f << 4 << 8000 << qrtr << 2000 << 8000 << qrtr + 1 << 8000 << 2000;
+ QTest::newRow("2ch_16b_8k_signed_8000_duration2") << f << 4 << 8000 << qrtr << 2000 << 8000 << qrtr + 124 << 8000 << 2000;
+ QTest::newRow("2ch_16b_8k_signed_8000_duration3") << f << 4 << 8000 << qrtr << 2000 << 8000 << qrtr + 125 << 8004 << 2001;
+ QTest::newRow("2ch_16b_8k_signed_8000_duration4") << f << 4 << 8000 << qrtr << 2000 << 8000 << qrtr + 126 << 8004 << 2001;
+}
+
+QTEST_MAIN(tst_QAudioFormat)
+
+#include "tst_qaudioformat.moc"
diff --git a/tests/auto/unit/multimedia/qaudionamespace/CMakeLists.txt b/tests/auto/unit/multimedia/qaudionamespace/CMakeLists.txt
new file mode 100644
index 000000000..3d4ac7126
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudionamespace/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qaudionamespace.pro.
+
+#####################################################################
+## tst_qaudionamespace Test:
+#####################################################################
+
+qt_internal_add_test(tst_qaudionamespace
+ SOURCES
+ tst_qaudionamespace.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qaudionamespace/tst_qaudionamespace.cpp b/tests/auto/unit/multimedia/qaudionamespace/tst_qaudionamespace.cpp
new file mode 100644
index 000000000..cae002306
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudionamespace/tst_qaudionamespace.cpp
@@ -0,0 +1,216 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <QtMultimedia/qaudio.h>
+#include <QtMultimedia/qaudiodevice.h>
+
+// Adds an enum, and the stringized version
+#define ADD_ENUM_TEST(x) \
+ QTest::newRow(#x) \
+ << QAudio::x \
+ << QString(QLatin1String(#x));
+
+class tst_QAudioNamespace : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void debugError();
+ void debugError_data();
+ void debugState();
+ void debugState_data();
+ void debugVolumeScale();
+ void debugVolumeScale_data();
+ void convertVolume();
+ void convertVolume_data();
+};
+
+void tst_QAudioNamespace::debugError_data()
+{
+ QTest::addColumn<QAudio::Error>("error");
+ QTest::addColumn<QString>("stringized");
+
+ ADD_ENUM_TEST(NoError);
+ ADD_ENUM_TEST(OpenError);
+ ADD_ENUM_TEST(IOError);
+ ADD_ENUM_TEST(UnderrunError);
+ ADD_ENUM_TEST(FatalError);
+}
+
+void tst_QAudioNamespace::debugError()
+{
+ QFETCH(QAudio::Error, error);
+ QFETCH(QString, stringized);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << error;
+}
+
+void tst_QAudioNamespace::debugState_data()
+{
+ QTest::addColumn<QAudio::State>("state");
+ QTest::addColumn<QString>("stringized");
+
+ ADD_ENUM_TEST(ActiveState);
+ ADD_ENUM_TEST(SuspendedState);
+ ADD_ENUM_TEST(StoppedState);
+ ADD_ENUM_TEST(IdleState);
+}
+
+void tst_QAudioNamespace::debugState()
+{
+ QFETCH(QAudio::State, state);
+ QFETCH(QString, stringized);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << state;
+}
+
+void tst_QAudioNamespace::debugVolumeScale_data()
+{
+ QTest::addColumn<QAudio::VolumeScale>("volumeScale");
+ QTest::addColumn<QString>("stringized");
+
+ ADD_ENUM_TEST(LinearVolumeScale);
+ ADD_ENUM_TEST(CubicVolumeScale);
+ ADD_ENUM_TEST(DecibelVolumeScale);
+}
+
+void tst_QAudioNamespace::debugVolumeScale()
+{
+ QFETCH(QAudio::VolumeScale, volumeScale);
+ QFETCH(QString, stringized);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << volumeScale;
+}
+
+void tst_QAudioNamespace::convertVolume_data()
+{
+ QTest::addColumn<qreal>("input");
+ QTest::addColumn<QAudio::VolumeScale>("from");
+ QTest::addColumn<QAudio::VolumeScale>("to");
+ QTest::addColumn<qreal>("expectedOutput");
+
+ QTest::newRow("-1.0 from linear to linear") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from linear to linear") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("0.5 from linear to linear") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(0.5);
+ QTest::newRow("1.0 from linear to linear") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from linear to cubic") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from linear to cubic") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("0.33 from linear to cubic") << qreal(0.33) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.69);
+ QTest::newRow("0.5 from linear to cubic") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.79);
+ QTest::newRow("0.72 from linear to cubic") << qreal(0.72) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.89);
+ QTest::newRow("1.0 from linear to cubic") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from linear to logarithmic") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from linear to logarithmic") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("0.33 from linear to logarithmic") << qreal(0.33) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.78);
+ QTest::newRow("0.5 from linear to logarithmic") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.9);
+ QTest::newRow("0.72 from linear to logarithmic") << qreal(0.72) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.96);
+ QTest::newRow("1.0 from linear to logarithmic") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from linear to decibel") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-200);
+ QTest::newRow("0.0 from linear to decibel") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-200);
+ QTest::newRow("0.33 from linear to decibel") << qreal(0.33) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-9.63);
+ QTest::newRow("0.5 from linear to decibel") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-6.02);
+ QTest::newRow("0.72 from linear to decibel") << qreal(0.72) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-2.85);
+ QTest::newRow("1.0 from linear to decibel") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(0);
+
+ QTest::newRow("-1.0 from cubic to linear") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from cubic to linear") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("0.33 from cubic to linear") << qreal(0.33) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.04);
+ QTest::newRow("0.5 from cubic to linear") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.13);
+ QTest::newRow("0.72 from cubic to linear") << qreal(0.72) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.37);
+ QTest::newRow("1.0 from cubic to linear") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from cubic to cubic") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from cubic to cubic") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("0.5 from cubic to cubic") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(0.5);
+ QTest::newRow("1.0 from cubic to cubic") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from cubic to logarithmic") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from cubic to logarithmic") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("0.33 from cubic to logarithmic") << qreal(0.33) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.15);
+ QTest::newRow("0.5 from cubic to logarithmic") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.44);
+ QTest::newRow("0.72 from cubic to logarithmic") << qreal(0.72) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.82);
+ QTest::newRow("1.0 from cubic to logarithmic") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from cubic to decibel") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200);
+ QTest::newRow("0.0 from cubic to decibel") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200);
+ QTest::newRow("0.33 from cubic to decibel") << qreal(0.33) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-28.89);
+ QTest::newRow("0.5 from cubic to decibel") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-18.06);
+ QTest::newRow("0.72 from cubic to decibel") << qreal(0.72) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-8.56);
+ QTest::newRow("1.0 from cubic to decibel") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(0);
+
+ QTest::newRow("-1.0 from logarithmic to linear") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from logarithmic to linear") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("0.33 from logarithmic to linear") << qreal(0.33) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.09);
+ QTest::newRow("0.5 from logarithmic to linear") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.15);
+ QTest::newRow("0.72 from logarithmic to linear") << qreal(0.72) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.28);
+ QTest::newRow("1.0 from logarithmic to linear") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from logarithmic to cubic") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from logarithmic to cubic") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("0.33 from logarithmic to cubic") << qreal(0.33) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.44);
+ QTest::newRow("0.5 from logarithmic to cubic") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.53);
+ QTest::newRow("0.72 from logarithmic to cubic") << qreal(0.72) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.65);
+ QTest::newRow("1.0 from logarithmic to cubic") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from logarithmic to logarithmic") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("0.0 from logarithmic to logarithmic") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("0.5 from logarithmic to logarithmic") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.5);
+ QTest::newRow("1.0 from logarithmic to logarithmic") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1.0 from logarithmic to decibel") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200);
+ QTest::newRow("0.0 from logarithmic to decibel") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200);
+ QTest::newRow("0.33 from logarithmic to decibel") << qreal(0.33) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-21.21);
+ QTest::newRow("0.5 from logarithmic to decibel") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-16.45);
+ QTest::newRow("0.72 from logarithmic to decibel") << qreal(0.72) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-11.17);
+ QTest::newRow("1.0 from logarithmic to decibel") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(0);
+
+ QTest::newRow("-1000 from decibel to linear") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("-200 from decibel to linear") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.0);
+ QTest::newRow("-40 from decibel to linear") << qreal(-40.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.01);
+ QTest::newRow("-10 from decibel to linear") << qreal(-10.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.32);
+ QTest::newRow("-5 from decibel to linear") << qreal(-5.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.56);
+ QTest::newRow("0 from decibel to linear") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1000 from decibel to cubic") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("-200 from decibel to cubic") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.0);
+ QTest::newRow("-40 from decibel to cubic") << qreal(-40.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.22);
+ QTest::newRow("-10 from decibel to cubic") << qreal(-10.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.68);
+ QTest::newRow("-5 from decibel to cubic") << qreal(-5.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.83);
+ QTest::newRow("0 from decibel to cubic") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1000 from decibel to logarithmic") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("-200 from decibel to logarithmic") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0);
+ QTest::newRow("-40 from decibel to logarithmic") << qreal(-40.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.05);
+ QTest::newRow("-10 from decibel to logarithmic") << qreal(-10.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.77);
+ QTest::newRow("-5 from decibel to logarithmic") << qreal(-5.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.92);
+ QTest::newRow("0 from decibel to logarithmic") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0);
+
+ QTest::newRow("-1000 from decibel to decibel") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(-1000.0);
+ QTest::newRow("-200 from decibel to decibel") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(-200.0);
+ QTest::newRow("-30 from decibel to decibel") << qreal(-30.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(-30.0);
+ QTest::newRow("0 from decibel to decibel") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(0.0);
+}
+
+void tst_QAudioNamespace::convertVolume()
+{
+ QFETCH(qreal, input);
+ QFETCH(QAudio::VolumeScale, from);
+ QFETCH(QAudio::VolumeScale, to);
+ QFETCH(qreal, expectedOutput);
+
+ qreal actualOutput = QAudio::convertVolume(input, from, to);
+ QVERIFY2(qAbs(actualOutput - expectedOutput) < 0.01,
+ QStringLiteral("actual: %1, expected: %2").arg(actualOutput).arg(expectedOutput).toLocal8Bit().constData());
+}
+
+QTEST_MAIN(tst_QAudioNamespace)
+
+#include "tst_qaudionamespace.moc"
diff --git a/tests/auto/unit/multimedia/qaudiorecorder/CMakeLists.txt b/tests/auto/unit/multimedia/qaudiorecorder/CMakeLists.txt
new file mode 100644
index 000000000..b2dc16b69
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiorecorder/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qaudiorecorder.pro.
+
+#####################################################################
+## tst_qaudiorecorder Test:
+#####################################################################
+
+qt_internal_add_test(tst_qaudiorecorder
+ SOURCES
+ tst_qaudiorecorder.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qaudiorecorder/tst_qaudiorecorder.cpp b/tests/auto/unit/multimedia/qaudiorecorder/tst_qaudiorecorder.cpp
new file mode 100644
index 000000000..7d6309976
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiorecorder/tst_qaudiorecorder.cpp
@@ -0,0 +1,87 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+
+#include <qaudioformat.h>
+
+#include <qmediarecorder.h>
+#include <private/qplatformmediarecorder_p.h>
+#include <qaudiodevice.h>
+#include <qaudiosource.h>
+#include <qmediacapturesession.h>
+
+#include "qmockmediacapturesession.h"
+#include "qmockintegration.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QAudioRecorder: public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void testAudioSource();
+ void testDevices();
+ void testAvailability();
+
+private:
+ QMediaRecorder *encoder = nullptr;
+};
+
+void tst_QAudioRecorder::init()
+{
+ encoder = nullptr;
+}
+
+void tst_QAudioRecorder::cleanup()
+{
+ delete encoder;
+ encoder = nullptr;
+}
+
+void tst_QAudioRecorder::testAudioSource()
+{
+ QMediaCaptureSession session;
+ encoder = new QMediaRecorder;
+ session.setRecorder(encoder);
+
+ QCOMPARE(session.camera(), nullptr);
+}
+
+void tst_QAudioRecorder::testDevices()
+{
+// audiosource = new QMediaRecorder;
+// QList<QAudioDevice> devices = mockIntegration->audioInputs();
+// QVERIFY(devices.size() > 0);
+// QVERIFY(devices.at(0).id() == "device1");
+// QVERIFY(audiosource->audioInputDescription("device1").compare("dev1 comment") == 0);
+// QVERIFY(audiosource->defaultAudioInput() == "device1");
+// QVERIFY(audiosource->isAvailable() == true);
+
+// QSignalSpy checkSignal(audiosource, SIGNAL(audioInputChanged(QString)));
+// audiosource->setAudioInput("device2");
+// QVERIFY(audiosource->audioInput().compare("device2") == 0);
+// QVERIFY(checkSignal.count() == 1);
+// QVERIFY(audiosource->isAvailable() == true);
+}
+
+void tst_QAudioRecorder::testAvailability()
+{
+ QMediaCaptureSession session;
+ QMediaRecorder source;
+ session.setRecorder(&source);
+
+ QVERIFY(source.isAvailable());
+}
+
+QTEST_GUILESS_MAIN(tst_QAudioRecorder)
+
+#include "tst_qaudiorecorder.moc"
diff --git a/tests/auto/unit/multimedia/qaudiostatemachine/CMakeLists.txt b/tests/auto/unit/multimedia/qaudiostatemachine/CMakeLists.txt
new file mode 100644
index 000000000..715091dac
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiostatemachine/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qaudiostatemachine
+ SOURCES
+ tst_qaudiostatemachine.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
+
diff --git a/tests/auto/unit/multimedia/qaudiostatemachine/tst_qaudiostatemachine.cpp b/tests/auto/unit/multimedia/qaudiostatemachine/tst_qaudiostatemachine.cpp
new file mode 100644
index 000000000..433590d09
--- /dev/null
+++ b/tests/auto/unit/multimedia/qaudiostatemachine/tst_qaudiostatemachine.cpp
@@ -0,0 +1,661 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+// TESTED_COMPONENT=src/multimedia
+
+#include <QtTest/QtTest>
+#include <private/qaudiostatemachine_p.h>
+#include <private/qaudiosystem_p.h>
+#include <QThread>
+
+QT_USE_NAMESPACE
+
+template<typename F>
+static std::unique_ptr<QThread> createTestThread(std::vector<std::atomic_int> &counters,
+ size_t index, F &&functor,
+ int minAttemptsCount = 2000)
+{
+ return std::unique_ptr<QThread>(QThread::create([=, &counters]() {
+ auto checkCounter = [=](int counter) { return counter < minAttemptsCount; };
+ for (; !QTest::currentTestFailed()
+ && std::any_of(counters.begin(), counters.end(), checkCounter);
+ ++counters[index])
+ functor();
+ }));
+}
+
+class tst_QAudioStateMachine : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void constructor_setsStoppedStateWithNoError();
+
+ void start_changesState_whenStateIsStopped_data();
+ void start_changesState_whenStateIsStopped();
+
+ void start_doesntChangeState_whenStateIsNotStopped_data();
+ void start_doesntChangeState_whenStateIsNotStopped();
+
+ void stop_changesState_whenStateIsNotStopped_data();
+ void stop_changesState_whenStateIsNotStopped();
+
+ void stop_doesntChangeState_whenStateIsStopped_data();
+ void stop_doesntChangeState_whenStateIsStopped();
+
+ void stopWithDraining_changesState_whenStateIsNotStopped_data();
+ void stopWithDraining_changesState_whenStateIsNotStopped();
+
+ void methods_dontChangeState_whenDraining();
+
+ void onDrained_finishesDraining();
+
+ void onDrained_getsFailed_whenDrainHasntBeenCalled_data();
+ void onDrained_getsFailed_whenDrainHasntBeenCalled();
+
+ void updateActiveOrIdle_doesntChangeState_whenStateIsNotActiveOrIdle_data();
+ void updateActiveOrIdle_doesntChangeState_whenStateIsNotActiveOrIdle();
+
+ void updateActiveOrIdle_changesState_whenStateIsActiveOrIdle_data();
+ void updateActiveOrIdle_changesState_whenStateIsActiveOrIdle();
+
+ void suspendAndResume_saveAndRestoreState_whenStateIsActiveOrIdle_data();
+ void suspendAndResume_saveAndRestoreState_whenStateIsActiveOrIdle();
+
+ void suspend_doesntChangeState_whenStateIsNotActiveOrIdle_data();
+ void suspend_doesntChangeState_whenStateIsNotActiveOrIdle();
+
+ void resume_doesntChangeState_whenStateIsNotSuspended_data();
+ void resume_doesntChangeState_whenStateIsNotSuspended();
+
+ void deleteNotifierInSlot_suppressesAdjacentSignal();
+
+ void twoThreadsToggleSuspendResumeAndIdleActive_statesAreConsistent();
+
+ void twoThreadsToggleStartStop_statesAreConsistent();
+
+private:
+ void generateNotStoppedPrevStates()
+ {
+ QTest::addColumn<QAudio::State>("prevState");
+ QTest::addColumn<QAudio::Error>("prevError");
+
+ QTest::newRow("from IdleState") << QAudio::IdleState << QAudio::UnderrunError;
+ QTest::newRow("from ActiveState") << QAudio::ActiveState << QAudio::NoError;
+ QTest::newRow("from SuspendedState") << QAudio::SuspendedState << QAudio::NoError;
+ }
+
+ void generateStoppedAndSuspendedPrevStates()
+ {
+ QTest::addColumn<QAudio::State>("prevState");
+
+ QTest::newRow("from StoppedState") << QAudio::StoppedState;
+ QTest::newRow("from SuspendedState") << QAudio::SuspendedState;
+ }
+};
+
+void tst_QAudioStateMachine::constructor_setsStoppedStateWithNoError()
+{
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+ QVERIFY(!stateMachine.isActiveOrIdle());
+}
+
+void tst_QAudioStateMachine::start_changesState_whenStateIsStopped_data()
+{
+ QTest::addColumn<bool>("active");
+ QTest::addColumn<QAudio::State>("expectedState");
+
+ QTest::newRow("to active") << true << QAudio::ActiveState;
+ QTest::newRow("to not active") << false << QAudio::IdleState;
+}
+
+void tst_QAudioStateMachine::start_changesState_whenStateIsStopped()
+{
+ QFETCH(bool, active);
+ QFETCH(QAudio::State, expectedState);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(stateMachine.start(active));
+
+ QCOMPARE(stateSpy.size(), 1);
+ QCOMPARE(stateSpy.front().front().value<QAudio::State>(), expectedState);
+ QCOMPARE(errorSpy.size(), 0);
+ QCOMPARE(stateMachine.state(), expectedState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+}
+
+void tst_QAudioStateMachine::start_doesntChangeState_whenStateIsNotStopped_data()
+{
+ generateNotStoppedPrevStates();
+}
+
+void tst_QAudioStateMachine::start_doesntChangeState_whenStateIsNotStopped()
+{
+ QFETCH(QAudio::State, prevState);
+ QFETCH(QAudio::Error, prevError);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+ stateMachine.forceSetState(prevState, prevError);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY2(!stateMachine.start(), "Cannot start (active)");
+ QVERIFY2(!stateMachine.start(false), "Cannot start (not active)");
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QCOMPARE(stateMachine.state(), prevState);
+ QCOMPARE(stateMachine.error(), prevError);
+}
+
+void tst_QAudioStateMachine::stop_changesState_whenStateIsNotStopped_data()
+{
+ generateNotStoppedPrevStates();
+}
+
+void tst_QAudioStateMachine::stop_changesState_whenStateIsNotStopped()
+{
+ QFETCH(QAudio::State, prevState);
+ QFETCH(QAudio::Error, prevError);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState, prevError);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ auto notifier = stateMachine.stop();
+ QVERIFY(notifier);
+
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+ QVERIFY(!notifier.isDraining());
+
+ notifier.reset();
+
+ QCOMPARE(stateSpy.size(), 1);
+ QCOMPARE(stateSpy.front().front().value<QAudio::State>(), QAudio::StoppedState);
+ QCOMPARE(errorSpy.size(), prevError == QAudio::NoError ? 0 : 1);
+ if (!errorSpy.empty())
+ QCOMPARE(errorSpy.front().front().value<QAudio::Error>(), QAudio::NoError);
+
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+ QVERIFY(!stateMachine.isDraining());
+}
+
+void tst_QAudioStateMachine::stop_doesntChangeState_whenStateIsStopped_data()
+{
+ QTest::addColumn<QAudio::Error>("error");
+
+ QTest::newRow("from NoError") << QAudio::NoError;
+ QTest::newRow("from IOError") << QAudio::IOError;
+}
+
+void tst_QAudioStateMachine::stop_doesntChangeState_whenStateIsStopped()
+{
+ QFETCH(QAudio::Error, error);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.setError(error);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY2(!stateMachine.stop(), "should return false if already stopped");
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), error);
+ QVERIFY(!stateMachine.isDraining());
+}
+
+void tst_QAudioStateMachine::stopWithDraining_changesState_whenStateIsNotStopped_data()
+{
+ generateNotStoppedPrevStates();
+}
+
+void tst_QAudioStateMachine::stopWithDraining_changesState_whenStateIsNotStopped()
+{
+ QFETCH(QAudio::State, prevState);
+ QFETCH(QAudio::Error, prevError);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState, prevError);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+
+ auto notifier = stateMachine.stop(QAudio::NoError, true);
+ QVERIFY(notifier);
+ QCOMPARE(notifier.isDraining(), prevState == QAudio::ActiveState);
+ notifier.reset();
+
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+ QCOMPARE(stateMachine.isDraining(), prevState == QAudio::ActiveState);
+
+ QCOMPARE(stateSpy.size(), 1);
+}
+
+void tst_QAudioStateMachine::methods_dontChangeState_whenDraining()
+{
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(QAudio::ActiveState);
+ stateMachine.stop(QAudio::IOError, true);
+ QVERIFY(stateMachine.isDraining());
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(!stateMachine.start());
+ QVERIFY(!stateMachine.stop());
+ QVERIFY(!stateMachine.stop(QAudio::NoError, true));
+ QVERIFY(!stateMachine.suspend());
+ QVERIFY(!stateMachine.resume());
+ QVERIFY(!stateMachine.updateActiveOrIdle(false));
+ QVERIFY(!stateMachine.updateActiveOrIdle(true));
+
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), QAudio::IOError);
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QVERIFY(stateMachine.isDraining());
+}
+
+void tst_QAudioStateMachine::onDrained_finishesDraining()
+{
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(QAudio::ActiveState);
+ stateMachine.stop(QAudio::IOError, true);
+ QVERIFY(stateMachine.isDraining());
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(stateMachine.onDrained());
+ QVERIFY(!stateMachine.isDraining());
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QCOMPARE(stateMachine.state(), QAudio::StoppedState);
+ QCOMPARE(stateMachine.error(), QAudio::IOError);
+
+ QVERIFY(stateMachine.start());
+}
+
+void tst_QAudioStateMachine::onDrained_getsFailed_whenDrainHasntBeenCalled_data()
+{
+ generateNotStoppedPrevStates();
+ QTest::newRow("from Stopped State") << QAudio::StoppedState << QAudio::IOError;
+}
+
+void tst_QAudioStateMachine::onDrained_getsFailed_whenDrainHasntBeenCalled()
+{
+ QFETCH(QAudio::State, prevState);
+ QFETCH(QAudio::Error, prevError);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState, prevError);
+
+ QVERIFY(!stateMachine.onDrained());
+
+ QCOMPARE(stateMachine.state(), prevState);
+ QCOMPARE(stateMachine.error(), prevError);
+}
+
+void tst_QAudioStateMachine::updateActiveOrIdle_doesntChangeState_whenStateIsNotActiveOrIdle_data()
+{
+ generateStoppedAndSuspendedPrevStates();
+}
+
+void tst_QAudioStateMachine::updateActiveOrIdle_doesntChangeState_whenStateIsNotActiveOrIdle()
+{
+ QFETCH(QAudio::State, prevState);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(!stateMachine.updateActiveOrIdle(true));
+ QVERIFY(!stateMachine.updateActiveOrIdle(false));
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+}
+
+void tst_QAudioStateMachine::updateActiveOrIdle_changesState_whenStateIsActiveOrIdle_data()
+{
+ QTest::addColumn<QAudio::State>("prevState");
+ QTest::addColumn<QAudio::Error>("prevError");
+ QTest::addColumn<bool>("active");
+ QTest::addColumn<QAudio::Error>("error");
+
+ QTest::newRow("from ActiveState+NoError -> not active+NoError")
+ << QAudio::ActiveState << QAudio::NoError << false << QAudio::NoError;
+ QTest::newRow("from Idle(UnderrunError) -> active+NoError")
+ << QAudio::IdleState << QAudio::UnderrunError << true << QAudio::NoError;
+ QTest::newRow("from Idle(UnderrunError) -> not active+UnderrunError")
+ << QAudio::IdleState << QAudio::UnderrunError << false << QAudio::UnderrunError;
+}
+
+void tst_QAudioStateMachine::updateActiveOrIdle_changesState_whenStateIsActiveOrIdle()
+{
+ QFETCH(QAudio::State, prevState);
+ QFETCH(QAudio::Error, prevError);
+ QFETCH(bool, active);
+ QFETCH(QAudio::Error, error);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState, prevError);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ const auto expectedState = active ? QAudio::ActiveState : QAudio::IdleState;
+
+ auto notifier = stateMachine.updateActiveOrIdle(active, error);
+ QVERIFY(notifier);
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QCOMPARE(stateMachine.state(), expectedState);
+ QCOMPARE(stateMachine.error(), error);
+
+ notifier.reset();
+
+ QCOMPARE(stateSpy.size(), expectedState == prevState ? 0 : 1);
+ if (!stateSpy.empty())
+ QCOMPARE(stateSpy.front().front().value<QAudio::State>(), expectedState);
+
+ QCOMPARE(errorSpy.size(), prevError == error ? 0 : 1);
+ if (!errorSpy.empty())
+ QCOMPARE(errorSpy.front().front().value<QAudio::Error>(), error);
+
+ QCOMPARE(stateMachine.state(), expectedState);
+ QCOMPARE(stateMachine.error(), error);
+}
+
+void tst_QAudioStateMachine::suspendAndResume_saveAndRestoreState_whenStateIsActiveOrIdle_data()
+{
+ QTest::addColumn<QAudio::State>("prevState");
+ QTest::addColumn<QAudio::Error>("prevError");
+
+ QTest::newRow("from Active+NoError") << QAudio::ActiveState << QAudio::NoError;
+ QTest::newRow("from Idle+UnderrunError") << QAudio::IdleState << QAudio::UnderrunError;
+}
+
+void tst_QAudioStateMachine::suspendAndResume_saveAndRestoreState_whenStateIsActiveOrIdle()
+{
+ QFETCH(QAudio::State, prevState);
+ QFETCH(QAudio::Error, prevError);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState, prevError);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(stateMachine.suspend());
+
+ QCOMPARE(stateSpy.size(), 1);
+ QCOMPARE(stateSpy.front().front().value<QAudio::State>(), QAudio::SuspendedState);
+ QCOMPARE(errorSpy.size(), prevError == QAudio::NoError ? 0 : 1);
+
+ QCOMPARE(stateMachine.state(), QAudio::SuspendedState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+
+ stateSpy.clear();
+ errorSpy.clear();
+
+ QVERIFY(!stateMachine.suspend());
+ QVERIFY(stateMachine.resume());
+
+ QCOMPARE(stateSpy.size(), 1);
+ QCOMPARE(stateSpy.front().front().value<QAudio::State>(), prevState);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QCOMPARE(stateMachine.state(), prevState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+}
+
+void tst_QAudioStateMachine::suspend_doesntChangeState_whenStateIsNotActiveOrIdle_data()
+{
+ generateStoppedAndSuspendedPrevStates();
+}
+
+void tst_QAudioStateMachine::suspend_doesntChangeState_whenStateIsNotActiveOrIdle()
+{
+ QFETCH(QAudio::State, prevState);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(!stateMachine.suspend());
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QCOMPARE(stateMachine.state(), prevState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+}
+
+void tst_QAudioStateMachine::resume_doesntChangeState_whenStateIsNotSuspended_data()
+{
+ QTest::addColumn<QAudio::State>("prevState");
+
+ QTest::newRow("from StoppedState") << QAudio::StoppedState;
+ QTest::newRow("from ActiveState") << QAudio::ActiveState;
+ QTest::newRow("from IdleState") << QAudio::IdleState;
+}
+
+void tst_QAudioStateMachine::resume_doesntChangeState_whenStateIsNotSuspended()
+{
+ QFETCH(QAudio::State, prevState);
+
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ stateMachine.forceSetState(prevState);
+
+ QSignalSpy stateSpy(&changeNotifier, &QAudioStateChangeNotifier::stateChanged);
+ QSignalSpy errorSpy(&changeNotifier, &QAudioStateChangeNotifier::errorChanged);
+
+ QVERIFY(!stateMachine.resume());
+
+ QCOMPARE(stateSpy.size(), 0);
+ QCOMPARE(errorSpy.size(), 0);
+
+ QCOMPARE(stateMachine.state(), prevState);
+ QCOMPARE(stateMachine.error(), QAudio::NoError);
+}
+
+void tst_QAudioStateMachine::deleteNotifierInSlot_suppressesAdjacentSignal()
+{
+ auto changeNotifier = std::make_unique<QAudioStateChangeNotifier>();
+ QAudioStateMachine stateMachine(*changeNotifier);
+ stateMachine.start();
+
+ auto onSignal = [&]() {
+ QVERIFY2(changeNotifier, "The 2nd signal shouldn't be emitted");
+ changeNotifier.reset();
+ };
+
+ connect(changeNotifier.get(), &QAudioStateChangeNotifier::errorChanged,
+ this, onSignal, Qt::DirectConnection);
+ connect(changeNotifier.get(), &QAudioStateChangeNotifier::stateChanged,
+ this, onSignal, Qt::DirectConnection);
+
+ stateMachine.stop(QAudio::IOError);
+}
+
+void tst_QAudioStateMachine::twoThreadsToggleSuspendResumeAndIdleActive_statesAreConsistent()
+{
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ QVERIFY(stateMachine.start());
+ QCOMPARE(stateMachine.state(), QAudio::ActiveState);
+
+ std::atomic<int> signalsCount = 0;
+ std::atomic<int> changesCount = 0;
+
+ connect(&changeNotifier, &QAudioStateChangeNotifier::stateChanged,
+ this, [&](QAudio::State) { ++signalsCount; }, Qt::DirectConnection);
+
+ std::vector<std::atomic_int> counters(2);
+
+ auto threadSuspendResume = createTestThread(counters, 0, [&]() {
+ {
+ auto notifier = stateMachine.suspend();
+ QVERIFY(notifier);
+ QVERIFY(notifier.isStateChanged());
+ QCOMPARE(notifier.audioState(), QAudio::SuspendedState);
+ ++changesCount;
+ }
+
+ {
+ auto notifier = stateMachine.resume();
+ QVERIFY(notifier);
+ QVERIFY(notifier.isStateChanged());
+ QCOMPARE_NE(notifier.audioState(), QAudio::SuspendedState);
+ ++changesCount;
+ }
+ });
+
+ auto threadIdleActive = createTestThread(counters, 1, [&]() {
+ if (auto notifier = stateMachine.updateActiveOrIdle(false)) {
+ if (notifier.isStateChanged())
+ ++changesCount;
+
+ QCOMPARE(notifier.audioState(), QAudio::IdleState);
+ }
+
+ if (auto notifier = stateMachine.updateActiveOrIdle(true)) {
+ if (notifier.isStateChanged())
+ ++changesCount;
+
+ QCOMPARE(notifier.audioState(), QAudio::ActiveState);
+ }
+ });
+
+ threadSuspendResume->start();
+ threadIdleActive->start();
+
+ threadSuspendResume->wait();
+ threadIdleActive->wait();
+
+ if (QTest::currentTestFailed()) {
+ qDebug() << "counterSuspendResume:" << counters[0];
+ qDebug() << "counterIdleActive:" << counters[1];
+ }
+
+ QCOMPARE(signalsCount, changesCount);
+}
+
+void tst_QAudioStateMachine::twoThreadsToggleStartStop_statesAreConsistent()
+{
+ QAudioStateChangeNotifier changeNotifier;
+ QAudioStateMachine stateMachine(changeNotifier);
+
+ QVERIFY(stateMachine.start());
+ QCOMPARE(stateMachine.state(), QAudio::ActiveState);
+
+ std::atomic<int> signalsCount = 0;
+ std::atomic<int> changesCount = 0;
+
+ connect(&changeNotifier, &QAudioStateChangeNotifier::stateChanged,
+ this, [&](QAudio::State) { ++signalsCount; }, Qt::DirectConnection);
+
+ std::vector<std::atomic_int> counters(2);
+
+ auto threadStartActive = createTestThread(counters, 0, [&]() {
+ if (auto startNotifier = stateMachine.start()) {
+ QCOMPARE(startNotifier.prevAudioState(), QAudio::StoppedState);
+ QCOMPARE(startNotifier.audioState(), QAudio::ActiveState);
+ ++changesCount;
+ startNotifier.reset();
+
+ auto stopNotifier = stateMachine.stop();
+ ++changesCount;
+ QVERIFY(stopNotifier);
+ QCOMPARE(stopNotifier.prevAudioState(), QAudio::ActiveState);
+ }
+ });
+
+ auto threadStartIdle = createTestThread(counters, 1, [&]() {
+ if (auto startNotifier = stateMachine.start(false)) {
+ QCOMPARE(startNotifier.prevAudioState(), QAudio::StoppedState);
+ QCOMPARE(startNotifier.audioState(), QAudio::IdleState);
+ ++changesCount;
+ startNotifier.reset();
+
+ auto stopNotifier = stateMachine.stop();
+ ++changesCount;
+ QVERIFY(stopNotifier);
+ QCOMPARE(stopNotifier.audioState(), QAudio::StoppedState);
+ QCOMPARE(stopNotifier.prevAudioState(), QAudio::IdleState);
+ }
+ });
+
+ threadStartActive->start();
+ threadStartIdle->start();
+
+ threadStartActive->wait();
+ threadStartIdle->wait();
+
+ if (QTest::currentTestFailed()) {
+ qDebug() << "counterSuspendResume:" << counters[0];
+ qDebug() << "counterIdleActive:" << counters[1];
+ }
+
+ QCOMPARE(signalsCount, changesCount);
+}
+
+QTEST_GUILESS_MAIN(tst_QAudioStateMachine)
+
+#include "tst_qaudiostatemachine.moc"
diff --git a/tests/auto/unit/multimedia/qcamera/CMakeLists.txt b/tests/auto/unit/multimedia/qcamera/CMakeLists.txt
new file mode 100644
index 000000000..484793923
--- /dev/null
+++ b/tests/auto/unit/multimedia/qcamera/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qcamera.pro.
+
+#####################################################################
+## tst_qcamera Test:
+#####################################################################
+
+qt_internal_add_test(tst_multimedia_qcamera
+ SOURCES
+ tst_qcamera.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp b/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp
new file mode 100644
index 000000000..bd1972550
--- /dev/null
+++ b/tests/auto/unit/multimedia/qcamera/tst_qcamera.cpp
@@ -0,0 +1,845 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+
+#include <qvideosink.h>
+#include <private/qplatformcamera_p.h>
+#include <private/qplatformimagecapture_p.h>
+#include <qcamera.h>
+#include <qcameradevice.h>
+#include <qimagecapture.h>
+#include <qmediacapturesession.h>
+#include <qobject.h>
+#include <qmediadevices.h>
+
+#include "qmockintegration.h"
+#include "qmockmediacapturesession.h"
+#include "qmockcamera.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QCamera: public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void testSimpleCamera();
+ void testSimpleCameraWhiteBalance();
+ void testSimpleCameraExposure();
+ void testSimpleCameraFocus();
+ void testSimpleCameraCapture();
+
+ void testCameraWhiteBalance();
+ void testCameraExposure();
+ void testCameraFocus();
+ void testCameraCapture();
+ void testCameraCaptureMetadata();
+ void testCameraEncodingProperyChange();
+
+ void testConstructor();
+ void testQCameraIsAvailable();
+ void testErrorSignal();
+ void testError();
+ void testErrorString();
+
+ void testSetCameraFormat();
+
+ // Test cases to for focus handling
+ void testFocusMode();
+ void testZoomChanged();
+ void testMaxZoomChangedSignal();
+
+ // Test cases for QPlatformCamera class.
+ void testCameraControl();
+
+ void testSetVideoOutput();
+ void testSetVideoOutputDestruction();
+
+ void testEnumDebug();
+
+ // Signals test cases for exposure related properties
+ void testSignalExposureCompensationChanged();
+ void testSignalIsoSensitivityChanged();
+ void testSignalShutterSpeedChanged();
+ void testSignalFlashReady();
+};
+
+void tst_QCamera::initTestCase()
+{
+#ifdef Q_OS_MACOS
+ if (qEnvironmentVariable("QTEST_ENVIRONMENT").toLower() == "ci")
+ QSKIP("Flakiness on macOS CI, to be investigated, QTBUG-111812");
+#endif
+}
+
+void tst_QCamera::init()
+{
+}
+
+void tst_QCamera::cleanup()
+{
+}
+
+void tst_QCamera::testSimpleCamera()
+{
+ QMockCamera::Simple simple;
+ QCamera camera;
+
+ QCOMPARE(camera.isActive(), false);
+ camera.start();
+ QCOMPARE(camera.isActive(), true);
+ camera.stop();
+ QCOMPARE(camera.isActive(), false);
+}
+
+void tst_QCamera::testSimpleCameraWhiteBalance()
+{
+ QMockCamera::Simple simple;
+ QCamera camera;
+
+ //only WhiteBalanceAuto is supported
+ QVERIFY(camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceAuto));
+ QVERIFY(!camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceManual));
+ QVERIFY(!camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceCloudy));
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceAuto);
+ camera.setWhiteBalanceMode(QCamera::WhiteBalanceCloudy);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceAuto);
+ QCOMPARE(camera.colorTemperature(), 0);
+ camera.setColorTemperature(5000);
+ QCOMPARE(camera.colorTemperature(), 0);
+}
+
+void tst_QCamera::testSimpleCameraExposure()
+{
+ QMockCamera::Simple simple;
+
+ QCamera camera;
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureAuto));
+ QVERIFY(!camera.isExposureModeSupported(QCamera::ExposureManual));
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureAuto);
+ camera.setExposureMode(QCamera::ExposureManual);//should be ignored
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureAuto);
+
+ QVERIFY(!camera.isFlashModeSupported(QCamera::FlashOn));
+ QCOMPARE(camera.flashMode(), QCamera::FlashOff);
+ QCOMPARE(camera.isFlashReady(), false);
+ camera.setFlashMode(QCamera::FlashOn);
+ QCOMPARE(camera.flashMode(), QCamera::FlashOff);
+
+ QCOMPARE(camera.exposureCompensation(), 0.0);
+ camera.setExposureCompensation(2.0);
+ QCOMPARE(camera.exposureCompensation(), 0.0);
+
+ QCOMPARE(camera.isoSensitivity(), -1);
+ QCOMPARE(camera.minimumIsoSensitivity(), -1);
+ QCOMPARE(camera.maximumIsoSensitivity(), -1);
+ camera.setManualIsoSensitivity(100);
+ QCOMPARE(camera.isoSensitivity(), -1);
+ camera.setAutoIsoSensitivity();
+ QCOMPARE(camera.isoSensitivity(), -1);
+
+ QVERIFY(camera.exposureTime() < 0);
+ QCOMPARE(camera.minimumExposureTime(), -1.);
+ QCOMPARE(camera.maximumExposureTime(), -1.);
+ camera.setAutoExposureTime();
+ QVERIFY(camera.exposureTime() < 0);
+ camera.setManualExposureTime(1/128.0);
+ QVERIFY(camera.exposureTime() < 0);
+}
+
+void tst_QCamera::testSimpleCameraFocus()
+{
+ QMockCamera::Simple simple;
+
+ QCamera camera;
+
+ QVERIFY(camera.isFocusModeSupported(QCamera::FocusModeAuto));
+ QVERIFY(!camera.isFocusModeSupported(QCamera::FocusModeInfinity));
+
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeAuto);
+ camera.setFocusMode(QCamera::FocusModeInfinity);
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeAuto);
+
+ QCOMPARE(camera.maximumZoomFactor(), 1.0);
+ QCOMPARE(camera.minimumZoomFactor(), 1.0);
+ QCOMPARE(camera.zoomFactor(), 1.0);
+
+ camera.zoomTo(100.0, 100.0);
+ QCOMPARE(camera.zoomFactor(), 1.0);
+
+ QCOMPARE(camera.customFocusPoint(), QPointF(-1., -1.));
+ camera.setCustomFocusPoint(QPointF(1.0, 1.0));
+ QCOMPARE(camera.customFocusPoint(), QPointF(-1., -1.));
+}
+
+void tst_QCamera::testSimpleCameraCapture()
+{
+ QMockCamera::Simple simple;
+
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(!imageCapture.isReadyForCapture());
+ QVERIFY(imageCapture.isAvailable());
+
+ QCOMPARE(imageCapture.error(), QImageCapture::NoError);
+ QVERIFY(imageCapture.errorString().isEmpty());
+
+ QSignalSpy errorSignal(&imageCapture, &QImageCapture::errorOccurred);
+ imageCapture.captureToFile(QStringLiteral("/dev/null"));
+ QCOMPARE(errorSignal.size(), 1);
+ QCOMPARE(imageCapture.error(), QImageCapture::NotReadyError);
+ QVERIFY(!imageCapture.errorString().isEmpty());
+
+ camera.start();
+ imageCapture.captureToFile(QStringLiteral("/dev/null"));
+ QCOMPARE(errorSignal.size(), 1);
+ QCOMPARE(imageCapture.error(), QImageCapture::NoError);
+ QVERIFY(imageCapture.errorString().isEmpty());
+}
+
+void tst_QCamera::testCameraCapture()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(!imageCapture.isReadyForCapture());
+
+ QSignalSpy capturedSignal(&imageCapture, &QImageCapture::imageCaptured);
+ QSignalSpy errorSignal(&imageCapture, &QImageCapture::errorOccurred);
+
+ imageCapture.captureToFile(QStringLiteral("/dev/null"));
+ QCOMPARE(capturedSignal.size(), 0);
+ QCOMPARE(errorSignal.size(), 1);
+ QCOMPARE(imageCapture.error(), QImageCapture::NotReadyError);
+
+ errorSignal.clear();
+
+ camera.start();
+ QVERIFY(imageCapture.isReadyForCapture());
+ QCOMPARE(errorSignal.size(), 0);
+
+ imageCapture.captureToFile(QStringLiteral("/dev/null"));
+
+ QTRY_COMPARE(capturedSignal.size(), 1);
+ QCOMPARE(errorSignal.size(), 0);
+ QCOMPARE(imageCapture.error(), QImageCapture::NoError);
+}
+
+void tst_QCamera::testCameraCaptureMetadata()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy metadataSignal(&imageCapture, &QImageCapture::imageMetadataAvailable);
+ QSignalSpy savedSignal(&imageCapture, &QImageCapture::imageSaved);
+
+ camera.start();
+ int id = imageCapture.captureToFile(QStringLiteral("/dev/null"));
+
+ QTRY_COMPARE(savedSignal.size(), 1);
+
+ QCOMPARE(metadataSignal.size(), 1);
+
+ QVariantList metadata = metadataSignal[0];
+ QCOMPARE(metadata[0].toInt(), id);
+ QMediaMetaData data = metadata[1].value<QMediaMetaData>();
+ QCOMPARE(data.keys().size(), 2);
+ QCOMPARE(data[QMediaMetaData::Author].toString(), "Author");
+ QCOMPARE(data[QMediaMetaData::Date].toDateTime().date().year(), 2021);
+}
+
+void tst_QCamera::testCameraWhiteBalance()
+{
+ QCamera camera;
+
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceAuto);
+ camera.setWhiteBalanceMode(QCamera::WhiteBalanceFlash);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceAuto);
+ QVERIFY(camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceAuto));
+ QVERIFY(camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceManual));
+ QVERIFY(camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceSunlight));
+ QVERIFY(!camera.isWhiteBalanceModeSupported(QCamera::WhiteBalanceCloudy));
+
+ camera.setWhiteBalanceMode(QCamera::WhiteBalanceSunlight);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceSunlight);
+
+ camera.setWhiteBalanceMode(QCamera::WhiteBalanceManual);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceManual);
+ camera.setColorTemperature(4000);
+ QCOMPARE(camera.colorTemperature(), 4000);
+
+ camera.setColorTemperature(8000);
+ QCOMPARE(camera.colorTemperature(), 8000);
+
+ camera.setWhiteBalanceMode(QCamera::WhiteBalanceAuto);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceAuto);
+ camera.setColorTemperature(4000);
+ QCOMPARE(camera.colorTemperature(), 4000);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceManual);
+
+ camera.setColorTemperature(0);
+ QCOMPARE(camera.colorTemperature(), 0);
+ QCOMPARE(camera.whiteBalanceMode(), QCamera::WhiteBalanceAuto);
+}
+
+void tst_QCamera::testCameraExposure()
+{
+ QCamera camera;
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureAuto));
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureAuto);
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureManual));
+ camera.setExposureMode(QCamera::ExposureManual);
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureManual);
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureNight));
+ camera.setExposureMode(QCamera::ExposureNight);
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureNight);
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureSports ));
+ camera.setExposureMode(QCamera::ExposureSports);
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureSports);
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureSnow ));
+ camera.setExposureMode(QCamera::ExposureSnow);
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureSnow);
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposureBeach ));
+ camera.setExposureMode(QCamera::ExposureBeach);
+ QCOMPARE(camera.exposureMode(), QCamera::ExposureBeach);
+
+ QVERIFY(camera.isExposureModeSupported(QCamera::ExposurePortrait ));
+ camera.setExposureMode(QCamera::ExposurePortrait);
+ QCOMPARE(camera.exposureMode(), QCamera::ExposurePortrait);
+
+
+ camera.setFlashMode(QCamera::FlashAuto);
+ QCOMPARE(camera.flashMode(), QCamera::FlashAuto);
+ QCOMPARE(camera.isFlashReady(), true);
+ camera.setFlashMode(QCamera::FlashOn);
+ QCOMPARE(camera.flashMode(), QCamera::FlashOn);
+
+ QCOMPARE(camera.exposureCompensation(), 0.0);
+ camera.setExposureCompensation(2.0);
+ QCOMPARE(camera.exposureCompensation(), 2.0);
+
+ int minIso = camera.minimumIsoSensitivity();
+ int maxIso = camera.maximumIsoSensitivity();
+ QCOMPARE(camera.isoSensitivity(), 100);
+ QVERIFY(minIso > 0);
+ QVERIFY(maxIso > 0);
+ camera.setManualIsoSensitivity(minIso);
+ QCOMPARE(camera.isoSensitivity(), minIso);
+ camera.setManualIsoSensitivity(maxIso*10);
+ QCOMPARE(camera.isoSensitivity(), maxIso);
+
+ camera.setManualIsoSensitivity(-10);
+ QCOMPARE(camera.isoSensitivity(), minIso);
+ camera.setAutoIsoSensitivity();
+ QCOMPARE(camera.isoSensitivity(), 100);
+
+ qreal minExposureTime = camera.minimumExposureTime();
+ qreal maxExposureTime = camera.maximumExposureTime();
+ QVERIFY(minExposureTime > 0);
+ QVERIFY(maxExposureTime > 0);
+ QVERIFY(camera.exposureTime() >= minExposureTime);
+ QVERIFY(camera.exposureTime() <= maxExposureTime);
+
+ camera.setAutoExposureTime();
+ QVERIFY(camera.exposureTime() >= minExposureTime);
+ QVERIFY(camera.exposureTime() <= maxExposureTime);
+
+ camera.setManualExposureTime(0);
+ QCOMPARE(camera.exposureTime(), minExposureTime);
+
+ camera.setManualExposureTime(10000);
+ QCOMPARE(camera.exposureTime(), maxExposureTime);
+
+ camera.setAutoExposureTime();
+}
+
+void tst_QCamera::testCameraFocus()
+{
+ QCamera camera;
+
+ QVERIFY(camera.isFocusModeSupported(QCamera::FocusModeAuto));
+ QVERIFY(camera.isFocusModeSupported(QCamera::FocusModeAuto));
+ QVERIFY(!camera.isFocusModeSupported(QCamera::FocusModeInfinity));
+
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeAuto);
+ camera.setFocusMode(QCamera::FocusModeManual);
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeManual);
+ camera.setFocusMode(QCamera::FocusModeInfinity);
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeManual);
+ camera.setFocusMode(QCamera::FocusModeAuto);
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeAuto);
+
+ QVERIFY(camera.maximumZoomFactor() == 4.0);
+ QVERIFY(camera.minimumZoomFactor() == 1.0);
+ QCOMPARE(camera.zoomFactor(), 1.0);
+ camera.zoomTo(0.5, 1.0);
+ QCOMPARE(camera.zoomFactor(), 1.0);
+ camera.zoomTo(2.0, 0.5);
+ QCOMPARE(camera.zoomFactor(), 2.0);
+ camera.zoomTo(2.5, 1);
+ QCOMPARE(camera.zoomFactor(), 2.5);
+ camera.zoomTo(2000000.0, 0);
+ QCOMPARE(camera.zoomFactor(), camera.maximumZoomFactor());
+
+ QCOMPARE(camera.customFocusPoint(), QPointF(-1, -1));
+ camera.setCustomFocusPoint(QPointF(1.0, 1.0));
+ QCOMPARE(camera.customFocusPoint(), QPointF(1.0, 1.0));
+}
+
+void tst_QCamera::testCameraEncodingProperyChange()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy activeChangedSignal(&camera, &QCamera::activeChanged);
+
+ camera.start();
+ QCOMPARE(camera.isActive(), true);
+ QCOMPARE(activeChangedSignal.size(), 1);
+}
+
+void tst_QCamera::testSetVideoOutput()
+{
+ QMediaCaptureSession session;
+ QVideoSink surface;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QVERIFY(!session.videoOutput());
+
+ session.setVideoOutput(&surface);
+ QVERIFY(session.videoOutput() == &surface);
+ QVERIFY(session.videoSink() == &surface);
+
+ session.setVideoOutput(static_cast<QVideoSink *>(nullptr));
+ QVERIFY(session.videoOutput() == nullptr);
+ QVERIFY(session.videoSink() == nullptr);
+
+ session.setVideoOutput(&surface);
+ QVERIFY(session.videoOutput() == &surface);
+ QVERIFY(session.videoSink() == &surface);
+
+ session.setVideoSink(&surface);
+ QVERIFY(session.videoOutput() == nullptr);
+ QVERIFY(session.videoSink() == &surface);
+
+ session.setVideoOutput(&surface);
+ QVERIFY(session.videoOutput() == &surface);
+ QVERIFY(session.videoSink() == &surface);
+
+ session.setVideoSink(nullptr);
+ QVERIFY(session.videoOutput() == nullptr);
+ QVERIFY(session.videoSink() == nullptr);
+}
+
+
+
+void tst_QCamera::testSetVideoOutputDestruction()
+{
+ {
+ QVideoSink surface;
+ {
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QVERIFY(session.videoOutput() == nullptr);
+ session.setVideoOutput(&surface);
+ }
+ }
+
+ {
+ QMediaCaptureSession session;
+ {
+ QVideoSink surface;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QVERIFY(session.videoOutput() == nullptr);
+ session.setVideoOutput(&surface);
+ }
+ }
+
+ {
+ QCamera camera;
+ {
+ QMediaCaptureSession session;
+ QVideoSink surface;
+ session.setCamera(&camera);
+
+ QVERIFY(session.videoOutput() == nullptr);
+ session.setVideoOutput(&surface);
+ }
+ }
+ {
+ QMediaCaptureSession session;
+ {
+ QVideoSink surface;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QVERIFY(session.videoOutput() == nullptr);
+ session.setVideoOutput(&surface);
+ }
+ }
+}
+
+void tst_QCamera::testEnumDebug()
+{
+ QTest::ignoreMessage(QtDebugMsg, "QCamera::CameraError");
+ qDebug() << QCamera::CameraError;
+// QTest::ignoreMessage(QtDebugMsg, "QCameraDevice::FrontFace");
+// qDebug() << QCameraDevice::FrontFace;
+}
+
+void tst_QCamera::testCameraControl()
+{
+ QCamera camera;
+ QMockCamera *m_cameraControl = new QMockCamera(&camera);
+ QVERIFY(m_cameraControl != nullptr);
+}
+
+void tst_QCamera::testConstructor()
+{
+ auto cameras = QMediaDevices::videoInputs();
+ QCameraDevice defaultCamera = QMediaDevices::defaultVideoInput();
+ QCameraDevice frontCamera, backCamera;
+ for (const auto &c : cameras) {
+ if (frontCamera.isNull() && c.position() == QCameraDevice::FrontFace)
+ frontCamera = c;
+ if (backCamera.isNull() && c.position() == QCameraDevice::BackFace)
+ backCamera = c;
+ }
+ QVERIFY(!defaultCamera.isNull());
+ QVERIFY(!frontCamera.isNull());
+ QVERIFY(!backCamera.isNull());
+
+ {
+ QCamera camera;
+ QCOMPARE(camera.isAvailable(), true);
+ QCOMPARE(camera.error(), QCamera::NoError);
+ QCOMPARE(camera.cameraDevice(), defaultCamera);
+ }
+
+ {
+ QCamera camera(QCameraDevice::FrontFace);
+ QCOMPARE(camera.isAvailable(), true);
+ QCOMPARE(camera.error(), QCamera::NoError);
+ QCOMPARE(camera.cameraDevice(), frontCamera);
+ }
+
+ {
+ QCamera camera(QMediaDevices::defaultVideoInput());
+ QCOMPARE(camera.isAvailable(), true);
+ QCOMPARE(camera.error(), QCamera::NoError);
+ QCOMPARE(camera.cameraDevice(), defaultCamera);
+ }
+
+ {
+ QCameraDevice cameraDevice = QMediaDevices::videoInputs().at(0);
+ QCamera camera(cameraDevice);
+ QCOMPARE(camera.isAvailable(), true);
+ QCOMPARE(camera.error(), QCamera::NoError);
+ QCOMPARE(camera.cameraDevice(), cameraDevice);
+ }
+
+ {
+ QCamera camera(QCameraDevice::BackFace);
+ QCOMPARE(camera.isAvailable(), true);
+ QCOMPARE(camera.error(), QCamera::NoError);
+ QCOMPARE(camera.cameraDevice(), backCamera);
+ }
+
+ {
+ // Should load the default camera when UnspecifiedPosition is requested
+ QCamera camera(QCameraDevice::UnspecifiedPosition);
+ QCOMPARE(camera.isAvailable(), true);
+ QCOMPARE(camera.error(), QCamera::NoError);
+ QCOMPARE(camera.cameraDevice(), defaultCamera);
+ }
+}
+
+/* Test case for isAvailable */
+void tst_QCamera::testQCameraIsAvailable()
+{
+ QCamera camera;
+ QVERIFY(camera.isAvailable());
+}
+
+/* Test case for verifying if error signal generated correctly */
+void tst_QCamera::testErrorSignal()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+ auto *service = QMockIntegration::instance()->lastCaptureService();
+ Q_ASSERT(service);
+ Q_ASSERT(service->mockCameraControl);
+
+ QSignalSpy spyError(&camera, &QCamera::errorOccurred);
+
+ /* Set the QPlatformCamera error and verify if the signal is emitted correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError, QStringLiteral("Camera Error"));
+
+ QVERIFY(spyError.size() == 1);
+ QCamera::Error err = qvariant_cast<QCamera::Error >(spyError.at(0).at(0));
+ QVERIFY(err == QCamera::CameraError);
+
+ spyError.clear();
+
+ /* Set the QPlatformCamera error and verify if the signal is emitted correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError,
+ QStringLiteral("InvalidRequestError Error"));
+ QVERIFY(spyError.size() == 1);
+ err = qvariant_cast<QCamera::Error >(spyError.at(0).at(0));
+ QVERIFY(err == QCamera::CameraError);
+
+ spyError.clear();
+
+ /* Set the QPlatformCamera error and verify if the signal is emitted correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError,
+ QStringLiteral("NotSupportedFeatureError Error"));
+ QVERIFY(spyError.size() == 1);
+ err = qvariant_cast<QCamera::Error >(spyError.at(0).at(0));
+ QVERIFY(err == QCamera::CameraError);
+
+}
+
+/* Test case for verifying the QCamera error */
+void tst_QCamera::testError()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+ auto *service = QMockIntegration::instance()->lastCaptureService();
+
+ /* Set the QPlatformCamera error and verify if it is set correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError, QStringLiteral("Camera Error"));
+ QVERIFY(camera.error() == QCamera::CameraError);
+
+ /* Set the QPlatformCamera error and verify if it is set correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError,
+ QStringLiteral("InvalidRequestError Error"));
+ QVERIFY(camera.error() == QCamera::CameraError);
+
+ /* Set the QPlatformCamera error and verify if it is set correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError,
+ QStringLiteral("CameraError Error"));
+ QVERIFY(camera.error() == QCamera::CameraError);
+
+}
+
+/* Test the error strings for QCamera class */
+void tst_QCamera::testErrorString()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+ auto *service = QMockIntegration::instance()->lastCaptureService();
+
+ /* Set the QPlatformCamera error and verify if it is set correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError, QStringLiteral("Camera Error"));
+ QVERIFY(camera.errorString() == QStringLiteral("Camera Error"));
+
+ /* Set the QPlatformCamera error and verify if it is set correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError,
+ QStringLiteral("InvalidRequestError Error"));
+ QVERIFY(camera.errorString() == QStringLiteral("InvalidRequestError Error"));
+
+ /* Set the QPlatformCamera error and verify if it is set correctly in QCamera */
+ service->mockCameraControl->updateError(QCamera::CameraError,
+ QStringLiteral("CameraError Error"));
+ QVERIFY(camera.errorString() == QStringLiteral("CameraError Error"));
+}
+
+void tst_QCamera::testSetCameraFormat()
+{
+ QCamera camera;
+ QCameraDevice device = camera.cameraDevice();
+ auto videoFormats = device.videoFormats();
+ QVERIFY(videoFormats.size());
+ QCameraFormat cameraFormat = videoFormats.first();
+ QSignalSpy spy(&camera, &QCamera::cameraFormatChanged);
+ QVERIFY(spy.size() == 0);
+ camera.setCameraFormat(cameraFormat);
+ QCOMPARE(spy.size(), 1);
+ QCOMPARE(camera.cameraFormat(), cameraFormat);
+ QCOMPARE(camera.cameraFormat().pixelFormat(), QVideoFrameFormat::Format_ARGB8888);
+ QCOMPARE(camera.cameraFormat().resolution(), QSize(640, 480));
+ QCOMPARE(camera.cameraFormat().minFrameRate(), 0);
+ QCOMPARE(camera.cameraFormat().maxFrameRate(), 30);
+ QCOMPARE(spy.size(), 1);
+
+ spy.clear();
+ camera.setCameraFormat({});
+ QCOMPARE(spy.size(), 1);
+ QCOMPARE(camera.cameraFormat(), QCameraFormat());
+
+ spy.clear();
+ camera.setCameraDevice(QMediaDevices::videoInputs().at(1));
+ QCOMPARE(spy.size(), 1);
+ QCOMPARE(camera.cameraFormat(), QCameraFormat());
+ camera.setCameraFormat(camera.cameraDevice().videoFormats().first());
+ QCOMPARE(camera.cameraFormat().pixelFormat(), QVideoFrameFormat::Format_XRGB8888);
+ QCOMPARE(camera.cameraFormat().resolution(), QSize(1280, 720));
+ QCOMPARE(camera.cameraFormat().minFrameRate(), 0);
+ QCOMPARE(camera.cameraFormat().maxFrameRate(), 30);
+ QCOMPARE(spy.size(), 2);
+}
+
+//Added this code to cover QCamera::FocusModeHyperfocal and QCamera::FocusModeAutoNear
+//As the FocusModeHyperfocal and FocusModeAutoNear are not supported we can not set the focus mode to these Focus Modes
+void tst_QCamera::testFocusMode()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QVERIFY(!camera.isFocusModeSupported(QCamera::FocusModeInfinity));
+ QVERIFY(camera.isFocusModeSupported(QCamera::FocusModeAutoNear));
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeAuto);
+ camera.setFocusMode(QCamera::FocusModeInfinity);
+ QVERIFY(camera.focusMode() != QCamera::FocusModeInfinity);
+ QCOMPARE(camera.focusMode(), QCamera::FocusModeAuto);
+ camera.setFocusMode(QCamera::FocusModeAutoNear);
+ QVERIFY(camera.focusMode() == QCamera::FocusModeAutoNear);
+}
+
+void tst_QCamera::testZoomChanged()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QSignalSpy spy(&camera, &QCamera::zoomFactorChanged);
+ QVERIFY(spy.size() == 0);
+ camera.setZoomFactor(2.0);
+ QVERIFY(spy.size() == 1);
+ camera.zoomTo(3.0, 1);
+ QVERIFY(spy.size() == 2);
+ camera.zoomTo(1.0, 0);
+ QVERIFY(spy.size() == 3);
+}
+
+void tst_QCamera::testMaxZoomChangedSignal()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+ QMockCamera *mock = QMockIntegration::instance()->lastCamera();
+
+ // ### change max zoom factor on backend, e.g. by changing camera
+ QSignalSpy spy(&camera, &QCamera::maximumZoomFactorChanged);
+ mock->maximumZoomFactorChanged(55);
+ QVERIFY(spy.size() == 1);
+ QCOMPARE(camera.maximumZoomFactor(), 55);
+}
+
+void tst_QCamera::testSignalExposureCompensationChanged()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QSignalSpy spyExposureCompensationChanged(&camera, &QCamera::exposureCompensationChanged);
+
+ QVERIFY(spyExposureCompensationChanged.size() == 0);
+
+ QVERIFY(camera.exposureCompensation() != 800);
+ camera.setExposureCompensation(2.0);
+
+ QTest::qWait(100);
+
+ QVERIFY(camera.exposureCompensation() == 2.0);
+
+ QCOMPARE(spyExposureCompensationChanged.size(),1);
+
+ // Setting the same should not result in a signal
+ camera.setExposureCompensation(2.0);
+ QTest::qWait(100);
+
+ QVERIFY(camera.exposureCompensation() == 2.0);
+ QCOMPARE(spyExposureCompensationChanged.size(),1);
+}
+
+void tst_QCamera::testSignalIsoSensitivityChanged()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QSignalSpy spyisoSensitivityChanged(&camera, &QCamera::isoSensitivityChanged);
+
+ QVERIFY(spyisoSensitivityChanged.size() ==0);
+
+ camera.setManualIsoSensitivity(800); //set the manualiso sentivity to 800
+ QTest::qWait(100);
+ QVERIFY(spyisoSensitivityChanged.size() ==1);
+
+}
+void tst_QCamera::testSignalShutterSpeedChanged()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QSignalSpy spySignalExposureTimeChanged(&camera, &QCamera::exposureTimeChanged);
+
+ QVERIFY(spySignalExposureTimeChanged.size() == 0);
+
+ camera.setManualExposureTime(2.0);//set the ManualShutterSpeed to 2.0
+ QTest::qWait(100);
+
+ QVERIFY(spySignalExposureTimeChanged.size() ==1);
+}
+
+void tst_QCamera::testSignalFlashReady()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ session.setCamera(&camera);
+
+ QSignalSpy spyflashReady(&camera, &QCamera::flashReady);
+
+ QVERIFY(spyflashReady.size() == 0);
+
+ QVERIFY(camera.flashMode() == QCamera::FlashAuto);
+
+ camera.setFlashMode(QCamera::FlashOff);//set theFlashMode to QCamera::FlashOff
+
+ QVERIFY(camera.flashMode() == QCamera::FlashOff);
+
+ QCOMPARE(spyflashReady.size(), 1);
+}
+
+QTEST_MAIN(tst_QCamera)
+
+#include "tst_qcamera.moc"
diff --git a/tests/auto/unit/multimedia/qcameradevice/CMakeLists.txt b/tests/auto/unit/multimedia/qcameradevice/CMakeLists.txt
new file mode 100644
index 000000000..4d9977e8e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qcameradevice/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qcameradevice.pro.
+
+#####################################################################
+## tst_qcameradevice Test:
+#####################################################################
+
+qt_internal_add_test(tst_qcameradevice
+ SOURCES
+ tst_qcameradevice.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qcameradevice/tst_qcameradevice.cpp b/tests/auto/unit/multimedia/qcameradevice/tst_qcameradevice.cpp
new file mode 100644
index 000000000..455586243
--- /dev/null
+++ b/tests/auto/unit/multimedia/qcameradevice/tst_qcameradevice.cpp
@@ -0,0 +1,139 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+
+#include <qcamera.h>
+#include <qcameradevice.h>
+#include <qmediadevices.h>
+
+#include "qmockintegration.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+using namespace Qt::Literals;
+
+class tst_QCameraDevice: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void constructor();
+ void defaultCamera();
+ void availableCameras();
+ void equality_operators();
+ void qDebug_operator();
+};
+
+void tst_QCameraDevice::constructor()
+{
+ {
+ // default camera
+ QCamera camera;
+ QCameraDevice info(camera.cameraDevice());
+ QVERIFY(!info.isNull());
+ QCOMPARE(info.id(), u"default"_s);
+ QCOMPARE(info.description(), u"defaultCamera"_s);
+ QCOMPARE(info.position(), QCameraDevice::UnspecifiedPosition);
+ }
+
+ auto cameras = QMediaDevices::videoInputs();
+ QCameraDevice info;
+ for (const auto &c : cameras) {
+ if (c.position() == QCameraDevice::BackFace)
+ info = c;
+ }
+ QVERIFY(!info.isNull());
+
+ QCamera camera(info);
+ QCOMPARE(info, camera.cameraDevice());
+ QVERIFY(!info.isNull());
+ QCOMPARE(info.id(), u"back"_s);
+ QCOMPARE(info.description(), u"backCamera"_s);
+ QCOMPARE(info.position(), QCameraDevice::BackFace);
+
+ QCameraDevice info2(info);
+ QVERIFY(!info2.isNull());
+ QCOMPARE(info2.id(), u"back"_s);
+ QCOMPARE(info2.description(), u"backCamera"_s);
+ QCOMPARE(info2.position(), QCameraDevice::BackFace);
+}
+
+void tst_QCameraDevice::defaultCamera()
+{
+ QCameraDevice info = QMediaDevices::defaultVideoInput();
+
+ QVERIFY(!info.isNull());
+ QCOMPARE(info.id(), u"default"_s);
+ QCOMPARE(info.description(), u"defaultCamera"_s);
+ QCOMPARE(info.position(), QCameraDevice::UnspecifiedPosition);
+
+ QCamera camera(info);
+ QCOMPARE(camera.cameraDevice(), info);
+}
+
+void tst_QCameraDevice::availableCameras()
+{
+ QList<QCameraDevice> cameras = QMediaDevices::videoInputs();
+ QCOMPARE(cameras.size(), 3);
+
+ QCameraDevice info = cameras.at(0);
+ QVERIFY(!info.isNull());
+ QCOMPARE(info.id(), u"default"_s);
+ QCOMPARE(info.description(), u"defaultCamera"_s);
+ QCOMPARE(info.position(), QCameraDevice::UnspecifiedPosition);
+
+ info = cameras.at(1);
+ QVERIFY(!info.isNull());
+ QCOMPARE(info.id(), QStringLiteral("front"));
+ QCOMPARE(info.description(), QStringLiteral("frontCamera"));
+ QCOMPARE(info.position(), QCameraDevice::FrontFace);
+
+ QCOMPARE(cameras.size(), 3);
+ info = cameras.at(2);
+ QVERIFY(!info.isNull());
+ QCOMPARE(info.id(), u"back"_s);
+ QCOMPARE(info.description(), u"backCamera"_s);
+ QCOMPARE(info.position(), QCameraDevice::BackFace);
+}
+
+void tst_QCameraDevice::equality_operators()
+{
+ QCameraDevice defaultCamera = QMediaDevices::defaultVideoInput();
+ QList<QCameraDevice> cameras = QMediaDevices::videoInputs();
+
+ QVERIFY(defaultCamera == cameras.at(0));
+ QVERIFY(defaultCamera != cameras.at(1));
+ QVERIFY(cameras.at(0) != cameras.at(1));
+
+ {
+ QCamera camera(defaultCamera);
+ QVERIFY(camera.cameraDevice() == defaultCamera);
+ QVERIFY(camera.cameraDevice() == cameras.at(0));
+ }
+
+ {
+ QCamera camera(cameras.at(1));
+ QVERIFY(camera.cameraDevice() == cameras.at(1));
+ }
+}
+
+void tst_QCameraDevice::qDebug_operator()
+{
+ QString outputString;
+ QDebug debug(&outputString);
+ debug.nospace();
+
+ QCameraDevice defaultCamera = QMediaDevices::defaultVideoInput();
+ debug << defaultCamera;
+
+ QCOMPARE(outputString,
+ u"\"QCameraDevice(name=defaultCamera, id=default, position=UnspecifiedPosition)\" "_s);
+}
+
+QTEST_MAIN(tst_QCameraDevice)
+
+#include "tst_qcameradevice.moc"
diff --git a/tests/auto/unit/multimedia/qerrorinfo/CMakeLists.txt b/tests/auto/unit/multimedia/qerrorinfo/CMakeLists.txt
new file mode 100644
index 000000000..ea6ac5690
--- /dev/null
+++ b/tests/auto/unit/multimedia/qerrorinfo/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qerrorinfo
+ SOURCES
+ tst_qerrorinfo.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qerrorinfo/tst_qerrorinfo.cpp b/tests/auto/unit/multimedia/qerrorinfo/tst_qerrorinfo.cpp
new file mode 100644
index 000000000..0d266705d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qerrorinfo/tst_qerrorinfo.cpp
@@ -0,0 +1,117 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+// TESTED_COMPONENT=src/multimedia
+
+#include <QtTest/QtTest>
+#include <QSignalSpy>
+#include <private/qerrorinfo_p.h>
+
+QT_USE_NAMESPACE
+
+enum class TestError { ErrorA, ErrorB, NoError };
+
+using TestErrorInfo = QErrorInfo<TestError>;
+
+class TestNotifier : public QObject
+{
+ Q_OBJECT
+public:
+signals:
+ void errorOccurred(TestError error, QString errorDescription);
+ void errorChanged();
+};
+
+class tst_QErrorInfo : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void defaultConstructor_setsNoError();
+ void constructor_setsPassedError();
+
+ void setAndNotify_setsErrorAndNotifes_data();
+ void setAndNotify_setsErrorAndNotifes();
+};
+
+void tst_QErrorInfo::defaultConstructor_setsNoError()
+{
+ TestErrorInfo errorInfo;
+ QCOMPARE(errorInfo.code(), TestError::NoError);
+ QCOMPARE(errorInfo.description(), QString());
+}
+
+void tst_QErrorInfo::constructor_setsPassedError()
+{
+ TestErrorInfo errorInfo(TestError::ErrorB, "test error");
+ QCOMPARE(errorInfo.code(), TestError::ErrorB);
+ QCOMPARE(errorInfo.description(), "test error");
+}
+
+void tst_QErrorInfo::setAndNotify_setsErrorAndNotifes_data()
+{
+ QTest::addColumn<TestError>("initialError");
+ QTest::addColumn<QString>("initialErrorDescription");
+ QTest::addColumn<TestError>("error");
+ QTest::addColumn<QString>("errorDescription");
+ QTest::addColumn<bool>("errorChangedEmitted");
+ QTest::addColumn<bool>("errorOccurredEmitted");
+
+ QTest::newRow("No error -> No error")
+ << TestError::NoError << QString() << TestError::NoError << QString() << false << false;
+ QTest::newRow("No error -> An error with empty string")
+ << TestError::NoError << QString() << TestError::ErrorA << QString() << true << true;
+ QTest::newRow("No error -> An error with non-empty string")
+ << TestError::NoError << QString() << TestError::ErrorB << QStringLiteral("error") << true
+ << true;
+ QTest::newRow("An error with empty string -> No error")
+ << TestError::ErrorA << QString() << TestError::NoError << QString() << true << false;
+ QTest::newRow("An error with non-empty string -> No Error")
+ << TestError::ErrorA << QStringLiteral("error") << TestError::NoError << QString() << true
+ << false;
+ QTest::newRow("An error -> Another error")
+ << TestError::ErrorA << QStringLiteral("error A") << TestError::ErrorB << QStringLiteral("error B")
+ << true << true;
+ QTest::newRow("An error -> Another error with empty string")
+ << TestError::ErrorA << QStringLiteral("error A") << TestError::ErrorB << QString() << true
+ << true;
+ QTest::newRow("An error -> The same error with changed string")
+ << TestError::ErrorA << QStringLiteral("error") << TestError::ErrorA
+ << QStringLiteral("another error") << true << true;
+}
+
+void tst_QErrorInfo::setAndNotify_setsErrorAndNotifes()
+{
+ QFETCH(TestError, initialError);
+ QFETCH(QString, initialErrorDescription);
+ QFETCH(TestError, error);
+ QFETCH(QString, errorDescription);
+ QFETCH(bool, errorChangedEmitted);
+ QFETCH(bool, errorOccurredEmitted);
+
+ TestErrorInfo errorInfo(initialError, initialErrorDescription);
+
+ TestNotifier notifier;
+ QSignalSpy errorOccurredSpy(&notifier, &TestNotifier::errorOccurred);
+ QSignalSpy errorChangedSpy(&notifier, &TestNotifier::errorChanged);
+
+ errorInfo.setAndNotify(error, errorDescription, notifier);
+
+ QCOMPARE(errorInfo.code(), error);
+ QCOMPARE(errorInfo.description(), errorDescription);
+
+ QList<QList<QVariant>> expectedErrorChanged;
+ if (errorChangedEmitted)
+ expectedErrorChanged.push_back({});
+
+ QList<QList<QVariant>> expectedErrorOccured;
+ if (errorOccurredEmitted)
+ expectedErrorOccured.push_back({ QVariant::fromValue(error), errorDescription });
+
+ QCOMPARE(errorOccurredSpy, expectedErrorOccured);
+ QCOMPARE(errorChangedSpy, expectedErrorChanged);
+}
+
+QTEST_GUILESS_MAIN(tst_QErrorInfo)
+
+#include "tst_qerrorinfo.moc"
diff --git a/tests/auto/unit/multimedia/qimagecapture/CMakeLists.txt b/tests/auto/unit/multimedia/qimagecapture/CMakeLists.txt
new file mode 100644
index 000000000..908154cf9
--- /dev/null
+++ b/tests/auto/unit/multimedia/qimagecapture/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qimagecapture.pro.
+
+#####################################################################
+## tst_qimagecapture Test:
+#####################################################################
+
+qt_internal_add_test(tst_qimagecapture
+ SOURCES
+ tst_qimagecapture.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qimagecapture/tst_qimagecapture.cpp b/tests/auto/unit/multimedia/qimagecapture/tst_qimagecapture.cpp
new file mode 100644
index 000000000..3267b6f40
--- /dev/null
+++ b/tests/auto/unit/multimedia/qimagecapture/tst_qimagecapture.cpp
@@ -0,0 +1,284 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+
+#include <private/qplatformcamera_p.h>
+#include <private/qplatformimagecapture_p.h>
+#include <qcamera.h>
+#include <qimagecapture.h>
+#include <qmediacapturesession.h>
+
+#include "qmockmediacapturesession.h"
+#include "qmockintegration.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QImageCapture: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void constructor();
+ void isAvailable();
+ void deleteMediaSource();
+ void isReadyForCapture();
+ void capture();
+ void encodingSettings();
+ void errors();
+ void error();
+ void imageCaptured();
+ void imageExposed();
+ void imageSaved();
+ void readyForCaptureChanged();
+};
+
+void tst_QImageCapture::constructor()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(imageCapture.isAvailable() == true);
+}
+
+void tst_QImageCapture::isAvailable()
+{
+ {
+ QMediaCaptureSession session;
+ QImageCapture imageCapture;
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(!imageCapture.isAvailable());
+ }
+
+ {
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(imageCapture.isAvailable());
+ }
+}
+
+void tst_QImageCapture::deleteMediaSource()
+{
+ QMediaCaptureSession session;
+ QCamera *camera = new QCamera;
+ QImageCapture *capture = new QImageCapture;
+ session.setCamera(camera);
+ session.setImageCapture(capture);
+
+ QVERIFY(capture->isAvailable());
+
+ delete camera;
+
+ QVERIFY(session.camera() == nullptr);
+ QVERIFY(!capture->isAvailable());
+
+ capture->captureToFile();
+ delete capture;
+}
+
+void tst_QImageCapture::isReadyForCapture()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(imageCapture.isAvailable() == true);
+ QVERIFY(imageCapture.isReadyForCapture() == false);
+ camera.start();
+ QVERIFY(imageCapture.isReadyForCapture() == true);
+ imageCapture.captureToFile();
+ QTRY_VERIFY(imageCapture.isReadyForCapture());
+ camera.stop();
+}
+
+void tst_QImageCapture::capture()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(imageCapture.isAvailable() == true);
+ QVERIFY(imageCapture.isReadyForCapture() == false);
+ QVERIFY(imageCapture.captureToFile() == -1);
+ camera.start();
+ QVERIFY(imageCapture.isReadyForCapture() == true);
+ QTest::qWait(300);
+ QVERIFY(imageCapture.captureToFile() != -1);
+ camera.stop();
+}
+
+void tst_QImageCapture::encodingSettings()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(imageCapture.isAvailable() == true);
+ imageCapture.setFileFormat(QImageCapture::JPEG);
+ imageCapture.setQuality(QImageCapture::NormalQuality);
+ QVERIFY(imageCapture.fileFormat() == QImageCapture::JPEG);
+ QVERIFY(imageCapture.quality() == QImageCapture::NormalQuality);
+}
+
+void tst_QImageCapture::errors()
+{
+ QMockCamera::Simple simple;
+
+ {
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QVERIFY(imageCapture.isAvailable() == true);
+ imageCapture.captureToFile(QStringLiteral("/dev/null"));
+ QCOMPARE(imageCapture.error(), QImageCapture::NotReadyError);
+ QVERIFY(!imageCapture.errorString().isEmpty());
+ }
+
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+ camera.start();
+
+ QVERIFY(imageCapture.isAvailable() == true);
+ QVERIFY(imageCapture.error() == QImageCapture::NoError);
+ QVERIFY(imageCapture.errorString().isEmpty());
+
+ imageCapture.captureToFile();
+ QVERIFY(imageCapture.error() == QImageCapture::NoError);
+ QVERIFY(imageCapture.errorString().isEmpty());
+}
+
+void tst_QImageCapture::error()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy spy(&imageCapture, &QImageCapture::errorOccurred);
+ imageCapture.captureToFile();
+ QTest::qWait(30);
+ QVERIFY(spy.size() == 1);
+ QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) == -1);
+ QVERIFY(qvariant_cast<QImageCapture::Error>(spy.at(0).at(1)) == QImageCapture::NotReadyError);
+ QVERIFY(qvariant_cast<QString>(spy.at(0).at(2)) == "Could not capture in stopped state");
+ spy.clear();
+}
+
+void tst_QImageCapture::imageCaptured()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy spy(&imageCapture, &QImageCapture::imageCaptured);
+ QVERIFY(imageCapture.isAvailable() == true);
+ QVERIFY(imageCapture.isReadyForCapture() == false);
+ camera.start();
+ imageCapture.captureToFile();
+ QTRY_VERIFY(imageCapture.isReadyForCapture());
+
+ QVERIFY(spy.size() == 1);
+ QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) > 0);
+ QImage image = qvariant_cast<QImage>(spy.at(0).at(1));
+ QVERIFY(image.isNull() == true);
+ spy.clear();
+ camera.stop();
+}
+
+void tst_QImageCapture::imageExposed()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy spy(&imageCapture, &QImageCapture::imageExposed);
+ QVERIFY(imageCapture.isAvailable() == true);
+ QVERIFY(imageCapture.isReadyForCapture() == false);
+ camera.start();
+ imageCapture.captureToFile();
+ QTRY_VERIFY(imageCapture.isReadyForCapture());
+
+ QVERIFY(spy.size() == 1);
+ QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) > 0);
+ spy.clear();
+ camera.stop();
+}
+
+void tst_QImageCapture::imageSaved()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy spy(&imageCapture, &QImageCapture::imageSaved);
+ QVERIFY(imageCapture.isAvailable() == true);
+ QVERIFY(imageCapture.isReadyForCapture() == false);
+ camera.start();
+ imageCapture.captureToFile(QStringLiteral("/usr/share"));
+ QTRY_VERIFY(imageCapture.isReadyForCapture());
+
+ QVERIFY(spy.size() == 1);
+ QVERIFY(qvariant_cast<int>(spy.at(0).at(0)) > 0);
+ QVERIFY(qvariant_cast<QString>(spy.at(0).at(1)) == "/usr/share");
+ spy.clear();
+ camera.stop();
+}
+
+void tst_QImageCapture::readyForCaptureChanged()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QImageCapture imageCapture;
+ session.setCamera(&camera);
+ session.setImageCapture(&imageCapture);
+
+ QSignalSpy spy(&imageCapture, &QImageCapture::readyForCaptureChanged);
+ QVERIFY(imageCapture.isReadyForCapture() == false);
+ imageCapture.captureToFile();
+ QTest::qWait(100);
+ QVERIFY(spy.size() == 0);
+ QVERIFY2(!imageCapture.errorString().isEmpty(),"Could not capture in stopped state" );
+ camera.start();
+ QTest::qWait(100);
+ imageCapture.captureToFile();
+ QTest::qWait(100);
+ QVERIFY(spy.size() == 2);
+ QVERIFY(spy.at(0).at(0).toBool() == false);
+ QVERIFY(spy.at(1).at(0).toBool() == true);
+ camera.stop();
+ spy.clear();
+}
+
+QTEST_MAIN(tst_QImageCapture)
+
+#include "tst_qimagecapture.moc"
diff --git a/tests/auto/unit/multimedia/qmaybe/CMakeLists.txt b/tests/auto/unit/multimedia/qmaybe/CMakeLists.txt
new file mode 100644
index 000000000..a9053e87c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmaybe/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qmaybe
+ SOURCES
+ tst_qmaybe.cpp
+ LIBRARIES
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qmaybe/tst_qmaybe.cpp b/tests/auto/unit/multimedia/qmaybe/tst_qmaybe.cpp
new file mode 100644
index 000000000..fbf21a26d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmaybe/tst_qmaybe.cpp
@@ -0,0 +1,124 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <private/qmaybe_p.h>
+#include <QtCore/private/quniquehandle_p.h>
+#ifdef Q_OS_WINDOWS
+#include <private/qcomptr_p.h>
+#include <private/qcomobject_p.h>
+#endif
+
+QT_USE_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
+namespace {
+
+// Helpers used to verify interop with QUniqueHandle and ComPtr which
+// overloads operator&
+struct DummyHandleTraits
+{
+ using Type = int;
+ static Type invalidValue() { return -1; }
+ static bool close(Type /*handle*/) { return true; }
+};
+
+using DummyHandle = QUniqueHandle<DummyHandleTraits>;
+
+#ifdef Q_OS_WINDOWS
+struct DummyComObject : QComObject<IUnknown>
+{
+};
+#endif
+
+} // namespace
+
+//clang-format off
+
+class tst_QMaybe : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void operatorBool_returnsFalse_onlyWhenErrorSet()
+ {
+ {
+ const QMaybe<QString, int> error{ -1 }; // TOOD: Is it safe to deduce expected/unexpected only based on type?
+ QVERIFY(!static_cast<bool>(error));
+ }
+
+ {
+ const QMaybe<QString, int> success{ "It worked!"_L1 };
+ QVERIFY(static_cast<bool>(success));
+ }
+ }
+
+ void value_returnsReferenceToValue_whenValueSet()
+ {
+ {
+ QMaybe mutableVal{ 1 };
+ mutableVal.value() = 2;
+ QCOMPARE_EQ(*mutableVal, 2); // value() must have returned a mutable reference
+ }
+
+ {
+ const QMaybe immutableVal{ 2 };
+ QCOMPARE_EQ(*std::addressof(immutableVal.value()), 2); // value() must have returned a reference
+ static_assert(std::is_const_v<std::remove_reference_t<decltype(immutableVal.value())>>); // And it is const
+ }
+ }
+
+ void dereferenceOperator_returnsPointerToValue_whenValueTypeOverloadsAddressOfOperator()
+ {
+ {
+ QMaybe<DummyHandle, int> mutableValue{ DummyHandle{ 1 } };
+ QCOMPARE_EQ(mutableValue->get(), 1);
+ QVERIFY(mutableValue->isValid()); // We did not accidentally call operator& that resets
+ // QUniqueHandle
+ }
+
+ {
+ const QMaybe<DummyHandle, int> immutableValue{ DummyHandle{ 2 } };
+ QCOMPARE_EQ(immutableValue->get(), 2);
+ QVERIFY(immutableValue->isValid()); // We did not accidentally call operator& that
+ // resets QUniqueHandle
+ }
+ }
+
+#ifdef Q_OS_WINDOWS
+ void dereferenceOperator_returnsPointerToValue_whenValueIsComPtr()
+ {
+ // Similar test as with QUniqueHandle, but with ComPtr that is used
+ // frequently on Windows and may behave slightly differently
+
+ {
+ QMaybe<ComPtr<DummyComObject>, HRESULT> mutableObject{
+ makeComObject<DummyComObject>()
+ };
+ QCOMPARE_NE(mutableObject->Get(), nullptr);
+
+ const ComPtr<IUnknown> unknownFromMutable = mutableObject.value();
+ QVERIFY(unknownFromMutable); // We did not accidentally call operator& that resets
+ // QUniqueHandle
+ }
+
+ {
+ QMaybe<ComPtr<DummyComObject>, HRESULT> immutableObject{
+ makeComObject<DummyComObject>()
+ };
+ QCOMPARE_NE(immutableObject->Get(), nullptr);
+
+ const ComPtr<IUnknown> unknownFromImmutable = immutableObject.value();
+ QVERIFY(unknownFromImmutable); // We did not accidentally call operator& that resets
+ // QUniqueHandle
+ }
+ }
+#endif
+};
+
+QTEST_APPLESS_MAIN(tst_QMaybe)
+
+#include "tst_qmaybe.moc"
+
+//clang-format on
diff --git a/tests/auto/unit/multimedia/qmediacapture_gstreamer/CMakeLists.txt b/tests/auto/unit/multimedia/qmediacapture_gstreamer/CMakeLists.txt
new file mode 100644
index 000000000..209be5883
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediacapture_gstreamer/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_qmediacapture_gstreamer Test:
+#####################################################################
+
+qt_internal_add_test(tst_qmediacapture_gstreamer
+ SOURCES
+ tst_qmediacapture_gstreamer.cpp
+ ../../../shared/qscopedenvironmentvariable.h
+ INCLUDE_DIRECTORIES
+ ../../../shared
+ LIBRARIES
+ Qt::Multimedia
+ Qt::MultimediaPrivate
+ Qt::QGstreamerMediaPluginPrivate
+)
diff --git a/tests/auto/unit/multimedia/qmediacapture_gstreamer/tst_qmediacapture_gstreamer.cpp b/tests/auto/unit/multimedia/qmediacapture_gstreamer/tst_qmediacapture_gstreamer.cpp
new file mode 100644
index 000000000..7fe6a06ac
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediacapture_gstreamer/tst_qmediacapture_gstreamer.cpp
@@ -0,0 +1,212 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QtMultimedia/QAudioDevice>
+#include <QtMultimedia/QAudioInput>
+#include <QtMultimedia/QAudioOutput>
+#include <QtMultimedia/QCamera>
+#include <QtMultimedia/QMediaCaptureSession>
+#include <QtMultimedia/private/qgstreamer_platformspecificinterface_p.h>
+#include <QtMultimedia/private/qplatformmediacapture_p.h>
+#include <QtQGstreamerMediaPlugin/private/qgstpipeline_p.h>
+
+#include <qscopedenvironmentvariable.h>
+
+#include <memory>
+
+// NOLINTBEGIN(readability-convert-member-functions-to-static)
+
+QT_USE_NAMESPACE
+
+using namespace Qt::Literals;
+
+class tst_QMediaCaptureGStreamer : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QMediaCaptureGStreamer();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void mediaIntegration_hasPlatformSpecificInterface();
+ void constructor_preparesGstPipeline();
+ void audioInput_makeCustomGStreamerAudioInput_fromPipelineDescription();
+ void audioOutput_makeCustomGStreamerAudioOutput_fromPipelineDescription();
+
+ void makeCustomGStreamerCamera_fromPipelineDescription();
+ void makeCustomGStreamerCamera_fromPipelineDescription_multipleItems();
+ void makeCustomGStreamerCamera_fromPipelineDescription_userProvidedGstElement();
+
+private:
+ std::unique_ptr<QMediaCaptureSession> session;
+
+ QGStreamerPlatformSpecificInterface *gstInterface()
+ {
+ return QGStreamerPlatformSpecificInterface::instance();
+ }
+
+ GstPipeline *getGstPipeline()
+ {
+ auto *iface = QGStreamerPlatformSpecificInterface::instance();
+ return iface ? iface->gstPipeline(session.get()) : nullptr;
+ }
+
+ QGstPipeline getPipeline()
+ {
+ return QGstPipeline{
+ getGstPipeline(),
+ QGstPipeline::NeedsRef,
+ };
+ }
+
+ void dumpGraph(const char *fileNamePrefix)
+ {
+ GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(getGstPipeline()),
+ GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_VERBOSE),
+ fileNamePrefix);
+ }
+};
+
+tst_QMediaCaptureGStreamer::tst_QMediaCaptureGStreamer()
+{
+ qputenv("QT_MEDIA_BACKEND", "gstreamer");
+}
+
+void tst_QMediaCaptureGStreamer::init()
+{
+ session = std::make_unique<QMediaCaptureSession>();
+}
+
+void tst_QMediaCaptureGStreamer::cleanup()
+{
+ session.reset();
+}
+
+void tst_QMediaCaptureGStreamer::mediaIntegration_hasPlatformSpecificInterface()
+{
+ QVERIFY(QGStreamerPlatformSpecificInterface::instance());
+}
+
+void tst_QMediaCaptureGStreamer::constructor_preparesGstPipeline()
+{
+ auto *rawPipeline = getGstPipeline();
+ QVERIFY(rawPipeline);
+
+ QGstPipeline pipeline{
+ rawPipeline,
+ QGstPipeline::NeedsRef,
+ };
+ QVERIFY(pipeline);
+
+ dumpGraph("constructor_preparesGstPipeline");
+}
+
+void tst_QMediaCaptureGStreamer::audioInput_makeCustomGStreamerAudioInput_fromPipelineDescription()
+{
+ auto pipelineString =
+ "audiotestsrc wave=2 freq=200 name=myOscillator ! identity name=myConverter"_ba;
+
+ QAudioInput input{
+ gstInterface()->makeCustomGStreamerAudioInput(pipelineString),
+ };
+
+ session->setAudioInput(&input);
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+
+ pipeline.finishStateChange();
+
+ QVERIFY(pipeline.findByName("myOscillator"));
+ QVERIFY(pipeline.findByName("myConverter"));
+
+ dumpGraph("audioInput_customAudioDevice");
+}
+
+void tst_QMediaCaptureGStreamer::
+ audioOutput_makeCustomGStreamerAudioOutput_fromPipelineDescription()
+{
+ auto pipelineStringInput =
+ "audiotestsrc wave=2 freq=200 name=myOscillator ! identity name=myConverter"_ba;
+ QAudioInput input{
+ gstInterface()->makeCustomGStreamerAudioInput(pipelineStringInput),
+ };
+ session->setAudioInput(&input);
+
+ auto pipelineStringOutput = "identity name=myConverter ! fakesink name=mySink"_ba;
+ QAudioOutput output{
+ gstInterface()->makeCustomGStreamerAudioOutput(pipelineStringOutput),
+ };
+ session->setAudioOutput(&output);
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+
+ pipeline.finishStateChange();
+
+ QVERIFY(pipeline.findByName("mySink"));
+ QVERIFY(pipeline.findByName("myConverter"));
+
+ dumpGraph("audioOutput_customAudioDevice");
+}
+
+void tst_QMediaCaptureGStreamer::makeCustomGStreamerCamera_fromPipelineDescription()
+{
+ auto pipelineString = "videotestsrc name=mySrc"_ba;
+ QCamera *cam =
+ gstInterface()->makeCustomGStreamerCamera(pipelineString, /*parent=*/session.get());
+
+ session->setCamera(cam);
+ cam->start();
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+ QVERIFY(pipeline.findByName("mySrc"));
+ dumpGraph("makeCustomGStreamerCamera_fromPipelineDescription");
+}
+
+void tst_QMediaCaptureGStreamer::makeCustomGStreamerCamera_fromPipelineDescription_multipleItems()
+{
+ auto pipelineString = "videotestsrc name=mySrc ! gamma gamma=2.0 name=myFilter"_ba;
+ QCamera *cam =
+ gstInterface()->makeCustomGStreamerCamera(pipelineString, /*parent=*/session.get());
+
+ session->setCamera(cam);
+ cam->start();
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+ QVERIFY(pipeline.findByName("mySrc"));
+ QVERIFY(pipeline.findByName("myFilter"));
+ dumpGraph("makeCustomGStreamerCamera_fromPipelineDescription_multipleItems");
+}
+
+void tst_QMediaCaptureGStreamer::
+ makeCustomGStreamerCamera_fromPipelineDescription_userProvidedGstElement()
+{
+ QGstElement element = QGstElement::createFromPipelineDescription("videotestsrc");
+ gst_element_set_name(element.element(), "mySrc");
+
+ QCamera *cam =
+ gstInterface()->makeCustomGStreamerCamera(element.element(), /*parent=*/session.get());
+
+ session->setCamera(cam);
+ cam->start();
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+ QCOMPARE(pipeline.findByName("mySrc"), element);
+ dumpGraph("makeCustomGStreamerCamera_fromPipelineDescription_userProvidedGstElement");
+
+ element.set("foreground-color", 0xff0000);
+ dumpGraph("makeCustomGStreamerCamera_fromPipelineDescription_userProvidedGstElement2");
+}
+
+QTEST_GUILESS_MAIN(tst_QMediaCaptureGStreamer)
+
+#include "tst_qmediacapture_gstreamer.moc"
diff --git a/tests/auto/unit/multimedia/qmediadevices/CMakeLists.txt b/tests/auto/unit/multimedia/qmediadevices/CMakeLists.txt
new file mode 100644
index 000000000..e8360f8b5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediadevices/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qmediadevices
+ SOURCES
+ tst_qmediadevices.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qmediadevices/tst_qmediadevices.cpp b/tests/auto/unit/multimedia/qmediadevices/tst_qmediadevices.cpp
new file mode 100644
index 000000000..9767c0e73
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediadevices/tst_qmediadevices.cpp
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+
+#include <qmediadevices.h>
+
+#include "qmockintegration.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QMediaDevices : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void videoInputsChangedEmitted_whenCamerasChanged();
+ void onlyVideoInputsChangedEmitted_when2MediaDevicesCreated_andCamerasChanged();
+};
+
+void tst_QMediaDevices::videoInputsChangedEmitted_whenCamerasChanged()
+{
+ QMediaDevices mediaDevices;
+ QSignalSpy videoInputsSpy(&mediaDevices, &QMediaDevices::videoInputsChanged);
+
+ QCOMPARE(videoInputsSpy.size(), 0);
+
+ QMockIntegration::instance()->addNewCamera();
+ QTRY_COMPARE(videoInputsSpy.size(), 1);
+
+ QMockIntegration::instance()->addNewCamera();
+ QCOMPARE(videoInputsSpy.size(), 2);
+}
+
+void tst_QMediaDevices::onlyVideoInputsChangedEmitted_when2MediaDevicesCreated_andCamerasChanged()
+{
+ QMediaDevices mediaDevicesA;
+ QMediaDevices mediaDevicesB;
+
+ QSignalSpy videoInputsSpyA(&mediaDevicesA, &QMediaDevices::videoInputsChanged);
+ QSignalSpy videoInputsSpyB(&mediaDevicesB, &QMediaDevices::videoInputsChanged);
+ QSignalSpy audioInputsSpy(&mediaDevicesA, &QMediaDevices::audioInputsChanged);
+ QSignalSpy audioOutputsSpy(&mediaDevicesA, &QMediaDevices::audioOutputsChanged);
+
+ QMockIntegration::instance()->addNewCamera();
+ QCOMPARE(videoInputsSpyA.size(), 1);
+ QCOMPARE(videoInputsSpyB.size(), 1);
+
+ QCOMPARE(audioInputsSpy.size(), 0);
+ QCOMPARE(audioOutputsSpy.size(), 0);
+}
+
+QTEST_MAIN(tst_QMediaDevices)
+
+#include "tst_qmediadevices.moc"
diff --git a/tests/auto/unit/multimedia/qmediaformat/CMakeLists.txt b/tests/auto/unit/multimedia/qmediaformat/CMakeLists.txt
new file mode 100644
index 000000000..4ad36e7bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaformat/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qmediaformat
+ SOURCES
+ tst_qmediaformat.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qmediaformat/tst_qmediaformat.cpp b/tests/auto/unit/multimedia/qmediaformat/tst_qmediaformat.cpp
new file mode 100644
index 000000000..9f1345db6
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaformat/tst_qmediaformat.cpp
@@ -0,0 +1,65 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+#include <QtMultimedia/qmediaformat.h>
+
+class tst_QMediaFormat : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testResolveForEncoding();
+};
+
+void tst_QMediaFormat::testResolveForEncoding()
+{
+ QMediaFormat format;
+
+ auto hasVideoCodecs = !format.supportedVideoCodecs(QMediaFormat::Encode).isEmpty();
+ bool hasWav = format.supportedFileFormats(QMediaFormat::Encode).contains(QMediaFormat::Wave);
+
+ // Resolve codecs for audio only stream
+ format.resolveForEncoding(QMediaFormat::NoFlags);
+ QVERIFY(format.audioCodec() != QMediaFormat::AudioCodec::Unspecified);
+ QVERIFY(format.fileFormat() != QMediaFormat::FileFormat::UnspecifiedFormat);
+ QVERIFY(format.videoCodec() == QMediaFormat::VideoCodec::Unspecified);
+
+ // Resolve codecs for audio/video stream
+ format.resolveForEncoding(QMediaFormat::RequiresVideo);
+ QVERIFY(format.audioCodec() != QMediaFormat::AudioCodec::Unspecified);
+ QVERIFY(format.fileFormat() != QMediaFormat::FileFormat::UnspecifiedFormat);
+ if (hasVideoCodecs)
+ QVERIFY(format.videoCodec() != QMediaFormat::VideoCodec::Unspecified);
+ else
+ QVERIFY(format.videoCodec() == QMediaFormat::VideoCodec::Unspecified);
+
+ // Resolve again for audio only stream
+ format.resolveForEncoding(QMediaFormat::NoFlags);
+ QVERIFY(format.videoCodec() == QMediaFormat::VideoCodec::Unspecified);
+
+ // check some specific conditions
+ if (hasWav) {
+ QMediaFormat f(QMediaFormat::Mpeg4Audio);
+ if (!f.supportedAudioCodecs(QMediaFormat::Encode).contains(QMediaFormat::AudioCodec::Wave)) {
+ qDebug() << "testing!";
+ format.setFileFormat(QMediaFormat::Mpeg4Audio);
+ format.setAudioCodec(QMediaFormat::AudioCodec::Wave);
+ format.resolveForEncoding(QMediaFormat::NoFlags);
+ QVERIFY(format.fileFormat() == QMediaFormat::Mpeg4Audio);
+ QVERIFY(format.audioCodec() != QMediaFormat::AudioCodec::Wave);
+
+ format = {};
+ format.setFileFormat(QMediaFormat::Wave);
+ format.setAudioCodec(QMediaFormat::AudioCodec::AAC);
+ format.resolveForEncoding(QMediaFormat::NoFlags);
+ QVERIFY(format.fileFormat() == QMediaFormat::Wave);
+ QVERIFY(format.audioCodec() == QMediaFormat::AudioCodec::Wave);
+ }
+ }
+
+}
+
+QTEST_MAIN(tst_QMediaFormat)
+#include "tst_qmediaformat.moc"
diff --git a/tests/auto/unit/multimedia/qmediaplayer/CMakeLists.txt b/tests/auto/unit/multimedia/qmediaplayer/CMakeLists.txt
new file mode 100644
index 000000000..4d3f2f865
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qmediaplayer.pro.
+
+#####################################################################
+## tst_qmediaplayer Test:
+#####################################################################
+
+qt_internal_add_test(tst_qmediaplayer
+ SOURCES
+ tst_qmediaplayer.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ Qt::Network
+ MockMultimediaPlugin
+)
+
+# Resources:
+set(testdata_resource_files
+ "testdata/nokia-tune.mp3"
+)
+
+qt_internal_add_resource(tst_qmediaplayer "testdata"
+ PREFIX
+ "/"
+ FILES
+ ${testdata_resource_files}
+)
+
diff --git a/tests/auto/unit/multimedia/qmediaplayer/testdata/nokia-tune.mp3 b/tests/auto/unit/multimedia/qmediaplayer/testdata/nokia-tune.mp3
new file mode 100644
index 000000000..2435f65b8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer/testdata/nokia-tune.mp3
Binary files differ
diff --git a/tests/auto/unit/multimedia/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/unit/multimedia/qmediaplayer/tst_qmediaplayer.cpp
new file mode 100644
index 000000000..3fb77ca2d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer/tst_qmediaplayer.cpp
@@ -0,0 +1,832 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qbuffer.h>
+
+#include <qvideosink.h>
+#include <qmediaplayer.h>
+#include <private/qplatformmediaplayer_p.h>
+#include <qobject.h>
+
+#include "qmockintegration.h"
+#include "qmockmediaplayer.h"
+#include "qmockaudiooutput.h"
+#include "qvideosink.h"
+#include "qaudiooutput.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class AutoConnection
+{
+public:
+ AutoConnection(QObject *sender, const char *signal, QObject *receiver, const char *method)
+ : sender(sender), signal(signal), receiver(receiver), method(method)
+ {
+ QObject::connect(sender, signal, receiver, method);
+ }
+
+ ~AutoConnection()
+ {
+ QObject::disconnect(sender, signal, receiver, method);
+ }
+
+private:
+ QObject *sender;
+ const char *signal;
+ QObject *receiver;
+ const char *method;
+};
+
+class tst_QMediaPlayer: public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void testValid();
+ void testMedia_data();
+ void testMedia();
+ void testMultipleMedia_data();
+ void testMultipleMedia();
+ void testDuration_data();
+ void testDuration();
+ void testPosition_data();
+ void testPosition();
+ void testVolume_data();
+ void testVolume();
+ void testMuted_data();
+ void testMuted();
+ void testIsAvailable();
+ void testVideoAvailable_data();
+ void testVideoAvailable();
+ void testBufferStatus_data();
+ void testBufferStatus();
+ void testSeekable_data();
+ void testSeekable();
+ void testPlaybackRate_data();
+ void testPlaybackRate();
+ void testError_data();
+ void testError();
+ void testErrorString_data();
+ void testErrorString();
+ void testService();
+ void testPlay_data();
+ void testPlay();
+ void testPause_data();
+ void testPause();
+ void testStop_data();
+ void testStop();
+ void testMediaStatus_data();
+ void testMediaStatus();
+ void testSetVideoOutput();
+ void testSetVideoOutputDestruction();
+ void debugEnums();
+ void testDestructor();
+ void testQrc_data();
+ void testQrc();
+
+private:
+ void setupCommonTestData();
+
+ QMockMediaPlayer *mockPlayer;
+ QAudioOutput *audioOutput = nullptr;
+ QMediaPlayer *player;
+};
+
+class QtTestMediaPlayer : public QMediaPlayer
+{
+ Q_OBJECT
+ Q_PROPERTY(int a READ a WRITE setA NOTIFY aChanged)
+ Q_PROPERTY(int b READ b WRITE setB NOTIFY bChanged)
+ Q_PROPERTY(int c READ c WRITE setC NOTIFY cChanged)
+ Q_PROPERTY(int d READ d WRITE setD)
+public:
+ QtTestMediaPlayer() : QMediaPlayer() {}
+
+ [[nodiscard]] int a() const { return m_a; }
+ void setA(int a) { m_a = a; }
+
+ [[nodiscard]] int b() const { return m_b; }
+ void setB(int b) { m_b = b; }
+
+ [[nodiscard]] int c() const { return m_c; }
+ void setC(int c) { m_c = c; }
+
+ [[nodiscard]] int d() const { return m_d; }
+ void setD(int d) { m_d = d; }
+
+Q_SIGNALS:
+ void aChanged(int a);
+ void bChanged(int b);
+ void cChanged(int c);
+
+private:
+ int m_a = 0;
+ int m_b = 0;
+ int m_c = 0;
+ int m_d = 0;
+};
+
+void tst_QMediaPlayer::setupCommonTestData()
+{
+ QTest::addColumn<bool>("valid");
+ QTest::addColumn<QMediaPlayer::PlaybackState>("state");
+ QTest::addColumn<QMediaPlayer::MediaStatus>("status");
+ QTest::addColumn<QUrl>("mediaContent");
+ QTest::addColumn<qint64>("duration");
+ QTest::addColumn<qint64>("position");
+ QTest::addColumn<bool>("seekable");
+ QTest::addColumn<int>("volume");
+ QTest::addColumn<bool>("muted");
+ QTest::addColumn<bool>("videoAvailable");
+ QTest::addColumn<int>("bufferProgress");
+ QTest::addColumn<qreal>("playbackRate");
+ QTest::addColumn<QMediaPlayer::Error>("error");
+ QTest::addColumn<QString>("errorString");
+
+ QTest::newRow("invalid") << false << QMediaPlayer::StoppedState << QMediaPlayer::InvalidMedia <<
+ QUrl() << qint64(0) << qint64(0) << false << 0 << false << false << 0 <<
+ qreal(0) << QMediaPlayer::NoError << QString();
+ QTest::newRow("valid+null") << true << QMediaPlayer::StoppedState << QMediaPlayer::InvalidMedia <<
+ QUrl() << qint64(0) << qint64(0) << false << 0 << false << false << 50 <<
+ qreal(0) << QMediaPlayer::NoError << QString();
+ QTest::newRow("valid+content+stopped") << true << QMediaPlayer::StoppedState << QMediaPlayer::InvalidMedia <<
+ QUrl(QUrl("file:///some.mp3")) << qint64(0) << qint64(0) << false << 50 << false << false << 0 <<
+ qreal(1) << QMediaPlayer::NoError << QString();
+ QTest::newRow("valid+content+playing") << true << QMediaPlayer::PlayingState << QMediaPlayer::LoadedMedia <<
+ QUrl(QUrl("file:///some.mp3")) << qint64(10000) << qint64(10) << true << 50 << true << false << 0 <<
+ qreal(1) << QMediaPlayer::NoError << QString();
+ QTest::newRow("valid+content+paused") << true << QMediaPlayer::PausedState << QMediaPlayer::LoadedMedia <<
+ QUrl(QUrl("file:///some.mp3")) << qint64(10000) << qint64(10) << true << 50 << true << false << 0 <<
+ qreal(1) << QMediaPlayer::NoError << QString();
+ QTest::newRow("valud+streaming") << true << QMediaPlayer::PlayingState << QMediaPlayer::LoadedMedia <<
+ QUrl(QUrl("http://example.com/stream")) << qint64(10000) << qint64(10000) << false << 50 << false << true << 0 <<
+ qreal(1) << QMediaPlayer::NoError << QString();
+ QTest::newRow("valid+error") << true << QMediaPlayer::StoppedState << QMediaPlayer::InvalidMedia <<
+ QUrl(QUrl("http://example.com/stream")) << qint64(0) << qint64(0) << false << 50 << false << false << 0 <<
+ qreal(0) << QMediaPlayer::ResourceError << QStringLiteral("Resource unavailable");
+}
+
+void tst_QMediaPlayer::initTestCase()
+{
+}
+
+void tst_QMediaPlayer::cleanupTestCase()
+{
+}
+
+void tst_QMediaPlayer::init()
+{
+ player = new QMediaPlayer;
+ mockPlayer = QMockIntegration::instance()->lastPlayer();
+ Q_ASSERT(mockPlayer);
+ audioOutput = new QAudioOutput;
+ player->setAudioOutput(audioOutput);
+ Q_ASSERT(mockPlayer->m_audioOutput != nullptr);
+}
+
+void tst_QMediaPlayer::cleanup()
+{
+ delete player;
+}
+
+void tst_QMediaPlayer::testValid()
+{
+ /*
+ QFETCH(bool, valid);
+
+ mockService->setIsValid(valid);
+ QCOMPARE(player->isValid(), valid);
+ */
+}
+
+void tst_QMediaPlayer::testMedia_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testMedia()
+{
+ QFETCH(QUrl, mediaContent);
+
+ player->setSource(mediaContent);
+ QCOMPARE(player->source(), mediaContent);
+
+ QBuffer stream;
+ player->setSourceDevice(&stream, mediaContent);
+ QCOMPARE(player->source(), mediaContent);
+ QCOMPARE(player->sourceDevice(), &stream);
+}
+
+void tst_QMediaPlayer::testMultipleMedia_data()
+{
+ QTest::addColumn<QUrl>("mediaContent");
+ QTest::addColumn<QUrl>("anotherMediaContent");
+
+ QTest::newRow("multipleSources")
+ << QUrl(QUrl("file:///some.mp3")) << QUrl(QUrl("file:///someother.mp3"));
+}
+
+void tst_QMediaPlayer::testMultipleMedia()
+{
+ QFETCH(QUrl, mediaContent);
+
+ player->setSource(mediaContent);
+ QCOMPARE(player->source(), mediaContent);
+
+ QBuffer stream;
+ player->setSourceDevice(&stream, mediaContent);
+ QCOMPARE(player->source(), mediaContent);
+ QCOMPARE(player->sourceDevice(), &stream);
+
+ QFETCH(QUrl, anotherMediaContent);
+
+ player->setSource(anotherMediaContent);
+ QCOMPARE(player->source(), anotherMediaContent);
+
+ QBuffer anotherStream;
+ player->setSourceDevice(&anotherStream, anotherMediaContent);
+ QCOMPARE(player->source(), anotherMediaContent);
+ QCOMPARE(player->sourceDevice(), &anotherStream);
+}
+
+void tst_QMediaPlayer::testDuration_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testDuration()
+{
+ QFETCH(qint64, duration);
+
+ mockPlayer->setDuration(duration);
+ QVERIFY(player->duration() == duration);
+}
+
+void tst_QMediaPlayer::testPosition_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testPosition()
+{
+ QFETCH(bool, valid);
+ QFETCH(bool, seekable);
+ QFETCH(qint64, position);
+ QFETCH(qint64, duration);
+
+ mockPlayer->setIsValid(valid);
+ mockPlayer->setSeekable(seekable);
+ mockPlayer->setPosition(position);
+ mockPlayer->setDuration(duration);
+ QVERIFY(player->isSeekable() == seekable);
+ QVERIFY(player->position() == position);
+ QVERIFY(player->duration() == duration);
+
+ if (seekable) {
+ {
+ QSignalSpy spy(player, &QMediaPlayer::positionChanged);
+ player->setPosition(position);
+ QCOMPARE(player->position(), position);
+ QCOMPARE(spy.size(), 0);
+ }
+
+ mockPlayer->setPosition(position);
+ {
+ QSignalSpy spy(player, &QMediaPlayer::positionChanged);
+ player->setPosition(0);
+ QCOMPARE(player->position(), qint64(0));
+ QCOMPARE(spy.size(), position == 0 ? 0 : 1);
+ }
+
+ mockPlayer->setPosition(position);
+ {
+ QSignalSpy spy(player, &QMediaPlayer::positionChanged);
+ player->setPosition(duration);
+ QCOMPARE(player->position(), duration);
+ QCOMPARE(spy.size(), position == duration ? 0 : 1);
+ }
+
+ mockPlayer->setPosition(position);
+ {
+ QSignalSpy spy(player, &QMediaPlayer::positionChanged);
+ player->setPosition(-1);
+ QCOMPARE(player->position(), qint64(0));
+ QCOMPARE(spy.size(), position == 0 ? 0 : 1);
+ }
+
+ }
+ else {
+ QSignalSpy spy(player, &QMediaPlayer::positionChanged);
+ player->setPosition(position);
+
+ QCOMPARE(player->position(), position);
+ QCOMPARE(spy.size(), 0);
+ }
+}
+
+void tst_QMediaPlayer::testVolume_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testVolume()
+{
+ QFETCH(bool, valid);
+ QFETCH(int, volume);
+ float vol = volume/100.;
+
+ audioOutput->setVolume(vol);
+ QVERIFY(audioOutput->volume() == vol);
+
+ if (valid) {
+ {
+ QSignalSpy spy(audioOutput, &QAudioOutput::volumeChanged);
+ audioOutput->setVolume(.1f);
+ QCOMPARE(audioOutput->volume(), .1f);
+ QCOMPARE(spy.size(), 1);
+ }
+
+ {
+ QSignalSpy spy(audioOutput, &QAudioOutput::volumeChanged);
+ audioOutput->setVolume(-1000.f);
+ QCOMPARE(audioOutput->volume(), 0.f);
+ QCOMPARE(spy.size(), 1);
+ }
+
+ {
+ QSignalSpy spy(audioOutput, &QAudioOutput::volumeChanged);
+ audioOutput->setVolume(1.f);
+ QCOMPARE(audioOutput->volume(), 1.f);
+ QCOMPARE(spy.size(), 1);
+ }
+
+ {
+ QSignalSpy spy(audioOutput, &QAudioOutput::volumeChanged);
+ audioOutput->setVolume(1000.f);
+ QCOMPARE(audioOutput->volume(), 1.f);
+ QCOMPARE(spy.size(), 0);
+ }
+ }
+}
+
+void tst_QMediaPlayer::testMuted_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testMuted()
+{
+ QFETCH(bool, valid);
+ QFETCH(bool, muted);
+ QFETCH(int, volume);
+ float vol = volume/100.;
+
+ if (valid) {
+ audioOutput->setMuted(muted);
+ audioOutput->setVolume(vol);
+ QVERIFY(audioOutput->isMuted() == muted);
+
+ QSignalSpy spy(audioOutput, &QAudioOutput::mutedChanged);
+ audioOutput->setMuted(!muted);
+ QCOMPARE(audioOutput->isMuted(), !muted);
+ QCOMPARE(audioOutput->volume(), vol);
+ QCOMPARE(spy.size(), 1);
+ }
+}
+
+void tst_QMediaPlayer::testVideoAvailable_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testVideoAvailable()
+{
+ QFETCH(bool, videoAvailable);
+
+ mockPlayer->setVideoAvailable(videoAvailable);
+ QVERIFY(player->hasVideo() == videoAvailable);
+}
+
+void tst_QMediaPlayer::testBufferStatus_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testBufferStatus()
+{
+ QFETCH(int, bufferProgress);
+
+ mockPlayer->setBufferStatus(bufferProgress);
+ QVERIFY(player->bufferProgress() == bufferProgress);
+}
+
+void tst_QMediaPlayer::testSeekable_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testSeekable()
+{
+ QFETCH(bool, seekable);
+
+ mockPlayer->setSeekable(seekable);
+ QVERIFY(player->isSeekable() == seekable);
+}
+
+void tst_QMediaPlayer::testPlaybackRate_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testPlaybackRate()
+{
+ QFETCH(bool, valid);
+ QFETCH(qreal, playbackRate);
+
+ if (valid) {
+ mockPlayer->setPlaybackRate(playbackRate);
+ QVERIFY(player->playbackRate() == playbackRate);
+
+ QSignalSpy spy(player, &QMediaPlayer::playbackRateChanged);
+ player->setPlaybackRate(playbackRate + 0.5f);
+ QCOMPARE(player->playbackRate(), playbackRate + 0.5f);
+ QCOMPARE(spy.size(), 1);
+ }
+}
+
+void tst_QMediaPlayer::testError_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testError()
+{
+ QFETCH(QMediaPlayer::Error, error);
+
+ mockPlayer->setError(error);
+ QVERIFY(player->error() == error);
+}
+
+void tst_QMediaPlayer::testErrorString_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testErrorString()
+{
+ QFETCH(QString, errorString);
+
+ mockPlayer->setErrorString(errorString);
+ QVERIFY(player->errorString() == errorString);
+}
+
+void tst_QMediaPlayer::testIsAvailable()
+{
+ QCOMPARE(player->isAvailable(), true);
+}
+
+void tst_QMediaPlayer::testService()
+{
+ /*
+ QFETCH(bool, valid);
+
+ mockService->setIsValid(valid);
+
+ if (valid)
+ QVERIFY(player->service() != 0);
+ else
+ QVERIFY(player->service() == 0);
+ */
+}
+
+void tst_QMediaPlayer::testPlay_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testPlay()
+{
+ QFETCH(bool, valid);
+ QFETCH(QUrl, mediaContent);
+ QFETCH(QMediaPlayer::PlaybackState, state);
+
+ mockPlayer->setIsValid(valid);
+ player->setSource(mediaContent);
+ mockPlayer->setState(state);
+ QCOMPARE(player->playbackState(), state);
+ QCOMPARE(player->isPlaying(), state == QMediaPlayer::PlayingState);
+ QCOMPARE(player->source(), mediaContent);
+
+ QSignalSpy spy(player, &QMediaPlayer::playbackStateChanged);
+ QSignalSpy playingChanged(player, &QMediaPlayer::playingChanged);
+
+ player->play();
+
+ if (!valid || mediaContent.isEmpty()) {
+ QCOMPARE(player->playbackState(), QMediaPlayer::StoppedState);
+ QVERIFY(!player->isPlaying());
+ QCOMPARE(spy.size(), 0);
+ QVERIFY(playingChanged.empty());
+ }
+ else {
+ QCOMPARE(player->playbackState(), QMediaPlayer::PlayingState);
+ QVERIFY(player->isPlaying());
+ QCOMPARE(spy.size(), state == QMediaPlayer::PlayingState ? 0 : 1);
+ QCOMPARE_EQ(playingChanged.size(), state == QMediaPlayer::PlayingState ? 0 : 1);
+ }
+}
+
+void tst_QMediaPlayer::testPause_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testPause()
+{
+ QFETCH(bool, valid);
+ QFETCH(QUrl, mediaContent);
+ QFETCH(QMediaPlayer::PlaybackState, state);
+
+ mockPlayer->setIsValid(valid);
+ player->setSource(mediaContent);
+ mockPlayer->setState(state);
+ QVERIFY(player->playbackState() == state);
+ QCOMPARE(player->isPlaying(), state == QMediaPlayer::PlayingState);
+ QVERIFY(player->source() == mediaContent);
+
+ QSignalSpy spy(player, &QMediaPlayer::playbackStateChanged);
+ QSignalSpy playingChanged(player, &QMediaPlayer::playingChanged);
+
+ player->pause();
+
+ QVERIFY(!player->isPlaying());
+
+ if (!valid || mediaContent.isEmpty()) {
+ QCOMPARE(player->playbackState(), QMediaPlayer::StoppedState);
+ QCOMPARE(spy.size(), 0);
+ QCOMPARE(playingChanged.size(), 0);
+ }
+ else {
+ QCOMPARE(player->playbackState(), QMediaPlayer::PausedState);
+ QCOMPARE(spy.size(), state == QMediaPlayer::PausedState ? 0 : 1);
+ QCOMPARE(playingChanged.size(), state == QMediaPlayer::PlayingState ? 1 : 0);
+ }
+}
+
+void tst_QMediaPlayer::testStop_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testStop()
+{
+ QFETCH(QUrl, mediaContent);
+ QFETCH(QMediaPlayer::PlaybackState, state);
+
+ player->setSource(mediaContent);
+ mockPlayer->setState(state);
+ QVERIFY(player->playbackState() == state);
+ QCOMPARE(player->isPlaying(), state == QMediaPlayer::PlayingState);
+ QVERIFY(player->source() == mediaContent);
+
+ QSignalSpy spy(player, &QMediaPlayer::playbackStateChanged);
+ QSignalSpy playingChanged(player, &QMediaPlayer::playingChanged);
+
+ player->stop();
+
+ QVERIFY(!player->isPlaying());
+
+ if (mediaContent.isEmpty() || state == QMediaPlayer::StoppedState) {
+ QCOMPARE(player->playbackState(), QMediaPlayer::StoppedState);
+ QCOMPARE(spy.size(), 0);
+ QCOMPARE(playingChanged.size(), 0);
+ }
+ else {
+ QCOMPARE(player->playbackState(), QMediaPlayer::StoppedState);
+ QCOMPARE(spy.size(), 1);
+ QCOMPARE(playingChanged.size(), state == QMediaPlayer::PlayingState ? 1 : 0);
+ }
+}
+
+void tst_QMediaPlayer::testMediaStatus_data()
+{
+ setupCommonTestData();
+}
+
+void tst_QMediaPlayer::testMediaStatus()
+{
+ QFETCH(int, bufferProgress);
+ int bufferSignals = 0;
+
+ mockPlayer->setMediaStatus(QMediaPlayer::NoMedia);
+ mockPlayer->setBufferStatus(bufferProgress);
+
+ QSignalSpy statusSpy(player, &QMediaPlayer::mediaStatusChanged);
+ QSignalSpy bufferSpy(player, &QMediaPlayer::bufferProgressChanged);
+
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::NoMedia);
+
+ mockPlayer->setMediaStatus(QMediaPlayer::LoadingMedia);
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::LoadingMedia);
+ QCOMPARE(statusSpy.size(), 1);
+
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
+ QMediaPlayer::LoadingMedia);
+
+ mockPlayer->setMediaStatus(QMediaPlayer::LoadedMedia);
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::LoadedMedia);
+ QCOMPARE(statusSpy.size(), 2);
+
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
+ QMediaPlayer::LoadedMedia);
+
+ // Verify the bufferProgressChanged() signal isn't being emitted.
+ QCOMPARE(bufferSpy.size(), 0);
+
+ mockPlayer->setMediaStatus(QMediaPlayer::StalledMedia);
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::StalledMedia);
+ QCOMPARE(statusSpy.size(), 3);
+
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
+ QMediaPlayer::StalledMedia);
+
+ // Verify the bufferProgressChanged() signal is being emitted.
+ QVERIFY(bufferSpy.size() > bufferSignals);
+ QCOMPARE(bufferSpy.last().value(0).toInt(), bufferProgress);
+ bufferSignals = bufferSpy.size();
+
+ mockPlayer->setMediaStatus(QMediaPlayer::BufferingMedia);
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::BufferingMedia);
+ QCOMPARE(statusSpy.size(), 4);
+
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
+ QMediaPlayer::BufferingMedia);
+
+ // Verify the bufferProgressChanged() signal is being emitted.
+ QVERIFY(bufferSpy.size() > bufferSignals);
+ QCOMPARE(bufferSpy.last().value(0).toInt(), bufferProgress);
+ bufferSignals = bufferSpy.size();
+
+ mockPlayer->setMediaStatus(QMediaPlayer::BufferedMedia);
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::BufferedMedia);
+ QCOMPARE(statusSpy.size(), 5);
+
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
+ QMediaPlayer::BufferedMedia);
+
+ // Verify the bufferProgressChanged() signal isn't being emitted.
+ QCOMPARE(bufferSpy.size(), bufferSignals);
+
+ mockPlayer->setMediaStatus(QMediaPlayer::EndOfMedia);
+ QCOMPARE(player->mediaStatus(), QMediaPlayer::EndOfMedia);
+ QCOMPARE(statusSpy.size(), 6);
+
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
+ QMediaPlayer::EndOfMedia);
+}
+
+void tst_QMediaPlayer::testDestructor()
+{
+ /* create an object for player */
+ QMediaPlayer *victim = new QMediaPlayer;
+
+ /* check whether the object is created */
+ QVERIFY(victim);
+
+ /* delete the instance (a crash is a failure :) */
+ delete victim;
+}
+
+void tst_QMediaPlayer::testSetVideoOutput()
+{
+ QVideoSink surface;
+
+ player->setVideoOutput(static_cast<QObject *>(nullptr));
+
+// QCOMPARE(mockService->rendererRef, 0);
+
+ player->setVideoOutput(&surface);
+// QVERIFY(mockService->rendererControl->surface() == &surface);
+// QCOMPARE(mockService->rendererRef, 1);
+
+ player->setVideoOutput(reinterpret_cast<QVideoSink *>(0));
+// QVERIFY(mockService->rendererControl->surface() == nullptr);
+
+ //rendererControl is released
+// QCOMPARE(mockService->rendererRef, 0);
+
+ player->setVideoOutput(&surface);
+// QVERIFY(mockService->rendererControl->surface() == &surface);
+// QCOMPARE(mockService->rendererRef, 1);
+
+ player->setVideoOutput(static_cast<QObject *>(nullptr));
+// QVERIFY(mockService->rendererControl->surface() == nullptr);
+// //rendererControl is released
+// QCOMPARE(mockService->rendererRef, 0);
+
+ player->setVideoOutput(&surface);
+// QVERIFY(mockService->rendererControl->surface() == &surface);
+// QCOMPARE(mockService->rendererRef, 1);
+}
+
+void tst_QMediaPlayer::testSetVideoOutputDestruction()
+{
+ QVideoSink surface;
+ {
+ QMediaPlayer player;
+ player.setVideoOutput(&surface);
+ }
+}
+
+void tst_QMediaPlayer::debugEnums()
+{
+ QTest::ignoreMessage(QtDebugMsg, "QMediaPlayer::PlayingState");
+ qDebug() << QMediaPlayer::PlayingState;
+ QTest::ignoreMessage(QtDebugMsg, "QMediaPlayer::NoMedia");
+ qDebug() << QMediaPlayer::NoMedia;
+ QTest::ignoreMessage(QtDebugMsg, "QMediaPlayer::NetworkError");
+ qDebug() << QMediaPlayer::NetworkError;
+}
+
+void tst_QMediaPlayer::testQrc_data()
+{
+ QTest::addColumn<QUrl>("mediaContent");
+ QTest::addColumn<QMediaPlayer::MediaStatus>("status");
+ QTest::addColumn<QMediaPlayer::Error>("error");
+ QTest::addColumn<int>("errorCount");
+ QTest::addColumn<QString>("backendMediaContentScheme");
+ QTest::addColumn<bool>("backendHasStream");
+
+ QTest::newRow("invalid") << QUrl(QUrl(QLatin1String("qrc:/invalid.mp3")))
+ << QMediaPlayer::InvalidMedia
+ << QMediaPlayer::ResourceError
+ << 1 // error count
+ << QString() // backend should not have got any media (empty URL scheme)
+ << false; // backend should not have got any stream
+
+ QTest::newRow("valid+nostream") << QUrl(QUrl(QLatin1String("qrc:/testdata/nokia-tune.mp3")))
+ << QMediaPlayer::LoadingMedia
+ << QMediaPlayer::NoError
+ << 0 // error count
+ << QStringLiteral("file") // backend should have a got a temporary file
+ << false; // backend should not have got any stream
+
+ QTest::newRow("valid+stream") << QUrl(QUrl(QLatin1String("qrc:/testdata/nokia-tune.mp3")))
+ << QMediaPlayer::LoadingMedia
+ << QMediaPlayer::NoError
+ << 0 // error count
+ << QStringLiteral("qrc")
+ << true; // backend should have got a stream (QFile opened from the resource)
+}
+
+void tst_QMediaPlayer::testQrc()
+{
+ QFETCH(QUrl, mediaContent);
+ QFETCH(QMediaPlayer::MediaStatus, status);
+ QFETCH(QMediaPlayer::Error, error);
+ QFETCH(int, errorCount);
+ QFETCH(QString, backendMediaContentScheme);
+ QFETCH(bool, backendHasStream);
+
+ mockPlayer->setState(QMediaPlayer::PlayingState, QMediaPlayer::NoMedia);
+ mockPlayer->setStreamPlaybackSupported(backendHasStream);
+
+ QSignalSpy mediaSpy(player, &QMediaPlayer::sourceChanged);
+ QSignalSpy statusSpy(player, &QMediaPlayer::mediaStatusChanged);
+ QSignalSpy errorSpy(player, &QMediaPlayer::errorOccurred);
+
+ player->setSource(mediaContent);
+
+ QTRY_COMPARE(player->mediaStatus(), status);
+ QCOMPARE(statusSpy.size(), 1);
+ QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)), status);
+
+ QCOMPARE(player->source(), mediaContent);
+ QCOMPARE(mediaSpy.size(), 1);
+ QCOMPARE(qvariant_cast<QUrl>(mediaSpy.last().value(0)), mediaContent);
+
+ QCOMPARE(player->error(), error);
+ QCOMPARE(errorSpy.size(), errorCount);
+ if (errorCount > 0) {
+ QCOMPARE(qvariant_cast<QMediaPlayer::Error>(errorSpy.last().value(0)), error);
+ QVERIFY(!player->errorString().isEmpty());
+ }
+
+ // Check the media actually passed to the backend
+ QCOMPARE(mockPlayer->media().scheme(), backendMediaContentScheme);
+ QCOMPARE(bool(mockPlayer->mediaStream()), backendHasStream);
+}
+
+QTEST_GUILESS_MAIN(tst_QMediaPlayer)
+#include "tst_qmediaplayer.moc"
diff --git a/tests/auto/unit/multimedia/qmediaplayer_gstreamer/CMakeLists.txt b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/CMakeLists.txt
new file mode 100644
index 000000000..dd54afd25
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_qmediaplayer_gstreamer Test:
+#####################################################################
+
+qt_internal_add_test(tst_qmediaplayer_gstreamer
+ SOURCES
+ tst_qmediaplayer_gstreamer.cpp
+ tst_qmediaplayer_gstreamer.h
+ ../../../shared/qscopedenvironmentvariable.h
+ INCLUDE_DIRECTORIES
+ ../../../shared
+ LIBRARIES
+ Qt::MultimediaPrivate
+ Qt::QGstreamerMediaPluginPrivate
+)
+
+
+# Resources:
+set(testdata_resource_files
+ "testdata/color_matrix.mp4"
+)
+
+qt_internal_add_resource(tst_qmediaplayer_gstreamer "testdata"
+ PREFIX
+ "/"
+ FILES
+ ${testdata_resource_files}
+)
+
diff --git a/tests/auto/unit/multimedia/qmediaplayer_gstreamer/testdata/color_matrix.mp4 b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/testdata/color_matrix.mp4
new file mode 100644
index 000000000..a3661b9d2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/testdata/color_matrix.mp4
Binary files differ
diff --git a/tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.cpp b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.cpp
new file mode 100644
index 000000000..3bb0b626e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.cpp
@@ -0,0 +1,153 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "tst_qmediaplayer_gstreamer.h"
+
+#include <QtTest/QtTest>
+#include <QtMultimedia/private/qmediaplayer_p.h>
+
+#include <qscopedenvironmentvariable.h>
+
+QT_USE_NAMESPACE
+
+using namespace Qt::Literals;
+
+QGStreamerPlatformSpecificInterface *tst_QMediaPlayerGStreamer::gstInterface()
+{
+ return dynamic_cast<QGStreamerPlatformSpecificInterface *>(
+ QPlatformMediaIntegration::instance()->platformSpecificInterface());
+}
+
+GstPipeline *tst_QMediaPlayerGStreamer::getGstPipeline()
+{
+ QGStreamerPlatformSpecificInterface *iface = gstInterface();
+ return iface ? iface->gstPipeline(player.get()) : nullptr;
+}
+
+QGstPipeline tst_QMediaPlayerGStreamer::getPipeline()
+{
+ return QGstPipeline{
+ getGstPipeline(),
+ QGstPipeline::NeedsRef,
+ };
+}
+
+void tst_QMediaPlayerGStreamer::dumpGraph(const char *fileNamePrefix)
+{
+ GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(getGstPipeline()),
+ GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_VERBOSE), fileNamePrefix);
+}
+
+tst_QMediaPlayerGStreamer::tst_QMediaPlayerGStreamer()
+{
+ qputenv("QT_MEDIA_BACKEND", "gstreamer");
+}
+
+void tst_QMediaPlayerGStreamer::initTestCase()
+{
+ using namespace std::chrono_literals;
+
+ QMediaPlayer player;
+
+ QVideoSink sink;
+ player.setVideoSink(&sink);
+ player.setSource(QUrl("qrc:/testdata/color_matrix.mp4"));
+
+ for (;;) {
+ QMediaPlayer::MediaStatus status = player.mediaStatus();
+ switch (status) {
+ case QMediaPlayer::MediaStatus::InvalidMedia: {
+ mediaSupported = false;
+ return;
+ }
+ case QMediaPlayer::MediaStatus::NoMedia:
+ case QMediaPlayer::MediaStatus::StalledMedia:
+ case QMediaPlayer::MediaStatus::LoadingMedia:
+ QTest::qWait(20ms);
+ continue;
+
+ default: {
+ mediaSupported = true;
+ return;
+ }
+ }
+ }
+}
+
+void tst_QMediaPlayerGStreamer::init()
+{
+ player = std::make_unique<QMediaPlayer>();
+}
+
+void tst_QMediaPlayerGStreamer::cleanup()
+{
+ player.reset();
+}
+
+void tst_QMediaPlayerGStreamer::constructor_preparesGstPipeline()
+{
+ auto *rawPipeline = getGstPipeline();
+ QVERIFY(rawPipeline);
+
+ QGstPipeline pipeline{
+ rawPipeline,
+ QGstPipeline::NeedsRef,
+ };
+ QVERIFY(pipeline);
+
+ QVERIFY(pipeline.findByName("videoInputSelector"));
+ QVERIFY(pipeline.findByName("audioInputSelector"));
+ QVERIFY(pipeline.findByName("subTitleInputSelector"));
+
+ dumpGraph("constructor_preparesGstPipeline");
+}
+
+void tst_QMediaPlayerGStreamer::videoSink_constructor_overridesConversionElement()
+{
+ if (!mediaSupported)
+ QSKIP("Media playback not supported");
+
+ QScopedEnvironmentVariable convOverride{
+ "QT_GSTREAMER_OVERRIDE_VIDEO_CONVERSION_ELEMENT",
+ "identity name=myConverter",
+ };
+
+ QVideoSink sink;
+ player->setVideoSink(&sink);
+ player->setSource(QUrl("qrc:/testdata/color_matrix.mp4"));
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+
+ QTRY_VERIFY(pipeline.findByName("myConverter"));
+
+ dumpGraph("videoSink_constructor_overridesConversionElement");
+}
+
+void tst_QMediaPlayerGStreamer::
+ videoSink_constructor_overridesConversionElement_withMultipleElements()
+{
+ if (!mediaSupported)
+ QSKIP("Media playback not supported");
+
+ QScopedEnvironmentVariable convOverride{
+ "QT_GSTREAMER_OVERRIDE_VIDEO_CONVERSION_ELEMENT",
+ "identity name=myConverter ! identity name=myConverter2",
+ };
+
+ QVideoSink sink;
+ player->setVideoSink(&sink);
+ player->setSource(QUrl("qrc:/testdata/color_matrix.mp4"));
+
+ QGstPipeline pipeline = getPipeline();
+ QTEST_ASSERT(pipeline);
+
+ QTRY_VERIFY(pipeline.findByName("myConverter"));
+ QTRY_VERIFY(pipeline.findByName("myConverter2"));
+
+ dumpGraph("videoSink_constructer_overridesConversionElement_withMultipleElements");
+}
+
+QTEST_GUILESS_MAIN(tst_QMediaPlayerGStreamer)
+
+#include "moc_tst_qmediaplayer_gstreamer.cpp"
diff --git a/tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.h b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.h
new file mode 100644
index 000000000..08e958404
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplayer_gstreamer/tst_qmediaplayer_gstreamer.h
@@ -0,0 +1,46 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#ifndef TST_GMEDIAPLAYER_GSTREAMER_H
+#define TST_GMEDIAPLAYER_GSTREAMER_H
+
+#include <QtCore/qtemporaryfile.h>
+#include <QtCore/qstandardpaths.h>
+#include <QtMultimedia/qmediaplayer.h>
+#include <QtQGstreamerMediaPlugin/private/qgstpipeline_p.h>
+#include <QtMultimedia/private/qgstreamer_platformspecificinterface_p.h>
+
+#include <memory>
+
+QT_USE_NAMESPACE
+
+class tst_QMediaPlayerGStreamer : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QMediaPlayerGStreamer();
+
+public slots:
+ void initTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void constructor_preparesGstPipeline();
+ void videoSink_constructor_overridesConversionElement();
+ void videoSink_constructor_overridesConversionElement_withMultipleElements();
+
+private:
+ std::unique_ptr<QMediaPlayer> player;
+
+ static QGStreamerPlatformSpecificInterface *gstInterface();
+
+ GstPipeline *getGstPipeline();
+ QGstPipeline getPipeline();
+ void dumpGraph(const char *fileNamePrefix);
+
+ bool mediaSupported;
+};
+
+#endif // TST_GMEDIAPLAYER_GSTREAMER_H
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/CMakeLists.txt b/tests/auto/unit/multimedia/qmediaplaylist/CMakeLists.txt
new file mode 100644
index 000000000..9300394b1
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qmediaplaylist.pro.
+
+#####################################################################
+## tst_qmediaplaylist Test:
+#####################################################################
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ testdata/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_qmediaplaylist
+ SOURCES
+ tst_qmediaplaylist.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/testdata/empty.pls b/tests/auto/unit/multimedia/qmediaplaylist/testdata/empty.pls
new file mode 100644
index 000000000..639c22b0c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/testdata/empty.pls
@@ -0,0 +1,2 @@
+[playlist]
+NumberOfEntries=100
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/testdata/test.m3u b/tests/auto/unit/multimedia/qmediaplaylist/testdata/test.m3u
new file mode 100644
index 000000000..e5cb7c828
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/testdata/test.m3u
@@ -0,0 +1,11 @@
+#comment
+
+http://test.host/path
+ http://test.host/path
+testfile
+
+
+testdir/testfile
+/testdir/testfile
+file://path/name#suffix
+testfile2#suffix
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/testdata/test.pls b/tests/auto/unit/multimedia/qmediaplaylist/testdata/test.pls
new file mode 100644
index 000000000..18832b101
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/testdata/test.pls
@@ -0,0 +1,27 @@
+[playlist]
+
+File1=http://test.host/path
+Title1=First
+Length1=-1
+File2= http://test.host/path
+Title2=Second
+Length2=-1
+File3=testfile
+Title3=Third
+Length3=-1
+
+
+
+File4=testdir/testfile
+Title4=Fourth
+Length4=-1
+File5=/testdir/testfile
+Title5=Fifth
+Length5=-1
+File6=file://path/name#suffix
+Title6=Sixth
+Length6=-1
+File7=testfile2#suffix
+Title7=Seventh
+Length7=-1
+NumberOfEntries=7
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile b/tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile2#suffix b/tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile2#suffix
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/testdata/testfile2#suffix
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/testdata/totem-pl-example.pls b/tests/auto/unit/multimedia/qmediaplaylist/testdata/totem-pl-example.pls
new file mode 100644
index 000000000..385fe2a30
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/testdata/totem-pl-example.pls
@@ -0,0 +1,5 @@
+[playlist]
+X-GNOME-Title=totem-pl-file-example
+NumberOfEntries=1
+File1=http://test.host/path
+Title1=Silence
diff --git a/tests/auto/unit/multimedia/qmediaplaylist/tst_qmediaplaylist.cpp b/tests/auto/unit/multimedia/qmediaplaylist/tst_qmediaplaylist.cpp
new file mode 100644
index 000000000..8ef882bbf
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediaplaylist/tst_qmediaplaylist.cpp
@@ -0,0 +1,903 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+#include "qmediaplaylist.h"
+
+QT_USE_NAMESPACE
+
+class tst_QMediaPlaylist : public QObject
+{
+ Q_OBJECT
+public slots:
+ void init();
+ void cleanup();
+ void initTestCase();
+
+private slots:
+ void construction();
+ void append();
+ void insert();
+ void clear();
+ void removeMedia();
+ void currentItem();
+ void saveAndLoad();
+ void loadM3uFile();
+ void loadPLSFile();
+ void playbackMode();
+ void playbackMode_data();
+ void shuffle();
+ void setMediaSource();
+
+ void testCurrentIndexChanged_signal();
+ void testCurrentMediaChanged_signal();
+ void testLoaded_signal();
+ void testMediaChanged_signal();
+ void testPlaybackModeChanged_signal();
+ void testEnums();
+
+private:
+ QUrl content1;
+ QUrl content2;
+ QUrl content3;
+};
+
+void tst_QMediaPlaylist::init()
+{
+}
+
+void tst_QMediaPlaylist::initTestCase()
+{
+ content1 = QUrl(QUrl(QLatin1String("file:///1")));
+ content2 = QUrl(QUrl(QLatin1String("file:///2")));
+ content3 = QUrl(QUrl(QLatin1String("file:///3")));
+
+}
+
+void tst_QMediaPlaylist::cleanup()
+{
+}
+
+void tst_QMediaPlaylist::construction()
+{
+ QMediaPlaylist playlist;
+ QCOMPARE(playlist.mediaCount(), 0);
+ QVERIFY(playlist.isEmpty());
+}
+
+void tst_QMediaPlaylist::append()
+{
+ QMediaPlaylist playlist;
+
+ playlist.addMedia(content1);
+ QCOMPARE(playlist.mediaCount(), 1);
+ QCOMPARE(playlist.media(0), content1);
+
+ QSignalSpy aboutToBeInsertedSignalSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int,int)));
+ QSignalSpy insertedSignalSpy(&playlist, SIGNAL(mediaInserted(int,int)));
+ playlist.addMedia(content2);
+ QCOMPARE(playlist.mediaCount(), 2);
+ QCOMPARE(playlist.media(1), content2);
+
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
+
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ QUrl content4(QUrl(QLatin1String("file:///4")));
+ QUrl content5(QUrl(QLatin1String("file:///5")));
+ playlist.addMedia(QList<QUrl>() << content3 << content4 << content5);
+ QCOMPARE(playlist.mediaCount(), 5);
+ QCOMPARE(playlist.media(2), content3);
+ QCOMPARE(playlist.media(3), content4);
+ QCOMPARE(playlist.media(4), content5);
+
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy[0][0].toInt(), 2);
+ QCOMPARE(aboutToBeInsertedSignalSpy[0][1].toInt(), 4);
+
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy[0][0].toInt(), 2);
+ QCOMPARE(insertedSignalSpy[0][1].toInt(), 4);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ playlist.addMedia(QList<QUrl>());
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
+ QCOMPARE(insertedSignalSpy.count(), 0);
+}
+
+void tst_QMediaPlaylist::insert()
+{
+ QMediaPlaylist playlist;
+
+ playlist.addMedia(content1);
+ QCOMPARE(playlist.mediaCount(), 1);
+ QCOMPARE(playlist.media(0), content1);
+
+ playlist.addMedia(content2);
+ QCOMPARE(playlist.mediaCount(), 2);
+ QCOMPARE(playlist.media(1), content2);
+
+ QSignalSpy aboutToBeInsertedSignalSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int,int)));
+ QSignalSpy insertedSignalSpy(&playlist, SIGNAL(mediaInserted(int,int)));
+
+ playlist.insertMedia(1, content3);
+ QCOMPARE(playlist.mediaCount(), 3);
+ QCOMPARE(playlist.media(0), content1);
+ QCOMPARE(playlist.media(1), content3);
+ QCOMPARE(playlist.media(2), content2);
+
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
+
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ QUrl content4(QUrl(QLatin1String("file:///4")));
+ QUrl content5(QUrl(QLatin1String("file:///5")));
+ playlist.insertMedia(1, QList<QUrl>() << content4 << content5);
+
+ QCOMPARE(playlist.media(0), content1);
+ QCOMPARE(playlist.media(1), content4);
+ QCOMPARE(playlist.media(2), content5);
+ QCOMPARE(playlist.media(3), content3);
+ QCOMPARE(playlist.media(4), content2);
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy[0][0].toInt(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy[0][1].toInt(), 2);
+
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy[0][0].toInt(), 1);
+ QCOMPARE(insertedSignalSpy[0][1].toInt(), 2);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ playlist.insertMedia(1, QList<QUrl>());
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
+ QCOMPARE(insertedSignalSpy.count(), 0);
+
+ playlist.clear();
+ playlist.addMedia(content1);
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ playlist.insertMedia(-10, content2);
+ QCOMPARE(playlist.media(0), content2);
+ QCOMPARE(playlist.media(1), content1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 0);
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(insertedSignalSpy.first()[1].toInt(), 0);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ playlist.insertMedia(10, content3);
+ QCOMPARE(playlist.media(0), content2);
+ QCOMPARE(playlist.media(1), content1);
+ QCOMPARE(playlist.media(2), content3);
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 2);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 2);
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy.first()[0].toInt(), 2);
+ QCOMPARE(insertedSignalSpy.first()[1].toInt(), 2);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ playlist.insertMedia(-10, QList<QUrl>() << content4 << content5);
+ QCOMPARE(playlist.media(0), content4);
+ QCOMPARE(playlist.media(1), content5);
+ QCOMPARE(playlist.media(2), content2);
+ QCOMPARE(playlist.media(3), content1);
+ QCOMPARE(playlist.media(4), content3);
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
+
+ aboutToBeInsertedSignalSpy.clear();
+ insertedSignalSpy.clear();
+
+ QUrl content6(QUrl(QLatin1String("file:///6")));
+ QUrl content7(QUrl(QLatin1String("file:///7")));
+ playlist.insertMedia(10, QList<QUrl>() << content6 << content7);
+ QCOMPARE(playlist.media(0), content4);
+ QCOMPARE(playlist.media(1), content5);
+ QCOMPARE(playlist.media(2), content2);
+ QCOMPARE(playlist.media(3), content1);
+ QCOMPARE(playlist.media(4), content3);
+ QCOMPARE(playlist.media(5), content6);
+ QCOMPARE(playlist.media(6), content7);
+ QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 5);
+ QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 6);
+ QCOMPARE(insertedSignalSpy.count(), 1);
+ QCOMPARE(insertedSignalSpy.first()[0].toInt(), 5);
+ QCOMPARE(insertedSignalSpy.first()[1].toInt(), 6);
+}
+
+
+void tst_QMediaPlaylist::currentItem()
+{
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+
+ QCOMPARE(playlist.currentIndex(), -1);
+ QCOMPARE(playlist.currentMedia(), QUrl());
+
+ QCOMPARE(playlist.nextIndex(), 0);
+ QCOMPARE(playlist.nextIndex(2), 1);
+ QCOMPARE(playlist.previousIndex(), 1);
+ QCOMPARE(playlist.previousIndex(2), 0);
+
+ playlist.setCurrentIndex(0);
+ QCOMPARE(playlist.currentIndex(), 0);
+ QCOMPARE(playlist.currentMedia(), content1);
+
+ QCOMPARE(playlist.nextIndex(), 1);
+ QCOMPARE(playlist.nextIndex(2), -1);
+ QCOMPARE(playlist.previousIndex(), -1);
+ QCOMPARE(playlist.previousIndex(2), -1);
+
+ playlist.setCurrentIndex(1);
+ QCOMPARE(playlist.currentIndex(), 1);
+ QCOMPARE(playlist.currentMedia(), content2);
+
+ QCOMPARE(playlist.nextIndex(), -1);
+ QCOMPARE(playlist.nextIndex(2), -1);
+ QCOMPARE(playlist.previousIndex(), 0);
+ QCOMPARE(playlist.previousIndex(2), -1);
+
+ playlist.setCurrentIndex(2);
+
+ QCOMPARE(playlist.currentIndex(), -1);
+ QCOMPARE(playlist.currentMedia(), QUrl());
+}
+
+void tst_QMediaPlaylist::clear()
+{
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+
+ playlist.clear();
+ QVERIFY(playlist.isEmpty());
+ QCOMPARE(playlist.mediaCount(), 0);
+}
+
+void tst_QMediaPlaylist::removeMedia()
+{
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+ playlist.addMedia(content3);
+
+ QSignalSpy aboutToBeRemovedSignalSpy(&playlist, SIGNAL(mediaAboutToBeRemoved(int,int)));
+ QSignalSpy removedSignalSpy(&playlist, SIGNAL(mediaRemoved(int,int)));
+ playlist.removeMedia(1);
+ QCOMPARE(playlist.mediaCount(), 2);
+ QCOMPARE(playlist.media(1), content3);
+
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
+
+ QCOMPARE(removedSignalSpy.count(), 1);
+ QCOMPARE(removedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
+
+ aboutToBeRemovedSignalSpy.clear();
+ removedSignalSpy.clear();
+
+ playlist.removeMedia(0,1);
+ QVERIFY(playlist.isEmpty());
+
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
+
+ QCOMPARE(removedSignalSpy.count(), 1);
+ QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
+
+
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+ playlist.addMedia(content3);
+
+ playlist.removeMedia(0,1);
+ QCOMPARE(playlist.mediaCount(), 1);
+ QCOMPARE(playlist.media(0), content3);
+
+ QCOMPARE(playlist.removeMedia(-1), false);
+ QCOMPARE(playlist.removeMedia(1), false);
+
+ playlist.addMedia(content1);
+ aboutToBeRemovedSignalSpy.clear();
+ removedSignalSpy.clear();
+
+ playlist.removeMedia(-10, 10);
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
+ QCOMPARE(removedSignalSpy.count(), 1);
+ QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
+
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+ playlist.addMedia(content3);
+ aboutToBeRemovedSignalSpy.clear();
+ removedSignalSpy.clear();
+
+ QCOMPARE(playlist.removeMedia(10, -10), false);
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 0);
+ QCOMPARE(removedSignalSpy.count(), 0);
+ QCOMPARE(playlist.removeMedia(-10, -5), false);
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 0);
+ QCOMPARE(removedSignalSpy.count(), 0);
+ QCOMPARE(playlist.removeMedia(5, 10), false);
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 0);
+ QCOMPARE(removedSignalSpy.count(), 0);
+
+ playlist.removeMedia(1, 10);
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 2);
+ QCOMPARE(removedSignalSpy.count(), 1);
+ QCOMPARE(removedSignalSpy.first()[0].toInt(), 1);
+ QCOMPARE(removedSignalSpy.first()[1].toInt(), 2);
+
+ playlist.addMedia(content2);
+ playlist.addMedia(content3);
+ aboutToBeRemovedSignalSpy.clear();
+ removedSignalSpy.clear();
+
+ playlist.removeMedia(-10, 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
+ QCOMPARE(removedSignalSpy.count(), 1);
+ QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
+ QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
+}
+
+void tst_QMediaPlaylist::saveAndLoad()
+{
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+ playlist.addMedia(content3);
+
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+ QVERIFY(playlist.errorString().isEmpty());
+
+ QBuffer buffer;
+ buffer.open(QBuffer::ReadWrite);
+
+ bool res = playlist.save(&buffer, "unsupported_format");
+ QVERIFY(!res);
+ QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
+ QVERIFY(!playlist.errorString().isEmpty());
+
+ QSignalSpy loadedSignal(&playlist, SIGNAL(loaded()));
+ QSignalSpy errorSignal(&playlist, SIGNAL(loadFailed()));
+ playlist.load(&buffer, "unsupported_format");
+ QTRY_VERIFY(loadedSignal.isEmpty());
+ QCOMPARE(errorSignal.size(), 1);
+ QVERIFY(playlist.error() != QMediaPlaylist::NoError);
+ QVERIFY(!playlist.errorString().isEmpty());
+
+
+ res = playlist.save(QUrl::fromLocalFile(QLatin1String("tmp.unsupported_format")), "unsupported_format");
+ QVERIFY(!res);
+ QVERIFY(playlist.error() != QMediaPlaylist::NoError);
+ QVERIFY(!playlist.errorString().isEmpty());
+
+ loadedSignal.clear();
+ errorSignal.clear();
+ QUrl testFileName = QUrl::fromLocalFile(QFINDTESTDATA("testdata") + "/testfile");
+ playlist.load(testFileName, "unsupported_format");
+ QTRY_VERIFY(loadedSignal.isEmpty());
+ QCOMPARE(errorSignal.size(), 1);
+ QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
+ QVERIFY(!playlist.errorString().isEmpty());
+ QVERIFY(playlist.mediaCount() == 3);
+
+ res = playlist.save(&buffer, "m3u");
+
+ QVERIFY(res);
+ QVERIFY(buffer.pos() > 0);
+ buffer.seek(0);
+
+ QMediaPlaylist playlist2;
+ QSignalSpy loadedSignal2(&playlist2, SIGNAL(loaded()));
+ QSignalSpy errorSignal2(&playlist2, SIGNAL(loadFailed()));
+ playlist2.load(&buffer, "m3u");
+ QCOMPARE(loadedSignal2.size(), 1);
+ QTRY_VERIFY(errorSignal2.isEmpty());
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+
+ QCOMPARE(playlist.mediaCount(), playlist2.mediaCount());
+ QCOMPARE(playlist.media(0), playlist2.media(0));
+ QCOMPARE(playlist.media(1), playlist2.media(1));
+ QCOMPARE(playlist.media(3), playlist2.media(3));
+ res = playlist.save(QUrl::fromLocalFile(QLatin1String("tmp.m3u")), "m3u");
+ QVERIFY(res);
+
+ loadedSignal2.clear();
+ errorSignal2.clear();
+ playlist2.clear();
+ QVERIFY(playlist2.isEmpty());
+ playlist2.load(QUrl::fromLocalFile(QLatin1String("tmp.m3u")), "m3u");
+ QCOMPARE(loadedSignal2.size(), 1);
+ QTRY_VERIFY(errorSignal2.isEmpty());
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+
+ QCOMPARE(playlist.mediaCount(), playlist2.mediaCount());
+ QCOMPARE(playlist.media(0), playlist2.media(0));
+ QCOMPARE(playlist.media(1), playlist2.media(1));
+ QCOMPARE(playlist.media(3), playlist2.media(3));
+}
+
+void tst_QMediaPlaylist::loadM3uFile()
+{
+ QMediaPlaylist playlist;
+
+ // Try to load playlist that does not exist in the testdata folder
+ QSignalSpy loadSpy(&playlist, SIGNAL(loaded()));
+ QSignalSpy loadFailedSpy(&playlist, SIGNAL(loadFailed()));
+ QString testFileName = QFINDTESTDATA("testdata");
+ playlist.load(QUrl::fromLocalFile(testFileName + "/missing_file.m3u"));
+ QTRY_VERIFY(loadSpy.isEmpty());
+ QVERIFY(!loadFailedSpy.isEmpty());
+ QVERIFY(playlist.error() != QMediaPlaylist::NoError);
+
+ loadSpy.clear();
+ loadFailedSpy.clear();
+ testFileName = QFINDTESTDATA("testdata/test.m3u");
+ playlist.load(QUrl::fromLocalFile(testFileName));
+ QTRY_VERIFY(!loadSpy.isEmpty());
+ QVERIFY(loadFailedSpy.isEmpty());
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+ QCOMPARE(playlist.mediaCount(), 7);
+
+ QCOMPARE(playlist.media(0), QUrl(QLatin1String("http://test.host/path")));
+ QCOMPARE(playlist.media(1), QUrl(QLatin1String("http://test.host/path")));
+ testFileName = QFINDTESTDATA("testdata/testfile");
+ QCOMPARE(playlist.media(2),
+ QUrl::fromLocalFile(testFileName));
+ testFileName = QFINDTESTDATA("testdata");
+ QCOMPARE(playlist.media(3),
+ QUrl::fromLocalFile(testFileName + "/testdir/testfile"));
+ QCOMPARE(playlist.media(4), QUrl(QLatin1String("file:///testdir/testfile")));
+ QCOMPARE(playlist.media(5), QUrl(QLatin1String("file://path/name#suffix")));
+ //ensure #2 suffix is not stripped from path
+ testFileName = QFINDTESTDATA("testdata/testfile2#suffix");
+ QCOMPARE(playlist.media(6), QUrl::fromLocalFile(testFileName));
+
+ // check ability to load from QNetworkRequest
+ loadSpy.clear();
+ loadFailedSpy.clear();
+ playlist.load(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.m3u")));
+ QTRY_VERIFY(!loadSpy.isEmpty());
+ QVERIFY(loadFailedSpy.isEmpty());
+}
+
+void tst_QMediaPlaylist::loadPLSFile()
+{
+ QMediaPlaylist playlist;
+
+ // Try to load playlist that does not exist in the testdata folder
+ QSignalSpy loadSpy(&playlist, SIGNAL(loaded()));
+ QSignalSpy loadFailedSpy(&playlist, SIGNAL(loadFailed()));
+ QString testFileName = QFINDTESTDATA("testdata");
+ playlist.load(QUrl::fromLocalFile(testFileName + "/missing_file.pls"));
+ QTRY_VERIFY(loadSpy.isEmpty());
+ QVERIFY(!loadFailedSpy.isEmpty());
+ QVERIFY(playlist.error() != QMediaPlaylist::NoError);
+
+ // Try to load empty playlist
+ loadSpy.clear();
+ loadFailedSpy.clear();
+ testFileName = QFINDTESTDATA("testdata/empty.pls");
+ playlist.load(QUrl::fromLocalFile(testFileName));
+ QTRY_VERIFY(!loadSpy.isEmpty());
+ QVERIFY(loadFailedSpy.isEmpty());
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+ QCOMPARE(playlist.mediaCount(), 0);
+
+ // Try to load regular playlist
+ loadSpy.clear();
+ loadFailedSpy.clear();
+ testFileName = QFINDTESTDATA("testdata/test.pls");
+ playlist.load(QUrl::fromLocalFile(testFileName));
+ QTRY_VERIFY(!loadSpy.isEmpty());
+ QVERIFY(loadFailedSpy.isEmpty());
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+ QCOMPARE(playlist.mediaCount(), 7);
+
+ QCOMPARE(playlist.media(0), QUrl(QLatin1String("http://test.host/path")));
+ QCOMPARE(playlist.media(1), QUrl(QLatin1String("http://test.host/path")));
+ testFileName = QFINDTESTDATA("testdata/testfile");
+ QCOMPARE(playlist.media(2),
+ QUrl::fromLocalFile(testFileName));
+ testFileName = QFINDTESTDATA("testdata");
+ QCOMPARE(playlist.media(3),
+ QUrl::fromLocalFile(testFileName + "/testdir/testfile"));
+ QCOMPARE(playlist.media(4), QUrl(QLatin1String("file:///testdir/testfile")));
+ QCOMPARE(playlist.media(5), QUrl(QLatin1String("file://path/name#suffix")));
+ //ensure #2 suffix is not stripped from path
+ testFileName = QFINDTESTDATA("testdata/testfile2#suffix");
+ QCOMPARE(playlist.media(6), QUrl::fromLocalFile(testFileName));
+
+ // Try to load a totem-pl generated playlist
+ // (Format doesn't respect the spec)
+ loadSpy.clear();
+ loadFailedSpy.clear();
+ playlist.clear();
+ testFileName = QFINDTESTDATA("testdata/totem-pl-example.pls");
+ playlist.load(QUrl::fromLocalFile(testFileName));
+ QTRY_VERIFY(!loadSpy.isEmpty());
+ QVERIFY(loadFailedSpy.isEmpty());
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+ QCOMPARE(playlist.mediaCount(), 1);
+ QCOMPARE(playlist.media(0), QUrl(QLatin1String("http://test.host/path")));
+
+
+ // check ability to load from QNetworkRequest
+ loadSpy.clear();
+ loadFailedSpy.clear();
+ playlist.load(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.pls")));
+ QTRY_VERIFY(!loadSpy.isEmpty());
+ QVERIFY(loadFailedSpy.isEmpty());
+}
+
+void tst_QMediaPlaylist::playbackMode_data()
+{
+ QTest::addColumn<QMediaPlaylist::PlaybackMode>("playbackMode");
+ QTest::addColumn<int>("expectedPrevious");
+ QTest::addColumn<int>("pos");
+ QTest::addColumn<int>("expectedNext");
+
+ QTest::newRow("Sequential, 0") << QMediaPlaylist::Sequential << -1 << 0 << 1;
+ QTest::newRow("Sequential, 1") << QMediaPlaylist::Sequential << 0 << 1 << 2;
+ QTest::newRow("Sequential, 2") << QMediaPlaylist::Sequential << 1 << 2 << -1;
+
+ QTest::newRow("Loop, 0") << QMediaPlaylist::Loop << 2 << 0 << 1;
+ QTest::newRow("Loop, 1") << QMediaPlaylist::Loop << 0 << 1 << 2;
+ QTest::newRow("Lopp, 2") << QMediaPlaylist::Loop << 1 << 2 << 0;
+
+ QTest::newRow("ItemOnce, 1") << QMediaPlaylist::CurrentItemOnce << -1 << 1 << -1;
+ QTest::newRow("ItemInLoop, 1") << QMediaPlaylist::CurrentItemInLoop << 1 << 1 << 1;
+
+ // Bit difficult to test random this way
+}
+
+void tst_QMediaPlaylist::playbackMode()
+{
+ QFETCH(QMediaPlaylist::PlaybackMode, playbackMode);
+ QFETCH(int, expectedPrevious);
+ QFETCH(int, pos);
+ QFETCH(int, expectedNext);
+
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+ playlist.addMedia(content3);
+
+ QCOMPARE(playlist.playbackMode(), QMediaPlaylist::Sequential);
+ QCOMPARE(playlist.currentIndex(), -1);
+
+ playlist.setPlaybackMode(playbackMode);
+ QCOMPARE(playlist.playbackMode(), playbackMode);
+
+ playlist.setCurrentIndex(pos);
+ QCOMPARE(playlist.currentIndex(), pos);
+ QCOMPARE(playlist.nextIndex(), expectedNext);
+ QCOMPARE(playlist.previousIndex(), expectedPrevious);
+
+ playlist.next();
+ QCOMPARE(playlist.currentIndex(), expectedNext);
+
+ playlist.setCurrentIndex(pos);
+ playlist.previous();
+ QCOMPARE(playlist.currentIndex(), expectedPrevious);
+}
+
+void tst_QMediaPlaylist::shuffle()
+{
+ QMediaPlaylist playlist;
+ QList<QUrl> contentList;
+
+ for (int i=0; i<100; i++) {
+ QUrl content(QUrl::fromLocalFile(QString::number(i)));
+ contentList.append(content);
+ playlist.addMedia(content);
+ }
+
+ playlist.shuffle();
+
+ QList<QUrl> shuffledContentList;
+ for (int i=0; i<playlist.mediaCount(); i++)
+ shuffledContentList.append(playlist.media(i));
+
+ QVERIFY(contentList != shuffledContentList);
+
+}
+
+
+void tst_QMediaPlaylist::setMediaSource()
+{
+ QUrl content0(QUrl(QLatin1String("test://audio/song1.mp3")));
+ QUrl content1(QUrl(QLatin1String("test://audio/song2.mp3")));
+ QUrl content2(QUrl(QLatin1String("test://video/movie1.mp4")));
+ QUrl content3(QUrl(QLatin1String("test://video/movie2.mp4")));
+
+ {
+ QMediaPlaylist playlist;
+ QSignalSpy currentIndexSpy(&playlist, SIGNAL(currentIndexChanged(int)));
+ QSignalSpy playbackModeSpy(&playlist, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
+ QSignalSpy mediaAboutToBeInsertedSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int, int)));
+ QSignalSpy mediaInsertedSpy(&playlist, SIGNAL(mediaInserted(int, int)));
+ QSignalSpy mediaAboutToBeRemovedSpy(&playlist, SIGNAL(mediaAboutToBeRemoved(int, int)));
+ QSignalSpy mediaRemovedSpy(&playlist, SIGNAL(mediaRemoved(int, int)));
+ QSignalSpy mediaChangedSpy(&playlist, SIGNAL(mediaChanged(int, int)));
+
+ QVERIFY(playlist.isEmpty());
+
+ QVERIFY(playlist.isEmpty());
+ QCOMPARE(playlist.currentIndex(), -1);
+ QCOMPARE(playlist.playbackMode(), QMediaPlaylist::Sequential);
+ QCOMPARE(currentIndexSpy.count(), 0);
+ QCOMPARE(playbackModeSpy.count(), 0);
+ QCOMPARE(mediaAboutToBeInsertedSpy.count(), 0);
+ QCOMPARE(mediaInsertedSpy.count(), 0);
+ QCOMPARE(mediaAboutToBeRemovedSpy.count(), 0);
+ QCOMPARE(mediaRemovedSpy.count(), 0);
+ QCOMPARE(mediaChangedSpy.count(), 0);
+
+ // add items to playlist
+ playlist.addMedia(content0);
+ playlist.addMedia(content1);
+ playlist.setCurrentIndex(1);
+ playlist.shuffle();
+ QCOMPARE(playlist.mediaCount(), 2);
+ QCOMPARE(playlist.currentIndex(), 1);
+ QCOMPARE(playlist.currentMedia(), content1);
+
+ currentIndexSpy.clear();
+ playbackModeSpy.clear();
+ mediaAboutToBeInsertedSpy.clear();
+ mediaInsertedSpy.clear();
+ mediaAboutToBeRemovedSpy.clear();
+ mediaRemovedSpy.clear();
+ mediaChangedSpy.clear();
+ }
+ {
+ QMediaPlaylist playlist;
+ QVERIFY(playlist.isEmpty());
+ // Add items to playlist before binding to the service (internal control)
+ playlist.addMedia(content0);
+ playlist.addMedia(content1);
+ playlist.addMedia(content2);
+ playlist.setCurrentIndex(2);
+ playlist.setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
+
+ QSignalSpy currentIndexSpy(&playlist, SIGNAL(currentIndexChanged(int)));
+ QSignalSpy playbackModeSpy(&playlist, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
+ QSignalSpy mediaAboutToBeInsertedSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int, int)));
+ QSignalSpy mediaInsertedSpy(&playlist, SIGNAL(mediaInserted(int, int)));
+ QSignalSpy mediaAboutToBeRemovedSpy(&playlist, SIGNAL(mediaAboutToBeRemoved(int, int)));
+ QSignalSpy mediaRemovedSpy(&playlist, SIGNAL(mediaRemoved(int, int)));
+ QSignalSpy mediaChangedSpy(&playlist, SIGNAL(mediaChanged(int, int)));
+
+ QCOMPARE(playlist.mediaCount(), 3);
+ QCOMPARE(playlist.currentIndex(), 2);
+ QCOMPARE(playlist.currentMedia(), content2);
+ QCOMPARE(playlist.playbackMode(), QMediaPlaylist::CurrentItemOnce);
+ QCOMPARE(currentIndexSpy.count(), 0);
+ QCOMPARE(playbackModeSpy.count(), 0);
+ QCOMPARE(mediaAboutToBeInsertedSpy.count(), 0);
+ QCOMPARE(mediaInsertedSpy.count(), 0);
+ QCOMPARE(mediaAboutToBeRemovedSpy.count(), 0);
+ QCOMPARE(mediaRemovedSpy.count(), 0);
+ QCOMPARE(mediaChangedSpy.count(), 0);
+
+ // Clear playlist content (service's playlist control)
+ playlist.clear();
+ playlist.setCurrentIndex(-1);
+ playlist.shuffle();
+
+ currentIndexSpy.clear();
+ playbackModeSpy.clear();
+ mediaAboutToBeInsertedSpy.clear();
+ mediaInsertedSpy.clear();
+ mediaAboutToBeRemovedSpy.clear();
+ mediaRemovedSpy.clear();
+ mediaChangedSpy.clear();
+ }
+}
+
+void tst_QMediaPlaylist::testCurrentIndexChanged_signal()
+{
+ //create an instance of QMediaPlaylist class.
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1); //set the media to playlist
+ playlist.addMedia(content2); //set the media to playlist
+
+ QSignalSpy spy(&playlist, SIGNAL(currentIndexChanged(int)));
+ QVERIFY(spy.size()== 0);
+ QCOMPARE(playlist.currentIndex(), -1);
+
+ //set the current index for playlist.
+ playlist.setCurrentIndex(0);
+ QVERIFY(spy.size()== 1); //verify the signal emission.
+ QCOMPARE(playlist.currentIndex(), 0); //verify the current index of playlist
+
+ //set the current index for playlist.
+ playlist.setCurrentIndex(1);
+ QVERIFY(spy.size()== 2); //verify the signal emission.
+ QCOMPARE(playlist.currentIndex(), 1); //verify the current index of playlist
+}
+
+void tst_QMediaPlaylist::testCurrentMediaChanged_signal()
+{
+ //create an instance of QMediaPlaylist class.
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1); //set the media to playlist
+ playlist.addMedia(content2); //set the media to playlist
+
+ QSignalSpy spy(&playlist, SIGNAL(currentMediaChanged(QUrl)));
+ QVERIFY(spy.size()== 0);
+ QCOMPARE(playlist.currentIndex(), -1);
+ QCOMPARE(playlist.currentMedia(), QUrl());
+
+ //set the current index for playlist.
+ playlist.setCurrentIndex(0);
+ QVERIFY(spy.size()== 1); //verify the signal emission.
+ QCOMPARE(playlist.currentIndex(), 0); //verify the current index of playlist
+ QCOMPARE(playlist.currentMedia(), content1); //verify the current media of playlist
+
+ //set the current index for playlist.
+ playlist.setCurrentIndex(1);
+ QVERIFY(spy.size()== 2); //verify the signal emission.
+ QCOMPARE(playlist.currentIndex(), 1); //verify the current index of playlist
+ QCOMPARE(playlist.currentMedia(), content2); //verify the current media of playlist
+}
+
+void tst_QMediaPlaylist::testLoaded_signal()
+{
+ //create an instance of QMediaPlaylist class.
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1); //set the media to playlist
+ playlist.addMedia(content2); //set the media to playlist
+ playlist.addMedia(content3); //set the media to playlist
+
+ QSignalSpy spy(&playlist, SIGNAL(loaded()));
+ QVERIFY(spy.size()== 0);
+
+ QBuffer buffer;
+ buffer.setData(QByteArray("foo.mp3"));
+ buffer.open(QBuffer::ReadWrite);
+
+ //load the playlist
+ playlist.load(&buffer,"m3u");
+ QVERIFY(spy.size()== 1); //verify the signal emission.
+}
+
+void tst_QMediaPlaylist::testMediaChanged_signal()
+{
+ //create an instance of QMediaPlaylist class.
+ QMediaPlaylist playlist;
+
+ QSignalSpy spy(&playlist, SIGNAL(mediaChanged(int,int)));
+
+ // Add media to playlist
+ playlist.addMedia(content1); //set the media to playlist
+ playlist.addMedia(content2); //set the media to playlist
+ playlist.addMedia(content3); //set the media to playlist
+
+ // Adds/inserts do not cause change signals
+ QVERIFY(spy.size() == 0);
+
+ // Now change the list
+ playlist.shuffle();
+
+ QVERIFY(spy.size() == 1);
+ spy.clear();
+
+ //create media.
+ QUrl content4(QUrl(QLatin1String("file:///4")));
+ QUrl content5(QUrl(QLatin1String("file:///5")));
+
+ //insert media to playlist
+ playlist.insertMedia(1, content4);
+ playlist.insertMedia(2, content5);
+ // Adds/inserts do not cause change signals
+ QVERIFY(spy.size() == 0);
+
+ // And again
+ playlist.shuffle();
+
+ QVERIFY(spy.size() == 1);
+}
+
+void tst_QMediaPlaylist::testPlaybackModeChanged_signal()
+{
+ //create an instance of QMediaPlaylist class.
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1); //set the media to playlist
+ playlist.addMedia(content2); //set the media to playlist
+ playlist.addMedia(content3); //set the media to playlist
+
+ QSignalSpy spy(&playlist, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
+ QVERIFY(playlist.playbackMode()== QMediaPlaylist::Sequential);
+ QVERIFY(spy.size() == 0);
+
+ // Set playback mode to the playlist
+ playlist.setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
+ QVERIFY(playlist.playbackMode()== QMediaPlaylist::CurrentItemOnce);
+ QVERIFY(spy.size() == 1);
+
+ // Set playback mode to the playlist
+ playlist.setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
+ QVERIFY(playlist.playbackMode()== QMediaPlaylist::CurrentItemInLoop);
+ QVERIFY(spy.size() == 2);
+
+ // Set playback mode to the playlist
+ playlist.setPlaybackMode(QMediaPlaylist::Sequential);
+ QVERIFY(playlist.playbackMode()== QMediaPlaylist::Sequential);
+ QVERIFY(spy.size() == 3);
+
+ // Set playback mode to the playlist
+ playlist.setPlaybackMode(QMediaPlaylist::Loop);
+ QVERIFY(playlist.playbackMode()== QMediaPlaylist::Loop);
+ QVERIFY(spy.size() == 4);
+}
+
+void tst_QMediaPlaylist::testEnums()
+{
+ //create an instance of QMediaPlaylist class.
+ QMediaPlaylist playlist;
+ playlist.addMedia(content1); //set the media to playlist
+ playlist.addMedia(content2); //set the media to playlist
+ playlist.addMedia(content3); //set the media to playlist
+ QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
+
+ QBuffer buffer;
+ buffer.open(QBuffer::ReadWrite);
+
+ // checking for QMediaPlaylist::FormatNotSupportedError enum
+ QVERIFY(!playlist.save(&buffer, "unsupported_format"));
+ QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
+
+ playlist.load(&buffer,"unsupported_format");
+ QVERIFY(playlist.error() == QMediaPlaylist::FormatNotSupportedError);
+}
+
+QTEST_MAIN(tst_QMediaPlaylist)
+#include "tst_qmediaplaylist.moc"
+
diff --git a/tests/auto/unit/multimedia/qmediarecorder/CMakeLists.txt b/tests/auto/unit/multimedia/qmediarecorder/CMakeLists.txt
new file mode 100644
index 000000000..83e40012a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediarecorder/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from QMediaRecorder.pro.
+
+#####################################################################
+## tst_QMediaRecorder Test:
+#####################################################################
+
+qt_internal_add_test(tst_qmediarecorder
+ SOURCES
+ tst_qmediarecorder.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp b/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp
new file mode 100644
index 000000000..a11f39207
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediarecorder/tst_qmediarecorder.cpp
@@ -0,0 +1,492 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+#include <QtMultimedia/qmediametadata.h>
+#include <private/qplatformmediarecorder_p.h>
+#include "private/qguiapplication_p.h"
+#include <qmediarecorder.h>
+#include <qaudioformat.h>
+#include <qmockintegration.h>
+#include <qmediacapturesession.h>
+#include <qscreencapture.h>
+#include <qwindowcapture.h>
+
+#include "qguiapplication_platform.h"
+#include "qmockmediacapturesession.h"
+#include "qmockmediaencoder.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QMediaRecorder : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+private slots:
+ void testBasicSession();
+ void testNullControls();
+ void testDeleteMediaCapture();
+ void testError();
+ void testSink();
+ void testRecord();
+ void testEncodingSettings();
+ void testAudioSettings();
+ void testVideoSettings();
+ void testSettingsApplied();
+
+ void metaData();
+
+ void testIsAvailable();
+ void testEnum();
+
+ void testVideoSettingsQuality();
+ void testVideoSettingsEncodingMode();
+
+ void testApplicationInative();
+
+private:
+ QMediaCaptureSession *captureSession;
+ QCamera *object = nullptr;
+ QMockMediaCaptureSession *service = nullptr;
+ QMockMediaEncoder *mock;
+ QMediaRecorder *encoder;
+};
+
+void tst_QMediaRecorder::initTestCase()
+{
+ captureSession = new QMediaCaptureSession;
+ object = new QCamera;
+ encoder = new QMediaRecorder;
+ captureSession->setCamera(object);
+ captureSession->setRecorder(encoder);
+ service = QMockIntegration::instance()->lastCaptureService();
+ mock = service->mockControl;
+}
+
+void tst_QMediaRecorder::cleanupTestCase()
+{
+ delete encoder;
+ delete object;
+ delete captureSession;
+}
+
+void tst_QMediaRecorder::testBasicSession()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QMediaRecorder recorder;
+ session.setCamera(&camera);
+ session.setRecorder(&recorder);
+
+ QCOMPARE(recorder.outputLocation(), QUrl());
+ QCOMPARE(recorder.recorderState(), QMediaRecorder::StoppedState);
+ QCOMPARE(recorder.error(), QMediaRecorder::NoError);
+ QCOMPARE(recorder.duration(), qint64(0));
+}
+
+void tst_QMediaRecorder::testNullControls()
+{
+ // With the new changes, hasControls does not make much sense anymore
+ // since the session does not own the controls
+ // The equivalent of this test would be to not set the control to the session
+ // ???
+ QMediaCaptureSession session;
+ // mockIntegration->lastCaptureService()->hasControls = false;
+ QCamera camera;
+ QMediaRecorder recorder;
+ session.setCamera(&camera);
+ // session.setRecorder(&recorder);
+
+ QCOMPARE(recorder.outputLocation(), QUrl());
+ QCOMPARE(recorder.recorderState(), QMediaRecorder::StoppedState);
+ QCOMPARE(recorder.error(), QMediaRecorder::NoError);
+ QCOMPARE(recorder.duration(), qint64(0));
+
+ recorder.setOutputLocation(QUrl("file://test/save/file.mp4"));
+ QCOMPARE(recorder.outputLocation(), QUrl("file://test/save/file.mp4"));
+ QCOMPARE(recorder.actualLocation(), QUrl());
+
+ QMediaFormat format;
+ format.setFileFormat(QMediaFormat::MPEG4);
+ format.setAudioCodec(QMediaFormat::AudioCodec::AAC);
+ format.setVideoCodec(QMediaFormat::VideoCodec::VP9);
+ recorder.setMediaFormat(format);
+ recorder.setQuality(QMediaRecorder::LowQuality);
+ recorder.setVideoResolution(640, 480);
+
+ QCOMPARE(recorder.mediaFormat().audioCodec(), QMediaFormat::AudioCodec::AAC);
+ QCOMPARE(recorder.mediaFormat().videoCodec(), QMediaFormat::VideoCodec::VP9);
+ QCOMPARE(recorder.mediaFormat().fileFormat(), QMediaFormat::MPEG4);
+
+ QSignalSpy spy(&recorder, &QMediaRecorder::recorderStateChanged);
+
+ recorder.record();
+ QCOMPARE(recorder.recorderState(), QMediaRecorder::StoppedState);
+ QCOMPARE(recorder.error(), QMediaRecorder::NoError);
+ QCOMPARE(spy.size(), 0);
+
+ recorder.pause();
+ QCOMPARE(recorder.recorderState(), QMediaRecorder::StoppedState);
+ QCOMPARE(recorder.error(), QMediaRecorder::NoError);
+ QCOMPARE(spy.size(), 0);
+
+ recorder.stop();
+ QCOMPARE(recorder.recorderState(), QMediaRecorder::StoppedState);
+ QCOMPARE(recorder.error(), QMediaRecorder::NoError);
+ QCOMPARE(spy.size(), 0);
+}
+
+void tst_QMediaRecorder::testDeleteMediaCapture()
+{
+ QMediaCaptureSession session;
+ QMediaRecorder recorder;
+
+ session.setRecorder(&recorder);
+
+ auto checkSourceDeleting = [&](auto setter, auto getter, auto signal) {
+ using Type = std::remove_pointer_t<decltype((session.*getter)())>;
+
+ auto errorPrinter = qScopeGuard(
+ []() { qDebug() << QMetaType::fromType<Type>().name() << "deleting failed"; });
+
+ auto capture = std::make_unique<Type>();
+
+ (session.*setter)(capture.get());
+
+ QVERIFY((session.*getter)() == capture.get());
+
+ QSignalSpy spy(&session, signal);
+ capture.reset();
+
+ QCOMPARE(spy.size(), 1);
+ QCOMPARE((session.*getter)(), nullptr);
+
+ QVERIFY(recorder.isAvailable());
+
+ errorPrinter.dismiss();
+ };
+
+ checkSourceDeleting(&QMediaCaptureSession::setImageCapture,
+ &QMediaCaptureSession::imageCapture,
+ &QMediaCaptureSession::imageCaptureChanged);
+ checkSourceDeleting(&QMediaCaptureSession::setCamera, &QMediaCaptureSession::camera,
+ &QMediaCaptureSession::cameraChanged);
+ checkSourceDeleting(&QMediaCaptureSession::setScreenCapture,
+ &QMediaCaptureSession::screenCapture,
+ &QMediaCaptureSession::screenCaptureChanged);
+ checkSourceDeleting(&QMediaCaptureSession::setWindowCapture,
+ &QMediaCaptureSession::windowCapture,
+ &QMediaCaptureSession::windowCaptureChanged);
+}
+
+void tst_QMediaRecorder::testError()
+{
+ const QString errorString(QLatin1String("format error"));
+
+ QSignalSpy spy(encoder, &QMediaRecorder::errorOccurred);
+
+ QCOMPARE(encoder->error(), QMediaRecorder::NoError);
+ QCOMPARE(encoder->errorString(), QString());
+
+ mock->updateError(QMediaRecorder::FormatError, errorString);
+ QCOMPARE(encoder->error(), QMediaRecorder::FormatError);
+ QCOMPARE(encoder->errorString(), errorString);
+ QCOMPARE(spy.size(), 1);
+
+ QCOMPARE(spy.last()[0].value<QMediaRecorder::Error>(), QMediaRecorder::FormatError);
+}
+
+void tst_QMediaRecorder::testSink()
+{
+ encoder->setOutputLocation(QUrl("test.tmp"));
+ QUrl s = encoder->outputLocation();
+ QCOMPARE(s.toString(), QStringLiteral("test.tmp"));
+ QCOMPARE(encoder->actualLocation(), QUrl());
+
+ //the actual location is available after record
+ encoder->record();
+ QCOMPARE(encoder->actualLocation().toString(), QStringLiteral("test.tmp"));
+ encoder->stop();
+ QCOMPARE(encoder->actualLocation().toString(), QStringLiteral("test.tmp"));
+
+ //setOutputLocation resets the actual location
+ encoder->setOutputLocation(QUrl());
+ QCOMPARE(encoder->actualLocation(), QUrl());
+
+ encoder->record();
+ QCOMPARE(encoder->actualLocation(), QUrl::fromLocalFile("default_name.mp4"));
+ encoder->stop();
+ QCOMPARE(encoder->actualLocation(), QUrl::fromLocalFile("default_name.mp4"));
+
+ mock->reset();
+}
+
+void tst_QMediaRecorder::testRecord()
+{
+ QSignalSpy stateSignal(encoder, &QMediaRecorder::recorderStateChanged);
+ QSignalSpy progressSignal(encoder, &QMediaRecorder::durationChanged);
+ encoder->record();
+ QCOMPARE(encoder->recorderState(), QMediaRecorder::RecordingState);
+ QCOMPARE(encoder->error(), QMediaRecorder::NoError);
+ QCOMPARE(encoder->errorString(), QString());
+
+ QCOMPARE(stateSignal.size(), 1);
+ QCOMPARE(stateSignal.last()[0].value<QMediaRecorder::RecorderState>(), QMediaRecorder::RecordingState);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ QVERIFY(progressSignal.size() > 0);
+
+ encoder->pause();
+
+ QCOMPARE(encoder->recorderState(), QMediaRecorder::PausedState);
+
+ QCOMPARE(stateSignal.size(), 2);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ encoder->stop();
+
+ QCOMPARE(encoder->recorderState(), QMediaRecorder::StoppedState);
+ QCOMPARE(stateSignal.size(), 3);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ mock->stop();
+ QCOMPARE(stateSignal.size(), 3);
+
+ mock->reset();
+}
+
+void tst_QMediaRecorder::testEncodingSettings()
+{
+ QMediaFormat format = encoder->mediaFormat();
+ QCOMPARE(format.fileFormat(), QMediaFormat::UnspecifiedFormat);
+ QCOMPARE(format.audioCodec(), QMediaFormat::AudioCodec::Unspecified);
+ QCOMPARE(format.videoCodec(), QMediaFormat::VideoCodec::Unspecified);
+ QCOMPARE(encoder->quality(), QMediaRecorder::NormalQuality);
+ QCOMPARE(encoder->encodingMode(), QMediaRecorder::ConstantQualityEncoding);
+
+ format.setAudioCodec(QMediaFormat::AudioCodec::MP3);
+ encoder->setAudioSampleRate(44100);
+ encoder->setAudioBitRate(256*1024);
+ encoder->setQuality(QMediaRecorder::HighQuality);
+ encoder->setEncodingMode(QMediaRecorder::AverageBitRateEncoding);
+
+ format.setVideoCodec(QMediaFormat::VideoCodec::H264);
+ encoder->setVideoBitRate(800);
+ encoder->setVideoFrameRate(24*1024);
+ encoder->setVideoResolution(QSize(800,600));
+ encoder->setMediaFormat(format);
+
+ QCOMPARE(encoder->mediaFormat().audioCodec(), QMediaFormat::AudioCodec::MP3);
+ QCOMPARE(encoder->audioSampleRate(), 44100);
+ QCOMPARE(encoder->audioBitRate(), 256*1024);
+ QCOMPARE(encoder->quality(), QMediaRecorder::HighQuality);
+ QCOMPARE(encoder->encodingMode(), QMediaRecorder::AverageBitRateEncoding);
+
+ QCOMPARE(encoder->mediaFormat().videoCodec(), QMediaFormat::VideoCodec::H264);
+ QCOMPARE(encoder->videoBitRate(), 800);
+ QCOMPARE(encoder->videoFrameRate(), 24*1024);
+ QCOMPARE(encoder->videoResolution(), QSize(800,600));
+}
+
+void tst_QMediaRecorder::testAudioSettings()
+{
+ QMediaRecorder recorder;
+
+ QCOMPARE(recorder.mediaFormat(), QMediaFormat());
+ QCOMPARE(recorder.mediaFormat().fileFormat(), QMediaFormat::UnspecifiedFormat);
+ QCOMPARE(recorder.audioBitRate(), -1);
+ QCOMPARE(recorder.quality(), QMediaRecorder::NormalQuality);
+ QCOMPARE(recorder.audioSampleRate(), -1);
+
+ QMediaFormat format;
+ format.setFileFormat(QMediaFormat::FLAC);
+ recorder.setMediaFormat(format);
+ QCOMPARE(recorder.mediaFormat(), format);
+
+ recorder.setAudioBitRate(128000);
+ QCOMPARE(recorder.audioBitRate(), 128000);
+
+ recorder.setQuality(QMediaRecorder::HighQuality);
+ QCOMPARE(recorder.quality(), QMediaRecorder::HighQuality);
+
+ recorder.setAudioSampleRate(44100);
+ QCOMPARE(recorder.audioSampleRate(), 44100);
+
+ QCOMPARE(recorder.audioChannelCount(), -1);
+ recorder.setAudioChannelCount(2);
+ QCOMPARE(recorder.audioChannelCount(), 2);
+}
+
+void tst_QMediaRecorder::testVideoSettings()
+{
+ QMediaRecorder recorder;
+
+ QCOMPARE(recorder.mediaFormat(), QMediaFormat());
+ QCOMPARE(recorder.mediaFormat().videoCodec(), QMediaFormat::VideoCodec::Unspecified);
+ QMediaFormat format;
+ format.setVideoCodec(QMediaFormat::VideoCodec::H265);
+ recorder.setMediaFormat(format);
+ QCOMPARE(recorder.mediaFormat(), format);
+ QCOMPARE(recorder.mediaFormat().videoCodec(), QMediaFormat::VideoCodec::H265);
+
+ QCOMPARE(recorder.videoBitRate(), -1);
+ recorder.setVideoBitRate(128000);
+ QCOMPARE(recorder.videoBitRate(), 128000);
+
+ QCOMPARE(recorder.quality(), QMediaRecorder::NormalQuality);
+ recorder.setQuality(QMediaRecorder::HighQuality);
+ QCOMPARE(recorder.quality(), QMediaRecorder::HighQuality);
+
+ QCOMPARE(recorder.videoFrameRate(), -1);
+ recorder.setVideoFrameRate(60);
+ QVERIFY(qFuzzyCompare(recorder.videoFrameRate(), qreal(60)));
+ recorder.setVideoFrameRate(24.0);
+ QVERIFY(qFuzzyCompare(recorder.videoFrameRate(), qreal(24.0)));
+
+ QCOMPARE(recorder.videoResolution(), QSize());
+ recorder.setVideoResolution(QSize(320,240));
+ QCOMPARE(recorder.videoResolution(), QSize(320,240));
+ recorder.setVideoResolution(800,600);
+ QCOMPARE(recorder.videoResolution(), QSize(800,600));
+}
+
+void tst_QMediaRecorder::testSettingsApplied()
+{
+ QMediaCaptureSession session;
+ QMediaRecorder encoder;
+ session.setRecorder(&encoder);
+
+ encoder.setVideoResolution(640,480);
+
+ //encoder settings are applied before recording if changed
+ encoder.setQuality(QMediaRecorder::VeryHighQuality);
+ encoder.record();
+
+ encoder.stop();
+}
+
+void tst_QMediaRecorder::metaData()
+{
+ QMediaCaptureSession session;
+ QCamera camera;
+ QMediaRecorder recorder;
+ session.setCamera(&camera);
+ session.setRecorder(&recorder);
+
+ QVERIFY(recorder.metaData().isEmpty());
+
+ QMediaMetaData data;
+ data.insert(QMediaMetaData::Author, QStringLiteral("John Doe"));
+ recorder.setMetaData(data);
+
+ QCOMPARE(recorder.metaData().value(QMediaMetaData::Author).toString(), QStringLiteral("John Doe"));
+}
+
+void tst_QMediaRecorder::testIsAvailable()
+{
+ {
+ QMediaCaptureSession session;
+ QCamera camera;
+ QMediaRecorder recorder;
+ session.setCamera(&camera);
+ session.setRecorder(&recorder);
+ QCOMPARE(recorder.isAvailable(), true);
+ }
+ {
+ QMediaRecorder recorder;
+ QCOMPARE(recorder.isAvailable(), false);
+ }
+}
+
+/* enum QMediaRecorder::ResourceError property test. */
+void tst_QMediaRecorder::testEnum()
+{
+ const QString errorString(QLatin1String("resource error"));
+
+ QSignalSpy spy(encoder, &QMediaRecorder::errorOccurred);
+
+ QCOMPARE(encoder->error(), QMediaRecorder::NoError);
+ QCOMPARE(encoder->errorString(), QString());
+
+ mock->updateError(QMediaRecorder::ResourceError, errorString);
+ QCOMPARE(encoder->error(), QMediaRecorder::ResourceError);
+ QCOMPARE(encoder->errorString(), errorString);
+ QCOMPARE(spy.size(), 1);
+
+ QCOMPARE(spy.last()[0].value<QMediaRecorder::Error>(), QMediaRecorder::ResourceError);
+}
+
+void tst_QMediaRecorder::testVideoSettingsQuality()
+{
+ QMediaRecorder recorder;
+ /* Verify the default value is intialised correctly*/
+ QCOMPARE(recorder.quality(), QMediaRecorder::NormalQuality);
+
+ /* Set all types of Quality parameter and Verify if it is set correctly*/
+ recorder.setQuality(QMediaRecorder::HighQuality);
+ QCOMPARE(recorder.quality(), QMediaRecorder::HighQuality);
+
+ recorder.setQuality(QMediaRecorder::VeryLowQuality);
+ QCOMPARE(recorder.quality(), QMediaRecorder::VeryLowQuality);
+
+ recorder.setQuality(QMediaRecorder::LowQuality);
+ QCOMPARE(recorder.quality(), QMediaRecorder::LowQuality);
+
+ recorder.setQuality(QMediaRecorder::VeryHighQuality);
+ QCOMPARE(recorder.quality(), QMediaRecorder::VeryHighQuality);
+}
+
+void tst_QMediaRecorder::testVideoSettingsEncodingMode()
+{
+ QMediaRecorder recorder;
+
+ /* Verify the default values are initialised correctly*/
+ QCOMPARE(recorder.encodingMode(), QMediaRecorder::ConstantQualityEncoding);
+
+ /* Set each type of encoding mode and Verify if it is set correctly*/
+ recorder.setEncodingMode(QMediaRecorder::ConstantBitRateEncoding);
+ QCOMPARE(recorder.encodingMode(),QMediaRecorder::ConstantBitRateEncoding);
+
+ recorder.setEncodingMode(QMediaRecorder::AverageBitRateEncoding);
+ QCOMPARE(recorder.encodingMode(), QMediaRecorder::AverageBitRateEncoding);
+}
+
+void tst_QMediaRecorder::testApplicationInative()
+{
+ QMediaCaptureSession session;
+ QMediaRecorder encoder;
+ session.setRecorder(&encoder);
+
+ encoder.setVideoResolution(640, 480);
+ encoder.setQuality(QMediaRecorder::VeryHighQuality);
+
+ encoder.setOutputLocation(QUrl("test.tmp"));
+ QCOMPARE(encoder.outputLocation().toString(), QStringLiteral("test.tmp"));
+ QCOMPARE(encoder.actualLocation(), QUrl());
+
+ encoder.record();
+
+ QGuiApplicationPrivate::setApplicationState(Qt::ApplicationInactive);
+ QCoreApplication::processEvents();
+
+ QGuiApplicationPrivate::setApplicationState(Qt::ApplicationActive);
+ QCoreApplication::processEvents();
+
+ encoder.stop();
+
+ // the actual location is available after record
+ QCOMPARE(encoder.actualLocation().toString(), QStringLiteral("test.tmp"));
+}
+
+QTEST_GUILESS_MAIN(tst_QMediaRecorder)
+#include "tst_qmediarecorder.moc"
diff --git a/tests/auto/unit/multimedia/qmediatimerange/CMakeLists.txt b/tests/auto/unit/multimedia/qmediatimerange/CMakeLists.txt
new file mode 100644
index 000000000..507eb16fa
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediatimerange/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qmediatimerange.pro.
+
+#####################################################################
+## tst_qmediatimerange Test:
+#####################################################################
+
+qt_internal_add_test(tst_qmediatimerange
+ SOURCES
+ tst_qmediatimerange.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qmediatimerange/tst_qmediatimerange.cpp b/tests/auto/unit/multimedia/qmediatimerange/tst_qmediatimerange.cpp
new file mode 100644
index 000000000..750b72108
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmediatimerange/tst_qmediatimerange.cpp
@@ -0,0 +1,766 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QtCore/qdebug.h>
+
+#include <qmediatimerange.h>
+#include <qmediatimerange.h>
+
+QT_USE_NAMESPACE
+
+class tst_QMediaTimeRange: public QObject
+{
+ Q_OBJECT
+
+public slots:
+
+private slots:
+ void testCtor();
+ void testIntervalCtor();
+ void testGetters();
+ void testAssignment();
+ void testIntervalNormalize();
+ void testIntervalTranslate();
+ void testIntervalContains();
+ void testEarliestLatest();
+ void testContains();
+ void testAddInterval();
+ void testAddTimeRange();
+ void testRemoveInterval();
+ void testRemoveTimeRange();
+ void testClear();
+ void testComparisons();
+ void testArithmetic();
+};
+
+void tst_QMediaTimeRange::testIntervalCtor()
+{
+ //Default Ctor for Time Interval
+ /* create an instance for the time interval and verify the default cases */
+ QMediaTimeRange::Interval tInter;
+ QVERIFY(tInter.isNormal());
+ QVERIFY(tInter.start() == 0);
+ QVERIFY(tInter.end() == 0);
+
+ // (qint, qint) Ctor time interval
+ /* create an instace of QMediaTimeRange::Interval passing start and end times and verify the all possible scenario's*/
+ QMediaTimeRange::Interval time(20,50);
+ QVERIFY(time.isNormal());
+ QVERIFY(time.start() == 20);
+ QVERIFY(time.end() == 50);
+
+ // Copy Ctor Time interval
+ QMediaTimeRange::Interval other(time);
+ QVERIFY(other.isNormal() == time.isNormal());
+ QVERIFY(other.start() == time.start());
+ QVERIFY(other.end() == time.end());
+ QVERIFY(other.contains(20) == time.contains(20));
+ QVERIFY(other == time);
+}
+
+void tst_QMediaTimeRange::testIntervalContains()
+{
+ QMediaTimeRange::Interval time(20,50);
+
+ /* start() <= time <= end(). Returns true if the time interval contains the specified time. */
+ QVERIFY(!time.contains(10));
+ QVERIFY(time.contains(20));
+ QVERIFY(time.contains(30));
+ QVERIFY(time.contains(50));
+ QVERIFY(!time.contains(60));
+
+ QMediaTimeRange::Interval x(20, 10); // denormal
+
+ // Check denormal ranges
+ QVERIFY(!x.contains(5));
+ QVERIFY(x.contains(10));
+ QVERIFY(x.contains(15));
+ QVERIFY(x.contains(20));
+ QVERIFY(!x.contains(25));
+
+ QMediaTimeRange::Interval y = x.normalized();
+ QVERIFY(!y.contains(5));
+ QVERIFY(y.contains(10));
+ QVERIFY(y.contains(15));
+ QVERIFY(y.contains(20));
+ QVERIFY(!y.contains(25));
+}
+
+void tst_QMediaTimeRange::testCtor()
+{
+ // Default Ctor
+ QMediaTimeRange a;
+ QVERIFY(a.isEmpty());
+
+ // (qint, qint) Ctor
+ QMediaTimeRange b(10, 20);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 20);
+
+ // Interval Ctor
+ QMediaTimeRange c(QMediaTimeRange::Interval(30, 40));
+
+ QVERIFY(!c.isEmpty());
+ QVERIFY(c.isContinuous());
+ QVERIFY(c.earliestTime() == 30);
+ QVERIFY(c.latestTime() == 40);
+
+ // Abnormal Interval Ctor
+ QMediaTimeRange d(QMediaTimeRange::Interval(20, 10));
+
+ QVERIFY(d.isEmpty());
+
+ // Copy Ctor
+ QMediaTimeRange e(b);
+
+ QVERIFY(!e.isEmpty());
+ QVERIFY(e.isContinuous());
+ QVERIFY(e.earliestTime() == 10);
+ QVERIFY(e.latestTime() == 20);
+
+ QVERIFY(e == b);
+}
+
+void tst_QMediaTimeRange::testGetters()
+{
+ QMediaTimeRange x;
+
+ // isEmpty
+ QVERIFY(x.isEmpty());
+
+ x.addInterval(10, 20);
+
+ // isEmpty + isContinuous
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+
+ x.addInterval(30, 40);
+
+ // isEmpty + isContinuous + intervals + start + end
+ QVERIFY(!x.isEmpty());
+ QVERIFY(!x.isContinuous());
+ QVERIFY(x.intervals().size() == 2);
+ QVERIFY(x.intervals()[0].start() == 10);
+ QVERIFY(x.intervals()[0].end() == 20);
+ QVERIFY(x.intervals()[1].start() == 30);
+ QVERIFY(x.intervals()[1].end() == 40);
+}
+
+void tst_QMediaTimeRange::testAssignment()
+{
+ QMediaTimeRange x;
+
+ // Range Assignment
+ x = QMediaTimeRange(10, 20);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 20);
+
+ // Interval Assignment
+ x = QMediaTimeRange::Interval(30, 40);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 30);
+ QVERIFY(x.latestTime() == 40);
+
+ // Shared Data Check
+ QMediaTimeRange y;
+
+ y = x;
+ y.addInterval(10, 20);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 30);
+ QVERIFY(x.latestTime() == 40);
+}
+
+void tst_QMediaTimeRange::testIntervalNormalize()
+{
+ QMediaTimeRange::Interval x(20, 10);
+
+ QVERIFY(!x.isNormal());
+ QVERIFY(x.start() == 20);
+ QVERIFY(x.end() == 10);
+
+ QMediaTimeRange::Interval y = x.normalized();
+
+ QVERIFY(y.isNormal());
+ QVERIFY(y.start() == 10);
+ QVERIFY(y.end() == 20);
+ QVERIFY(x != y);
+}
+
+void tst_QMediaTimeRange::testIntervalTranslate()
+{
+ QMediaTimeRange::Interval x(10, 20);
+ x = x.translated(10);
+
+ QVERIFY(x.start() == 20);
+ QVERIFY(x.end() == 30);
+
+ /* verifying the backward through time with a negative offset.*/
+ x = x.translated(-10);
+
+ QVERIFY(x.start() == 10);
+ QVERIFY(x.end() == 20);
+}
+
+void tst_QMediaTimeRange::testEarliestLatest()
+{
+ // Test over a single interval
+ QMediaTimeRange x(30, 40);
+
+ QVERIFY(x.earliestTime() == 30);
+ QVERIFY(x.latestTime() == 40);
+
+ // Test over multiple intervals
+ x.addInterval(50, 60);
+
+ QVERIFY(x.earliestTime() == 30);
+ QVERIFY(x.latestTime() == 60);
+}
+
+void tst_QMediaTimeRange::testContains()
+{
+ // Test over a single interval
+ QMediaTimeRange x(10, 20);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.contains(15));
+ QVERIFY(x.contains(10));
+ QVERIFY(x.contains(20));
+ QVERIFY(!x.contains(25));
+
+ // Test over multiple intervals
+ x.addInterval(40, 50);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(!x.isContinuous());
+ QVERIFY(x.contains(15));
+ QVERIFY(x.contains(45));
+ QVERIFY(!x.contains(30));
+
+ // Test over a concrete interval
+ QMediaTimeRange::Interval y(10, 20);
+ QVERIFY(y.contains(15));
+ QVERIFY(y.contains(10));
+ QVERIFY(y.contains(20));
+ QVERIFY(!y.contains(25));
+}
+
+void tst_QMediaTimeRange::testAddInterval()
+{
+ // All intervals Overlap
+ QMediaTimeRange x;
+ x.addInterval(10, 40);
+ x.addInterval(30, 50);
+ x.addInterval(20, 60);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 60);
+
+ // 1 adjacent interval, 1 encompassed interval
+ x = QMediaTimeRange();
+ x.addInterval(10, 40);
+ x.addInterval(20, 30);
+ x.addInterval(41, 50);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 50);
+
+ // 1 overlapping interval, 1 disjoint interval
+ x = QMediaTimeRange();
+ x.addInterval(10, 30);
+ x.addInterval(20, 40);
+ x.addInterval(50, 60);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(!x.isContinuous());
+ QVERIFY(x.intervals().size() == 2);
+ QVERIFY(x.intervals()[0].start() == 10);
+ QVERIFY(x.intervals()[0].end() == 40);
+ QVERIFY(x.intervals()[1].start() == 50);
+ QVERIFY(x.intervals()[1].end() == 60);
+
+ // Identical Add
+ x = QMediaTimeRange();
+ x.addInterval(10, 20);
+ x.addInterval(10, 20);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 20);
+
+ // Multi-Merge
+ x = QMediaTimeRange();
+ x.addInterval(10, 20);
+ x.addInterval(30, 40);
+ x.addInterval(50, 60);
+ x.addInterval(15, 55);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 60);
+
+ // Interval Parameter - All intervals Overlap
+ x = QMediaTimeRange();
+ x.addInterval(QMediaTimeRange::Interval(10, 40));
+ x.addInterval(QMediaTimeRange::Interval(30, 50));
+ x.addInterval(QMediaTimeRange::Interval(20, 60));
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 60);
+
+ // Interval Parameter - Abnormal Interval
+ x = QMediaTimeRange();
+ x.addInterval(QMediaTimeRange::Interval(20, 10));
+
+ QVERIFY(x.isEmpty());
+}
+
+void tst_QMediaTimeRange::testAddTimeRange()
+{
+ // Add Time Range uses Add Interval internally,
+ // so in this test the focus is on combinations of number
+ // of intervals added, rather than the different types of
+ // merges which can occur.
+ QMediaTimeRange a, b;
+
+ // Add Single into Single
+ a = QMediaTimeRange(10, 30);
+ b = QMediaTimeRange(20, 40);
+
+ b.addTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 40);
+
+ // Add Multiple into Single
+ a = QMediaTimeRange();
+ a.addInterval(10, 30);
+ a.addInterval(40, 60);
+
+ b = QMediaTimeRange(20, 50);
+
+ b.addTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 60);
+
+ // Add Single into Multiple
+ a = QMediaTimeRange(20, 50);
+
+ b = QMediaTimeRange();
+ b.addInterval(10, 30);
+ b.addInterval(40, 60);
+
+ b.addTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 60);
+
+ // Add Multiple into Multiple
+ a = QMediaTimeRange();
+ a.addInterval(10, 30);
+ a.addInterval(40, 70);
+ a.addInterval(80, 100);
+
+ b = QMediaTimeRange();
+ b.addInterval(20, 50);
+ b.addInterval(60, 90);
+
+ b.addTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 100);
+
+ // Add Nothing to Single
+ a = QMediaTimeRange();
+ b = QMediaTimeRange(10, 20);
+
+ b.addTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 20);
+
+ // Add Single to Nothing
+ a = QMediaTimeRange(10, 20);
+ b = QMediaTimeRange();
+
+ b.addTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 20);
+
+ // Add Nothing to Nothing
+ a = QMediaTimeRange();
+ b = QMediaTimeRange();
+
+ b.addTimeRange(a);
+
+ QVERIFY(b.isEmpty());
+}
+
+void tst_QMediaTimeRange::testRemoveInterval()
+{
+ // Removing an interval, causing a split
+ QMediaTimeRange x;
+ x.addInterval(10, 50);
+ x.removeInterval(20, 40);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(!x.isContinuous());
+ QVERIFY(x.intervals().size() == 2);
+ QVERIFY(x.intervals()[0].start() == 10);
+ QVERIFY(x.intervals()[0].end() == 19);
+ QVERIFY(x.intervals()[1].start() == 41);
+ QVERIFY(x.intervals()[1].end() == 50);
+
+ // Removing an interval, causing a deletion
+ x = QMediaTimeRange();
+ x.addInterval(20, 30);
+ x.removeInterval(10, 40);
+
+ QVERIFY(x.isEmpty());
+
+ // Removing an interval, causing a tail trim
+ x = QMediaTimeRange();
+ x.addInterval(20, 40);
+ x.removeInterval(30, 50);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 20);
+ QVERIFY(x.latestTime() == 29);
+
+ // Removing an interval, causing a head trim
+ x = QMediaTimeRange();
+ x.addInterval(20, 40);
+ x.removeInterval(10, 30);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 31);
+ QVERIFY(x.latestTime() == 40);
+
+ // Identical Remove
+ x = QMediaTimeRange();
+ x.addInterval(10, 20);
+ x.removeInterval(10, 20);
+
+ QVERIFY(x.isEmpty());
+
+ // Multi-Trim
+ x = QMediaTimeRange();
+ x.addInterval(10, 20);
+ x.addInterval(30, 40);
+ x.removeInterval(15, 35);
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(!x.isContinuous());
+ QVERIFY(x.intervals().size() == 2);
+ QVERIFY(x.intervals()[0].start() == 10);
+ QVERIFY(x.intervals()[0].end() == 14);
+ QVERIFY(x.intervals()[1].start() == 36);
+ QVERIFY(x.intervals()[1].end() == 40);
+
+ // Multi-Delete
+ x = QMediaTimeRange();
+ x.addInterval(10, 20);
+ x.addInterval(30, 40);
+ x.addInterval(50, 60);
+ x.removeInterval(10, 60);
+
+ QVERIFY(x.isEmpty());
+
+ // Interval Parameter - Removing an interval, causing a split
+ x = QMediaTimeRange();
+ x.addInterval(10, 50);
+ x.removeInterval(QMediaTimeRange::Interval(20, 40));
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(!x.isContinuous());
+ QVERIFY(x.intervals().size() == 2);
+ QVERIFY(x.intervals()[0].start() == 10);
+ QVERIFY(x.intervals()[0].end() == 19);
+ QVERIFY(x.intervals()[1].start() == 41);
+ QVERIFY(x.intervals()[1].end() == 50);
+
+ // Interval Parameter - Abnormal Interval
+ x = QMediaTimeRange();
+ x.addInterval(10, 40);
+ x.removeInterval(QMediaTimeRange::Interval(30, 20));
+
+ QVERIFY(!x.isEmpty());
+ QVERIFY(x.isContinuous());
+ QVERIFY(x.earliestTime() == 10);
+ QVERIFY(x.latestTime() == 40);
+}
+
+void tst_QMediaTimeRange::testRemoveTimeRange()
+{
+ // Remove Time Range uses Remove Interval internally,
+ // so in this test the focus is on combinations of number
+ // of intervals removed, rather than the different types of
+ // deletions which can occur.
+ QMediaTimeRange a, b;
+
+ // Remove Single from Single
+ a = QMediaTimeRange(10, 30);
+ b = QMediaTimeRange(20, 40);
+
+ b.removeTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 31);
+ QVERIFY(b.latestTime() == 40);
+
+ // Remove Multiple from Single
+ a = QMediaTimeRange();
+ a.addInterval(10, 30);
+ a.addInterval(40, 60);
+
+ b = QMediaTimeRange(20, 50);
+
+ b.removeTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 31);
+ QVERIFY(b.latestTime() == 39);
+
+ // Remove Single from Multiple
+ a = QMediaTimeRange(20, 50);
+
+ b = QMediaTimeRange();
+ b.addInterval(10, 30);
+ b.addInterval(40, 60);
+
+ b.removeTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(!b.isContinuous());
+ QVERIFY(b.intervals().size() == 2);
+ QVERIFY(b.intervals()[0].start() == 10);
+ QVERIFY(b.intervals()[0].end() == 19);
+ QVERIFY(b.intervals()[1].start() == 51);
+ QVERIFY(b.intervals()[1].end() == 60);
+
+ // Remove Multiple from Multiple
+ a = QMediaTimeRange();
+ a.addInterval(20, 50);
+ a.addInterval(50, 90);
+
+
+ b = QMediaTimeRange();
+ b.addInterval(10, 30);
+ b.addInterval(40, 70);
+ b.addInterval(80, 100);
+
+ b.removeTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(!b.isContinuous());
+ QVERIFY(b.intervals().size() == 2);
+ QVERIFY(b.intervals()[0].start() == 10);
+ QVERIFY(b.intervals()[0].end() == 19);
+ QVERIFY(b.intervals()[1].start() == 91);
+ QVERIFY(b.intervals()[1].end() == 100);
+
+ // Remove Nothing from Single
+ a = QMediaTimeRange();
+ b = QMediaTimeRange(10, 20);
+
+ b.removeTimeRange(a);
+
+ QVERIFY(!b.isEmpty());
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 10);
+ QVERIFY(b.latestTime() == 20);
+
+ // Remove Single from Nothing
+ a = QMediaTimeRange(10, 20);
+ b = QMediaTimeRange();
+
+ b.removeTimeRange(a);
+
+ QVERIFY(b.isEmpty());
+
+ // Remove Nothing from Nothing
+ a = QMediaTimeRange();
+ b = QMediaTimeRange();
+
+ b.removeTimeRange(a);
+
+ QVERIFY(b.isEmpty());
+}
+
+void tst_QMediaTimeRange::testClear()
+{
+ QMediaTimeRange x;
+
+ // Clear Nothing
+ x.clear();
+
+ QVERIFY(x.isEmpty());
+
+ // Clear Single
+ x = QMediaTimeRange(10, 20);
+ x.clear();
+
+ QVERIFY(x.isEmpty());
+
+ // Clear Multiple
+ x = QMediaTimeRange();
+ x.addInterval(10, 20);
+ x.addInterval(30, 40);
+ x.clear();
+
+ QVERIFY(x.isEmpty());
+}
+
+void tst_QMediaTimeRange::testComparisons()
+{
+ // Interval equality
+ QVERIFY(QMediaTimeRange::Interval(10, 20) == QMediaTimeRange::Interval(10, 20));
+ QVERIFY(QMediaTimeRange::Interval(10, 20) != QMediaTimeRange::Interval(10, 30));
+ QVERIFY(!(QMediaTimeRange::Interval(10, 20) != QMediaTimeRange::Interval(10, 20)));
+ QVERIFY(!(QMediaTimeRange::Interval(10, 20) == QMediaTimeRange::Interval(10, 30)));
+
+ // Time range equality - Single Interval
+ QMediaTimeRange a(10, 20), b(20, 30), c(10, 20);
+
+ QVERIFY(a == c);
+ QVERIFY(!(a == b));
+ QVERIFY(a != b);
+ QVERIFY(!(a != c));
+
+ // Time Range Equality - Multiple Intervals
+ QMediaTimeRange x, y, z;
+
+ x.addInterval(10, 20);
+ x.addInterval(30, 40);
+ x.addInterval(50, 60);
+
+ y.addInterval(10, 20);
+ y.addInterval(35, 45);
+ y.addInterval(50, 60);
+
+ z.addInterval(10, 20);
+ z.addInterval(30, 40);
+ z.addInterval(50, 60);
+
+ QVERIFY(x == z);
+ QVERIFY(!(x == y));
+ QVERIFY(x != y);
+ QVERIFY(!(x != z));
+}
+
+void tst_QMediaTimeRange::testArithmetic()
+{
+ QMediaTimeRange a(10, 20), b(20, 30);
+
+ // Test +=
+ a += b;
+
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 30);
+
+ // Test -=
+ a -= b;
+
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 19);
+
+ // Test += and -= on intervals
+ a -= QMediaTimeRange::Interval(10, 20);
+ a += QMediaTimeRange::Interval(40, 50);
+
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 40);
+ QVERIFY(a.latestTime() == 50);
+
+ // Test Interval + Interval
+ a = QMediaTimeRange::Interval(10, 20) + QMediaTimeRange::Interval(20, 30);
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 30);
+
+ // Test Range + Interval
+ a = a + QMediaTimeRange::Interval(30, 40);
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 40);
+
+ // Test Interval + Range
+ a = QMediaTimeRange::Interval(40, 50) + a;
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 50);
+
+ // Test Range + Range
+ a = a + QMediaTimeRange(50, 60);
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 60);
+
+ // Test Range - Interval
+ a = a - QMediaTimeRange::Interval(50, 60);
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 49);
+
+ // Test Range - Range
+ a = a - QMediaTimeRange(40, 50);
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 39);
+
+ // Test Interval - Range
+ b = QMediaTimeRange::Interval(0, 20) - a;
+ QVERIFY(b.isContinuous());
+ QVERIFY(b.earliestTime() == 0);
+ QVERIFY(b.latestTime() == 9);
+
+ // Test Interval - Interval
+ a = QMediaTimeRange::Interval(10, 20) - QMediaTimeRange::Interval(15, 30);
+ QVERIFY(a.isContinuous());
+ QVERIFY(a.earliestTime() == 10);
+ QVERIFY(a.latestTime() == 14);
+}
+
+QTEST_MAIN(tst_QMediaTimeRange)
+
+#include "tst_qmediatimerange.moc"
diff --git a/tests/auto/unit/multimedia/qmultimediautils/CMakeLists.txt b/tests/auto/unit/multimedia/qmultimediautils/CMakeLists.txt
new file mode 100644
index 000000000..2dd805271
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmultimediautils/CMakeLists.txt
@@ -0,0 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qmultimediautils
+ SOURCES
+ tst_qmultimediautils.cpp
+ LIBRARIES
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qmultimediautils/tst_qmultimediautils.cpp b/tests/auto/unit/multimedia/qmultimediautils/tst_qmultimediautils.cpp
new file mode 100644
index 000000000..8ed54ac64
--- /dev/null
+++ b/tests/auto/unit/multimedia/qmultimediautils/tst_qmultimediautils.cpp
@@ -0,0 +1,184 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <QDebug>
+#include <private/qmultimediautils_p.h>
+#include <qvideoframeformat.h>
+
+class tst_QMultimediaUtils : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void fraction_of_0();
+ void fraction_of_negative_1_5();
+ void fraction_of_1_5();
+ void fraction_of_30();
+ void fraction_of_29_97();
+ void fraction_of_lower_boundary();
+ void fraction_of_upper_boundary();
+
+ void qRotatedFrameSize_returnsSizeAccordinglyToRotation();
+
+ void qMediaFromUserInput_addsFilePrefix_whenCalledWithLocalFile();
+
+ void qGetRequiredSwapChainFormat_returnsSdr_whenMaxLuminanceIsBelowSdrThreshold_data();
+ void qGetRequiredSwapChainFormat_returnsSdr_whenMaxLuminanceIsBelowSdrThreshold();
+ void qGetRequiredSwapChainFormat_returnsHdr_whenMaxLuminanceIsBelowHdrThreshold_data();
+ void qGetRequiredSwapChainFormat_returnsHdr_whenMaxLuminanceIsBelowHdrThreshold();
+
+ void qShouldUpdateSwapChainFormat_returnsFalse_whenSwapChainIsNullPointer();
+};
+
+void tst_QMultimediaUtils::fraction_of_0()
+{
+ auto [n, d] = qRealToFraction(0.);
+ QCOMPARE(n, 0);
+ QCOMPARE(d, 1);
+}
+
+void tst_QMultimediaUtils::fraction_of_negative_1_5()
+{
+ auto [n, d] = qRealToFraction(-1.5);
+ QCOMPARE(double(n) / double(d), -1.5);
+ QCOMPARE(n, -3);
+ QCOMPARE(d, 2);
+}
+
+void tst_QMultimediaUtils::fraction_of_1_5()
+{
+ auto [n, d] = qRealToFraction(1.5);
+ QCOMPARE(double(n) / double(d), 1.5);
+ QCOMPARE(n, 3);
+ QCOMPARE(d, 2);
+}
+
+void tst_QMultimediaUtils::fraction_of_30()
+{
+ auto [n, d] = qRealToFraction(30.);
+ QCOMPARE(double(n) / double(d), 30.);
+ QCOMPARE(d, 1);
+}
+
+void tst_QMultimediaUtils::fraction_of_29_97()
+{
+ auto [n, d] = qRealToFraction(29.97);
+ QCOMPARE(double(n) / double(d), 29.97);
+}
+
+void tst_QMultimediaUtils::fraction_of_lower_boundary()
+{
+ double f = 0.000001;
+ auto [n, d] = qRealToFraction(f);
+ QVERIFY(double(n) / double(d) < f);
+ QVERIFY(double(n) / double(d) >= 0.);
+}
+
+void tst_QMultimediaUtils::fraction_of_upper_boundary()
+{
+ double f = 0.999999;
+ auto [n, d] = qRealToFraction(f);
+ QVERIFY(double(n) / double(d) <= 1.);
+ QVERIFY(double(n) / double(d) > f);
+}
+
+void tst_QMultimediaUtils::qRotatedFrameSize_returnsSizeAccordinglyToRotation()
+{
+ QCOMPARE(qRotatedFrameSize({ 10, 22 }, 0), QSize(10, 22));
+ QCOMPARE(qRotatedFrameSize({ 10, 23 }, -180), QSize(10, 23));
+ QCOMPARE(qRotatedFrameSize({ 10, 24 }, 180), QSize(10, 24));
+ QCOMPARE(qRotatedFrameSize({ 10, 25 }, 360), QSize(10, 25));
+ QCOMPARE(qRotatedFrameSize({ 11, 26 }, 540), QSize(11, 26));
+
+ QCOMPARE(qRotatedFrameSize({ 10, 22 }, -90), QSize(22, 10));
+ QCOMPARE(qRotatedFrameSize({ 10, 23 }, 90), QSize(23, 10));
+ QCOMPARE(qRotatedFrameSize({ 10, 24 }, 270), QSize(24, 10));
+ QCOMPARE(qRotatedFrameSize({ 10, 25 }, 450), QSize(25, 10));
+
+ QCOMPARE(qRotatedFrameSize({ 10, 22 }, QtVideo::Rotation::None), QSize(10, 22));
+ QCOMPARE(qRotatedFrameSize({ 10, 22 }, QtVideo::Rotation::Clockwise180), QSize(10, 22));
+
+ QCOMPARE(qRotatedFrameSize({ 11, 22 }, QtVideo::Rotation::Clockwise90), QSize(22, 11));
+ QCOMPARE(qRotatedFrameSize({ 11, 22 }, QtVideo::Rotation::Clockwise270), QSize(22, 11));
+}
+
+void tst_QMultimediaUtils::qMediaFromUserInput_addsFilePrefix_whenCalledWithLocalFile()
+{
+ using namespace Qt::Literals;
+
+ QCOMPARE(qMediaFromUserInput(QUrl(u"/foo/bar/baz"_s)), QUrl(u"file:///foo/bar/baz"_s));
+ QCOMPARE(qMediaFromUserInput(QUrl::fromLocalFile(u"C:/foo/bar/baz"_s)),
+ QUrl(u"file:///C:/foo/bar/baz"_s));
+ QCOMPARE(qMediaFromUserInput(QUrl(u"file:///foo/bar/baz"_s)), QUrl(u"file:///foo/bar/baz"_s));
+ QCOMPARE(qMediaFromUserInput(QUrl(u"http://foo/bar/baz"_s)), QUrl(u"http://foo/bar/baz"_s));
+
+ QCOMPARE(qMediaFromUserInput(QUrl(u"foo/bar/baz"_s)),
+ QUrl::fromLocalFile(QDir::currentPath() + u"/foo/bar/baz"_s));
+}
+
+void tst_QMultimediaUtils::
+ qGetRequiredSwapChainFormat_returnsSdr_whenMaxLuminanceIsBelowSdrThreshold_data()
+{
+ QTest::addColumn<float>("maxLuminance");
+
+ QTest::newRow("0") << 0.0f;
+ QTest::newRow("80") << 80.0f;
+ QTest::newRow("100") << 100.0f;
+}
+
+void tst_QMultimediaUtils::
+ qGetRequiredSwapChainFormat_returnsSdr_whenMaxLuminanceIsBelowSdrThreshold()
+{
+ // Arrange
+ QFETCH(float, maxLuminance);
+
+ QVideoFrameFormat format;
+ format.setMaxLuminance(maxLuminance);
+
+ // Act
+ QRhiSwapChain::Format requiredSwapChainFormat = qGetRequiredSwapChainFormat(format);
+
+ // Assert
+ QCOMPARE(requiredSwapChainFormat, QRhiSwapChain::Format::SDR);
+}
+
+void tst_QMultimediaUtils::
+ qGetRequiredSwapChainFormat_returnsHdr_whenMaxLuminanceIsBelowHdrThreshold_data()
+{
+ QTest::addColumn<float>("maxLuminance");
+
+ QTest::newRow("101") << 101.0f;
+ QTest::newRow("300") << 300.0f;
+ QTest::newRow("1600") << 1600.0f;
+}
+
+void tst_QMultimediaUtils::
+ qGetRequiredSwapChainFormat_returnsHdr_whenMaxLuminanceIsBelowHdrThreshold()
+{
+ // Arrange
+ QVideoFrameFormat format;
+ format.setMaxLuminance(300.0f);
+
+ // Act
+ QRhiSwapChain::Format requiredSwapChainFormat = qGetRequiredSwapChainFormat(format);
+
+ // Assert
+ QCOMPARE(requiredSwapChainFormat, QRhiSwapChain::Format::HDRExtendedSrgbLinear);
+}
+
+void tst_QMultimediaUtils::qShouldUpdateSwapChainFormat_returnsFalse_whenSwapChainIsNullPointer()
+{
+ // Arrange
+ QRhiSwapChain *swapChain = nullptr;
+ QRhiSwapChain::Format requiredSwapChainFormat = QRhiSwapChain::Format::SDR;
+
+ // Act
+ bool shouldUpdate = qShouldUpdateSwapChainFormat(swapChain, requiredSwapChainFormat);
+
+ // Assert
+ QCOMPARE(shouldUpdate, false);
+}
+
+QTEST_MAIN(tst_QMultimediaUtils)
+#include "tst_qmultimediautils.moc"
diff --git a/tests/auto/unit/multimedia/qsamplecache/CMakeLists.txt b/tests/auto/unit/multimedia/qsamplecache/CMakeLists.txt
new file mode 100644
index 000000000..2f58c1f6e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qsamplecache/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qsamplecache.pro.
+
+#####################################################################
+## tst_qsamplecache Test:
+#####################################################################
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ testdata/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_qsamplecache
+ SOURCES
+ tst_qsamplecache.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/unit/multimedia/qsamplecache/testdata/test.wav b/tests/auto/unit/multimedia/qsamplecache/testdata/test.wav
new file mode 100644
index 000000000..4dd022661
--- /dev/null
+++ b/tests/auto/unit/multimedia/qsamplecache/testdata/test.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qsamplecache/testdata/test2.wav b/tests/auto/unit/multimedia/qsamplecache/testdata/test2.wav
new file mode 100644
index 000000000..4dd022661
--- /dev/null
+++ b/tests/auto/unit/multimedia/qsamplecache/testdata/test2.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qsamplecache/tst_qsamplecache.cpp b/tests/auto/unit/multimedia/qsamplecache/tst_qsamplecache.cpp
new file mode 100644
index 000000000..311d05a5a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qsamplecache/tst_qsamplecache.cpp
@@ -0,0 +1,144 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <private/qsamplecache_p.h>
+
+class tst_QSampleCache : public QObject
+{
+ Q_OBJECT
+public:
+
+public slots:
+
+private slots:
+ void testCachedSample();
+ void testNotCachedSample();
+ void testEnoughCapacity();
+ void testNotEnoughCapacity();
+ void testInvalidFile();
+
+private:
+
+};
+
+void tst_QSampleCache::testCachedSample()
+{
+ QSampleCache cache;
+
+ QSample* sample = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QVERIFY(sample);
+ QTRY_VERIFY(!cache.isLoading());
+
+ QSample* sampleCached = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QCOMPARE(sample, sampleCached); // sample is cached
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+ // loading thread still starts, but does nothing in this case
+ QTRY_VERIFY(!cache.isLoading());
+
+ sample->release();
+ sampleCached->release();
+}
+
+void tst_QSampleCache::testNotCachedSample()
+{
+ QSampleCache cache;
+
+ QSample* sample = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QVERIFY(sample);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ sample->release();
+
+ QVERIFY(!cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+}
+
+void tst_QSampleCache::testEnoughCapacity()
+{
+ QSampleCache cache;
+
+ QSample* sample = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QVERIFY(sample);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ int sampleSize = sample->data().size();
+ sample->release();
+ cache.setCapacity(sampleSize * 2);
+
+ QVERIFY(!cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+
+ sample = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QVERIFY(sample);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ sample->release();
+
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+
+ // load another sample and make sure first sample is not destroyed
+ QSample* sampleOther = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test2.wav")));
+ QVERIFY(sampleOther);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ sampleOther->release();
+
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test2.wav"))));
+
+ QSample* sampleCached = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QCOMPARE(sample, sampleCached); // sample is cached
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test2.wav"))));
+ QVERIFY(!cache.isLoading());
+
+ sampleCached->release();
+}
+
+void tst_QSampleCache::testNotEnoughCapacity()
+{
+ QSampleCache cache;
+
+ QSample* sample = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QVERIFY(sample);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ int sampleSize = sample->data().size();
+ sample->release();
+ cache.setCapacity(sampleSize / 2); // unloads all samples
+
+ QVERIFY(!cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+
+ sample = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav")));
+ QVERIFY(sample);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ sample->release();
+
+ QVERIFY(cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+
+ // load another sample to force sample cache to destroy first sample
+ QSample* sampleOther = cache.requestSample(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test2.wav")));
+ QVERIFY(sampleOther);
+ QVERIFY(cache.isLoading());
+ QTRY_VERIFY(!cache.isLoading());
+ sampleOther->release();
+
+ QVERIFY(!cache.isCached(QUrl::fromLocalFile(QFINDTESTDATA("testdata/test.wav"))));
+}
+
+void tst_QSampleCache::testInvalidFile()
+{
+ QSampleCache cache;
+
+ QSample* sample = cache.requestSample(QUrl::fromLocalFile("invalid"));
+ QVERIFY(sample);
+ QTRY_COMPARE(sample->state(), QSample::Error);
+ QVERIFY(!cache.isLoading());
+ sample->release();
+
+ QVERIFY(!cache.isCached(QUrl::fromLocalFile("invalid")));
+}
+
+QTEST_MAIN(tst_QSampleCache)
+
+#include "tst_qsamplecache.moc"
diff --git a/tests/auto/unit/multimedia/qscreencapture/CMakeLists.txt b/tests/auto/unit/multimedia/qscreencapture/CMakeLists.txt
new file mode 100644
index 000000000..f5b152034
--- /dev/null
+++ b/tests/auto/unit/multimedia/qscreencapture/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_qscreencapture Test:
+#####################################################################
+
+qt_internal_add_test(tst_qscreencapture
+ SOURCES
+ tst_qscreencapture.cpp
+ INCLUDE_DIRECTORIES
+ ../../mockbackend
+ LIBRARIES
+ # Remove: L${CMAKE_CURRENT_SOURCE_DIR}
+ Qt::Gui
+ Qt::MultimediaPrivate
+ MockMultimediaPlugin
+)
diff --git a/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp b/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp
new file mode 100644
index 000000000..ad574ddf6
--- /dev/null
+++ b/tests/auto/unit/multimedia/qscreencapture/tst_qscreencapture.cpp
@@ -0,0 +1,64 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+// TESTED_COMPONENT=src/multimedia
+
+#include <QtTest/QtTest>
+#include <QDebug>
+
+#include "qmockintegration.h"
+#include "qscreencapture.h"
+#include "qmocksurfacecapture.h"
+#include "qatomic.h"
+
+QT_USE_NAMESPACE
+
+Q_ENABLE_MOCK_MULTIMEDIA_PLUGIN
+
+class tst_QScreenCapture : public QObject
+{
+ Q_OBJECT
+
+private:
+ // Use custom waiting instead of QSignalSpy since the spy tries copying not sharable object
+ // QVideoFrame to QVariant and gets an assert
+ bool waitForFrame(QPlatformSurfaceCapture &psc)
+ {
+ QAtomicInteger<bool> newFrameReceived = false;
+ QObject o;
+ auto connection = connect(&psc, &QPlatformSurfaceCapture::newVideoFrame, &o,
+ [&newFrameReceived]() { newFrameReceived = true; });
+
+ return QTest::qWaitFor([&newFrameReceived]() { return newFrameReceived; });
+ }
+
+private slots:
+ void destructionOfActiveCapture();
+
+};
+
+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<QPlatformSurfaceCapture> psc = QMockIntegration::instance()->lastScreenCapture();
+ QVERIFY(psc);
+
+ sc->setActive(true);
+
+ QVERIFY(waitForFrame(*psc));
+
+ QSignalSpy spy(sc.get(), &QScreenCapture::activeChanged);
+
+ psc->setParent(nullptr);
+ sc.reset();
+
+ QVERIFY2(spy.empty(), "No signals from QScreenCapture are expected on deletion");
+ QVERIFY2(!psc, "Platform screen capture must be deleted whether or not it has a parent");
+ }
+}
+
+QTEST_MAIN(tst_QScreenCapture)
+
+#include "tst_qscreencapture.moc"
diff --git a/tests/auto/unit/multimedia/qvideobuffers/CMakeLists.txt b/tests/auto/unit/multimedia/qvideobuffers/CMakeLists.txt
new file mode 100644
index 000000000..765d02c96
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideobuffers/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qvideobuffers
+ SOURCES
+ tst_qvideobuffers.cpp
+ LIBRARIES
+ Qt::Multimedia
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qvideobuffers/tst_qvideobuffers.cpp b/tests/auto/unit/multimedia/qvideobuffers/tst_qvideobuffers.cpp
new file mode 100644
index 000000000..b93e9d666
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideobuffers/tst_qvideobuffers.cpp
@@ -0,0 +1,252 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <private/qmemoryvideobuffer_p.h>
+#include <private/qimagevideobuffer_p.h>
+#include "qvideoframeformat.h"
+
+using BufferPtr = std::shared_ptr<QAbstractVideoBuffer>;
+using MapModes = std::vector<QtVideo::MapMode>;
+
+static const MapModes validMapModes = { QtVideo::MapMode::ReadOnly, QtVideo::MapMode::WriteOnly, QtVideo::MapMode::ReadWrite };
+
+class tst_QVideoBuffers : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QVideoBuffers() {}
+public slots:
+ void initTestCase();
+
+private slots:
+ void map_changesMappedStateAndReturnsProperMappings_whenBufferIsNotMapped_data();
+ void map_changesMappedStateAndReturnsProperMappings_whenBufferIsNotMapped();
+
+ void map_doesNothing_whenBufferIsMapped_data();
+ void map_doesNothing_whenBufferIsMapped();
+
+ void mapMemoryOrImageBuffer_detachesDataDependingOnMode_data();
+ void mapMemoryOrImageBuffer_detachesDataDependingOnMode();
+
+ void unmap_resetsMappedState_whenBufferIsMapped_data();
+ void unmap_resetsMappedState_whenBufferIsMapped();
+
+ void imageBuffer_fixesInputImage_data();
+ void imageBuffer_fixesInputImage();
+
+private:
+ QString mapModeToString(QtVideo::MapMode mapMode) const
+ {
+ switch (mapMode) {
+ case QtVideo::MapMode::NotMapped:
+ return QLatin1String("NotMapped");
+ case QtVideo::MapMode::ReadOnly:
+ return QLatin1String("ReadOnly");
+ case QtVideo::MapMode::WriteOnly:
+ return QLatin1String("WriteOnly");
+ case QtVideo::MapMode::ReadWrite:
+ return QLatin1String("ReadWrite");
+ default:
+ return QLatin1String("Unknown");
+ }
+ }
+
+ void generateImageAndMemoryBuffersWithAllModes(const MapModes& modes = validMapModes) const
+ {
+ QTest::addColumn<BufferPtr>("buffer");
+ QTest::addColumn<QtVideo::MapMode>("mapMode");
+ QTest::addColumn<const uint8_t *>("sourcePointer");
+
+ for (auto mode : modes) {
+ QTest::newRow(QStringLiteral("ImageBuffer, %1").arg(mapModeToString(mode)).toLocal8Bit().constData())
+ << createImageBuffer() << mode << m_image.constBits();
+ QTest::newRow(QStringLiteral("MemoryBuffer, %1").arg(mapModeToString(mode)).toLocal8Bit().constData())
+ << createMemoryBuffer() << mode << reinterpret_cast<const uint8_t *>(m_byteArray.constData());
+ }
+ }
+
+ void generateMapModes(const MapModes &modes = validMapModes) const
+ {
+ QTest::addColumn<QtVideo::MapMode>("mapMode");
+
+ for (auto mode : modes)
+ QTest::newRow(mapModeToString(mode).toLocal8Bit().constData()) << mode;
+ }
+
+ BufferPtr createImageBuffer() const
+ {
+ return std::make_shared<QImageVideoBuffer>(m_image);
+ }
+
+ BufferPtr createMemoryBuffer() const
+ {
+ return std::make_shared<QMemoryVideoBuffer>(m_byteArray, m_byteArray.size() / m_image.height());
+ }
+
+ QImage m_image = { QSize(5, 4), QImage::Format_RGBA8888 };
+ QByteArray m_byteArray;
+};
+
+
+void tst_QVideoBuffers::initTestCase()
+{
+ m_image.fill(Qt::gray);
+ m_image.setPixelColor(0, 0, Qt::green);
+ m_image.setPixelColor(m_image.width() - 1, 0, Qt::blue);
+ m_image.setPixelColor(0, m_image.height() - 1, Qt::red);
+
+ m_byteArray.assign(m_image.constBits(), m_image.constBits() + m_image.sizeInBytes());
+}
+
+void tst_QVideoBuffers::map_changesMappedStateAndReturnsProperMappings_whenBufferIsNotMapped_data()
+{
+ generateImageAndMemoryBuffersWithAllModes();
+}
+
+void tst_QVideoBuffers::map_changesMappedStateAndReturnsProperMappings_whenBufferIsNotMapped()
+{
+ QFETCH(BufferPtr, buffer);
+ QFETCH(QtVideo::MapMode, mapMode);
+
+ auto mappedData = buffer->map(mapMode);
+
+ QCOMPARE(mappedData.planeCount, 1);
+ QVERIFY(mappedData.data[0]);
+ QCOMPARE(mappedData.dataSize[0], 80);
+ QCOMPARE(mappedData.bytesPerLine[0], 20);
+
+ const auto data = reinterpret_cast<const char*>(mappedData.data[0]);
+ QCOMPARE(QByteArray(data, mappedData.dataSize[0]), m_byteArray);
+}
+
+void tst_QVideoBuffers::map_doesNothing_whenBufferIsMapped_data()
+{
+ generateImageAndMemoryBuffersWithAllModes();
+}
+
+void tst_QVideoBuffers::map_doesNothing_whenBufferIsMapped()
+{
+ QFETCH(BufferPtr, buffer);
+ QFETCH(QtVideo::MapMode, mapMode);
+
+ buffer->map(mapMode);
+ auto mappedData = buffer->map(QtVideo::MapMode::ReadOnly);
+ QCOMPARE(mappedData.planeCount, 0);
+}
+
+void tst_QVideoBuffers::mapMemoryOrImageBuffer_detachesDataDependingOnMode_data()
+{
+ generateImageAndMemoryBuffersWithAllModes();
+}
+
+void tst_QVideoBuffers::mapMemoryOrImageBuffer_detachesDataDependingOnMode()
+{
+ QFETCH(BufferPtr, buffer);
+ QFETCH(QtVideo::MapMode, mapMode);
+ QFETCH(const uint8_t *, sourcePointer);
+
+ auto mappedData = buffer->map(mapMode);
+ QCOMPARE(mappedData.planeCount, 1);
+
+ const bool isDetached = mappedData.data[0] != sourcePointer;
+ const bool isWriteMode = (mapMode & QtVideo::MapMode::WriteOnly) == QtVideo::MapMode::WriteOnly;
+ QCOMPARE(isDetached, isWriteMode);
+}
+
+void tst_QVideoBuffers::unmap_resetsMappedState_whenBufferIsMapped_data()
+{
+ generateImageAndMemoryBuffersWithAllModes();
+}
+
+void tst_QVideoBuffers::unmap_resetsMappedState_whenBufferIsMapped()
+{
+ QFETCH(BufferPtr, buffer);
+ QFETCH(QtVideo::MapMode, mapMode);
+
+ buffer->map(mapMode);
+
+ buffer->unmap();
+
+ // Check buffer is valid and it's possible to map again
+ auto mappedData = buffer->map(QtVideo::MapMode::ReadOnly);
+ QCOMPARE(mappedData.planeCount, 1);
+
+ const auto data = reinterpret_cast<const char*>(mappedData.data[0]);
+ QCOMPARE(QByteArray(data, mappedData.dataSize[0]), m_byteArray);
+}
+
+void tst_QVideoBuffers::imageBuffer_fixesInputImage_data()
+{
+ QTest::addColumn<QImage::Format>("inputImageFormat");
+ QTest::addColumn<QImage::Format>("underlyingImageFormat");
+
+ QTest::newRow("Format_RGB32 => Format_RGB32") << QImage::Format_RGB32 << QImage::Format_RGB32;
+ QTest::newRow("Format_ARGB32 => Format_ARGB32")
+ << QImage::Format_ARGB32 << QImage::Format_ARGB32;
+ QTest::newRow("Format_ARGB32_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_ARGB32_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGBA8888 => Format_RGBA8888")
+ << QImage::Format_RGBA8888 << QImage::Format_RGBA8888;
+ QTest::newRow("Format_RGBA8888_Premultiplied => Format_RGBA8888_Premultiplied")
+ << QImage::Format_RGBA8888_Premultiplied << QImage::Format_RGBA8888_Premultiplied;
+ QTest::newRow("Format_RGBX8888 => Format_RGBX8888")
+ << QImage::Format_RGBX8888 << QImage::Format_RGBX8888;
+ QTest::newRow("Format_Grayscale8 => Format_Grayscale8")
+ << QImage::Format_Grayscale8 << QImage::Format_Grayscale8;
+ QTest::newRow("Format_Grayscale16 => Format_Grayscale16")
+ << QImage::Format_Grayscale16 << QImage::Format_Grayscale16;
+
+ QTest::newRow("Format_ARGB8565_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_ARGB8565_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_ARGB6666_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_ARGB6666_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_ARGB8555_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_ARGB8555_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_ARGB4444_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_ARGB4444_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_A2BGR30_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_A2BGR30_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_A2RGB30_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_A2RGB30_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGBA64_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_RGBA64_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGBA16FPx4_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_RGBA16FPx4_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGBA32FPx4_Premultiplied => Format_ARGB32_Premultiplied")
+ << QImage::Format_RGBA32FPx4_Premultiplied << QImage::Format_ARGB32_Premultiplied;
+
+ QTest::newRow("Format_Alpha8 => Format_ARGB32")
+ << QImage::Format_Alpha8 << QImage::Format_ARGB32;
+ QTest::newRow("Format_RGBA64 => Format_ARGB32")
+ << QImage::Format_RGBA64 << QImage::Format_ARGB32;
+ QTest::newRow("Format_RGBA16FPx4 => Format_ARGB32")
+ << QImage::Format_RGBA16FPx4 << QImage::Format_ARGB32;
+ QTest::newRow("Format_RGBA32FPx4 => Format_ARGB32")
+ << QImage::Format_RGBA32FPx4 << QImage::Format_ARGB32;
+}
+
+void tst_QVideoBuffers::imageBuffer_fixesInputImage()
+{
+ QFETCH(QImage::Format, inputImageFormat);
+ QFETCH(QImage::Format, underlyingImageFormat);
+
+ m_image.convertTo(inputImageFormat);
+ QImageVideoBuffer buffer(m_image);
+
+ auto underlyingImage = buffer.underlyingImage();
+
+ QCOMPARE(underlyingImage.format(), underlyingImageFormat);
+ QCOMPARE_NE(QVideoFrameFormat::pixelFormatFromImageFormat(underlyingImage.format()),
+ QVideoFrameFormat::Format_Invalid);
+ QCOMPARE(m_image.convertedTo(underlyingImageFormat), underlyingImage);
+
+ if (inputImageFormat == underlyingImageFormat)
+ QCOMPARE(m_image.constBits(), underlyingImage.constBits());
+}
+
+QTEST_APPLESS_MAIN(tst_QVideoBuffers);
+
+#include "tst_qvideobuffers.moc"
diff --git a/tests/auto/unit/multimedia/qvideoframe/CMakeLists.txt b/tests/auto/unit/multimedia/qvideoframe/CMakeLists.txt
new file mode 100644
index 000000000..29b8a413e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframe/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qvideoframe.pro.
+
+#####################################################################
+## tst_qvideoframe Test:
+#####################################################################
+
+qt_internal_add_test(tst_qvideoframe
+ SOURCES
+ tst_qvideoframe.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp b/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp
new file mode 100644
index 000000000..de10177fa
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframe/tst_qvideoframe.cpp
@@ -0,0 +1,1437 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <qvideoframe.h>
+#include <qvideoframeformat.h>
+#include "QtTest/qtestcase.h"
+#include "private/qmemoryvideobuffer_p.h"
+#include "private/qhwvideobuffer_p.h"
+#include "private/qvideoframe_p.h"
+#include <QtGui/QImage>
+#include <QtCore/QPointer>
+#include <QtMultimedia/private/qtmultimedia-config_p.h>
+#include "private/qvideoframeconverter_p.h"
+
+// Adds an enum, and the stringized version
+#define ADD_ENUM_TEST(x) \
+ QTest::newRow(#x) \
+ << QVideoFrame::x \
+ << QString(QLatin1String(#x));
+
+
+// Image used for testing conversion from QImage to QVideoFrame
+QImage createTestImage(QImage::Format format)
+{
+ // +---+---+---+
+ // | r | g | b |
+ // | b | r | g |
+ // +---+---+---+
+ QImage image{ { 3, 2 }, QImage::Format_ARGB32 };
+ image.setPixelColor(0, 0, QColor(Qt::red));
+ image.setPixelColor(1, 0, QColor(Qt::green));
+ image.setPixelColor(2, 0, QColor(Qt::blue));
+ image.setPixelColor(0, 1, QColor(Qt::blue));
+ image.setPixelColor(1, 1, QColor(Qt::red));
+ image.setPixelColor(2, 1, QColor(Qt::green));
+ return image.convertToFormat(format);
+}
+
+// clang-format off
+
+// Convert a QVideoFrame pixel value from raw format to QRgb
+// Only works with little-endian byte ordering
+QRgb swizzle(uint value, QVideoFrameFormat::PixelFormat format)
+{
+ switch (format) {
+ case QVideoFrameFormat::Format_ARGB8888:
+ case QVideoFrameFormat::Format_ARGB8888_Premultiplied:
+ case QVideoFrameFormat::Format_XRGB8888:
+ Q_ASSERT(false); // not implemented
+ return 0;
+ case QVideoFrameFormat::Format_BGRA8888:
+ case QVideoFrameFormat::Format_BGRA8888_Premultiplied:
+ case QVideoFrameFormat::Format_BGRX8888:
+ return value;
+ case QVideoFrameFormat::Format_ABGR8888:
+ case QVideoFrameFormat::Format_XBGR8888:
+ Q_ASSERT(false); // not implemented
+ return 0;
+ case QVideoFrameFormat::Format_RGBA8888:
+ case QVideoFrameFormat::Format_RGBX8888:
+ return (((value >> 24) & 0xff) << 24) // a -> a
+ | ((value & 0xff) << 16) // b -> r
+ | (((value >> 8) & 0xff) << 8) // g -> g
+ | ((value >> 16) & 0xff); // r -> b
+ default:
+ qWarning() << "Unsupported format";
+ return 0;
+ }
+}
+
+std::vector<QRgb> swizzle(const std::vector<uint> &pixels, QVideoFrameFormat::PixelFormat format)
+{
+ std::vector<QRgb> rgba(pixels.size());
+ std::transform(pixels.begin(), pixels.end(), rgba.begin(),
+ [format](uint value) {
+ return swizzle(value, format);
+ });
+ return rgba;
+}
+
+// clang-format on
+
+std::optional<std::vector<QRgb>> getPixels(QVideoFrame &frame)
+{
+ if (!frame.map(QtVideo::MapMode::ReadOnly))
+ return std::nullopt;
+
+ const uint *mappedPixels = reinterpret_cast<const uint *>(frame.bits(0));
+ const unsigned long long stride = frame.bytesPerLine(0) / sizeof(QRgb);
+
+ std::vector<uint> pixels;
+ for (int j = 0; j < frame.size().height(); ++j) {
+ for (int i = 0; i < frame.size().width(); ++i) {
+ pixels.push_back(mappedPixels[i + j * stride]);
+ }
+ }
+
+ frame.unmap();
+
+ return swizzle(pixels, frame.pixelFormat());
+}
+
+bool compareEq(QVideoFrame &frame, const QImage &image)
+{
+ if (frame.size() != image.size()) {
+ qDebug() << "Size mismatch";
+ return false;
+ }
+
+ const std::vector<QRgb> expectedPixels = { image.pixel(0, 0), image.pixel(1, 0), image.pixel(2, 0),
+ image.pixel(0, 1), image.pixel(1, 1), image.pixel(2, 1) };
+
+ const std::optional<std::vector<QRgb>> actualPixels = getPixels(frame);
+ if (!actualPixels) {
+ qDebug() << "Failed to read pixels from frame";
+ return false;
+ }
+
+ for (size_t i = 0; i < expectedPixels.size(); ++i) {
+ if (expectedPixels[i] != actualPixels->at(i)) {
+ qDebug() << "Pixel difference at element" << i << ":" << Qt::hex << expectedPixels[i]
+ << "vs" << actualPixels->at(i);
+ return false;
+ }
+ }
+ return true;
+}
+
+QSet s_pixelFormats{ QVideoFrameFormat::Format_ARGB8888,
+ QVideoFrameFormat::Format_ARGB8888_Premultiplied,
+ QVideoFrameFormat::Format_XRGB8888,
+ QVideoFrameFormat::Format_BGRA8888,
+ QVideoFrameFormat::Format_BGRA8888_Premultiplied,
+ QVideoFrameFormat::Format_BGRX8888,
+ QVideoFrameFormat::Format_ABGR8888,
+ QVideoFrameFormat::Format_XBGR8888,
+ QVideoFrameFormat::Format_RGBA8888,
+ QVideoFrameFormat::Format_RGBX8888,
+ QVideoFrameFormat::Format_NV12,
+ QVideoFrameFormat::Format_NV21,
+ QVideoFrameFormat::Format_IMC1,
+ QVideoFrameFormat::Format_IMC2,
+ QVideoFrameFormat::Format_IMC3,
+ QVideoFrameFormat::Format_IMC4,
+ QVideoFrameFormat::Format_AYUV,
+ QVideoFrameFormat::Format_AYUV_Premultiplied,
+ QVideoFrameFormat::Format_YV12,
+ QVideoFrameFormat::Format_YUV420P,
+ QVideoFrameFormat::Format_YUV422P,
+ QVideoFrameFormat::Format_UYVY,
+ QVideoFrameFormat::Format_YUYV,
+ QVideoFrameFormat::Format_Y8,
+ QVideoFrameFormat::Format_Y16,
+ QVideoFrameFormat::Format_P010,
+ QVideoFrameFormat::Format_P016,
+ QVideoFrameFormat::Format_YUV420P10 };
+
+bool isSupportedPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat)
+{
+#ifdef Q_OS_ANDROID
+ // TODO: QTBUG-125238
+ switch (pixelFormat) {
+ case QVideoFrameFormat::Format_Y16:
+ case QVideoFrameFormat::Format_P010:
+ case QVideoFrameFormat::Format_P016:
+ case QVideoFrameFormat::Format_YUV420P10:
+ return false;
+ default:
+ return true;
+ }
+#else
+ return true;
+#endif
+}
+
+class tst_QVideoFrame : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QVideoFrame();
+ ~tst_QVideoFrame() override;
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void create_data();
+ void create();
+ void createInvalid_data();
+ void createInvalid();
+ void createFromBuffer_data();
+ void createFromBuffer();
+ void createFromImage_data();
+ void createNull();
+ void destructor();
+ void copy_data();
+ void copy();
+ void assign_data();
+ void assign();
+ void map_data();
+ void map();
+ void mapPlanes_data();
+ void mapPlanes();
+ void formatConversion_data();
+ void formatConversion();
+
+ void qImageFromVideoFrame_doesNotCrash_whenCalledWithEvenAndOddSizedFrames_data();
+ void qImageFromVideoFrame_doesNotCrash_whenCalledWithEvenAndOddSizedFrames();
+
+ void isMapped();
+ void isReadable();
+ void isWritable();
+
+ void image_data();
+ void image();
+
+ void emptyData();
+
+ void mirrored_takesValue_fromVideoFrameFormat();
+ void rotation_takesValue_fromVideoFrameFormat();
+ void streamFrameRate_takesValue_fromVideoFrameFormat();
+
+ void constructor_createsInvalidFrame_whenCalledWithNullImage();
+ void constructor_createsInvalidFrame_whenCalledWithEmptyImage();
+ void constructor_createsInvalidFrame_whenCalledWithInvalidImageFormat();
+ void constructor_createsFrameWithCorrectFormat_whenCalledWithSupportedImageFormats_data();
+ void constructor_createsFrameWithCorrectFormat_whenCalledWithSupportedImageFormats();
+ void constructor_copiesImageData_whenCalledWithRGBFormats_data();
+ void constructor_copiesImageData_whenCalledWithRGBFormats();
+};
+
+class QtTestDummyVideoBuffer : public QObject, public QHwVideoBuffer
+{
+ Q_OBJECT
+public:
+ QtTestDummyVideoBuffer() : QHwVideoBuffer(QVideoFrame::NoHandle) { }
+ explicit QtTestDummyVideoBuffer(QVideoFrame::HandleType type) : QHwVideoBuffer(type) { }
+
+ MapData map(QtVideo::MapMode) override { return {}; }
+ void unmap() override {}
+};
+
+class QtTestVideoBuffer : public QHwVideoBuffer
+{
+public:
+ QtTestVideoBuffer() : QHwVideoBuffer(QVideoFrame::NoHandle) { }
+ explicit QtTestVideoBuffer(QVideoFrame::HandleType type) : QHwVideoBuffer(type) { }
+
+ MapData map(QtVideo::MapMode mode) override
+ {
+ m_mapMode = mode;
+ MapData mapData;
+ int nBytes = m_numBytes;
+ mapData.planeCount = m_planeCount;
+ for (int i = 0; i < m_planeCount; ++i) {
+ mapData.data[i] = m_data[i];
+ mapData.bytesPerLine[i] = m_bytesPerLine[i];
+ if (i) {
+ mapData.dataSize[i-1] = m_data[i] - m_data[i-1];
+ nBytes -= mapData.dataSize[i-1];
+ }
+ mapData.dataSize[i] = nBytes;
+ }
+ return mapData;
+ }
+ void unmap() override { m_mapMode = QtVideo::MapMode::NotMapped; }
+
+ uchar *m_data[4];
+ int m_bytesPerLine[4];
+ int m_planeCount = 0;
+ int m_numBytes;
+ QtVideo::MapMode m_mapMode = QtVideo::MapMode::NotMapped;
+};
+
+tst_QVideoFrame::tst_QVideoFrame()
+{
+}
+
+tst_QVideoFrame::~tst_QVideoFrame()
+{
+}
+
+void tst_QVideoFrame::initTestCase()
+{
+}
+
+void tst_QVideoFrame::cleanupTestCase()
+{
+}
+
+void tst_QVideoFrame::init()
+{
+}
+
+void tst_QVideoFrame::cleanup()
+{
+}
+
+void tst_QVideoFrame::create_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<int>("bytesPerLine");
+
+ QTest::newRow("64x64 ARGB32")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << 64*4;
+ QTest::newRow("32x256 YUV420P")
+ << QSize(32, 256)
+ << QVideoFrameFormat::Format_YUV420P
+ << 32;
+ QTest::newRow("32x256 UYVY")
+ << QSize(32, 256)
+ << QVideoFrameFormat::Format_UYVY
+ << 32*2;
+}
+
+void tst_QVideoFrame::create()
+{
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(int, bytesPerLine);
+
+ QVideoFrame frame(QVideoFrameFormat(size, pixelFormat));
+
+ QVERIFY(frame.isValid());
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
+ QCOMPARE(QVideoFramePrivate::hwBuffer(frame), nullptr);
+ QCOMPARE_NE(QVideoFramePrivate::buffer(frame), nullptr);
+ QCOMPARE(frame.pixelFormat(), pixelFormat);
+ QCOMPARE(frame.size(), size);
+ QCOMPARE(frame.width(), size.width());
+ QCOMPARE(frame.height(), size.height());
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), qint64(-1));
+ frame.map(QtVideo::MapMode::ReadOnly);
+ QCOMPARE(frame.bytesPerLine(0), bytesPerLine);
+ frame.unmap();
+}
+
+void tst_QVideoFrame::createInvalid_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+
+ QTest::newRow("0x64 ARGB32 0 size")
+ << QSize(0, 64)
+ << QVideoFrameFormat::Format_ARGB8888;
+ QTest::newRow("32x0 YUV420P 0 size")
+ << QSize(32, 0)
+ << QVideoFrameFormat::Format_YUV420P;
+}
+
+void tst_QVideoFrame::createInvalid()
+{
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+
+ QVideoFrame frame(QVideoFrameFormat(size, pixelFormat));
+
+ QVERIFY(!frame.isValid());
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
+ QCOMPARE(QVideoFramePrivate::buffer(frame), nullptr);
+ QCOMPARE(frame.pixelFormat(), pixelFormat);
+ QCOMPARE(frame.size(), size);
+ QCOMPARE(frame.width(), size.width());
+ QCOMPARE(frame.height(), size.height());
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), qint64(-1));
+}
+
+void tst_QVideoFrame::createFromBuffer_data()
+{
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+
+ QTest::newRow("64x64 ARGB32 no handle")
+ << QVideoFrame::NoHandle
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888;
+ QTest::newRow("64x64 ARGB32 gl handle")
+ << QVideoFrame::RhiTextureHandle
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888;
+}
+
+void tst_QVideoFrame::createFromBuffer()
+{
+ QFETCH(QVideoFrame::HandleType, handleType);
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+
+ QVideoFrame frame =
+ QVideoFramePrivate::createFrame(std::make_unique<QtTestDummyVideoBuffer>(handleType),
+ QVideoFrameFormat(size, pixelFormat));
+
+ QVERIFY(frame.isValid());
+ QCOMPARE(frame.handleType(), handleType);
+ QCOMPARE(frame.pixelFormat(), pixelFormat);
+ QCOMPARE(frame.size(), size);
+ QCOMPARE(frame.width(), size.width());
+ QCOMPARE(frame.height(), size.height());
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), qint64(-1));
+}
+
+void tst_QVideoFrame::createFromImage_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QImage::Format>("imageFormat");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+
+ QTest::newRow("64x64 RGB32")
+ << QSize(64, 64)
+ << QImage::Format_RGB32
+ << QVideoFrameFormat::Format_XRGB8888;
+ QTest::newRow("19x46 ARGB32_Premultiplied")
+ << QSize(19, 46)
+ << QImage::Format_ARGB32_Premultiplied
+ << QVideoFrameFormat::Format_ARGB8888_Premultiplied;
+}
+
+void tst_QVideoFrame::createNull()
+{
+ // Default ctor
+ {
+ QVideoFrame frame;
+
+ QVERIFY(!frame.isValid());
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
+ QCOMPARE(frame.pixelFormat(), QVideoFrameFormat::Format_Invalid);
+ QCOMPARE(frame.size(), QSize());
+ QCOMPARE(frame.width(), -1);
+ QCOMPARE(frame.height(), -1);
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), qint64(-1));
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), QtVideo::MapMode::NotMapped);
+ QVERIFY(!frame.map(QtVideo::MapMode::ReadOnly));
+ QVERIFY(!frame.map(QtVideo::MapMode::ReadWrite));
+ QVERIFY(!frame.map(QtVideo::MapMode::WriteOnly));
+ QCOMPARE(frame.isMapped(), false);
+ frame.unmap(); // Shouldn't crash
+ QCOMPARE(frame.isReadable(), false);
+ QCOMPARE(frame.isWritable(), false);
+ }
+
+ // Null buffer (shouldn't crash)
+ {
+ QVideoFrame frame = QVideoFramePrivate::createFrame(
+ std::unique_ptr<QHwVideoBuffer>(),
+ QVideoFrameFormat(QSize(1024, 768), QVideoFrameFormat::Format_ARGB8888));
+ QVERIFY(!frame.isValid());
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
+ QCOMPARE(frame.pixelFormat(), QVideoFrameFormat::Format_ARGB8888);
+ QCOMPARE(frame.size(), QSize(1024, 768));
+ QCOMPARE(frame.width(), 1024);
+ QCOMPARE(frame.height(), 768);
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), qint64(-1));
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), QtVideo::MapMode::NotMapped);
+ QVERIFY(!frame.map(QtVideo::MapMode::ReadOnly));
+ QVERIFY(!frame.map(QtVideo::MapMode::ReadWrite));
+ QVERIFY(!frame.map(QtVideo::MapMode::WriteOnly));
+ QCOMPARE(frame.isMapped(), false);
+ frame.unmap(); // Shouldn't crash
+ QCOMPARE(frame.isReadable(), false);
+ QCOMPARE(frame.isWritable(), false);
+ }
+}
+
+void tst_QVideoFrame::destructor()
+{
+ QPointer<QtTestDummyVideoBuffer> buffer = new QtTestDummyVideoBuffer;
+
+ {
+ QVideoFrame frame = QVideoFramePrivate::createFrame(
+ std::unique_ptr<QHwVideoBuffer>(buffer),
+ QVideoFrameFormat(QSize(4, 1), QVideoFrameFormat::Format_ARGB8888));
+ }
+
+ QVERIFY(buffer.isNull());
+}
+
+void tst_QVideoFrame::copy_data()
+{
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<qint64>("startTime");
+ QTest::addColumn<qint64>("endTime");
+
+ QTest::newRow("64x64 ARGB32")
+ << QVideoFrame::RhiTextureHandle
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << qint64(63641740)
+ << qint64(63641954);
+ QTest::newRow("64x64 ARGB32")
+ << QVideoFrame::RhiTextureHandle
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << qint64(63641740)
+ << qint64(63641954);
+ QTest::newRow("32x256 YUV420P")
+ << QVideoFrame::NoHandle
+ << QSize(32, 256)
+ << QVideoFrameFormat::Format_YUV420P
+ << qint64(12345)
+ << qint64(12389);
+ QTest::newRow("1052x756 ARGB32")
+ << QVideoFrame::NoHandle
+ << QSize(1052, 756)
+ << QVideoFrameFormat::Format_ARGB8888
+ << qint64(12345)
+ << qint64(12389);
+ QTest::newRow("32x256 YUV420P")
+ << QVideoFrame::NoHandle
+ << QSize(32, 256)
+ << QVideoFrameFormat::Format_YUV420P
+ << qint64(12345)
+ << qint64(12389);
+}
+
+void tst_QVideoFrame::copy()
+{
+ QFETCH(QVideoFrame::HandleType, handleType);
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(qint64, startTime);
+ QFETCH(qint64, endTime);
+
+ QPointer<QtTestDummyVideoBuffer> buffer = new QtTestDummyVideoBuffer(handleType);
+
+ {
+ QVideoFrame frame = QVideoFramePrivate::createFrame(std::unique_ptr<QHwVideoBuffer>(buffer),
+ QVideoFrameFormat(size, pixelFormat));
+ frame.setStartTime(startTime);
+ frame.setEndTime(endTime);
+
+ QVERIFY(frame.isValid());
+ QCOMPARE(frame.handleType(), handleType);
+ QCOMPARE(frame.pixelFormat(), pixelFormat);
+ QCOMPARE(frame.size(), size);
+ QCOMPARE(frame.width(), size.width());
+ QCOMPARE(frame.height(), size.height());
+ QCOMPARE(frame.startTime(), startTime);
+ QCOMPARE(frame.endTime(), endTime);
+
+ {
+ QVideoFrame otherFrame(frame);
+
+ QVERIFY(!buffer.isNull());
+
+ QVERIFY(otherFrame.isValid());
+ QCOMPARE(otherFrame.handleType(), handleType);
+ QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
+ QCOMPARE(otherFrame.size(), size);
+ QCOMPARE(otherFrame.width(), size.width());
+ QCOMPARE(otherFrame.height(), size.height());
+ QCOMPARE(otherFrame.startTime(), startTime);
+ QCOMPARE(otherFrame.endTime(), endTime);
+
+ otherFrame.setEndTime(-1);
+
+ QVERIFY(!buffer.isNull());
+
+ QVERIFY(otherFrame.isValid());
+ QCOMPARE(otherFrame.handleType(), handleType);
+ QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
+ QCOMPARE(otherFrame.size(), size);
+ QCOMPARE(otherFrame.width(), size.width());
+ QCOMPARE(otherFrame.height(), size.height());
+ QCOMPARE(otherFrame.startTime(), startTime);
+ QCOMPARE(otherFrame.endTime(), qint64(-1));
+ }
+
+ QVERIFY(!buffer.isNull());
+
+ QVERIFY(frame.isValid());
+ QCOMPARE(frame.handleType(), handleType);
+ QCOMPARE(frame.pixelFormat(), pixelFormat);
+ QCOMPARE(frame.size(), size);
+ QCOMPARE(frame.width(), size.width());
+ QCOMPARE(frame.height(), size.height());
+ QCOMPARE(frame.startTime(), startTime);
+ QCOMPARE(frame.endTime(), qint64(-1)); // Explicitly shared.
+ }
+
+ QVERIFY(buffer.isNull());
+}
+
+void tst_QVideoFrame::assign_data()
+{
+ QTest::addColumn<QVideoFrame::HandleType>("handleType");
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<qint64>("startTime");
+ QTest::addColumn<qint64>("endTime");
+
+ QTest::newRow("64x64 ARGB32")
+ << QVideoFrame::RhiTextureHandle
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << qint64(63641740)
+ << qint64(63641954);
+ QTest::newRow("32x256 YUV420P")
+ << QVideoFrame::NoHandle
+ << QSize(32, 256)
+ << QVideoFrameFormat::Format_YUV420P
+ << qint64(12345)
+ << qint64(12389);
+}
+
+void tst_QVideoFrame::assign()
+{
+ QFETCH(QVideoFrame::HandleType, handleType);
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(qint64, startTime);
+ QFETCH(qint64, endTime);
+
+ QPointer<QtTestDummyVideoBuffer> buffer = new QtTestDummyVideoBuffer(handleType);
+
+ QVideoFrame frame;
+ {
+ QVideoFrame otherFrame = QVideoFramePrivate::createFrame(
+ std::unique_ptr<QHwVideoBuffer>(buffer), QVideoFrameFormat(size, pixelFormat));
+ otherFrame.setStartTime(startTime);
+ otherFrame.setEndTime(endTime);
+
+ frame = otherFrame;
+
+ QVERIFY(!buffer.isNull());
+
+ QVERIFY(otherFrame.isValid());
+ QCOMPARE(otherFrame.handleType(), handleType);
+ QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
+ QCOMPARE(otherFrame.size(), size);
+ QCOMPARE(otherFrame.width(), size.width());
+ QCOMPARE(otherFrame.height(), size.height());
+ QCOMPARE(otherFrame.startTime(), startTime);
+ QCOMPARE(otherFrame.endTime(), endTime);
+
+ otherFrame.setStartTime(-1);
+
+ QVERIFY(!buffer.isNull());
+
+ QVERIFY(otherFrame.isValid());
+ QCOMPARE(otherFrame.handleType(), handleType);
+ QCOMPARE(otherFrame.pixelFormat(), pixelFormat);
+ QCOMPARE(otherFrame.size(), size);
+ QCOMPARE(otherFrame.width(), size.width());
+ QCOMPARE(otherFrame.height(), size.height());
+ QCOMPARE(otherFrame.startTime(), qint64(-1));
+ QCOMPARE(otherFrame.endTime(), endTime);
+ }
+
+ QVERIFY(!buffer.isNull());
+
+ QVERIFY(frame.isValid());
+ QCOMPARE(frame.handleType(), handleType);
+ QCOMPARE(frame.pixelFormat(), pixelFormat);
+ QCOMPARE(frame.size(), size);
+ QCOMPARE(frame.width(), size.width());
+ QCOMPARE(frame.height(), size.height());
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), endTime);
+
+ frame = QVideoFrame();
+
+ QVERIFY(buffer.isNull());
+
+ QVERIFY(!frame.isValid());
+ QCOMPARE(frame.handleType(), QVideoFrame::NoHandle);
+ QCOMPARE(frame.pixelFormat(), QVideoFrameFormat::Format_Invalid);
+ QCOMPARE(frame.size(), QSize());
+ QCOMPARE(frame.width(), -1);
+ QCOMPARE(frame.height(), -1);
+ QCOMPARE(frame.startTime(), qint64(-1));
+ QCOMPARE(frame.endTime(), qint64(-1));
+}
+
+void tst_QVideoFrame::map_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<QtVideo::MapMode>("mode");
+
+ QTest::newRow("read-only")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << QtVideo::MapMode::ReadOnly;
+
+ QTest::newRow("write-only")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << QtVideo::MapMode::WriteOnly;
+
+ QTest::newRow("read-write")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888
+ << QtVideo::MapMode::ReadWrite;
+}
+
+void tst_QVideoFrame::map()
+{
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(QtVideo::MapMode, mode);
+
+ QVideoFrame frame(QVideoFrameFormat(size, pixelFormat));
+
+ QVERIFY(!frame.bits(0));
+ QCOMPARE(frame.mappedBytes(0), 0);
+ QCOMPARE(frame.bytesPerLine(0), 0);
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), QtVideo::MapMode::NotMapped);
+
+ QVERIFY(frame.map(mode));
+
+ // Mapping multiple times is allowed in ReadOnly mode
+ if (mode == QtVideo::MapMode::ReadOnly) {
+ const uchar *bits = frame.bits(0);
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadOnly));
+ QVERIFY(frame.isMapped());
+ QCOMPARE(frame.bits(0), bits);
+
+ frame.unmap();
+ //frame should still be mapped after the first nested unmap
+ QVERIFY(frame.isMapped());
+ QCOMPARE(frame.bits(0), bits);
+
+ //re-mapping in Write or ReadWrite modes should fail
+ QVERIFY(!frame.map(QtVideo::MapMode::WriteOnly));
+ QVERIFY(!frame.map(QtVideo::MapMode::ReadWrite));
+ } else {
+ // Mapping twice in ReadWrite or WriteOnly modes should fail, but leave it mapped (and the mode is ignored)
+ QVERIFY(!frame.map(mode));
+ QVERIFY(!frame.map(QtVideo::MapMode::ReadOnly));
+ }
+
+ QVERIFY(frame.bits(0));
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), mode);
+
+ frame.unmap();
+
+ QVERIFY(!frame.bits(0));
+ QCOMPARE(frame.mappedBytes(0), 0);
+ QCOMPARE(frame.bytesPerLine(0), 0);
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), QtVideo::MapMode::NotMapped);
+}
+
+void tst_QVideoFrame::mapPlanes_data()
+{
+ QTest::addColumn<QVideoFrame>("frame");
+
+ // Distance between subsequent lines within a color plane in bytes
+ QTest::addColumn<QList<int> >("strides");
+
+ // Distance from first pixel of first color plane to first pixel
+ // of n'th plane in bytes
+ QTest::addColumn<QList<int> >("offsets");
+
+ static uchar bufferData[1024];
+
+ auto planarBuffer = std::make_unique<QtTestVideoBuffer>();
+ planarBuffer->m_data[0] = bufferData;
+ planarBuffer->m_data[1] = bufferData + 512;
+ planarBuffer->m_data[2] = bufferData + 765;
+ planarBuffer->m_bytesPerLine[0] = 64;
+ planarBuffer->m_bytesPerLine[1] = 36;
+ planarBuffer->m_bytesPerLine[2] = 36;
+ planarBuffer->m_planeCount = 3;
+ planarBuffer->m_numBytes = sizeof(bufferData);
+
+ QTest::newRow("Planar") << QVideoFramePrivate::createFrame(
+ std::move(planarBuffer),
+ QVideoFrameFormat(QSize(64, 64), QVideoFrameFormat::Format_YUV420P))
+ << (QList<int>() << 64 << 36 << 36) << (QList<int>() << 512 << 765);
+ QTest::newRow("Format_YUV420P")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_YUV420P))
+ << (QList<int>() << 64 << 32 << 32)
+ << (QList<int>() << 4096 << 5120);
+ QTest::newRow("Format_YUV422P")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_YUV422P))
+ << (QList<int>() << 64 << 64 / 2 << 64 / 2)
+ << (QList<int>() << 64 * 64 << 64 * 64 + 64 / 2 * 64);
+ QTest::newRow("Format_YV12")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_YV12))
+ << (QList<int>() << 64 << 32 << 32)
+ << (QList<int>() << 4096 << 5120);
+ QTest::newRow("Format_NV12")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_NV12))
+ << (QList<int>() << 64 << 64)
+ << (QList<int>() << 4096);
+ QTest::newRow("Format_NV21")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_NV21))
+ << (QList<int>() << 64 << 64)
+ << (QList<int>() << 4096);
+ QTest::newRow("Format_IMC2")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_IMC2))
+ << (QList<int>() << 64 << 64)
+ << (QList<int>() << 4096);
+ QTest::newRow("Format_IMC4")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_IMC4))
+ << (QList<int>() << 64 << 64)
+ << (QList<int>() << 4096);
+ QTest::newRow("Format_IMC1")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_IMC1))
+ << (QList<int>() << 64 << 64 << 64)
+ << (QList<int>() << 4096 << 6144);
+ QTest::newRow("Format_IMC3")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_IMC3))
+ << (QList<int>() << 64 << 64 << 64)
+ << (QList<int>() << 4096 << 6144);
+ QTest::newRow("Format_ARGB32")
+ << QVideoFrame(QVideoFrameFormat(QSize(60, 64), QVideoFrameFormat::Format_ARGB8888))
+ << (QList<int>() << 240)
+ << (QList<int>());
+}
+
+void tst_QVideoFrame::mapPlanes()
+{
+ QFETCH(QVideoFrame, frame);
+ QFETCH(QList<int>, strides);
+ QFETCH(QList<int>, offsets);
+
+ QCOMPARE(strides.size(), offsets.size() + 1);
+
+ QCOMPARE(frame.map(QtVideo::MapMode::ReadOnly), true);
+ QCOMPARE(frame.planeCount(), strides.size());
+
+ QVERIFY(strides.size() > 0);
+ QCOMPARE(frame.bytesPerLine(0), strides.at(0));
+ QVERIFY(frame.bits(0));
+
+ if (strides.size() > 1) {
+ QCOMPARE(frame.bytesPerLine(1), strides.at(1));
+ QCOMPARE(int(frame.bits(1) - frame.bits(0)), offsets.at(0));
+ }
+ if (strides.size() > 2) {
+ QCOMPARE(frame.bytesPerLine(2), strides.at(2));
+ QCOMPARE(int(frame.bits(2) - frame.bits(0)), offsets.at(1));
+ }
+ if (strides.size() > 3) {
+ QCOMPARE(frame.bytesPerLine(3), strides.at(3));
+ QCOMPARE(int(frame.bits(3) - frame.bits(0)), offsets.at(0));
+ }
+
+ frame.unmap();
+}
+
+void tst_QVideoFrame::formatConversion_data()
+{
+ QTest::addColumn<QImage::Format>("imageFormat");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ QTest::newRow("QImage::Format_RGB32 | QVideoFrameFormat::Format_BGRX8888")
+ << QImage::Format_RGB32
+ << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("QImage::Format_ARGB32 | QVideoFrameFormat::Format_BGRA8888")
+ << QImage::Format_ARGB32
+ << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("QImage::Format_ARGB32_Premultiplied | QVideoFrameFormat::Format_BGRA8888_Premultiplied")
+ << QImage::Format_ARGB32_Premultiplied
+ << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("QVideoFrameFormat::Format_ARGB8888")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_ARGB8888;
+ QTest::newRow("QVideoFrameFormat::Format_ARGB8888_Premultiplied")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_ARGB8888_Premultiplied;
+#else
+ QTest::newRow("QImage::Format_RGB32 | QVideoFrameFormat::Format_XRGB8888")
+ << QImage::Format_RGB32
+ << QVideoFrameFormat::Format_XRGB8888;
+ QTest::newRow("QImage::Format_ARGB32 | QVideoFrameFormat::Format_ARGB8888")
+ << QImage::Format_ARGB32
+ << QVideoFrameFormat::Format_ARGB8888;
+ QTest::newRow("QImage::Format_ARGB32_Premultiplied | QVideoFrameFormat::Format_ARGB8888_Premultiplied")
+ << QImage::Format_ARGB32_Premultiplied
+ << QVideoFrameFormat::Format_ARGB8888_Premultiplied;
+ QTest::newRow("QVideoFrameFormat::Format_BGRA8888")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("QVideoFrameFormat::Format_BGRA8888_Premultiplied")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+#endif
+
+ QTest::newRow("QImage::Format_MonoLSB")
+ << QImage::Format_MonoLSB
+ << QVideoFrameFormat::Format_Invalid;
+ QTest::newRow("QImage::Format_Indexed8")
+ << QImage::Format_Indexed8
+ << QVideoFrameFormat::Format_Invalid;
+ QTest::newRow("QImage::Format_ARGB6666_Premultiplied")
+ << QImage::Format_ARGB6666_Premultiplied
+ << QVideoFrameFormat::Format_Invalid;
+ QTest::newRow("QImage::Format_ARGB8555_Premultiplied")
+ << QImage::Format_ARGB8555_Premultiplied
+ << QVideoFrameFormat::Format_Invalid;
+ QTest::newRow("QImage::Format_RGB666")
+ << QImage::Format_RGB666
+ << QVideoFrameFormat::Format_Invalid;
+ QTest::newRow("QImage::Format_RGB444")
+ << QImage::Format_RGB444
+ << QVideoFrameFormat::Format_Invalid;
+ QTest::newRow("QImage::Format_ARGB4444_Premultiplied")
+ << QImage::Format_ARGB4444_Premultiplied
+ << QVideoFrameFormat::Format_Invalid;
+
+ QTest::newRow("QVideoFrameFormat::Format_BGR32")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_XBGR8888;
+ QTest::newRow("QVideoFrameFormat::Format_AYUV")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_AYUV;
+ QTest::newRow("QVideoFrameFormat::Format_AYUV_Premultiplied")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_AYUV_Premultiplied;
+ QTest::newRow("QVideoFrameFormat::Format_YUV420P")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_YUV420P;
+ QTest::newRow("QVideoFrameFormat::Format_YV12")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_YV12;
+ QTest::newRow("QVideoFrameFormat::Format_UYVY")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_UYVY;
+ QTest::newRow("QVideoFrameFormat::Format_YUYV")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_YUYV;
+ QTest::newRow("QVideoFrameFormat::Format_NV12")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_NV12;
+ QTest::newRow("QVideoFrameFormat::Format_NV21")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_NV21;
+ QTest::newRow("QVideoFrameFormat::Format_IMC1")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_IMC1;
+ QTest::newRow("QVideoFrameFormat::Format_IMC2")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_IMC2;
+ QTest::newRow("QVideoFrameFormat::Format_IMC3")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_IMC3;
+ QTest::newRow("QVideoFrameFormat::Format_IMC4")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_IMC4;
+ QTest::newRow("QVideoFrameFormat::Format_Y8")
+ << QImage::Format_Grayscale8
+ << QVideoFrameFormat::Format_Y8;
+ QTest::newRow("QVideoFrameFormat::Format_Y16")
+ << QImage::Format_Grayscale16
+ << QVideoFrameFormat::Format_Y16;
+ QTest::newRow("QVideoFrameFormat::Format_Jpeg")
+ << QImage::Format_Invalid
+ << QVideoFrameFormat::Format_Jpeg;
+ QTest::newRow("QVideoFrameFormat::Format_RGBX8888")
+ << QImage::Format_RGBX8888 << QVideoFrameFormat::Format_RGBX8888;
+ QTest::newRow("QImage::Format_RGBA8888_Premultiplied => QVideoFrameFormat::Format_RGBX8888 "
+ "(workaround)")
+ << QImage::Format_RGBA8888_Premultiplied << QVideoFrameFormat::Format_RGBX8888;
+}
+
+void tst_QVideoFrame::formatConversion()
+{
+ QFETCH(QImage::Format, imageFormat);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+
+ if (imageFormat != QImage::Format_Invalid)
+ QCOMPARE(QVideoFrameFormat::pixelFormatFromImageFormat(imageFormat), pixelFormat);
+
+ if (imageFormat == QImage::Format_RGBA8888_Premultiplied) {
+ qWarning() << "Workaround: convert QImage::Format_RGBA8888_Premultiplied to "
+ "QVideoFrameFormat::Format_RGBX8888; to be removed in 6.8";
+ return;
+ }
+
+ if (pixelFormat != QVideoFrameFormat::Format_Invalid)
+ QCOMPARE(QVideoFrameFormat::imageFormatFromPixelFormat(pixelFormat), imageFormat);
+}
+
+void tst_QVideoFrame::qImageFromVideoFrame_doesNotCrash_whenCalledWithEvenAndOddSizedFrames_data() {
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<bool>("forceCpuConversion");
+ QTest::addColumn<bool>("supportedOnPlatform");
+
+ const std::vector<QSize> sizes{
+ // Even sized
+ { 2, 2 },
+ { 2, 10 },
+ { 10, 2 },
+ { 640, 480 },
+ { 4096, 2160 },
+ // Odd sized
+ { 0, 0 },
+ { 3, 3 },
+ { 2, 3 },
+ { 3, 2 },
+ { 641, 480 },
+ { 640, 481 },
+ // TODO: Crashes
+ // { 1, 1 } // TODO: Division by zero in QVideoFrame::map (Debug)
+ // { 1, 2 } // TODO: D3D validation error in QRhiD3D11::executeCommandBuffer
+ // { 2, 1 } // TODO: D3D validation error in QRhiD3D11::executeCommandBuffer
+ };
+
+ for (const QSize &size : sizes) {
+ for (const QVideoFrameFormat::PixelFormat pixelFormat : s_pixelFormats) {
+ for (const bool forceCpu : { false, true }) {
+
+ if (pixelFormat == QVideoFrameFormat::Format_YUV420P10 && forceCpu)
+ continue; // TODO: Cpu conversion not implemented
+
+ QString name = QStringLiteral("%1x%2_%3%4")
+ .arg(size.width())
+ .arg(size.height())
+ .arg(QVideoFrameFormat::pixelFormatToString(pixelFormat))
+ .arg(forceCpu ? "_cpu" : "");
+
+ QTest::addRow("%s", name.toLatin1().data())
+ << size << pixelFormat << forceCpu << isSupportedPixelFormat(pixelFormat);
+ }
+ }
+ }
+}
+
+void tst_QVideoFrame::qImageFromVideoFrame_doesNotCrash_whenCalledWithEvenAndOddSizedFrames() {
+ QFETCH(const QSize, size);
+ QFETCH(const QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(const bool, forceCpuConversion);
+ QFETCH(const bool, supportedOnPlatform);
+
+ const QVideoFrameFormat format{ size, pixelFormat };
+ const QVideoFrame frame{ format };
+ const QImage actual = qImageFromVideoFrame(frame, QtVideo::Rotation::None, false, false,
+ forceCpuConversion);
+
+ if (supportedOnPlatform)
+ QCOMPARE_EQ(actual.isNull(), size.isEmpty());
+ // Otherwise, we don't expect an image being produced, although it might.
+ // TODO: Investigate why 16 bit formats fail on some Android flavors.
+}
+
+#define TEST_MAPPED(frame, mode) \
+do { \
+ QVERIFY(frame.bits(0)); \
+ QVERIFY(frame.isMapped()); \
+ QCOMPARE(frame.mappedBytes(0), 16384); \
+ QCOMPARE(frame.bytesPerLine(0), 256); \
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), mode); \
+} while (0)
+
+#define TEST_UNMAPPED(frame) \
+do { \
+ QVERIFY(!frame.bits(0)); \
+ QVERIFY(!frame.isMapped()); \
+ QCOMPARE(frame.mappedBytes(0), 0); \
+ QCOMPARE(frame.bytesPerLine(0), 0); \
+ QCOMPARE(static_cast<QtVideo::MapMode>(frame.mapMode()), QtVideo::MapMode::NotMapped); \
+} while (0)
+
+void tst_QVideoFrame::isMapped()
+{
+ QVideoFrame frame(QVideoFrameFormat(QSize(64, 64), QVideoFrameFormat::Format_ARGB8888));
+ const QVideoFrame& constFrame(frame);
+
+ TEST_UNMAPPED(frame);
+ TEST_UNMAPPED(constFrame);
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadOnly));
+ TEST_MAPPED(frame, QtVideo::MapMode::ReadOnly);
+ TEST_MAPPED(constFrame, QtVideo::MapMode::ReadOnly);
+ frame.unmap();
+ TEST_UNMAPPED(frame);
+ TEST_UNMAPPED(constFrame);
+
+ QVERIFY(frame.map(QtVideo::MapMode::WriteOnly));
+ TEST_MAPPED(frame, QtVideo::MapMode::WriteOnly);
+ TEST_MAPPED(constFrame, QtVideo::MapMode::WriteOnly);
+ frame.unmap();
+ TEST_UNMAPPED(frame);
+ TEST_UNMAPPED(constFrame);
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadWrite));
+ TEST_MAPPED(frame, QtVideo::MapMode::ReadWrite);
+ TEST_MAPPED(constFrame, QtVideo::MapMode::ReadWrite);
+ frame.unmap();
+ TEST_UNMAPPED(frame);
+ TEST_UNMAPPED(constFrame);
+}
+
+void tst_QVideoFrame::isReadable()
+{
+ QVideoFrame frame(QVideoFrameFormat(QSize(64, 64), QVideoFrameFormat::Format_ARGB8888));
+
+ QVERIFY(!frame.isMapped());
+ QVERIFY(!frame.isReadable());
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadOnly));
+ QVERIFY(frame.isMapped());
+ QVERIFY(frame.isReadable());
+ frame.unmap();
+
+ QVERIFY(frame.map(QtVideo::MapMode::WriteOnly));
+ QVERIFY(frame.isMapped());
+ QVERIFY(!frame.isReadable());
+ frame.unmap();
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadWrite));
+ QVERIFY(frame.isMapped());
+ QVERIFY(frame.isReadable());
+ frame.unmap();
+}
+
+void tst_QVideoFrame::isWritable()
+{
+ QVideoFrame frame(QVideoFrameFormat(QSize(64, 64), QVideoFrameFormat::Format_ARGB8888));
+
+ QVERIFY(!frame.isMapped());
+ QVERIFY(!frame.isWritable());
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadOnly));
+ QVERIFY(frame.isMapped());
+ QVERIFY(!frame.isWritable());
+ frame.unmap();
+
+ QVERIFY(frame.map(QtVideo::MapMode::WriteOnly));
+ QVERIFY(frame.isMapped());
+ QVERIFY(frame.isWritable());
+ frame.unmap();
+
+ QVERIFY(frame.map(QtVideo::MapMode::ReadWrite));
+ QVERIFY(frame.isMapped());
+ QVERIFY(frame.isWritable());
+ frame.unmap();
+}
+
+void tst_QVideoFrame::image_data()
+{
+ QTest::addColumn<QSize>("size");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+
+ QTest::newRow("64x64 ARGB32")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888;
+
+ QTest::newRow("64x64 ARGB32_Premultiplied")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_ARGB8888_Premultiplied;
+
+ QTest::newRow("64x64 RGB32")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_XRGB8888;
+
+ QTest::newRow("64x64 BGRA32")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_BGRA8888;
+
+ QTest::newRow("64x64 BGRA32_Premultiplied")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+
+ QTest::newRow("64x64 BGR32")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_XBGR8888;
+
+ QTest::newRow("64x64 AYUV")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_AYUV;
+
+ QTest::newRow("64x64 YUV420P")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_YUV420P;
+
+ QTest::newRow("64x64 YV12")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_YV12;
+
+ QTest::newRow("64x64 UYVY")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_UYVY;
+
+ QTest::newRow("64x64 YUYV")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_YUYV;
+
+ QTest::newRow("64x64 NV12")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_NV12;
+
+ QTest::newRow("64x64 NV21")
+ << QSize(64, 64)
+ << QVideoFrameFormat::Format_NV21;
+}
+
+void tst_QVideoFrame::image()
+{
+ QFETCH(QSize, size);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+
+ QVideoFrame frame(QVideoFrameFormat(size, pixelFormat));
+ QImage img = frame.toImage();
+
+ QVERIFY(!img.isNull());
+ QCOMPARE(img.size(), size);
+}
+
+void tst_QVideoFrame::emptyData()
+{
+ QByteArray data(nullptr, 0);
+ QVideoFrame f = QVideoFramePrivate::createFrame(
+ std::make_unique<QMemoryVideoBuffer>(data, 600),
+ QVideoFrameFormat(QSize(800, 600), QVideoFrameFormat::Format_ARGB8888));
+ QVERIFY(!f.map(QtVideo::MapMode::ReadOnly));
+}
+
+void tst_QVideoFrame::mirrored_takesValue_fromVideoFrameFormat()
+{
+ QVideoFrameFormat format(QSize(10, 20), QVideoFrameFormat::Format_ARGB8888);
+ format.setMirrored(true);
+
+ QVideoFrame frame(format);
+ QVERIFY(frame.mirrored());
+
+ frame.setMirrored(false);
+ frame.setRotation(QtVideo::Rotation::Clockwise180);
+ QVERIFY(!frame.mirrored());
+ QVERIFY(!frame.surfaceFormat().isMirrored());
+}
+
+void tst_QVideoFrame::rotation_takesValue_fromVideoFrameFormat()
+{
+ QVideoFrameFormat format(QSize(10, 20), QVideoFrameFormat::Format_ARGB8888);
+ format.setRotation(QtVideo::Rotation::Clockwise270);
+
+ QVideoFrame frame(format);
+ QCOMPARE(frame.rotation(), QtVideo::Rotation::Clockwise270);
+
+ frame.setRotation(QtVideo::Rotation::Clockwise180);
+
+ QCOMPARE(frame.rotation(), QtVideo::Rotation::Clockwise180);
+ QCOMPARE(frame.surfaceFormat().rotation(), QtVideo::Rotation::Clockwise180);
+}
+
+void tst_QVideoFrame::streamFrameRate_takesValue_fromVideoFrameFormat()
+{
+ QVideoFrameFormat format(QSize(10, 20), QVideoFrameFormat::Format_ARGB8888);
+ format.setStreamFrameRate(20.);
+
+ QVideoFrame frame(format);
+ QCOMPARE(frame.streamFrameRate(), 20.);
+
+ frame.setStreamFrameRate(25.);
+
+ QCOMPARE(frame.streamFrameRate(), 25.);
+ QCOMPARE(frame.surfaceFormat().streamFrameRate(), 25.);
+}
+
+void tst_QVideoFrame::constructor_createsInvalidFrame_whenCalledWithNullImage()
+{
+ const QVideoFrame frame{ QImage{} };
+ QVERIFY(!frame.isValid());
+}
+
+void tst_QVideoFrame::constructor_createsInvalidFrame_whenCalledWithEmptyImage()
+{
+ {
+ const QImage image{ QSize{}, QImage::Format_RGB32 };
+ const QVideoFrame frame{ image };
+
+ QVERIFY(!frame.isValid());
+ }
+
+ {
+ const QImage image{ { 0, 0 }, QImage::Format_RGB32 };
+ const QVideoFrame frame{ image };
+
+ QVERIFY(!frame.isValid());
+ }
+
+ {
+ const QImage image{ { 1, 0 }, QImage::Format_RGB32 };
+ const QVideoFrame frame{ image };
+
+ QVERIFY(!frame.isValid());
+ }
+
+ {
+ const QImage image{ { 0, 1 }, QImage::Format_RGB32 };
+ const QVideoFrame frame{ image };
+
+ QVERIFY(!frame.isValid());
+ }
+}
+
+void tst_QVideoFrame::constructor_createsInvalidFrame_whenCalledWithInvalidImageFormat()
+{
+ const QImage image{ { 1, 1 }, QImage::Format_Invalid};
+ const QVideoFrame frame{ image };
+
+ QVERIFY(!frame.isValid());
+}
+
+// clang-format off
+void tst_QVideoFrame::constructor_createsFrameWithCorrectFormat_whenCalledWithSupportedImageFormats_data()
+{
+ QTest::addColumn<QImage::Format>("imageFormat");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("expectedFrameFormat");
+
+ // Formats that do not require conversion
+ QTest::newRow("Format_RGB32") << QImage::Format_RGB32 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32 << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_RGBA8888") << QImage::Format_RGBA8888 << QVideoFrameFormat::Format_RGBA8888;
+ QTest::newRow("Format_RGBA8888_Premultiplied") << QImage::Format_RGBA8888_Premultiplied << QVideoFrameFormat::Format_RGBX8888;
+ QTest::newRow("Format_RGBX8888") << QImage::Format_RGBX8888 << QVideoFrameFormat::Format_RGBX8888;
+ QTest::newRow("Format_Grayscale8") << QImage::Format_Grayscale8 << QVideoFrameFormat::Format_Y8;
+ QTest::newRow("Format_Grayscale16") << QImage::Format_Grayscale16 << QVideoFrameFormat::Format_Y16;
+
+ // Formats that require conversion of input image
+ QTest::newRow("Format_Mono") << QImage::Format_Mono << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_RGB16") << QImage::Format_RGB16 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_RGB666") << QImage::Format_RGB666 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_RGB555") << QImage::Format_RGB555 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_RGB888") << QImage::Format_RGB888 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_RGB444") << QImage::Format_RGB444 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_BGR30") << QImage::Format_BGR30 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_A2BGR30_Premultiplied") << QImage::Format_A2BGR30_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_RGB30") << QImage::Format_RGB30 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_Alpha8") << QImage::Format_Alpha8 << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("Format_RGBX64") << QImage::Format_RGBX64 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_RGBA64") << QImage::Format_RGBA64 << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("Format_RGBA64_Premultiplied") << QImage::Format_RGBA64_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_BGR888") << QImage::Format_BGR888 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_RGBX16FPx4") << QImage::Format_RGBX16FPx4 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_RGBA16FPx4") << QImage::Format_RGBA16FPx4 << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("Format_RGBA16FPx4_Premultiplied") << QImage::Format_RGBA16FPx4_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+ QTest::newRow("Format_RGBX32FPx4") << QImage::Format_RGBX32FPx4 << QVideoFrameFormat::Format_BGRX8888;
+ QTest::newRow("Format_RGBA32FPx4") << QImage::Format_RGBA32FPx4 << QVideoFrameFormat::Format_BGRA8888;
+ QTest::newRow("Format_RGBA32FPx4_Premultiplied") << QImage::Format_RGBA32FPx4_Premultiplied << QVideoFrameFormat::Format_BGRA8888_Premultiplied;
+}
+// clang-format on
+
+void tst_QVideoFrame::constructor_createsFrameWithCorrectFormat_whenCalledWithSupportedImageFormats()
+{
+ QFETCH(const QImage::Format, imageFormat);
+ QFETCH(QVideoFrameFormat::PixelFormat, expectedFrameFormat);
+
+ const QImage image{ { 1, 1 }, imageFormat };
+ const QVideoFrame frame{ image };
+
+ QVERIFY(frame.isValid());
+ QCOMPARE_EQ(frame.pixelFormat(), expectedFrameFormat);
+}
+
+// clang-format off
+void tst_QVideoFrame::constructor_copiesImageData_whenCalledWithRGBFormats_data()
+{
+ QTest::addColumn<QImage::Format>("imageFormat");
+
+ // Formats that do not require image conversion
+ QTest::newRow("Format_RGB32") << QImage::Format_RGB32;
+ QTest::newRow("Format_RGBX8888") << QImage::Format_RGBX8888;
+ QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32;
+ QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGBA8888") << QImage::Format_RGBA8888;
+ QTest::newRow("Format_RGBA8888_Premultiplied") << QImage::Format_RGBA8888_Premultiplied;
+
+ // Formats that require image conversion
+ QTest::newRow("Format_Mono") << QImage::Format_Mono;
+ QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB;
+ QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8;
+ QTest::newRow("Format_RGB16") << QImage::Format_RGB16;
+ QTest::newRow("Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("Format_RGB666") << QImage::Format_RGB666;
+ QTest::newRow("Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied;
+ QTest::newRow("Format_RGB555") << QImage::Format_RGB555;
+ QTest::newRow("Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
+ QTest::newRow("Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Format_RGB444") << QImage::Format_RGB444;
+ QTest::newRow("Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied;
+ QTest::newRow("Format_BGR30") << QImage::Format_BGR30;
+ QTest::newRow("Format_A2BGR30_Premultiplied") << QImage::Format_A2BGR30_Premultiplied;
+ QTest::newRow("Format_RGB30") << QImage::Format_RGB30;
+ QTest::newRow("Format_A2RGB30_Premultiplied") << QImage::Format_A2RGB30_Premultiplied;
+ QTest::newRow("Format_Alpha8") << QImage::Format_Alpha8;
+ QTest::newRow("Format_RGBX64") << QImage::Format_RGBX64;
+ QTest::newRow("Format_RGBA64") << QImage::Format_RGBA64;
+ QTest::newRow("Format_RGBA64_Premultiplied") << QImage::Format_RGBA64_Premultiplied;
+ QTest::newRow("Format_BGR888") << QImage::Format_BGR888;
+ QTest::newRow("Format_RGBX16FPx4") << QImage::Format_RGBX16FPx4;
+ QTest::newRow("Format_RGBA16FPx4") << QImage::Format_RGBA16FPx4;
+ QTest::newRow("Format_RGBA16FPx4_Premultiplied") << QImage::Format_RGBA16FPx4_Premultiplied;
+ QTest::newRow("Format_RGBX32FPx4") << QImage::Format_RGBX32FPx4;
+ QTest::newRow("Format_RGBA32FPx4") << QImage::Format_RGBA32FPx4;
+ QTest::newRow("Format_RGBA32FPx4_Premultiplied") << QImage::Format_RGBA32FPx4_Premultiplied;
+}
+
+// clang-format on
+
+void tst_QVideoFrame::constructor_copiesImageData_whenCalledWithRGBFormats()
+{
+ QFETCH(const QImage::Format, imageFormat);
+
+ // Arrange
+ const QImage image{ createTestImage(imageFormat) };
+
+ // Act
+ QVideoFrame frame{ image };
+
+ // Assert
+ QVERIFY(compareEq(frame, image));
+}
+
+QTEST_MAIN(tst_QVideoFrame)
+
+#include "tst_qvideoframe.moc"
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt b/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt
new file mode 100644
index 000000000..d2e3086d2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ testdata/*)
+list(APPEND testdata_resource_files ${test_data_glob})
+
+qt_internal_add_test(tst_qvideoframecolormanagement
+ SOURCES
+ tst_qvideoframecolormanagement.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+ BUILTIN_TESTDATA
+ TESTDATA ${testdata_resource_files}
+)
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg
new file mode 100644
index 000000000..52b0f620b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_abgr8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_argb8888_premultiplied_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgra8888_premultiplied_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_bgrx8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full.png
new file mode 100644
index 000000000..d6d461f5d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video.png
new file mode 100644
index 000000000..2a4f7d8a7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full.png
new file mode 100644
index 000000000..d291f62bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video.png
new file mode 100644
index 000000000..35296fc03
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full.png
new file mode 100644
index 000000000..64e5eb6dc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video.png
new file mode 100644
index 000000000..9f6bdd1ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc1_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full.png
new file mode 100644
index 000000000..90b2b3601
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video.png
new file mode 100644
index 000000000..90b2b3601
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full.png
new file mode 100644
index 000000000..2e78cfc31
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video.png
new file mode 100644
index 000000000..d673b7ce5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full.png
new file mode 100644
index 000000000..8be30a706
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video.png
new file mode 100644
index 000000000..1f64ea0f1
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full.png
new file mode 100644
index 000000000..24fb9065e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video.png
new file mode 100644
index 000000000..f737d8602
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc2_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full.png
new file mode 100644
index 000000000..d6d461f5d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video.png
new file mode 100644
index 000000000..2a4f7d8a7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full.png
new file mode 100644
index 000000000..d291f62bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video.png
new file mode 100644
index 000000000..35296fc03
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full.png
new file mode 100644
index 000000000..64e5eb6dc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video.png
new file mode 100644
index 000000000..9f6bdd1ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc3_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full.png
new file mode 100644
index 000000000..6efa73ea2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video.png
new file mode 100644
index 000000000..6efa73ea2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full.png
new file mode 100644
index 000000000..8d6a36a1c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video.png
new file mode 100644
index 000000000..dab23bf0d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full.png
new file mode 100644
index 000000000..36e787cef
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video.png
new file mode 100644
index 000000000..01e6ab967
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full.png
new file mode 100644
index 000000000..22beff2e8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video.png
new file mode 100644
index 000000000..c2af074b8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_imc4_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full.png
new file mode 100644
index 000000000..d6d461f5d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video.png
new file mode 100644
index 000000000..2a4f7d8a7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full.png
new file mode 100644
index 000000000..d291f62bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video.png
new file mode 100644
index 000000000..35296fc03
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full.png
new file mode 100644
index 000000000..64e5eb6dc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video.png
new file mode 100644
index 000000000..9f6bdd1ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv12_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full.png
new file mode 100644
index 000000000..d6d461f5d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video.png
new file mode 100644
index 000000000..2a4f7d8a7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full.png
new file mode 100644
index 000000000..d291f62bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video.png
new file mode 100644
index 000000000..35296fc03
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full.png
new file mode 100644
index 000000000..64e5eb6dc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video.png
new file mode 100644
index 000000000..9f6bdd1ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_nv21_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full.png
new file mode 100644
index 000000000..71e107b8a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full_cpu.png
new file mode 100644
index 000000000..1242dd25b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video.png
new file mode 100644
index 000000000..71e107b8a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video_cpu.png
new file mode 100644
index 000000000..1242dd25b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full.png
new file mode 100644
index 000000000..58a7ebc92
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full_cpu.png
new file mode 100644
index 000000000..4286840f8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video.png
new file mode 100644
index 000000000..d8756caac
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video_cpu.png
new file mode 100644
index 000000000..fb6d356f8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full.png
new file mode 100644
index 000000000..905568bf9
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full_cpu.png
new file mode 100644
index 000000000..d819e478c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video.png
new file mode 100644
index 000000000..f374df207
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video_cpu.png
new file mode 100644
index 000000000..2fbc2225c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full.png
new file mode 100644
index 000000000..d2ee0f8e2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full_cpu.png
new file mode 100644
index 000000000..d819e478c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video.png
new file mode 100644
index 000000000..740de7f79
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video_cpu.png
new file mode 100644
index 000000000..d19223883
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p010_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full.png
new file mode 100644
index 000000000..ad76d393a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full_cpu.png
new file mode 100644
index 000000000..68509c232
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video.png
new file mode 100644
index 000000000..ad76d393a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video_cpu.png
new file mode 100644
index 000000000..68509c232
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full.png
new file mode 100644
index 000000000..a6e47132c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full_cpu.png
new file mode 100644
index 000000000..2cb927d35
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video.png
new file mode 100644
index 000000000..d9760b9c9
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video_cpu.png
new file mode 100644
index 000000000..3f65f27db
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full.png
new file mode 100644
index 000000000..04ae5e1cd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full_cpu.png
new file mode 100644
index 000000000..299548d61
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video.png
new file mode 100644
index 000000000..9faa15fad
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video_cpu.png
new file mode 100644
index 000000000..d544f8767
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full.png
new file mode 100644
index 000000000..84b04ff9e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full_cpu.png
new file mode 100644
index 000000000..299548d61
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video.png
new file mode 100644
index 000000000..505752c10
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video_cpu.png
new file mode 100644
index 000000000..7da761925
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_p016_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video_cpu.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgba8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_rgbx8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full.png
new file mode 100644
index 000000000..c5243c441
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full_cpu.png
new file mode 100644
index 000000000..6a0cb7dd8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video.png
new file mode 100644
index 000000000..c5243c441
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video_cpu.png
new file mode 100644
index 000000000..6a0cb7dd8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full.png
new file mode 100644
index 000000000..0a9874943
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full_cpu.png
new file mode 100644
index 000000000..126744377
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video.png
new file mode 100644
index 000000000..7318c1e99
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video_cpu.png
new file mode 100644
index 000000000..908b28c2f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full.png
new file mode 100644
index 000000000..68789bef5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full_cpu.png
new file mode 100644
index 000000000..7ef68b58b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video.png
new file mode 100644
index 000000000..bfd6396ec
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video_cpu.png
new file mode 100644
index 000000000..03e337184
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full.png
new file mode 100644
index 000000000..704c59cf9
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full_cpu.png
new file mode 100644
index 000000000..7ef68b58b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video.png
new file mode 100644
index 000000000..d9ad9c239
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video_cpu.png
new file mode 100644
index 000000000..0030ce5bc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_uyvy_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xbgr8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video.png
new file mode 100644
index 000000000..682e999cc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video_cpu.png
new file mode 100644
index 000000000..7d1d73109
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_xrgb8888_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full.png
new file mode 100644
index 000000000..b1dc781f2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full_cpu.png
new file mode 100644
index 000000000..584ad4c25
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video.png
new file mode 100644
index 000000000..b1dc781f2
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video_cpu.png
new file mode 100644
index 000000000..584ad4c25
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full.png
new file mode 100644
index 000000000..619ee36a4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full_cpu.png
new file mode 100644
index 000000000..16445be0c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video.png
new file mode 100644
index 000000000..881f6be33
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video_cpu.png
new file mode 100644
index 000000000..9c7e87238
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full.png
new file mode 100644
index 000000000..b1d3111df
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full_cpu.png
new file mode 100644
index 000000000..1a3025e2d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video.png
new file mode 100644
index 000000000..e4d1ce940
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video_cpu.png
new file mode 100644
index 000000000..614b71e3e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full.png
new file mode 100644
index 000000000..b1d3111df
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full_cpu.png
new file mode 100644
index 000000000..1a3025e2d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video.png
new file mode 100644
index 000000000..df8df3edd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video_cpu.png
new file mode 100644
index 000000000..d6bed0482
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y16_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full.png
new file mode 100644
index 000000000..130a3b541
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full_cpu.png
new file mode 100644
index 000000000..61d2c6ca0
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video.png
new file mode 100644
index 000000000..130a3b541
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video_cpu.png
new file mode 100644
index 000000000..61d2c6ca0
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full.png
new file mode 100644
index 000000000..21ed2218a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full_cpu.png
new file mode 100644
index 000000000..188efe1d9
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video.png
new file mode 100644
index 000000000..f60f53d02
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video_cpu.png
new file mode 100644
index 000000000..512c467b6
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full.png
new file mode 100644
index 000000000..df59b71e7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full_cpu.png
new file mode 100644
index 000000000..bfc57d849
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video.png
new file mode 100644
index 000000000..dbca71c70
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video_cpu.png
new file mode 100644
index 000000000..52f4b0223
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full.png
new file mode 100644
index 000000000..df59b71e7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full_cpu.png
new file mode 100644
index 000000000..bfc57d849
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video.png
new file mode 100644
index 000000000..3479bb890
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video_cpu.png
new file mode 100644
index 000000000..b3a488e2f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_y8_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_full.png
new file mode 100644
index 000000000..20b24da65
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_video.png
new file mode 100644
index 000000000..20b24da65
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_full.png
new file mode 100644
index 000000000..b96379a0b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_video.png
new file mode 100644
index 000000000..c77645b59
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_full.png
new file mode 100644
index 000000000..a1b8b62da
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_video.png
new file mode 100644
index 000000000..7a69f6afa
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_full.png
new file mode 100644
index 000000000..644b083fe
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_video.png
new file mode 100644
index 000000000..d4e9debd7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p10_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full.png
new file mode 100644
index 000000000..d6d461f5d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video.png
new file mode 100644
index 000000000..2a4f7d8a7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full.png
new file mode 100644
index 000000000..d291f62bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video.png
new file mode 100644
index 000000000..35296fc03
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full.png
new file mode 100644
index 000000000..64e5eb6dc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video.png
new file mode 100644
index 000000000..9f6bdd1ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv420p_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full.png
new file mode 100644
index 000000000..3e255af2f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full_cpu.png
new file mode 100644
index 000000000..6a0cb7dd8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video.png
new file mode 100644
index 000000000..3e255af2f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video_cpu.png
new file mode 100644
index 000000000..6a0cb7dd8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full.png
new file mode 100644
index 000000000..74fd12726
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full_cpu.png
new file mode 100644
index 000000000..126744377
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video.png
new file mode 100644
index 000000000..e358d16d8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video_cpu.png
new file mode 100644
index 000000000..908b28c2f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full.png
new file mode 100644
index 000000000..cb1cbbd34
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full_cpu.png
new file mode 100644
index 000000000..7ef68b58b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video.png
new file mode 100644
index 000000000..6dd95a078
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video_cpu.png
new file mode 100644
index 000000000..03e337184
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full.png
new file mode 100644
index 000000000..3e92f3695
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full_cpu.png
new file mode 100644
index 000000000..7ef68b58b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video.png
new file mode 100644
index 000000000..e94891e1c
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video_cpu.png
new file mode 100644
index 000000000..0030ce5bc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuv422p_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full.png
new file mode 100644
index 000000000..c5243c441
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full_cpu.png
new file mode 100644
index 000000000..6a0cb7dd8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video.png
new file mode 100644
index 000000000..c5243c441
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video_cpu.png
new file mode 100644
index 000000000..6a0cb7dd8
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full.png
new file mode 100644
index 000000000..0a9874943
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full_cpu.png
new file mode 100644
index 000000000..126744377
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video.png
new file mode 100644
index 000000000..7318c1e99
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video_cpu.png
new file mode 100644
index 000000000..908b28c2f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full.png
new file mode 100644
index 000000000..68789bef5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full_cpu.png
new file mode 100644
index 000000000..7ef68b58b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video.png
new file mode 100644
index 000000000..bfd6396ec
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video_cpu.png
new file mode 100644
index 000000000..03e337184
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full.png
new file mode 100644
index 000000000..704c59cf9
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full_cpu.png
new file mode 100644
index 000000000..7ef68b58b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video.png
new file mode 100644
index 000000000..d9ad9c239
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video_cpu.png
new file mode 100644
index 000000000..0030ce5bc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yuyv_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video.png
new file mode 100644
index 000000000..2af7cdaa4
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video_cpu.png
new file mode 100644
index 000000000..12685832f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_adobergb_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full.png
new file mode 100644
index 000000000..d6d461f5d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full_cpu.png
new file mode 100644
index 000000000..2138f7b91
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video.png
new file mode 100644
index 000000000..2a4f7d8a7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video_cpu.png
new file mode 100644
index 000000000..0de0ffbc5
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt2020_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full.png
new file mode 100644
index 000000000..d291f62bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video.png
new file mode 100644
index 000000000..35296fc03
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video_cpu.png
new file mode 100644
index 000000000..7b198e19b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt601_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full.png
new file mode 100644
index 000000000..64e5eb6dc
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full_cpu.png
new file mode 100644
index 000000000..33229f55f
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_full_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video.png
new file mode 100644
index 000000000..9f6bdd1ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video_cpu.png b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video_cpu.png
new file mode 100644
index 000000000..74b3efccd
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/testdata/umbrellas.jpg_yv12_bt709_video_cpu.png
Binary files differ
diff --git a/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp b/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp
new file mode 100644
index 000000000..ad221e54e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframecolormanagement/tst_qvideoframecolormanagement.cpp
@@ -0,0 +1,475 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <qvideoframe.h>
+#include <qvideoframeformat.h>
+#include "private/qmemoryvideobuffer_p.h"
+#include "private/qvideoframeconverter_p.h"
+#include "private/qplatformmediaintegration_p.h"
+#include "private/qimagevideobuffer_p.h"
+#include "private/qvideoframe_p.h"
+#include <QtGui/QColorSpace>
+#include <QtGui/QImage>
+#include <QtCore/QPointer>
+
+#include "../../../integration/shared/mediabackendutils.h"
+
+QT_USE_NAMESPACE
+
+namespace {
+
+struct TestParams
+{
+ QString fileName;
+ QVideoFrameFormat::PixelFormat pixelFormat;
+ QVideoFrameFormat::ColorSpace colorSpace;
+ QVideoFrameFormat::ColorRange colorRange;
+ bool forceCpu;
+};
+
+QString toString(QVideoFrameFormat::ColorRange r)
+{
+ switch (r) {
+ case QVideoFrameFormat::ColorRange_Video:
+ return "Video";
+ case QVideoFrameFormat::ColorRange_Full:
+ return "Full";
+ default:
+ Q_ASSERT(false);
+ return "";
+ }
+}
+
+std::vector<QVideoFrameFormat::ColorRange> colorRanges()
+{
+ return {
+ QVideoFrameFormat::ColorRange_Video,
+ QVideoFrameFormat::ColorRange_Full,
+ };
+}
+
+const QSet s_formats{ QVideoFrameFormat::Format_ARGB8888,
+ QVideoFrameFormat::Format_ARGB8888_Premultiplied,
+ QVideoFrameFormat::Format_XRGB8888,
+ QVideoFrameFormat::Format_BGRA8888,
+ QVideoFrameFormat::Format_BGRA8888_Premultiplied,
+ QVideoFrameFormat::Format_BGRX8888,
+ QVideoFrameFormat::Format_ABGR8888,
+ QVideoFrameFormat::Format_XBGR8888,
+ QVideoFrameFormat::Format_RGBA8888,
+ QVideoFrameFormat::Format_RGBX8888,
+ QVideoFrameFormat::Format_NV12,
+ QVideoFrameFormat::Format_NV21,
+ QVideoFrameFormat::Format_IMC1,
+ QVideoFrameFormat::Format_IMC2,
+ QVideoFrameFormat::Format_IMC3,
+ QVideoFrameFormat::Format_IMC4,
+ QVideoFrameFormat::Format_AYUV,
+ QVideoFrameFormat::Format_AYUV_Premultiplied,
+ QVideoFrameFormat::Format_YV12,
+ QVideoFrameFormat::Format_YUV420P,
+ QVideoFrameFormat::Format_YUV422P,
+ QVideoFrameFormat::Format_UYVY,
+ QVideoFrameFormat::Format_YUYV,
+ QVideoFrameFormat::Format_Y8,
+ QVideoFrameFormat::Format_Y16,
+ QVideoFrameFormat::Format_P010,
+ QVideoFrameFormat::Format_P016,
+ QVideoFrameFormat::Format_YUV420P10 };
+
+bool hasCorrespondingFFmpegFormat(QVideoFrameFormat::PixelFormat format)
+{
+ return format != QVideoFrameFormat::Format_AYUV
+ && format != QVideoFrameFormat::Format_AYUV_Premultiplied;
+}
+
+bool supportsCpuConversion(QVideoFrameFormat::PixelFormat format)
+{
+ return format != QVideoFrameFormat::Format_YUV420P10;
+}
+
+QString toString(QVideoFrameFormat::PixelFormat f)
+{
+ return QVideoFrameFormat::pixelFormatToString(f);
+}
+
+QSet<QVideoFrameFormat::PixelFormat> pixelFormats()
+{
+ return s_formats;
+}
+
+bool isSupportedPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat)
+{
+#ifdef Q_OS_ANDROID
+ // TODO: QTBUG-125238
+ switch (pixelFormat) {
+ case QVideoFrameFormat::Format_Y16:
+ case QVideoFrameFormat::Format_P010:
+ case QVideoFrameFormat::Format_P016:
+ case QVideoFrameFormat::Format_YUV420P10:
+ return false;
+ default:
+ return true;
+ }
+#else
+ return true;
+#endif
+}
+
+
+QString toString(QVideoFrameFormat::ColorSpace s)
+{
+ switch (s) {
+ case QVideoFrameFormat::ColorSpace_BT601:
+ return "BT601";
+ case QVideoFrameFormat::ColorSpace_BT709:
+ return "BT709";
+ case QVideoFrameFormat::ColorSpace_AdobeRgb:
+ return "AdobeRgb";
+ case QVideoFrameFormat::ColorSpace_BT2020:
+ return "BT2020";
+ default:
+ Q_ASSERT(false);
+ return "";
+ }
+}
+
+std::vector<QVideoFrameFormat::ColorSpace> colorSpaces()
+{
+ return { QVideoFrameFormat::ColorSpace_BT601, QVideoFrameFormat::ColorSpace_BT709,
+ QVideoFrameFormat::ColorSpace_AdobeRgb, QVideoFrameFormat::ColorSpace_BT2020 };
+}
+
+QString name(const TestParams &p)
+{
+ QString name = QStringLiteral("%1_%2_%3_%4%5")
+ .arg(p.fileName)
+ .arg(toString(p.pixelFormat))
+ .arg(toString(p.colorSpace))
+ .arg(toString(p.colorRange))
+ .arg(p.forceCpu ? "_cpu" : "")
+ .toLower();
+ name.replace(" ", "_");
+ return name;
+}
+
+QString path(const QTemporaryDir &dir, const TestParams &param, const QString &suffix = ".png")
+{
+ return dir.filePath(name(param) + suffix);
+}
+
+QVideoFrame createTestFrame(const TestParams &params, const QImage &image)
+{
+ QVideoFrameFormat format(image.size(), params.pixelFormat);
+ format.setColorRange(params.colorRange);
+ format.setColorSpace(params.colorSpace);
+ format.setColorTransfer(QVideoFrameFormat::ColorTransfer_Unknown);
+
+ auto buffer = std::make_unique<QImageVideoBuffer>(image);
+ QVideoFrameFormat imageFormat = {
+ image.size(), QVideoFrameFormat::pixelFormatFromImageFormat(image.format())
+ };
+
+ QVideoFrame source = QVideoFramePrivate::createFrame(std::move(buffer), imageFormat);
+ return QPlatformMediaIntegration::instance()->convertVideoFrame(source, format);
+}
+
+struct ImageDiffReport
+{
+ int DiffCountAboveThreshold; // Number of channel differences above threshold
+ int MaxDiff; // Maximum difference between two images (max across channels)
+ int PixelCount; // Number of pixels in the image
+ QImage DiffImage; // The difference image (absolute per-channel difference)
+};
+
+double aboveThresholdDiffRatio(const ImageDiffReport &report)
+{
+ return static_cast<double>(report.DiffCountAboveThreshold) / report.PixelCount;
+}
+
+int maxChannelDiff(QRgb lhs, QRgb rhs)
+{
+ // clang-format off
+ return std::max({ std::abs(qRed(lhs) - qRed(rhs)),
+ std::abs(qGreen(lhs) - qGreen(rhs)),
+ std::abs(qBlue(lhs) - qBlue(rhs)) });
+ // clang-format on
+}
+
+int clampedAbsDiff(int lhs, int rhs)
+{
+ return std::clamp(std::abs(lhs - rhs), 0, 255);
+}
+
+QRgb pixelDiff(QRgb lhs, QRgb rhs)
+{
+ return qRgb(clampedAbsDiff(qRed(lhs), qRed(rhs)), clampedAbsDiff(qGreen(lhs), qGreen(rhs)),
+ clampedAbsDiff(qBlue(lhs), qBlue(rhs)));
+}
+
+std::optional<ImageDiffReport> compareImagesRgb32(const QImage &computed, const QImage &baseline,
+ int channelThreshold)
+{
+ Q_ASSERT(baseline.format() == QImage::Format_RGB32);
+
+ if (computed.size() != baseline.size())
+ return {};
+
+ if (computed.format() != baseline.format())
+ return {};
+
+ if (computed.colorSpace() != baseline.colorSpace())
+ return {};
+
+ const QSize size = baseline.size();
+
+ ImageDiffReport report{};
+ report.PixelCount = size.width() * size.height();
+ report.DiffImage = QImage(size, baseline.format());
+
+ // Iterate over all pixels and update report
+ for (int l = 0; l < size.height(); l++) {
+ const QRgb *colorComputed = reinterpret_cast<const QRgb *>(computed.constScanLine(l));
+ const QRgb *colorBaseline = reinterpret_cast<const QRgb *>(baseline.constScanLine(l));
+ QRgb *colorDiff = reinterpret_cast<QRgb *>(report.DiffImage.scanLine(l));
+
+ int w = size.width();
+ while (w--) {
+ *colorDiff = pixelDiff(*colorComputed, *colorBaseline);
+ if (*colorComputed != *colorBaseline) {
+ const int diff = maxChannelDiff(*colorComputed, *colorBaseline);
+
+ if (diff > report.MaxDiff)
+ report.MaxDiff = diff;
+
+ if (diff > channelThreshold)
+ ++report.DiffCountAboveThreshold;
+ }
+
+ ++colorComputed;
+ ++colorBaseline;
+ ++colorDiff;
+ }
+ }
+ return report;
+}
+
+bool copyAllFiles(const QDir &source, const QDir &dest)
+{
+ if (!source.exists() || !dest.exists())
+ return false;
+
+ QDirIterator it(source);
+ while (it.hasNext()) {
+ QFileInfo file{ it.next() };
+ if (file.isFile()) {
+ const QString destination = dest.absolutePath() + "/" + file.fileName();
+ QFile::copy(file.absoluteFilePath(), destination);
+ }
+ }
+
+ return true;
+}
+
+class ReferenceData
+{
+public:
+ ReferenceData()
+ {
+ m_testdataDir = QTest::qExtractTestData("testdata");
+ if (!m_testdataDir)
+ m_testdataDir = QSharedPointer<QTemporaryDir>(new QTemporaryDir);
+ }
+
+ ~ReferenceData()
+ {
+ if (m_testdataDir->autoRemove())
+ return;
+
+ QString resultPath = m_testdataDir->path();
+ if (qEnvironmentVariableIsSet("COIN_CTEST_RESULTSDIR")) {
+ const QDir sourceDir = m_testdataDir->path();
+ const QDir resultsDir{ qEnvironmentVariable("COIN_CTEST_RESULTSDIR") };
+ if (!copyAllFiles(sourceDir, resultsDir)) {
+ qDebug() << "Failed to copy files to COIN_CTEST_RESULTSDIR";
+ } else {
+ resultPath = resultsDir.path();
+ }
+ }
+
+ qDebug() << "Images with differences were found. The output images with differences"
+ << "can be found in" << resultPath << ". Review the images and if the"
+ << "differences are expected, please update the testdata with the new"
+ << "output images";
+ }
+
+ QImage getReference(const TestParams &param) const
+ {
+ const QString referenceName = name(param);
+ const QString referencePath = m_testdataDir->filePath(referenceName + ".png");
+ QImage result;
+ if (result.load(referencePath))
+ return result;
+ return {};
+ }
+
+ void saveNewReference(const QImage &reference, const TestParams &params) const
+ {
+ const QString filename = path(*m_testdataDir, params);
+ if (!reference.save(filename)) {
+ qDebug() << "Failed to save reference file";
+ Q_ASSERT(false);
+ }
+
+ m_testdataDir->setAutoRemove(false);
+ }
+
+ bool saveComputedImage(const TestParams &params, const QImage &image, const QString& suffix) const
+ {
+ if (!image.save(path(*m_testdataDir, params, suffix))) {
+ qDebug() << "Unexpectedly failed to save actual image to file";
+ Q_ASSERT(false);
+ return false;
+ }
+ m_testdataDir->setAutoRemove(false);
+ return true;
+ }
+
+ QImage getTestdata(const QString &name)
+ {
+ const QString filePath = m_testdataDir->filePath(name);
+ QImage image;
+ if (image.load(filePath))
+ return image;
+ return {};
+ }
+
+private:
+ QSharedPointer<QTemporaryDir> m_testdataDir;
+};
+
+std::optional<ImageDiffReport> compareToReference(const TestParams &params, const QImage &actual,
+ const ReferenceData &references,
+ int maxChannelThreshold)
+{
+ const QImage expected = references.getReference(params);
+ if (expected.isNull()) {
+ // Reference image does not exist. Create one. Adding this to
+ // testdata directory is a manual job.
+ references.saveNewReference(actual, params);
+ qDebug() << "Reference image is missing. Please update testdata directory with the missing "
+ "reference image";
+ return {};
+ }
+
+ // Convert to RGB32 to simplify image comparison
+ const QImage computed = actual.convertToFormat(QImage::Format_RGB32);
+ const QImage baseline = expected.convertToFormat(QImage::Format_RGB32);
+
+ std::optional<ImageDiffReport> diffReport = compareImagesRgb32(computed, baseline, maxChannelThreshold);
+ if (!diffReport)
+ return {};
+
+ if (diffReport->MaxDiff > 0) {
+ // Images are not equal, and may require manual inspection
+ if (!references.saveComputedImage(params, computed, "_actual.png"))
+ return {};
+ if (!references.saveComputedImage(params, diffReport->DiffImage, "_diff.png"))
+ return {};
+ }
+
+ return diffReport;
+}
+
+} // namespace
+
+class tst_qvideoframecolormanagement : public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase()
+ {
+ if (!isFFMPEGPlatform())
+ QSKIP("This test requires the ffmpeg backend to create test frames");
+ }
+
+ void qImageFromVideoFrame_returnsQImageWithCorrectColors_data()
+ {
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<TestParams>("params");
+ for (const char *file : { "umbrellas.jpg" }) {
+ for (const QVideoFrameFormat::PixelFormat pixelFormat : pixelFormats()) {
+ for (const QVideoFrameFormat::ColorSpace colorSpace : colorSpaces()) {
+ for (const QVideoFrameFormat::ColorRange colorRange : colorRanges()) {
+ for (const bool forceCpu : { false, true }) {
+
+ if (!isSupportedPixelFormat(pixelFormat))
+ continue;
+
+ if (forceCpu && !supportsCpuConversion(pixelFormat))
+ continue; // TODO: CPU Conversion not implemented
+
+ if (!hasCorrespondingFFmpegFormat(pixelFormat))
+ continue;
+
+ TestParams param{
+ file, pixelFormat, colorSpace, colorRange, forceCpu,
+ };
+ QTest::addRow("%s", name(param).toLatin1().data()) << file << param;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // This test is a regression test for the QMultimedia display pipeline.
+ // It compares rendered output (as created by qImageFromVideoFrame)
+ // against reference images stored to file. The reference images were
+ // created by the test itself, and does not verify correctness, just
+ // changes to render output.
+ void qImageFromVideoFrame_returnsQImageWithCorrectColors()
+ {
+ QFETCH(const QString, fileName);
+ QFETCH(const TestParams, params);
+
+ const QImage templateImage = m_reference.getTestdata(fileName);
+ QVERIFY(!templateImage.isNull());
+
+ const QVideoFrame frame = createTestFrame(params, templateImage);
+
+ // Act
+ const QImage actual =
+ qImageFromVideoFrame(frame, QtVideo::Rotation::None, false, false, params.forceCpu);
+
+ // Assert
+ constexpr int diffThreshold = 4;
+ std::optional<ImageDiffReport> result =
+ compareToReference(params, actual, m_reference, diffThreshold);
+
+ // Sanity checks
+ QVERIFY(result.has_value());
+ QCOMPARE_GT(result->PixelCount, 0);
+
+ // Verify that images are similar
+ const double ratioAboveThreshold =
+ static_cast<double>(result->DiffCountAboveThreshold) / result->PixelCount;
+
+ // These thresholds are empirically determined to allow tests to pass in CI.
+ // If tests fail, review the difference between the reference and actual
+ // output to determine if it is a platform dependent inaccuracy before
+ // adjusting the limits
+ QCOMPARE_LT(ratioAboveThreshold, 0.01); // Fraction of pixels with larger differences
+ QCOMPARE_LT(result->MaxDiff, 6); // Maximum per-channel difference
+ }
+
+
+private:
+ ReferenceData m_reference;
+};
+
+QTEST_MAIN(tst_qvideoframecolormanagement)
+
+#include "tst_qvideoframecolormanagement.moc"
diff --git a/tests/auto/unit/multimedia/qvideoframeformat/CMakeLists.txt b/tests/auto/unit/multimedia/qvideoframeformat/CMakeLists.txt
new file mode 100644
index 000000000..0d1b92d55
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframeformat/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qvideoframeformat.pro.
+
+#####################################################################
+## tst_qvideoframeformat Test:
+#####################################################################
+
+qt_internal_add_test(tst_qvideoframeformat
+ SOURCES
+ tst_qvideoframeformat.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp b/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp
new file mode 100644
index 000000000..41d54de0d
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideoframeformat/tst_qvideoframeformat.cpp
@@ -0,0 +1,567 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+
+#include <qvideoframeformat.h>
+
+// Adds an enum, and the stringized version
+#define ADD_ENUM_TEST(x) \
+ QTest::newRow(#x) \
+ << QVideoFrameFormat::x \
+ << QString(QLatin1String(#x));
+
+class tst_QVideoFrameFormat : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QVideoFrameFormat();
+ ~tst_QVideoFrameFormat() override;
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void constructNull();
+ void construct_data();
+ void construct();
+ void frameSize_data();
+ void frameSize();
+ void planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat_data() const;
+ void planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat() const;
+ void viewport_data();
+ void viewport();
+ void scanLineDirection_data();
+ void scanLineDirection();
+ void frameRate_data();
+ void frameRate();
+ void colorSpaceEnum_data();
+ void colorSpaceEnum ();
+ void compare();
+ void copy();
+ void assign();
+
+ void isValid();
+ void copyAllParameters ();
+ void assignAllParameters ();
+};
+
+tst_QVideoFrameFormat::tst_QVideoFrameFormat()
+{
+}
+
+tst_QVideoFrameFormat::~tst_QVideoFrameFormat()
+{
+}
+
+void tst_QVideoFrameFormat::initTestCase()
+{
+}
+
+void tst_QVideoFrameFormat::cleanupTestCase()
+{
+}
+
+void tst_QVideoFrameFormat::init()
+{
+}
+
+void tst_QVideoFrameFormat::cleanup()
+{
+}
+
+void tst_QVideoFrameFormat::constructNull()
+{
+ QVideoFrameFormat format;
+
+ QVERIFY(!format.isValid());
+ QCOMPARE(format.pixelFormat(), QVideoFrameFormat::Format_Invalid);
+ QCOMPARE(format.frameSize(), QSize());
+ QCOMPARE(format.frameWidth(), -1);
+ QCOMPARE(format.frameHeight(), -1);
+ QCOMPARE(format.viewport(), QRect());
+ QCOMPARE(format.scanLineDirection(), QVideoFrameFormat::TopToBottom);
+ QCOMPARE(format.streamFrameRate(), 0.0);
+ QCOMPARE(format.colorSpace(), QVideoFrameFormat::ColorSpace_Undefined);
+}
+
+void tst_QVideoFrameFormat::construct_data()
+{
+ QTest::addColumn<QSize>("frameSize");
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<bool>("valid");
+
+ QTest::newRow("32x32 rgb32 no handle")
+ << QSize(32, 32)
+ << QVideoFrameFormat::Format_XRGB8888
+ << true;
+
+ QTest::newRow("32x32 invalid no handle")
+ << QSize(32, 32)
+ << QVideoFrameFormat::Format_Invalid
+ << false;
+
+ QTest::newRow("invalid size, rgb32 no handle")
+ << QSize()
+ << QVideoFrameFormat::Format_XRGB8888
+ << false;
+
+ QTest::newRow("0x0 rgb32 no handle")
+ << QSize(0,0)
+ << QVideoFrameFormat::Format_XRGB8888
+ << true;
+}
+
+void tst_QVideoFrameFormat::construct()
+{
+ QFETCH(QSize, frameSize);
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(bool, valid);
+
+ QRect viewport(QPoint(0, 0), frameSize);
+
+ QVideoFrameFormat format(frameSize, pixelFormat);
+
+ QCOMPARE(format.pixelFormat(), pixelFormat);
+ QCOMPARE(format.frameSize(), frameSize);
+ QCOMPARE(format.frameWidth(), frameSize.width());
+ QCOMPARE(format.frameHeight(), frameSize.height());
+ QCOMPARE(format.isValid(), valid);
+ QCOMPARE(format.viewport(), viewport);
+ QCOMPARE(format.scanLineDirection(), QVideoFrameFormat::TopToBottom);
+ QCOMPARE(format.streamFrameRate(), 0.0);
+ QCOMPARE(format.colorSpace(), QVideoFrameFormat::ColorSpace_Undefined);
+}
+
+void tst_QVideoFrameFormat::frameSize_data()
+{
+ QTest::addColumn<QSize>("initialSize");
+ QTest::addColumn<QSize>("newSize");
+
+ QTest::newRow("grow")
+ << QSize(64, 64)
+ << QSize(1024, 1024);
+ QTest::newRow("shrink")
+ << QSize(1024, 1024)
+ << QSize(64, 64);
+ QTest::newRow("unchanged")
+ << QSize(512, 512)
+ << QSize(512, 512);
+}
+
+void tst_QVideoFrameFormat::frameSize()
+{
+ QFETCH(QSize, initialSize);
+ QFETCH(QSize, newSize);
+
+ QVideoFrameFormat format(initialSize, QVideoFrameFormat::Format_XRGB8888);
+
+ format.setFrameSize(newSize);
+
+ QCOMPARE(format.frameSize(), newSize);
+ QCOMPARE(format.frameWidth(), newSize.width());
+ QCOMPARE(format.frameHeight(), newSize.height());
+}
+
+void tst_QVideoFrameFormat::planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat_data() const {
+ QTest::addColumn<QVideoFrameFormat::PixelFormat>("pixelFormat");
+ QTest::addColumn<int>("colorPlanes"); // Number of planes as specified by QVideoFrameFormat::PixelFormat documentation
+
+ QTest::newRow("ARGB8888") << QVideoFrameFormat::Format_ARGB8888 << 1;
+ QTest::newRow("ARGB8888_Premultiplied") << QVideoFrameFormat::Format_ARGB8888_Premultiplied << 1;
+ QTest::newRow("XRGB8888") << QVideoFrameFormat::Format_XRGB8888 << 1;
+ QTest::newRow("BGRA8888") << QVideoFrameFormat::Format_BGRA8888 << 1;
+ QTest::newRow("BGRA8888_Premultiplied") << QVideoFrameFormat::Format_BGRA8888_Premultiplied << 1;
+ QTest::newRow("BGRX8888") << QVideoFrameFormat::Format_BGRX8888 << 1;
+ QTest::newRow("ABGR8888") << QVideoFrameFormat::Format_ABGR8888 << 1;
+ QTest::newRow("XBGR8888") << QVideoFrameFormat::Format_XBGR8888 << 1;
+ QTest::newRow("RGBA8888") << QVideoFrameFormat::Format_RGBA8888 << 1;
+ QTest::newRow("RGBX8888") << QVideoFrameFormat::Format_RGBX8888 << 1;
+
+ QTest::newRow("AUYVY") << QVideoFrameFormat::Format_AYUV << 1;
+ QTest::newRow("AYUV_Premultiplied") << QVideoFrameFormat::Format_AYUV_Premultiplied << 1;
+ QTest::newRow("YUV420P") << QVideoFrameFormat::Format_YUV420P << 3;
+ QTest::newRow("YUV422P") << QVideoFrameFormat::Format_YUV422P << 3;
+ QTest::newRow("YV12") << QVideoFrameFormat::Format_YV12 << 3;
+
+ QTest::newRow("UYVY") << QVideoFrameFormat::Format_UYVY << 1;
+ QTest::newRow("YUYV") << QVideoFrameFormat::Format_YUYV << 1;
+ QTest::newRow("NV12") << QVideoFrameFormat::Format_NV12 << 2;
+ QTest::newRow("NV21") << QVideoFrameFormat::Format_NV21 << 2;
+
+ QTest::newRow("IMC1") << QVideoFrameFormat::Format_IMC1 << 3;
+ QTest::newRow("IMC2") << QVideoFrameFormat::Format_IMC2 << 2;
+ QTest::newRow("IMC3") << QVideoFrameFormat::Format_IMC3 << 3;
+ QTest::newRow("IMC4") << QVideoFrameFormat::Format_IMC4 << 2;
+
+ QTest::newRow("Y8") << QVideoFrameFormat::Format_Y8 << 1;
+ QTest::newRow("Y16") << QVideoFrameFormat::Format_Y16 << 1;
+
+ QTest::newRow("P010") << QVideoFrameFormat::Format_P010 << 2;
+ QTest::newRow("P016") << QVideoFrameFormat::Format_P016 << 2;
+
+ QTest::newRow("SamplerExternalOES") << QVideoFrameFormat::Format_SamplerExternalOES << 1;
+ QTest::newRow("Jpeg") << QVideoFrameFormat::Format_Jpeg << 1;
+ QTest::newRow("SamplerRect") << QVideoFrameFormat::Format_SamplerRect << 1;
+
+ QTest::newRow("YUV420P10") << QVideoFrameFormat::Format_YUV420P10 << 3;
+}
+
+void tst_QVideoFrameFormat::planeCount_returnsNumberOfColorPlanesDictatedByPixelFormat() const {
+ QFETCH(QVideoFrameFormat::PixelFormat, pixelFormat);
+ QFETCH(int, colorPlanes);
+
+ const QVideoFrameFormat frameFormat = QVideoFrameFormat({}, pixelFormat);
+
+ QCOMPARE_EQ(frameFormat.planeCount(), colorPlanes);
+}
+
+void tst_QVideoFrameFormat::viewport_data()
+{
+ QTest::addColumn<QSize>("initialSize");
+ QTest::addColumn<QRect>("viewport");
+ QTest::addColumn<QSize>("newSize");
+ QTest::addColumn<QRect>("expectedViewport");
+
+ QTest::newRow("grow reset")
+ << QSize(64, 64)
+ << QRect(8, 8, 48, 48)
+ << QSize(1024, 1024)
+ << QRect(0, 0, 1024, 1024);
+ QTest::newRow("shrink reset")
+ << QSize(1024, 1024)
+ << QRect(8, 8, 1008, 1008)
+ << QSize(64, 64)
+ << QRect(0, 0, 64, 64);
+ QTest::newRow("unchanged reset")
+ << QSize(512, 512)
+ << QRect(8, 8, 496, 496)
+ << QSize(512, 512)
+ << QRect(0, 0, 512, 512);
+}
+
+void tst_QVideoFrameFormat::viewport()
+{
+ QFETCH(QSize, initialSize);
+ QFETCH(QRect, viewport);
+ QFETCH(QSize, newSize);
+ QFETCH(QRect, expectedViewport);
+
+ QRect initialViewport(QPoint(0, 0), initialSize);
+
+ QVideoFrameFormat format(initialSize, QVideoFrameFormat::Format_XRGB8888);
+
+ format.setViewport(viewport);
+
+ QCOMPARE(format.viewport(), viewport);
+
+ format.setFrameSize(newSize);
+
+ QCOMPARE(format.viewport(), expectedViewport);
+}
+
+void tst_QVideoFrameFormat::scanLineDirection_data()
+{
+ QTest::addColumn<QVideoFrameFormat::Direction>("direction");
+ QTest::addColumn<QString>("stringized");
+
+ ADD_ENUM_TEST(TopToBottom);
+ ADD_ENUM_TEST(BottomToTop);
+}
+
+void tst_QVideoFrameFormat::scanLineDirection()
+{
+ QFETCH(QVideoFrameFormat::Direction, direction);
+ QFETCH(QString, stringized);
+
+ QVideoFrameFormat format(QSize(16, 16), QVideoFrameFormat::Format_XRGB8888);
+
+ format.setScanLineDirection(direction);
+
+ QCOMPARE(format.scanLineDirection(), direction);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << direction;
+}
+
+void tst_QVideoFrameFormat::colorSpaceEnum_data()
+{
+ QTest::addColumn<QVideoFrameFormat::ColorSpace>("colorspace");
+ QTest::addColumn<QString>("stringized");
+
+ ADD_ENUM_TEST(ColorSpace_BT601);
+ ADD_ENUM_TEST(ColorSpace_BT709);
+ ADD_ENUM_TEST(ColorSpace_BT2020);
+ ADD_ENUM_TEST(ColorSpace_AdobeRgb);
+ ADD_ENUM_TEST(ColorSpace_Undefined);
+}
+
+/* Test case for Enum ColorSpace */
+void tst_QVideoFrameFormat::colorSpaceEnum()
+{
+ QFETCH(QVideoFrameFormat::ColorSpace, colorspace);
+ QFETCH(QString, stringized);
+
+ QVideoFrameFormat format(QSize(64, 64), QVideoFrameFormat::Format_XRGB8888);
+ format.setColorSpace(colorspace);
+
+ QCOMPARE(format.colorSpace(), colorspace);
+
+ QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData());
+ qDebug() << colorspace;
+}
+
+
+void tst_QVideoFrameFormat::frameRate_data()
+{
+ QTest::addColumn<qreal>("frameRate");
+
+ QTest::newRow("null")
+ << qreal(0.0);
+ QTest::newRow("1/1")
+ << qreal(1.0);
+ QTest::newRow("24/1")
+ << qreal(24.0);
+ QTest::newRow("15/2")
+ << qreal(7.5);
+}
+
+void tst_QVideoFrameFormat::frameRate()
+{
+ QFETCH(qreal, frameRate);
+
+ QVideoFrameFormat format(QSize(64, 64), QVideoFrameFormat::Format_XRGB8888);
+
+ format.setStreamFrameRate(frameRate);
+
+ QCOMPARE(format.streamFrameRate(), frameRate);
+}
+
+void tst_QVideoFrameFormat::compare()
+{
+ QVideoFrameFormat format1(
+ QSize(16, 16), QVideoFrameFormat::Format_XRGB8888);
+ QVideoFrameFormat format2(
+ QSize(16, 16), QVideoFrameFormat::Format_XRGB8888);
+ QVideoFrameFormat format3(
+ QSize(32, 32), QVideoFrameFormat::Format_AYUV);
+ QVideoFrameFormat format4(
+ QSize(16, 16), QVideoFrameFormat::Format_XBGR8888);
+
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+ QCOMPARE(format1 == format3, false);
+ QCOMPARE(format1 != format3, true);
+ QCOMPARE(format1 == format4, false);
+ QCOMPARE(format1 != format4, true);
+
+ format2.setFrameSize(1024, 768);
+
+ // Not equal, frame size differs.
+ QCOMPARE(format1 == format2, false);
+ QCOMPARE(format1 != format2, true);
+
+ format1.setFrameSize(1024, 768);
+
+ // Equal.
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+
+ format1.setViewport(QRect(0, 0, 800, 600));
+ format2.setViewport(QRect(112, 84, 800, 600));
+
+ // Not equal, viewports differ.
+ QCOMPARE(format1 == format2, false);
+ QCOMPARE(format1 != format2, true);
+
+ format1.setViewport(QRect(112, 84, 800, 600));
+
+ // Equal.
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+
+ format2.setScanLineDirection(QVideoFrameFormat::BottomToTop);
+
+ // Not equal scan line direction differs.
+ QCOMPARE(format1 == format2, false);
+ QCOMPARE(format1 != format2, true);
+
+ format1.setScanLineDirection(QVideoFrameFormat::BottomToTop);
+
+ // Equal.
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+
+ format1.setStreamFrameRate(7.5);
+
+ // Not equal frame rate differs.
+ QCOMPARE(format1 == format2, false);
+ QCOMPARE(format1 != format2, true);
+
+ format2.setStreamFrameRate(qreal(7.50001));
+
+ // Equal.
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+
+ format2.setColorSpace(QVideoFrameFormat::ColorSpace_BT601);
+
+ // Not equal yuv color space differs.
+ QCOMPARE(format1 == format2, false);
+ QCOMPARE(format1 != format2, true);
+
+ format1.setColorSpace(QVideoFrameFormat::ColorSpace_BT601);
+
+ // Equal.
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+}
+
+
+void tst_QVideoFrameFormat::copy()
+{
+ QVideoFrameFormat original(
+ QSize(1024, 768), QVideoFrameFormat::Format_ARGB8888);
+ original.setScanLineDirection(QVideoFrameFormat::BottomToTop);
+
+ QVideoFrameFormat copy(original);
+
+ QCOMPARE(copy.pixelFormat(), QVideoFrameFormat::Format_ARGB8888);
+ QCOMPARE(copy.frameSize(), QSize(1024, 768));
+ QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::BottomToTop);
+
+ QCOMPARE(original == copy, true);
+ QCOMPARE(original != copy, false);
+
+ copy.setScanLineDirection(QVideoFrameFormat::TopToBottom);
+
+ QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::TopToBottom);
+
+ QCOMPARE(original.scanLineDirection(), QVideoFrameFormat::BottomToTop);
+
+ QCOMPARE(original == copy, false);
+ QCOMPARE(original != copy, true);
+}
+
+void tst_QVideoFrameFormat::assign()
+{
+ QVideoFrameFormat copy(
+ QSize(64, 64), QVideoFrameFormat::Format_AYUV);
+
+ QVideoFrameFormat original(
+ QSize(1024, 768), QVideoFrameFormat::Format_ARGB8888);
+ original.setScanLineDirection(QVideoFrameFormat::BottomToTop);
+
+ copy = original;
+
+ QCOMPARE(copy.pixelFormat(), QVideoFrameFormat::Format_ARGB8888);
+ QCOMPARE(copy.frameSize(), QSize(1024, 768));
+ QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::BottomToTop);
+
+ QCOMPARE(original == copy, true);
+ QCOMPARE(original != copy, false);
+
+ copy.setScanLineDirection(QVideoFrameFormat::TopToBottom);
+
+ QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::TopToBottom);
+
+ QCOMPARE(original.scanLineDirection(), QVideoFrameFormat::BottomToTop);
+
+ QCOMPARE(original == copy, false);
+ QCOMPARE(original != copy, true);
+}
+
+/* Test case for api isValid */
+void tst_QVideoFrameFormat::isValid()
+{
+ /* When both pixel format and framesize is not valid */
+ QVideoFrameFormat format;
+ QVERIFY(!format.isValid());
+
+ /* When framesize is valid and pixel format is not valid */
+ format.setFrameSize(64,64);
+ QVERIFY(format.frameSize() == QSize(64,64));
+ QVERIFY(!format.pixelFormat());
+ QVERIFY(!format.isValid());
+
+ /* When both the pixel format and framesize is valid. */
+ QVideoFrameFormat format1(QSize(32, 32), QVideoFrameFormat::Format_AYUV);
+ QVERIFY(format1.isValid());
+
+ /* When pixel format is valid and frame size is not valid */
+ format1.setFrameSize(-1,-1);
+ QVERIFY(!format1.frameSize().isValid());
+ QVERIFY(!format1.isValid());
+}
+
+/* Test case for copy constructor with all the parameters. */
+void tst_QVideoFrameFormat::copyAllParameters()
+{
+ /* Create the instance and set all the parameters. */
+ QVideoFrameFormat original(
+ QSize(1024, 768), QVideoFrameFormat::Format_ARGB8888);
+
+ original.setScanLineDirection(QVideoFrameFormat::BottomToTop);
+ original.setViewport(QRect(0, 0, 1024, 1024));
+ original.setStreamFrameRate(qreal(15.0));
+ original.setColorSpace(QVideoFrameFormat::ColorSpace_BT709);
+
+ /* Copy the original instance to copy and verify if both the instances
+ have the same parameters. */
+ QVideoFrameFormat copy(original);
+
+ QCOMPARE(copy.pixelFormat(), QVideoFrameFormat::Format_ARGB8888);
+ QCOMPARE(copy.frameSize(), QSize(1024, 768));
+ QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::BottomToTop);
+ QCOMPARE(copy.viewport(), QRect(0, 0, 1024, 1024));
+ QCOMPARE(copy.streamFrameRate(), qreal(15.0));
+ QCOMPARE(copy.colorSpace(), QVideoFrameFormat::ColorSpace_BT709);
+
+ /* Verify if both the instances are eqaul */
+ QCOMPARE(original == copy, true);
+ QCOMPARE(original != copy, false);
+}
+
+/* Test case for copy constructor with all the parameters. */
+void tst_QVideoFrameFormat::assignAllParameters()
+{
+ /* Create the instance and set all the parameters. */
+ QVideoFrameFormat copy(
+ QSize(64, 64), QVideoFrameFormat::Format_AYUV);
+ copy.setScanLineDirection(QVideoFrameFormat::TopToBottom);
+ copy.setViewport(QRect(0, 0, 640, 320));
+ copy.setStreamFrameRate(qreal(7.5));
+ copy.setColorSpace(QVideoFrameFormat::ColorSpace_BT601);
+
+ /* Create the instance and set all the parameters. */
+ QVideoFrameFormat original(
+ QSize(1024, 768), QVideoFrameFormat::Format_ARGB8888);
+ original.setScanLineDirection(QVideoFrameFormat::BottomToTop);
+ original.setViewport(QRect(0, 0, 1024, 1024));
+ original.setStreamFrameRate(qreal(15.0));
+ original.setColorSpace(QVideoFrameFormat::ColorSpace_BT709);
+
+ /* Assign the original instance to copy and verify if both the instancess
+ have the same parameters. */
+ copy = original;
+
+ QCOMPARE(copy.pixelFormat(), QVideoFrameFormat::Format_ARGB8888);
+ QCOMPARE(copy.frameSize(), QSize(1024, 768));
+ QCOMPARE(copy.scanLineDirection(), QVideoFrameFormat::BottomToTop);
+ QCOMPARE(copy.viewport(), QRect(0, 0, 1024, 1024));
+ QCOMPARE(copy.streamFrameRate(), qreal(15.0));
+ QCOMPARE(copy.colorSpace(), QVideoFrameFormat::ColorSpace_BT709);
+
+ /* Verify if both the instances are eqaul */
+ QCOMPARE(original == copy, true);
+ QCOMPARE(original != copy, false);
+}
+
+QTEST_MAIN(tst_QVideoFrameFormat)
+
+
+
+#include "tst_qvideoframeformat.moc"
diff --git a/tests/auto/unit/multimedia/qvideotexturehelper/CMakeLists.txt b/tests/auto/unit/multimedia/qvideotexturehelper/CMakeLists.txt
new file mode 100644
index 000000000..a47b46d5b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideotexturehelper/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_test(tst_qvideotexturehelper
+ SOURCES
+ tst_qvideotexturehelper.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+)
diff --git a/tests/auto/unit/multimedia/qvideotexturehelper/tst_qvideotexturehelper.cpp b/tests/auto/unit/multimedia/qvideotexturehelper/tst_qvideotexturehelper.cpp
new file mode 100644
index 000000000..aa166af54
--- /dev/null
+++ b/tests/auto/unit/multimedia/qvideotexturehelper/tst_qvideotexturehelper.cpp
@@ -0,0 +1,260 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/qbytearray.h>
+#include <QtTest/qtest.h>
+
+#include <private/qvideotexturehelper_p.h>
+#include <qvideoframe.h>
+
+#include "qvideoframeformat.h"
+
+QT_USE_NAMESPACE
+
+struct ColorSpaceCoeff
+{
+ float a;
+ float b;
+ float c;
+};
+
+// Coefficients used in ITU-R BT.709-6 Table 3 - Signal format
+constexpr ColorSpaceCoeff BT709Coefficients = {
+ 0.2126f, 0.7152f, 0.0722f // E_g' = 0.2126 * E_R' + 0.7152 * E_G' + 0.0722 * E_B'
+ //
+ // Note that the other coefficients can be derived from a and c
+ // to re-normalize the values, see ITU-R BT.601-7, section 2.5.2
+ //
+ // E_CB' = (E_B' - E_g') / 1.8556 -> 1.8556 == (1-0.0722) * 2
+ // E_CR' = (E_R' - E_g') / 1.5748 -> 1.5748 == (1-0.2126) * 2
+};
+
+// Coefficients used in ITU-R BT.2020-2 Table 4 - Signal format
+constexpr ColorSpaceCoeff BT2020Coefficients = {
+ 0.2627f, 0.6780f, 0.0593f // Y_c' = (0.2627 R + 0.6780 G + 0.05938 B)'
+ // C_B' = (B' - Y') / 1.8814 -> 1.8814 == 2*(1-0.0593)
+ // C_R' = (R' - Y') / 1.4746 -> 1.4746 == 2*(1-0.2627)
+};
+
+struct ColorSpaceEntry
+{
+ QVideoFrameFormat::ColorSpace colorSpace;
+ QVideoFrameFormat::ColorRange colorRange;
+ ColorSpaceCoeff coefficients;
+};
+
+// clang-format off
+const std::vector<ColorSpaceEntry> colorSpaces = {
+ {
+ QVideoFrameFormat::ColorSpace_BT709,
+ QVideoFrameFormat::ColorRange_Video,
+ BT709Coefficients
+ },
+ {
+ QVideoFrameFormat::ColorSpace_BT709,
+ QVideoFrameFormat::ColorRange_Full,
+ BT709Coefficients
+ },
+ {
+ QVideoFrameFormat::ColorSpace_BT2020,
+ QVideoFrameFormat::ColorRange_Video,
+ BT2020Coefficients
+ },
+ {
+ QVideoFrameFormat::ColorSpace_BT2020,
+ QVideoFrameFormat::ColorRange_Full,
+ BT2020Coefficients
+ }
+};
+
+ColorSpaceCoeff getColorSpaceCoef(QVideoFrameFormat::ColorSpace colorSpace,
+ QVideoFrameFormat::ColorRange range)
+{
+ const auto it = std::find_if(colorSpaces.begin(), colorSpaces.end(),
+ [&](const ColorSpaceEntry &p) {
+ return p.colorSpace == colorSpace && p.colorRange == range;
+ });
+
+ if (it != colorSpaces.end())
+ return it->coefficients;
+
+ Q_ASSERT(false);
+
+ return {};
+}
+
+QMatrix4x4 yuv2rgb(QVideoFrameFormat::ColorSpace colorSpace, QVideoFrameFormat::ColorRange range)
+{
+ constexpr float max8bit = static_cast<float>(255);
+ constexpr float uvOffset = -128.0f/max8bit; // Really -0.5, but carried over from fixed point
+
+ QMatrix4x4 normalizeYUV;
+
+ if (range == QVideoFrameFormat::ColorRange_Video) {
+ // YUV signal is assumed to be in limited range 8 bit representation,
+ // where Y is in range [16..235] and U and V are in range [16..240].
+ // Shaders use floats in [0..1], so we scale the values accordingly.
+ constexpr float yRange = (235 - 16) / max8bit;
+ constexpr float yOffset = -16 / max8bit;
+ constexpr float uvRange = (240 - 16) / max8bit;
+
+ // Second, stretch limited range YUV signals to full range
+ normalizeYUV.scale(1/yRange, 1/uvRange, 1/uvRange);
+
+ // First, pull limited range signals down so that they start on 0
+ normalizeYUV.translate(yOffset, uvOffset, uvOffset);
+ } else {
+ normalizeYUV.translate(0.0f, uvOffset, uvOffset);
+ }
+
+ const auto [a, b, c] = getColorSpaceCoef(colorSpace, range);
+
+ // Re-normalization coefficients that restores the color difference
+ // signals to (-0.5..0.5)
+ const auto d = 2 * (1.0f - c);
+ const auto e = 2 * (1.0f - a);
+
+ // Color matrix from ITU-R BT.709-6 Table 3 - Signal Format
+ // Same as ITU-R BT.2020-2 Table 4 - Signal format
+ const QMatrix4x4 rgb2yuv {
+ a, b, c, 0.0f, // Item 3.2: E_g' = a * E_R' + b * E_G' + c * E_B'
+ -a/d, -b/d, (1-c)/d, 0.0f, // Item 3.3: E_CB' = (E_B' - E_g')/d
+ (1-a)/e, -b/e, -c/e, 0.0f, // Item 3.3: E_CR' = (E_R' - E_g')/e
+ 0.0f, 0.0f, 0.0f, 1.0f
+ };
+
+ const QMatrix4x4 yuv2rgb = rgb2yuv.inverted();
+
+ // Read backwards:
+ // 1. Offset and scale YUV signal to be in range [0..1]
+ // 3. Convert to RGB in range [0..1]
+ return yuv2rgb * normalizeYUV;
+}
+
+// clang-format on
+
+bool fuzzyCompareWithTolerance(const QMatrix4x4 &computed, const QMatrix4x4 &baseline,
+ float tolerance)
+{
+ const float *computedData = computed.data();
+ const float *baselineData = baseline.data();
+ for (int i = 0; i < 16; ++i) {
+ const float c = computedData[i];
+ const float b = baselineData[i];
+
+ bool difference = false;
+ if (qFuzzyIsNull(c) && qFuzzyIsNull(b))
+ continue;
+
+ difference = 2 * (std::abs(c - b) / (c + b)) > tolerance;
+
+ if (difference) {
+ qDebug() << "Mismatch at index" << i << c << "vs" << b;
+ qDebug() << "Computed:";
+ qDebug() << computed;
+ qDebug() << "Baseline:";
+ qDebug() << baseline;
+
+ return false;
+ }
+ }
+ return true;
+}
+
+bool fuzzyCompareWithTolerance(const QVector3D &computed, const QVector3D &baseline,
+ float tolerance)
+{
+ auto fuzzyCompare = [](float c, float b, float tolerance) {
+ if (std::abs(c) < tolerance && std::abs(b) < tolerance)
+ return true;
+
+ return 2 * std::abs(c - b) / (c + b) < tolerance;
+ };
+
+ const bool equal = fuzzyCompare(computed.x(), baseline.x(), tolerance)
+ && fuzzyCompare(computed.y(), baseline.y(), tolerance)
+ && fuzzyCompare(computed.z(), baseline.z(), tolerance);
+
+ if (!equal) {
+ qDebug() << "Vectors are different. Computed:";
+ qDebug() << computed;
+ qDebug() << "Baseline:";
+ qDebug() << baseline;
+ }
+
+ return equal;
+}
+
+QMatrix4x4 getColorMatrix(const QByteArray &uniformDataBytes)
+{
+ const auto uniformData =
+ reinterpret_cast<const QVideoTextureHelper::UniformData *>(uniformDataBytes.data());
+ const auto colorMatrixData = reinterpret_cast<const float *>(uniformData->colorMatrix);
+
+ return QMatrix4x4{ colorMatrixData }.transposed();
+};
+
+class tst_qvideotexturehelper : public QObject
+{
+ Q_OBJECT
+public:
+private slots:
+ void updateUniformData_populatesYUV2RGBColorMatrix_data()
+ {
+ QTest::addColumn<QVideoFrameFormat::ColorSpace>("colorSpace");
+ QTest::addColumn<QVideoFrameFormat::ColorRange>("colorRange");
+
+ QTest::addRow("BT709_full")
+ << QVideoFrameFormat::ColorSpace_BT709 << QVideoFrameFormat::ColorRange_Full;
+
+ QTest::addRow("BT709_video")
+ << QVideoFrameFormat::ColorSpace_BT709 << QVideoFrameFormat::ColorRange_Video;
+
+ QTest::addRow("BT2020_full")
+ << QVideoFrameFormat::ColorSpace_BT2020 << QVideoFrameFormat::ColorRange_Full;
+
+ QTest::addRow("BT2020_video")
+ << QVideoFrameFormat::ColorSpace_BT2020 << QVideoFrameFormat::ColorRange_Video;
+ }
+
+ void updateUniformData_populatesYUV2RGBColorMatrix()
+ {
+ QFETCH(const QVideoFrameFormat::ColorSpace, colorSpace);
+ QFETCH(const QVideoFrameFormat::ColorRange, colorRange);
+
+ // Arrange
+ QVideoFrameFormat format{ {}, QVideoFrameFormat::Format_NV12 };
+ format.setColorSpace(colorSpace);
+ format.setColorRange(colorRange);
+
+ const QMatrix4x4 expected = yuv2rgb(colorSpace, colorRange);
+
+ // Act
+ QByteArray data;
+ QVideoTextureHelper::updateUniformData(&data, format, {}, {}, 0.0);
+ const QMatrix4x4 actual = getColorMatrix(data);
+
+ // Assert
+ QVERIFY(fuzzyCompareWithTolerance(actual, expected, 1e-3f));
+
+ { // Sanity check: Color matrix maps white to white
+ constexpr QVector3D expectedWhiteRgb{ 1.0f, 1.0f, 1.0f };
+ const QVector3D whiteYuv = expected.inverted().map(expectedWhiteRgb);
+
+ const QVector3D actualWhiteRgb = actual.map(whiteYuv);
+ QVERIFY(fuzzyCompareWithTolerance(actualWhiteRgb, expectedWhiteRgb, 5e-4f));
+ }
+
+ { // Sanity check: Color matrix maps black to black
+ constexpr QVector3D expectedBlackRgb{ 0.0f, 0.0f, 0.0f };
+ const QVector3D blackYuv = expected.inverted().map(expectedBlackRgb);
+
+ const QVector3D actualBlackRgb = actual.map(blackYuv);
+ QVERIFY(fuzzyCompareWithTolerance(actualBlackRgb, expectedBlackRgb, 5e-4f));
+ }
+ }
+};
+
+QTEST_MAIN(tst_qvideotexturehelper)
+
+#include "tst_qvideotexturehelper.moc"
diff --git a/tests/auto/unit/multimedia/qwavedecoder/CMakeLists.txt b/tests/auto/unit/multimedia/qwavedecoder/CMakeLists.txt
new file mode 100644
index 000000000..4567e95ac
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Generated from qwavedecoder.pro.
+
+#####################################################################
+## tst_qwavedecoder Test:
+#####################################################################
+
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_qwavedecoder
+ SOURCES
+ tst_qwavedecoder.cpp
+ LIBRARIES
+ Qt::Gui
+ Qt::MultimediaPrivate
+ Qt::Network
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wav
new file mode 100644
index 000000000..b6eac4d70
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_datadesc_1_16_8000.le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wav
new file mode 100644
index 000000000..2f0da1370
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtdesc_1_16_8000.le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wav
new file mode 100644
index 000000000..b14a53c9e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/corrupt_fmtstring_1_16_8000.le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/empty.wav b/tests/auto/unit/multimedia/qwavedecoder/data/empty.wav
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/empty.wav
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/gendata.sh b/tests/auto/unit/multimedia/qwavedecoder/data/gendata.sh
new file mode 100755
index 000000000..99a04129b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/gendata.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+# Copyright (C) 2016 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+# Generate some simple test data. Uses "sox".
+
+endian=""
+endian_extn=""
+
+for channel in 1 2; do
+ if [ $channel -eq 1 ]; then
+ endian="little"
+ endian_extn="le"
+ fi
+
+ if [ $channel -eq 2 ]; then
+ endian="big"
+ endian_extn="be"
+ fi
+ for samplebits in 8 16 32; do
+ for samplerate in 44100 8000; do
+ if [ $samplebits -ne 8 ]; then
+ sox -n --endian "${endian}" -c ${channel} -b ${samplebits} -r ${samplerate} isawav_${channel}_${samplebits}_${samplerate}_${endian_extn}.wav synth 0.25 sine 300-3300
+ else
+ sox -n -c ${channel} -b ${samplebits} -r ${samplerate} isawav_${channel}_${samplebits}_${samplerate}.wav synth 0.25 sine 300-3300
+ fi
+ done
+ done
+done
+
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le.wav
new file mode 100644
index 000000000..88b1a8379
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le_2.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le_2.wav
new file mode 100644
index 000000000..087e68e82
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_44100_le_2.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_8000_le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_8000_le.wav
new file mode 100644
index 000000000..83a405907
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_16_8000_le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_44100_le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_44100_le.wav
new file mode 100644
index 000000000..9c437b155
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_44100_le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_8000_le.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_8000_le.wav
new file mode 100644
index 000000000..f90a8bc35
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_32_8000_le.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_44100.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_44100.wav
new file mode 100644
index 000000000..7d10829ea
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_44100.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000.wav
new file mode 100644
index 000000000..76c08e89e
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_even_bext.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_even_bext.wav
new file mode 100644
index 000000000..531b0ee58
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_even_bext.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_odd_bext.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_odd_bext.wav
new file mode 100644
index 000000000..467be6312
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_1_8_8000_odd_bext.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_44100_be.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_44100_be.wav
new file mode 100644
index 000000000..ca0cd425a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_44100_be.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_8000_be.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_8000_be.wav
new file mode 100644
index 000000000..3a684590b
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_16_8000_be.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_44100_be.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_44100_be.wav
new file mode 100644
index 000000000..f1aaf2906
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_44100_be.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_8000_be.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_8000_be.wav
new file mode 100644
index 000000000..c10c20872
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_32_8000_be.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_44100.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_44100.wav
new file mode 100644
index 000000000..befd02baf
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_44100.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_8000.wav b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_8000.wav
new file mode 100644
index 000000000..ce8b0d06a
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/isawav_2_8_8000.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/nosampledata.wav b/tests/auto/unit/multimedia/qwavedecoder/data/nosampledata.wav
new file mode 100644
index 000000000..8dbde9545
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/nosampledata.wav
Binary files differ
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/notawav.wav b/tests/auto/unit/multimedia/qwavedecoder/data/notawav.wav
new file mode 100644
index 000000000..36a20ea05
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/notawav.wav
@@ -0,0 +1 @@
+Ceci n'est pas une wav file
diff --git a/tests/auto/unit/multimedia/qwavedecoder/data/onebyte.wav b/tests/auto/unit/multimedia/qwavedecoder/data/onebyte.wav
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/data/onebyte.wav
@@ -0,0 +1 @@
+1
diff --git a/tests/auto/unit/multimedia/qwavedecoder/tst_qwavedecoder.cpp b/tests/auto/unit/multimedia/qwavedecoder/tst_qwavedecoder.cpp
new file mode 100644
index 000000000..079f98075
--- /dev/null
+++ b/tests/auto/unit/multimedia/qwavedecoder/tst_qwavedecoder.cpp
@@ -0,0 +1,278 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtTest/QtTest>
+#include <qwavedecoder.h>
+
+#include <QNetworkAccessManager>
+#include <QNetworkRequest>
+#include <QNetworkReply>
+
+class tst_QWaveDecoder : public QObject
+{
+ Q_OBJECT
+public:
+ enum Corruption {
+ None = 1,
+ NotAWav = 2,
+ NoSampleData = 4,
+ FormatDescriptor = 8,
+ FormatString = 16,
+ DataDescriptor = 32
+ };
+
+public slots:
+
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+
+ void file_data();
+ void file();
+
+ void http_data() {file_data();}
+ void http();
+
+ void readAllAtOnce();
+ void readPerByte();
+};
+
+void tst_QWaveDecoder::init()
+{
+}
+
+void tst_QWaveDecoder::cleanup()
+{
+}
+
+void tst_QWaveDecoder::initTestCase()
+{
+}
+
+void tst_QWaveDecoder::cleanupTestCase()
+{
+}
+
+static QString testFilePath(const char *filename)
+{
+ QString path = QStringLiteral("data/%1").arg(filename);
+ return QFINDTESTDATA(path);
+}
+
+void tst_QWaveDecoder::file_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<tst_QWaveDecoder::Corruption>("corruption");
+ QTest::addColumn<int>("channels");
+ QTest::addColumn<int>("samplesize");
+ QTest::addColumn<int>("samplerate");
+
+ QTest::newRow("File is empty") << testFilePath("empty.wav") << tst_QWaveDecoder::NotAWav << -1 << -1 << -1;
+ QTest::newRow("File is one byte") << testFilePath("onebyte.wav") << tst_QWaveDecoder::NotAWav << -1 << -1 << -1;
+ QTest::newRow("File is not a wav(text)") << testFilePath("notawav.wav") << tst_QWaveDecoder::NotAWav << -1 << -1 << -1;
+ QTest::newRow("Wav file has no sample data") << testFilePath("nosampledata.wav") << tst_QWaveDecoder::NoSampleData << -1 << -1 << -1;
+ QTest::newRow("corrupt fmt chunk descriptor") << testFilePath("corrupt_fmtdesc_1_16_8000.le.wav") << tst_QWaveDecoder::FormatDescriptor << -1 << -1 << -1;
+ QTest::newRow("corrupt fmt string") << testFilePath("corrupt_fmtstring_1_16_8000.le.wav") << tst_QWaveDecoder::FormatString << -1 << -1 << -1;
+ QTest::newRow("corrupt data chunk descriptor") << testFilePath("corrupt_datadesc_1_16_8000.le.wav") << tst_QWaveDecoder::DataDescriptor << -1 << -1 << -1;
+
+ QTest::newRow("File isawav_1_8_8000.wav") << testFilePath("isawav_1_8_8000.wav") << tst_QWaveDecoder::None << 1 << 8 << 8000;
+ QTest::newRow("File isawav_1_8_44100.wav") << testFilePath("isawav_1_8_44100.wav") << tst_QWaveDecoder::None << 1 << 8 << 44100;
+ QTest::newRow("File isawav_2_8_8000.wav") << testFilePath("isawav_2_8_8000.wav") << tst_QWaveDecoder::None << 2 << 8 << 8000;
+ QTest::newRow("File isawav_2_8_44100.wav") << testFilePath("isawav_2_8_44100.wav") << tst_QWaveDecoder::None << 2 << 8 << 44100;
+
+ QTest::newRow("File isawav_1_16_8000_le.wav") << testFilePath("isawav_1_16_8000_le.wav") << tst_QWaveDecoder::None << 1 << 16 << 8000;
+ QTest::newRow("File isawav_1_16_44100_le.wav") << testFilePath("isawav_1_16_44100_le.wav") << tst_QWaveDecoder::None << 1 << 16 << 44100;
+ QTest::newRow("File isawav_2_16_8000_be.wav") << testFilePath("isawav_2_16_8000_be.wav") << tst_QWaveDecoder::None << 2 << 16 << 8000;
+ QTest::newRow("File isawav_2_16_44100_be.wav") << testFilePath("isawav_2_16_44100_be.wav") << tst_QWaveDecoder::None << 2 << 16 << 44100;
+ // The next file has extra data in the wave header.
+ QTest::newRow("File isawav_1_16_44100_le_2.wav") << testFilePath("isawav_1_16_44100_le_2.wav") << tst_QWaveDecoder::None << 1 << 16 << 44100;
+ // The next file has embedded bext chunk with odd payload (QTBUG-122193)
+ QTest::newRow("File isawav_1_8_8000_odd_bext.wav") << testFilePath("isawav_1_8_8000_odd_bext.wav") << tst_QWaveDecoder::None << 1 << 8 << 8000;
+ // The next file has embedded bext chunk with even payload
+ QTest::newRow("File isawav_1_8_8000_even_bext.wav") << testFilePath("isawav_1_8_8000_even_bext.wav") << tst_QWaveDecoder::None << 1 << 8 << 8000;
+ // 32 bit waves are not supported
+ QTest::newRow("File isawav_1_32_8000_le.wav") << testFilePath("isawav_1_32_8000_le.wav") << tst_QWaveDecoder::FormatDescriptor << 1 << 32 << 8000;
+ QTest::newRow("File isawav_1_32_44100_le.wav") << testFilePath("isawav_1_32_44100_le.wav") << tst_QWaveDecoder::FormatDescriptor << 1 << 32 << 44100;
+ QTest::newRow("File isawav_2_32_8000_be.wav") << testFilePath("isawav_2_32_8000_be.wav") << tst_QWaveDecoder::FormatDescriptor << 2 << 32 << 8000;
+ QTest::newRow("File isawav_2_32_44100_be.wav") << testFilePath("isawav_2_32_44100_be.wav") << tst_QWaveDecoder::FormatDescriptor << 2 << 32 << 44100;
+}
+
+void tst_QWaveDecoder::file()
+{
+ QFETCH(QString, file);
+ QFETCH(tst_QWaveDecoder::Corruption, corruption);
+ QFETCH(int, channels);
+ QFETCH(int, samplesize);
+ QFETCH(int, samplerate);
+
+ QFile stream;
+ stream.setFileName(file);
+ stream.open(QIODevice::ReadOnly);
+
+ QVERIFY(stream.isOpen());
+
+ QWaveDecoder waveDecoder(&stream);
+ QSignalSpy validFormatSpy(&waveDecoder, &QWaveDecoder::formatKnown);
+ QSignalSpy parsingErrorSpy(&waveDecoder, &QWaveDecoder::parsingError);
+
+ QVERIFY(waveDecoder.open(QIODeviceBase::ReadOnly));
+
+ if (corruption == NotAWav) {
+ QSKIP("Not all failures detected correctly yet");
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ } else if (corruption == NoSampleData) {
+ QTRY_COMPARE(validFormatSpy.count(), 1);
+ QCOMPARE(parsingErrorSpy.count(), 0);
+ QVERIFY(waveDecoder.audioFormat().isValid());
+ QVERIFY(waveDecoder.size() == 0);
+ QVERIFY(waveDecoder.duration() == 0);
+ } else if (corruption == FormatDescriptor) {
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ } else if (corruption == FormatString) {
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ QVERIFY(!waveDecoder.audioFormat().isValid());
+ } else if (corruption == DataDescriptor) {
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ QVERIFY(waveDecoder.size() == 0);
+ } else if (corruption == None) {
+ QTRY_COMPARE(validFormatSpy.count(), 1);
+ QCOMPARE(parsingErrorSpy.count(), 0);
+ QVERIFY(waveDecoder.audioFormat().isValid());
+ QVERIFY(waveDecoder.size() > 0);
+ QVERIFY(waveDecoder.duration() == 250);
+ QAudioFormat format = waveDecoder.audioFormat();
+ QVERIFY(format.isValid());
+ QVERIFY(format.channelCount() == channels);
+ QCOMPARE(format.bytesPerSample() * 8, samplesize);
+ QVERIFY(format.sampleRate() == samplerate);
+ }
+
+ stream.close();
+}
+
+void tst_QWaveDecoder::http()
+{
+ QFETCH(QString, file);
+ QFETCH(tst_QWaveDecoder::Corruption, corruption);
+ QFETCH(int, channels);
+ QFETCH(int, samplesize);
+ QFETCH(int, samplerate);
+
+ QFile stream;
+ stream.setFileName(file);
+ stream.open(QIODevice::ReadOnly);
+
+ QVERIFY(stream.isOpen());
+
+ QNetworkAccessManager nam;
+
+ QNetworkReply *reply = nam.get(QNetworkRequest(QUrl::fromLocalFile(file)));
+
+ QWaveDecoder waveDecoder(reply);
+ QSignalSpy validFormatSpy(&waveDecoder, &QWaveDecoder::formatKnown);
+ QSignalSpy parsingErrorSpy(&waveDecoder, &QWaveDecoder::parsingError);
+
+ QVERIFY(waveDecoder.open(QIODeviceBase::ReadOnly));
+
+ if (corruption == NotAWav) {
+ QSKIP("Not all failures detected correctly yet");
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ } else if (corruption == NoSampleData) {
+ QTRY_COMPARE(validFormatSpy.count(), 1);
+ QCOMPARE(parsingErrorSpy.count(), 0);
+ QVERIFY(waveDecoder.audioFormat().isValid());
+ QVERIFY(waveDecoder.size() == 0);
+ QVERIFY(waveDecoder.duration() == 0);
+ } else if (corruption == FormatDescriptor) {
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ } else if (corruption == FormatString) {
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ QVERIFY(!waveDecoder.audioFormat().isValid());
+ } else if (corruption == DataDescriptor) {
+ QTRY_COMPARE(parsingErrorSpy.count(), 1);
+ QCOMPARE(validFormatSpy.count(), 0);
+ QVERIFY(waveDecoder.size() == 0);
+ } else if (corruption == None) {
+ QTRY_COMPARE(validFormatSpy.count(), 1);
+ QCOMPARE(parsingErrorSpy.count(), 0);
+ QVERIFY(waveDecoder.audioFormat().isValid());
+ QVERIFY(waveDecoder.size() > 0);
+ QVERIFY(waveDecoder.duration() == 250);
+ QAudioFormat format = waveDecoder.audioFormat();
+ QVERIFY(format.isValid());
+ QVERIFY(format.channelCount() == channels);
+ QCOMPARE(format.bytesPerSample() * 8, samplesize);
+ QVERIFY(format.sampleRate() == samplerate);
+ }
+
+ delete reply;
+}
+
+void tst_QWaveDecoder::readAllAtOnce()
+{
+ QFile stream;
+ stream.setFileName(testFilePath("isawav_2_8_44100.wav"));
+ stream.open(QIODevice::ReadOnly);
+
+ QVERIFY(stream.isOpen());
+
+ QWaveDecoder waveDecoder(&stream);
+ QSignalSpy validFormatSpy(&waveDecoder, &QWaveDecoder::formatKnown);
+
+ QVERIFY(waveDecoder.open(QIODeviceBase::ReadOnly));
+
+ QTRY_COMPARE(validFormatSpy.count(), 1);
+ QVERIFY(waveDecoder.size() > 0);
+
+ QByteArray buffer;
+ buffer.resize(waveDecoder.size());
+
+ qint64 readSize = waveDecoder.read(buffer.data(), waveDecoder.size());
+ QVERIFY(readSize == waveDecoder.size());
+
+ readSize = waveDecoder.read(buffer.data(), 1);
+ QVERIFY(readSize == 0);
+
+ stream.close();
+}
+
+void tst_QWaveDecoder::readPerByte()
+{
+ QFile stream;
+ stream.setFileName(testFilePath("isawav_2_8_44100.wav"));
+ stream.open(QIODevice::ReadOnly);
+
+ QVERIFY(stream.isOpen());
+
+ QWaveDecoder waveDecoder(&stream);
+ QSignalSpy validFormatSpy(&waveDecoder, &QWaveDecoder::formatKnown);
+
+ QVERIFY(waveDecoder.open(QIODeviceBase::ReadOnly));
+
+ QTRY_COMPARE(validFormatSpy.count(), 1);
+ QVERIFY(waveDecoder.size() > 0);
+
+ qint64 readSize = 0;
+ char buf;
+ for (int ii = 0; ii < waveDecoder.size(); ++ii)
+ readSize += waveDecoder.read(&buf, 1);
+ QVERIFY(readSize == waveDecoder.size());
+ QVERIFY(waveDecoder.read(&buf,1) == 0);
+
+ stream.close();
+}
+
+QTEST_MAIN(tst_QWaveDecoder)
+
+#include "tst_qwavedecoder.moc"
+