summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-04-02 06:29:37 +1300
committerTom Rini <trini@konsulko.com>2025-05-02 13:40:25 -0600
commita7bbc59c31f4099a8da3acccf6919b886fb590f6 (patch)
tree002a69a6f8e7488523babdb2366466934874a2bd /test
parent236ae39fb0c571d2553271a7fa75920348f9c5eb (diff)
video: truetype: Fill in the measured line
Create a measured line for the (single) line of text. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/video.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/dm/video.c b/test/dm/video.c
index cfc831b6931..d3fd74a9a9a 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -785,6 +785,7 @@ static int dm_test_font_measure(struct unit_test_state *uts)
"attempting more than you can do and for making a certainty of "
"what you try. But this principle, like others in life and "
"war, has its exceptions.";
+ const struct vidconsole_mline *line;
struct vidconsole_bbox bbox;
struct video_priv *priv;
struct udevice *dev, *con;
@@ -798,13 +799,23 @@ static int dm_test_font_measure(struct unit_test_state *uts)
/* this is using the Nimbus font with size of 18 pixels */
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
vidconsole_position_cursor(con, 0, 0);
+ alist_init_struct(&lines, struct vidconsole_mline);
ut_assertok(vidconsole_measure(con, NULL, 0, test_string, &bbox,
&lines));
ut_asserteq(0, bbox.x0);
ut_asserteq(0, bbox.y0);
ut_asserteq(0x47a, bbox.x1);
ut_asserteq(0x12, bbox.y1);
- ut_asserteq(0, lines.count);
+ ut_asserteq(1, lines.count);
+
+ line = alist_get(&lines, 0, struct vidconsole_mline);
+ ut_assertnonnull(line);
+ ut_asserteq(0, line->bbox.x0);
+ ut_asserteq(0, line->bbox.y0);
+ ut_asserteq(0x47a, line->bbox.x1);
+ ut_asserteq(0x12, line->bbox.y1);
+ ut_asserteq(0, line->start);
+ ut_asserteq(strlen(test_string), line->len);
return 0;
}