expo: Honour the textline edit_id when building

There is no need to create a new ID and it makes it harder for tests to
locate objects. Use the ID provided in the file, if any.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-05-05 17:42:56 +02:00
parent 44ac51e503
commit 502aa8bc31
2 changed files with 3 additions and 5 deletions

View File

@@ -286,7 +286,7 @@ static int textline_build(struct build_info *info, ofnode node,
struct scene *scn, uint id, struct scene_obj **objp)
{
struct scene_obj_textline *ted;
uint ted_id, edit_id;
uint edit_id;
const char *name;
u32 max_chars;
int ret;
@@ -301,7 +301,6 @@ static int textline_build(struct build_info *info, ofnode node,
ret = scene_textline(scn, name, id, max_chars, &ted);
if (ret < 0)
return log_msg_ret("ted", ret);
ted_id = ret;
/* Set the title */
ret = add_txt_str(info, node, scn, "title", 0);
@@ -311,10 +310,9 @@ static int textline_build(struct build_info *info, ofnode node,
/* Setup the editor */
info->err_prop = "edit-id";
ret = ofnode_read_u32(node, "edit-id", &id);
ret = ofnode_read_u32(node, "edit-id", &edit_id);
if (ret)
return log_msg_ret("id", -ENOENT);
edit_id = ret;
ret = scene_txt_str(scn, "edit", edit_id, 0, abuf_data(&ted->buf),
NULL);

View File

@@ -819,7 +819,7 @@ static int expo_test_build(struct unit_test_state *uts)
ut_asserteq_str("name", exp->name);
ut_asserteq(0, exp->scene_id);
ut_asserteq(ID_DYNAMIC_START + 24, exp->next_id);
ut_asserteq(ID_DYNAMIC_START + 23, exp->next_id);
ut_asserteq(false, exp->popup);
/* check the scene */