summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-04-02 06:29:43 +1300
committerTom Rini <[email protected]>2025-05-02 13:40:25 -0600
commitf94f1f4b8ce62855693b4b48356f7e8d229b3fa4 (patch)
treef3a8400dd68f59b9a15fee6385d733a5747897df /test
parentcb32266d4aeca4a730c1f8b85c981a8793d768c4 (diff)
video: Add a function to draw a rectangle
Provide a way to draw an unfilled box of a certain width. This is useful for grouping menu items together. Add a comment showing how to see the copy-framebuffer, for testing. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/dm/video.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/dm/video.c b/test/dm/video.c
index dd06b2f58e8..ecf74605b5c 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -902,3 +902,24 @@ static int dm_test_video_silence(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_video_silence, UTF_SCAN_FDT);
+
+/* test drawing a box */
+static int dm_test_video_box(struct unit_test_state *uts)
+{
+ struct video_priv *priv;
+ struct udevice *dev;
+
+ ut_assertok(video_get_nologo(uts, &dev));
+ priv = dev_get_uclass_priv(dev);
+ video_draw_box(dev, 100, 100, 200, 200, 3,
+ video_index_to_colour(priv, VID_LIGHT_BLUE));
+ video_draw_box(dev, 300, 100, 400, 200, 1,
+ video_index_to_colour(priv, VID_MAGENTA));
+ video_draw_box(dev, 500, 100, 600, 200, 20,
+ video_index_to_colour(priv, VID_LIGHT_RED));
+ ut_asserteq(133, video_compress_fb(uts, dev, false));
+ ut_assertok(video_check_copy_fb(uts, dev));
+
+ return 0;
+}
+DM_TEST(dm_test_video_box, UTF_SCAN_FDT);