aboutsummaryrefslogtreecommitdiff
path: root/test/dm/video.c
diff options
context:
space:
mode:
authorSimon Glass2021-11-19 13:23:50 -0700
committerAnatolij Gustschin2021-12-26 23:02:19 +0100
commit8657ad43f353386be5fb6a517650322e804c98b4 (patch)
tree3623a28f6fb32df01a51060e2baa3d77da6a8d17 /test/dm/video.c
parent84051743917e5a34936bc47923838fd5eda24f43 (diff)
sandbox: video: Add BMP tests for 32bpp and 8bpp modes
Add a few more tests for BMP rendering. Use a back door into the sandbox SDL driver to adjust the resolution at runtime. The truetype code does not support 8bpp. Add this so that the display is not blank when running in this mode. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/video.c')
-rw-r--r--test/dm/video.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/dm/video.c b/test/dm/video.c
index da0ae3622f7..c8c6668c8b3 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -13,6 +13,7 @@
#include <os.h>
#include <video.h>
#include <video_console.h>
+#include <asm/test.h>
#include <dm/test.h>
#include <dm/uclass-internal.h>
#include <test/test.h>
@@ -319,6 +320,43 @@ static int dm_test_video_bmp(struct unit_test_state *uts)
}
DM_TEST(dm_test_video_bmp, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+/* Test drawing a bitmap file on a 8bpp display */
+static int dm_test_video_bmp8(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ ulong addr;
+
+ ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev));
+ ut_assertnonnull(dev);
+ ut_assertok(sandbox_sdl_set_bpp(dev, VIDEO_BPP8));
+
+ ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr));
+
+ ut_assertok(video_bmp_display(dev, addr, 0, 0, false));
+ ut_asserteq(1247, compress_frame_buffer(uts, dev));
+
+ return 0;
+}
+DM_TEST(dm_test_video_bmp8, 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)
+{
+ struct udevice *dev;
+ ulong addr;
+
+ ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev));
+ ut_assertnonnull(dev);
+ ut_assertok(sandbox_sdl_set_bpp(dev, VIDEO_BPP32));
+ ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr));
+
+ ut_assertok(video_bmp_display(dev, addr, 0, 0, false));
+ ut_asserteq(2024, compress_frame_buffer(uts, dev));
+
+ return 0;
+}
+DM_TEST(dm_test_video_bmp32, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
/* Test drawing a compressed bitmap file */
static int dm_test_video_bmp_comp(struct unit_test_state *uts)
{