diff options
author | Simon Glass <sjg@chromium.org> | 2025-05-02 08:46:21 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2025-05-30 09:49:32 +0100 |
commit | 5f993342962de816044f4172234ca7ecfd2bcaf6 (patch) | |
tree | 300d6df560a5984ed2c6a1b5abfa8ecd1780562d /test | |
parent | 932ea4a1044455e7bcb48fb1391ea7e06137fad5 (diff) |
expo: Test some cedit actions
Refactor the action-processing code into a new cedit_do_action()
function so we can call it from a test. Check moving to a new field and
opening the menu, to ensure that rendering is correct.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/boot/cedit.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/boot/cedit.c b/test/boot/cedit.c index df191a09f89..5b3e9b586a6 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -226,8 +226,10 @@ BOOTSTD_TEST(cedit_cmos, UTF_CONSOLE); /* Check the cedit displays correctely */ static int cedit_render(struct unit_test_state *uts) { + struct scene_obj_menu *menu; struct video_priv *vid_priv; extern struct expo *cur_exp; + struct expo_action act; struct udevice *dev; struct scene *scn; struct expo *exp; @@ -237,9 +239,50 @@ static int cedit_render(struct unit_test_state *uts) exp = cur_exp; ut_assertok(uclass_first_device_err(UCLASS_VIDEO, &dev)); ut_asserteq(ID_SCENE1, cedit_prepare(exp, &vid_priv, &scn)); + + menu = scene_obj_find(scn, ID_POWER_LOSS, SCENEOBJT_MENU); + ut_assertnonnull(menu); + ut_asserteq(ID_AC_OFF, menu->cur_item_id); + ut_assertok(expo_render(exp)); ut_asserteq(4929, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); + + /* move to the second menu */ + act.type = EXPOACT_POINT_OBJ; + act.select.id = ID_POWER_LOSS; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(4986, video_compress_fb(uts, dev, false)); + + /* open the menu */ + act.type = EXPOACT_OPEN; + act.select.id = ID_POWER_LOSS; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(5393, video_compress_fb(uts, dev, false)); + + /* close the menu */ + act.type = EXPOACT_CLOSE; + act.select.id = ID_POWER_LOSS; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(4986, video_compress_fb(uts, dev, false)); + + /* open the menu again to check it looks the same */ + act.type = EXPOACT_OPEN; + act.select.id = ID_POWER_LOSS; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(5393, video_compress_fb(uts, dev, false)); + + /* close the menu */ + act.type = EXPOACT_CLOSE; + act.select.id = ID_POWER_LOSS; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(4986, video_compress_fb(uts, dev, false)); + expo_destroy(exp); cur_exp = NULL; |