]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: Add a test for 16bpp BMP files
authorSimon Glass <sjg@chromium.org>
Fri, 19 Nov 2021 20:23:58 +0000 (13:23 -0700)
committerAnatolij Gustschin <agust@denx.de>
Sun, 26 Dec 2021 22:05:42 +0000 (23:05 +0100)
Add a compressed 16bpp BMP file and a test to cover this.

Signed-off-by: Simon Glass <sjg@chromium.org>
.gitattributes
configs/sandbox_defconfig
configs/sandbox_flattree_defconfig
test/dm/video.c
tools/logos/denx-16bpp.bmp.gz [new file with mode: 0644]

index 899473ab0fbbd38f4f5cc0690042da3c1c619ac5..1879a2dfb3c9253291d7f709b549bea27205c2d1 100644 (file)
@@ -3,3 +3,4 @@
 # Denote all files that are truly binary and should not be modified
 *.bmp binary
 *.ttf binary
+*.gz binary
index c390afe9de519db44c939188311ab6cdff12212a..5dffc704bd6b3afeec7681c15c16e24792f9a71b 100644 (file)
@@ -285,6 +285,7 @@ CONFIG_OSD=y
 CONFIG_SANDBOX_OSD=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
 CONFIG_W1=y
 CONFIG_W1_GPIO=y
 CONFIG_W1_EEPROM=y
index f184723a899a9be14e4606ea879a72251565e9c1..f16d890048f0911e8477ca9c8d74b97ed625297b 100644 (file)
@@ -198,6 +198,7 @@ CONFIG_VIDEO_SANDBOX_SDL=y
 CONFIG_OSD=y
 CONFIG_SANDBOX_OSD=y
 CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_RSA_VERIFY_WITH_PKEY=y
 CONFIG_TPM=y
index d5648f0c59bcc5544394a7f77e69136b730da900..c496b05df76f3e7eb80f5ff0da1894deeb9370ba 100644 (file)
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <bzlib.h>
 #include <dm.h>
+#include <gzip.h>
 #include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -339,6 +340,29 @@ static int dm_test_video_bmp8(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_video_bmp8, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
 
+/* Test drawing a bitmap file on a 16bpp display */
+static int dm_test_video_bmp16(struct unit_test_state *uts)
+{
+       ulong src, src_len = ~0UL;
+       uint dst_len = ~0U;
+       struct udevice *dev;
+       ulong dst = 0x10000;
+
+       ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev));
+       ut_assertnonnull(dev);
+       ut_assertok(sandbox_sdl_set_bpp(dev, VIDEO_BPP16));
+
+       ut_assertok(read_file(uts, "tools/logos/denx-16bpp.bmp.gz", &src));
+       ut_assertok(gunzip(map_sysmem(dst, 0), dst_len, map_sysmem(src, 0),
+                          &src_len));
+
+       ut_assertok(video_bmp_display(dev, dst, 0, 0, false));
+       ut_asserteq(3700, compress_frame_buffer(uts, dev));
+
+       return 0;
+}
+DM_TEST(dm_test_video_bmp16, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
 /* Test drawing a bitmap file on a 32bpp display */
 static int dm_test_video_bmp32(struct unit_test_state *uts)
 {
diff --git a/tools/logos/denx-16bpp.bmp.gz b/tools/logos/denx-16bpp.bmp.gz
new file mode 100644 (file)
index 0000000..ed99c58
Binary files /dev/null and b/tools/logos/denx-16bpp.bmp.gz differ