@@ -58,13 +58,8 @@ namespace
5858 LV::VideoPtr load_raw_indexed_image (std::filesystem::path const & image_path,
5959 std::filesystem::path const & palette_path,
6060 int width,
61- int height,
62- VisVideoDepth depth)
61+ int height)
6362 {
64- if (depth != VISUAL_VIDEO_DEPTH_24BIT) {
65- return nullptr ;
66- }
67-
6863 auto image {LV::Video::create (width, height, VISUAL_VIDEO_DEPTH_8BIT)};
6964
7065 std::size_t const content_bytes_per_row = image->get_width () * image->get_bpp ();
@@ -89,28 +84,34 @@ namespace
8984 }
9085 image->set_palette (palette.value ());
9186
92- auto final_image {LV::Video::create (image->get_width (), image->get_height (), VISUAL_VIDEO_DEPTH_24BIT)};
93- final_image->convert_depth (image);
94-
95- return final_image;
87+ return image;
9688 }
9789
9890 void test_load_indexed8 ()
9991 {
92+ auto bmp_image {LV::Video::create_from_file (" ../images/additive-colors-indexed8.bmp" )};
93+ LV_TEST_ASSERT (bmp_image);
94+
10095 auto png_image {LV::Video::create_from_file (" ../images/additive-colors-indexed8.png" )};
10196 LV_TEST_ASSERT (png_image);
10297
10398 auto raw_image {load_raw_indexed_image (" ../images/additive-colors-indexed8.raw" ,
10499 " ../images/additive-colors-indexed8.raw.pal" ,
105100 png_image->get_width (),
106- png_image->get_height (),
107- VISUAL_VIDEO_DEPTH_24BIT)};
101+ png_image->get_height ())};
108102
109- LV_TEST_ASSERT (png_image->has_same_content (raw_image));
103+ auto raw_image_rgb24 {LV::Video::create (raw_image->get_width (), raw_image->get_height (), VISUAL_VIDEO_DEPTH_24BIT)};
104+ raw_image_rgb24->convert_depth (raw_image);
105+
106+ LV_TEST_ASSERT (bmp_image->has_same_content (raw_image));
107+ LV_TEST_ASSERT (png_image->has_same_content (raw_image_rgb24));
110108 }
111109
112110 void test_load_rgb24 ()
113111 {
112+ auto bmp_image {LV::Video::create_from_file (" ../images/additive-colors-rgb24.bmp" )};
113+ LV_TEST_ASSERT (bmp_image);
114+
114115 auto png_image {LV::Video::create_from_file (" ../images/additive-colors-rgb24.png" )};
115116 LV_TEST_ASSERT (png_image);
116117
@@ -119,6 +120,7 @@ namespace
119120 png_image->get_height (),
120121 VISUAL_VIDEO_DEPTH_24BIT)};
121122
123+ LV_TEST_ASSERT (bmp_image->has_same_content (raw_image));
122124 LV_TEST_ASSERT (png_image->has_same_content (raw_image));
123125 }
124126
0 commit comments