expo: Support rendering multiple lines of text
Use the measurement info to write each line of text separately, thus
respecting word-wrapping and newlines.
Fix up the comment for scene_obj_render() while we are here.
Since a lineedit does not support alignment, add a special case to just
display the text if there is no measurement. This happens assuming the
lineedit is initially empty.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/test/boot/expo.c b/test/boot/expo.c
index 6fb9f81..c9ff5b8 100644
--- a/test/boot/expo.c
+++ b/test/boot/expo.c
@@ -25,6 +25,7 @@
OBJ_LOGO,
OBJ_TEXT,
OBJ_TEXT2,
+ OBJ_TEXT3,
OBJ_MENU,
OBJ_MENU_TITLE,
@@ -33,6 +34,7 @@
STR_TEXT,
STR_TEXT2,
+ STR_TEXT3,
STR_MENU_TITLE,
STR_POINTER_TEXT,
@@ -488,6 +490,14 @@
60));
ut_assertok(scene_obj_set_pos(scn, OBJ_TEXT2, 200, 600));
+ id = scene_txt_str(scn, "text", OBJ_TEXT3, STR_TEXT3,
+ "this is yet\nanother string, with word-wrap",
+ NULL);
+ ut_assert(id > 0);
+ ut_assertok(scene_txt_set_font(scn, OBJ_TEXT3, "nimbus_sans_l_regular",
+ 60));
+ ut_assertok(scene_obj_set_bbox(scn, OBJ_TEXT3, 500, 200, 1000, 700));
+
id = scene_menu(scn, "main", OBJ_MENU, &menu);
ut_assert(id > 0);
@@ -646,7 +656,7 @@
ut_assertok(scene_arrange(scn));
ut_assertok(expo_render(exp));
- ut_asserteq(10314, video_compress_fb(uts, dev, false));
+ ut_asserteq(14848, video_compress_fb(uts, dev, false));
ut_assertok(video_check_copy_fb(uts, dev));
/* make sure only the preview for the second item is shown */