diff --git a/libvisual/tests/images/additive-colors-indexed8.bmp b/libvisual/tests/images/additive-colors-indexed8.bmp new file mode 100644 index 00000000..f2446896 Binary files /dev/null and b/libvisual/tests/images/additive-colors-indexed8.bmp differ diff --git a/libvisual/tests/images/additive-colors-rgb24.bmp b/libvisual/tests/images/additive-colors-rgb24.bmp new file mode 100644 index 00000000..72be071d Binary files /dev/null and b/libvisual/tests/images/additive-colors-rgb24.bmp differ diff --git a/libvisual/tests/video_test/video_load_test.cpp b/libvisual/tests/video_test/video_load_test.cpp index cb641d70..5251885b 100644 --- a/libvisual/tests/video_test/video_load_test.cpp +++ b/libvisual/tests/video_test/video_load_test.cpp @@ -58,13 +58,8 @@ namespace LV::VideoPtr load_raw_indexed_image (std::filesystem::path const& image_path, std::filesystem::path const& palette_path, int width, - int height, - VisVideoDepth depth) + int height) { - if (depth != VISUAL_VIDEO_DEPTH_24BIT) { - return nullptr; - } - auto image {LV::Video::create (width, height, VISUAL_VIDEO_DEPTH_8BIT)}; std::size_t const content_bytes_per_row = image->get_width () * image->get_bpp (); @@ -89,28 +84,34 @@ namespace } image->set_palette (palette.value()); - auto final_image {LV::Video::create (image->get_width(), image->get_height(), VISUAL_VIDEO_DEPTH_24BIT)}; - final_image->convert_depth(image); - - return final_image; + return image; } void test_load_indexed8 () { + auto bmp_image {LV::Video::create_from_file ("../images/additive-colors-indexed8.bmp")}; + LV_TEST_ASSERT (bmp_image); + auto png_image {LV::Video::create_from_file ("../images/additive-colors-indexed8.png")}; LV_TEST_ASSERT (png_image); auto raw_image {load_raw_indexed_image ("../images/additive-colors-indexed8.raw", "../images/additive-colors-indexed8.raw.pal", png_image->get_width (), - png_image->get_height (), - VISUAL_VIDEO_DEPTH_24BIT)}; + png_image->get_height ())}; - LV_TEST_ASSERT (png_image->has_same_content (raw_image)); + auto raw_image_rgb24 {LV::Video::create (raw_image->get_width(), raw_image->get_height(), VISUAL_VIDEO_DEPTH_24BIT)}; + raw_image_rgb24->convert_depth(raw_image); + + LV_TEST_ASSERT (bmp_image->has_same_content (raw_image)); + LV_TEST_ASSERT (png_image->has_same_content (raw_image_rgb24)); } void test_load_rgb24 () { + auto bmp_image {LV::Video::create_from_file ("../images/additive-colors-rgb24.bmp")}; + LV_TEST_ASSERT (bmp_image); + auto png_image {LV::Video::create_from_file ("../images/additive-colors-rgb24.png")}; LV_TEST_ASSERT (png_image); @@ -119,6 +120,7 @@ namespace png_image->get_height (), VISUAL_VIDEO_DEPTH_24BIT)}; + LV_TEST_ASSERT (bmp_image->has_same_content (raw_image)); LV_TEST_ASSERT (png_image->has_same_content (raw_image)); }