]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
dm: video: test: Test that bitmap display works correctly
authorSimon Glass <sjg@chromium.org>
Tue, 19 Jan 2016 02:52:28 +0000 (19:52 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 21 Jan 2016 02:10:16 +0000 (19:10 -0700)
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@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
include/configs/sandbox.h
test/dm/video.c
tools/logos/denx-comp.bmp [new file with mode: 0644]

index 23ae44c8a0390dd4fce6f59f774ef6d3020c4693..6498981cef248715e98dabae34b1061616249229 100644 (file)
 #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
 
index 65db216b319dcf753e88246fd9c41764c29c40fe..9f5e7fce375fff6c9be269c188004ef512696e28 100644 (file)
@@ -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 (file)
index 0000000..89d0f47
Binary files /dev/null and b/tools/logos/denx-comp.bmp differ