summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-05-02 08:46:40 -0600
committerSimon Glass <sjg@chromium.org>2025-05-30 09:49:32 +0100
commit87750b027691cd67a20ae6c5b95df65c33e8294e (patch)
tree0089c864132dd9c27a237f62470b32c0dc16e0f2 /test
parent589e4ccacfc6ef347a78386b8bedc666911e9c4c (diff)
expo: Allow strings to be editable
In some cases dynamic text is needed, e.g. for a menu countdown. Add a function which handles this, allowing the caller to take control of the text that is shown on each render. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/boot/expo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/boot/expo.c b/test/boot/expo.c
index 96c5943f394..a50e9f721de 100644
--- a/test/boot/expo.c
+++ b/test/boot/expo.c
@@ -707,6 +707,7 @@ static int expo_test_build(struct unit_test_state *uts)
struct scene_obj_menu *menu;
struct scene_menitem *item;
struct scene_obj_txt *txt;
+ struct abuf orig, *copy;
struct scene_obj *obj;
struct scene *scn;
struct expo *exp;
@@ -774,6 +775,16 @@ static int expo_test_build(struct unit_test_state *uts)
count = list_count_nodes(&menu->item_head);
ut_asserteq(3, count);
+ /* try editing some text */
+ ut_assertok(expo_edit_str(exp, txt->gen.str_id, &orig, &copy));
+ ut_asserteq_str("2 GHz", orig.data);
+ ut_asserteq_str("2 GHz", copy->data);
+
+ /* change it and check that things look right */
+ abuf_printf(copy, "atlantic %d", 123);
+ ut_asserteq_str("2 GHz", orig.data);
+ ut_asserteq_str("atlantic 123", copy->data);
+
expo_destroy(exp);
return 0;