[Concept,v2,3/9] video: Add tests for the video commands

Message ID 20251002154554.4129220-4-sjg@u-boot.org
State New
Headers
Series video: Tidy up embedded graphical images |

Commit Message

Simon Glass Oct. 2, 2025, 3:45 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add a simple test for the setcurs and lcdputs commands.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Pull out the docs into a separate patch
- Update test result for hex

 test/dm/video.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
  

Patch

diff --git a/test/dm/video.c b/test/dm/video.c
index 702e9854005..847342891fd 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -1080,3 +1080,23 @@  static int dm_test_video_backspace_truetype(struct unit_test_state *uts)
 	return 0;
 }
 DM_TEST(dm_test_video_backspace_truetype, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
+/* video commands */
+static int dm_test_video_cmd(struct unit_test_state *uts)
+{
+	struct udevice *dev, *con;
+
+	ut_assertok(select_vidconsole(uts, "vidconsole0"));
+	ut_assertok(video_get_nologo(uts, &dev));
+	ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
+	ut_assertok(vidconsole_select_font(con, "8x16", 0));
+
+	ut_assertok(run_command("setcurs 10 5", 0));
+
+	ut_assertok(run_command("lcdputs \"Test string\"", 0));
+	ut_asserteq(187, video_compress_fb(uts, dev, false));
+	ut_assertok(video_check_copy_fb(uts, dev));
+
+	return 0;
+}
+DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT);