At present when the user moves to a new menu item, the menu code handles this immediately. This means it is not possible to use an expo action to effect the same change.
Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action(). Expand the test to cover this. Signed-off-by: Simon Glass <s...@chromium.org> --- boot/bootflow_menu.c | 8 ++++++++ boot/cedit.c | 5 ++++- boot/scene_menu.c | 2 -- test/boot/cedit.c | 22 ++++++++++++++++++++++ test/boot/expo.c | 4 ++++ 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index e3a27f16daa..d20d0be4734 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -180,6 +180,7 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, { struct bootflow *sel_bflow; struct udevice *dev; + struct scene *scn; struct expo *exp; uint sel_id; bool done; @@ -209,6 +210,9 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, ret = expo_set_scene_id(exp, MAIN); if (ret) return log_msg_ret("scn", ret); + scn = expo_lookup_scene_id(exp, MAIN); + if (!scn) + return log_msg_ret("scn", -ENOENT); if (text_mode) expo_set_text_mode(exp, text_mode); @@ -224,6 +228,10 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, sel_id = act.select.id; done = true; break; + case EXPOACT_POINT_ITEM: + LOGR("bmp", scene_menu_select_item(scn, + OBJ_MENU, act.select.id)); + break; case EXPOACT_QUIT: return -EPIPE; default: diff --git a/boot/cedit.c b/boot/cedit.c index bcbbe69fe33..8b4429b4c72 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -154,8 +154,11 @@ int cedit_do_action(struct expo *exp, struct scene *scn, { switch (act->type) { case EXPOACT_NONE: - case EXPOACT_POINT_ITEM: return -EAGAIN; + case EXPOACT_POINT_ITEM: + LOGR("cdp", scene_menu_select_item(scn, scn->highlight_id, + act->select.id)); + break; case EXPOACT_POINT_OBJ: scene_set_highlight_id(scn, act->select.id); cedit_arange(exp, vid_priv, scn->id); diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 48905d3e2b6..df14a6c0409 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -399,8 +399,6 @@ int scene_menu_send_key(struct scene *scn, struct scene_obj_menu *menu, int key, break; } - menu_point_to_item(menu, item->id); - return 0; } diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 9fab8750b40..187cdcbd034 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -226,6 +226,7 @@ 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; @@ -238,6 +239,11 @@ 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)); @@ -256,6 +262,22 @@ static int cedit_render(struct unit_test_state *uts) ut_assertok(expo_render(exp)); ut_asserteq(5393, video_compress_fb(uts, dev, false)); + /* move to the second item */ + act.type = EXPOACT_POINT_ITEM; + act.select.id = ID_AC_ON; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(5365, video_compress_fb(uts, dev, false)); + + /* select it */ + act.type = EXPOACT_SELECT; + act.select.id = ID_AC_ON; + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_assertok(expo_render(exp)); + ut_asserteq(4980, video_compress_fb(uts, dev, false)); + + ut_asserteq(ID_AC_ON, menu->cur_item_id); + expo_destroy(exp); cur_exp = NULL; diff --git a/test/boot/expo.c b/test/boot/expo.c index 616071ead48..b32a4596e85 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -588,6 +588,8 @@ static int expo_render_image(struct unit_test_state *uts) expo_set_scene_id(exp, SCENE1); ut_assertok(expo_render(exp)); + ut_asserteq(0, scn->highlight_id); + ut_assertok(scene_arrange(scn)); ut_asserteq(0, scn->highlight_id); /* move down */ @@ -599,6 +601,7 @@ static int expo_render_image(struct unit_test_state *uts) ut_asserteq(ITEM2, act.select.id); ut_assertok(scene_menu_select_item(scn, OBJ_MENU, act.select.id)); ut_asserteq(ITEM2, scene_menu_get_cur_item(scn, OBJ_MENU)); + ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); /* make sure only the preview for the second item is shown */ @@ -639,6 +642,7 @@ static int expo_render_image(struct unit_test_state *uts) ut_asserteq(EXPOACT_POINT_ITEM, act.type); ut_asserteq(ITEM1, act.select.id); + ut_assertok(scene_menu_select_item(scn, OBJ_MENU, act.select.id)); ut_assertok(expo_render(exp)); ut_assert_nextline("U-Boot : Boot Menu"); -- 2.43.0