[U-Boot] [PATCH v2 14/14] dm: video: test: Test that bitmap display works correctly

Simon Glass sjg at chromium.org
Tue Jan 19 03:52:28 CET 2016


Add a test for the 'bmp' command. Test both the uncompressed and compressed
versions of the file, since they use different code paths.

Signed-off-by: Simon Glass <sjg at chromium.org>
Acked-by: Anatolij Gustschin <agust at denx.de>
---

Changes in v2: None

 include/configs/sandbox.h |   2 ++
 test/dm/video.c           |  54 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/logos/denx-comp.bmp | Bin 0 -> 4148 bytes
 3 files changed, 56 insertions(+)
 create mode 100644 tools/logos/denx-comp.bmp

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 23ae44c..6498981 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -163,6 +163,8 @@
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define LCD_BPP			LCD_COLOR16
 #define CONFIG_LCD_BMP_RLE8
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_SPLASH_SCREEN_ALIGN
 
 #define CONFIG_KEYBOARD
 
diff --git a/test/dm/video.c b/test/dm/video.c
index 65db216..9f5e7fc 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -215,3 +215,57 @@ static int dm_test_video_rotation3(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_video_rotation3, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Read a file into memory and return a pointer to it */
+static int read_file(struct unit_test_state *uts, const char *fname,
+		     ulong *addrp)
+{
+	int buf_size = 100000;
+	ulong addr = 0;
+	int size, fd;
+	char *buf;
+
+	buf = map_sysmem(addr, 0);
+	ut_assert(buf != NULL);
+	fd = os_open(fname, OS_O_RDONLY);
+	ut_assert(fd >= 0);
+	size = os_read(fd, buf, buf_size);
+	ut_assert(size >= 0);
+	ut_assert(size < buf_size);
+	os_close(fd);
+	*addrp = addr;
+
+	return 0;
+}
+
+/* Test drawing a bitmap file */
+static int dm_test_video_bmp(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+	ulong addr;
+
+	ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+	ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr));
+
+	ut_assertok(video_bmp_display(dev, addr, 0, 0, false));
+	ut_asserteq(1368, compress_frame_buffer(dev));
+
+	return 0;
+}
+DM_TEST(dm_test_video_bmp, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test drawing a compressed bitmap file */
+static int dm_test_video_bmp_comp(struct unit_test_state *uts)
+{
+	struct udevice *dev;
+	ulong addr;
+
+	ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+	ut_assertok(read_file(uts, "tools/logos/denx-comp.bmp", &addr));
+
+	ut_assertok(video_bmp_display(dev, addr, 0, 0, false));
+	ut_asserteq(1368, compress_frame_buffer(dev));
+
+	return 0;
+}
+DM_TEST(dm_test_video_bmp_comp, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
diff --git a/tools/logos/denx-comp.bmp b/tools/logos/denx-comp.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..89d0f471c85cf734b5f0e2bb2508d39f5b9e72b8
GIT binary patch
literal 4148
zcmeH}JBVCW7{|ZwzF%|i?CfTD_HOoU9!9h=1``B36Gbe<AYvs!EaD?*V<8b+Q&?(h
zNm>O{DjKjbg$6`yOp(GSK^vPDZ4|D*@7%dFJBwIaNQOOg&pqGkfBxTN_VhC+$KpTl
zM<VaCyTW>jrIN8kJ}yPxm at R)`htdsy{^j&j&%I?E`#k at -`>WrHoIihlzQ6JN0~jqn
zgj at QYdis={dEtzlefg}Md-I%Jc;|v#ymV16eQ-%Ge{@-{esWc=eRfT*e|=qUet%PL
z-M%Gvf4(cbzwOE+Uv%>LSDie2qmviE>E!kAI(hqtPTu>mlMioqa^<H^KE2b)m%nuK
z?XR8O+U?}dAD!&}*-6(e!CJy}@8uo?_ZawZ7&z)eQPqg=^fjjm&q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