From patchwork Sun Jan 18 20:42:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1597 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769025; bh=tJ608chImMK+Ye8I6i/VNBMKCBb3vgJAiU/BlWBqSHc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tvOdnLM1YfHWoasmXZxXxew8DJXH3ZcB/cjB8z0CfZesXeG9Xa+Dwgzy34LFHuyp6 W9A4H82N+UsA0IwM0LJznXJ8g5qyTL+MHImbhhFgjPpgaZYgnZqU9GfpGrL+wEiOao b9reRLM3ceR0NRPEg2jQbty/aMpdCOEsej0J95LU6cJekjXFm+tVcRL96a9xtA9wDg 7ksqnAA+DFs1HVZAA4OLQTIa76lRp4NL28EeCUnx5FKEmYsIlMmKKl0jqw5yYGGbqn Cj3BXZbgfg6JYsZr2eQ+ttL1ivv8IR/AXbPwfBzE0kSQ1dlQZpL5+H4hv2vNnJzxzs dvB3R/M531EUQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6A2376949B for ; Sun, 18 Jan 2026 13:43:45 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TNwyXYu8is-W for ; Sun, 18 Jan 2026 13:43:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769025; bh=tJ608chImMK+Ye8I6i/VNBMKCBb3vgJAiU/BlWBqSHc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tvOdnLM1YfHWoasmXZxXxew8DJXH3ZcB/cjB8z0CfZesXeG9Xa+Dwgzy34LFHuyp6 W9A4H82N+UsA0IwM0LJznXJ8g5qyTL+MHImbhhFgjPpgaZYgnZqU9GfpGrL+wEiOao b9reRLM3ceR0NRPEg2jQbty/aMpdCOEsej0J95LU6cJekjXFm+tVcRL96a9xtA9wDg 7ksqnAA+DFs1HVZAA4OLQTIa76lRp4NL28EeCUnx5FKEmYsIlMmKKl0jqw5yYGGbqn Cj3BXZbgfg6JYsZr2eQ+ttL1ivv8IR/AXbPwfBzE0kSQ1dlQZpL5+H4hv2vNnJzxzs dvB3R/M531EUQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 590EB69491 for ; Sun, 18 Jan 2026 13:43:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769023; bh=XGTGxNTMY5bSlkktRSolmnavZuOD2ghUyOZnKvMF3r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MMfl573VqoSLnlDp47Z9eH9cLNFSoP17q2gNsWFmiIV2K+hFIMNXAPwcMGJmqncv/ 6LXF8ERRdsn+eAe9bKgO7XxRMiNP1NWPfH1y4jtFB2NW9kyfzC+muTYDk0ugtGU7Ci s7CcTjNwtwU4dcn7Xgw6V63/AKXaJiHzs7px3LNaw6MM0uqRqM3uQcwY3u3jlblqrB Bpx84oeIvjA2Y7qG9DMgvd39aXZQq6TeVb8Xd973cH17v6quvHIYGfVEfJXYt2rZkl tyv7WdbdaU8cBP2T9xCkrG6Z7nb9Jg8cefbMS4J60AkoAMPlDk++fqKjxid6spreEB LCVW49E4ViQmg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C74A86948C; Sun, 18 Jan 2026 13:43:43 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id qP4__gOq9tHz; Sun, 18 Jan 2026 13:43:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768769019; bh=QxvFJ4OXqWnSAWvLeMfUjRHU90hQ5wL4F5jKWd/ta5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhjfoTVJtKcdHcGcV34wshwQtgCSX5DzIJRMvpFGSYhojF1Yqd4VcB2pPN4FAYHE5 6JDQnb8LR2Rer1fA14yzT6sYN71mpkA7Hqq5KWcVJf2mGiSA+7p1LVR38AYwvW73H7 JP0xHPVXC1uWD3g99bCKBwow/HwDDTTnMu8amEeMvqU48Gf9JbxqDt+zEcfyT8Yu/4 +GhWUdjkpb+C9x1CrIfF4zLugYQBzqmQ/CiDo148oJicwrIraY5zurferYOtogkMCb PymxgW8s2e7kLCPic72r+NjL7cgGlkKcGJYCp4RGysRFjABkAWGT30tfuIHi8phLfc 1qYoGp7KyKqfw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 725026946A; Sun, 18 Jan 2026 13:43:39 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:42:45 -0700 Message-ID: <20260118204303.1982533-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118204303.1982533-1-sjg@u-boot.org> References: <20260118204303.1982533-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SBZ2MVCG63F3ZVMBGKFBZ7UC3FLREDLM X-Message-ID-Hash: SBZ2MVCG63F3ZVMBGKFBZ7UC3FLREDLM X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/16] test: expo: Add a separate test for textedit List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a dedicated test for textedit rendering. Move the textedit creation out of create_test_expo() into its own test function, allowing each test to configure the textedit as needed. Update the checksums in expo_render_image() and expo_render_textline() since the textedit is no longer rendered there. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/expo.c | 77 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/test/boot/expo.c b/test/boot/expo.c index 03ad3e2167d..62b0b1a7c1b 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -490,7 +490,6 @@ static int create_test_expo(struct unit_test_state *uts, struct expo **expp, struct scene_obj_menu *menu; struct abuf buf, logo_copy; struct scene *scn; - struct abuf orig, *text; struct udevice *dev; struct expo *exp; int id, size; @@ -595,14 +594,6 @@ static int create_test_expo(struct unit_test_state *uts, struct expo **expp, ut_assert(id > 0); ut_assertok(scene_obj_set_bbox(scn, OBJ_BOX, 500, 200, 1000, 350)); - id = scene_texted(scn, "editor", OBJ_TEXTED, STR_TEXTED, NULL); - ut_assert(id > 0); - ut_assertok(scene_obj_set_bbox(scn, OBJ_TEXTED, 100, 200, 400, 650)); - ut_assertok(expo_edit_str(exp, STR_TEXTED, &orig, &text)); - - abuf_printf(text, "This\nis the initial contents of the text editor " - "but it is quite likely that more will be added later"); - /* * Add an extra text object that overlaps with OBJ_TEXT to test reverse * search order. OBJ_TEXT is at (400, 100), so let's add one nearby @@ -732,17 +723,17 @@ static int expo_render_image(struct unit_test_state *uts) /* render it */ expo_set_scene_id(exp, SCENE1); ut_assertok(expo_render(exp)); - ut_asserteq(19065, video_compress_fb(uts, dev, false)); + ut_asserteq(15711, video_compress_fb(uts, dev, false)); ut_asserteq(0, scn->highlight_id); ut_assertok(scene_arrange(scn)); ut_asserteq(0, scn->highlight_id); ut_assertok(expo_render(exp)); - ut_asserteq(20707, video_compress_fb(uts, dev, false)); + ut_asserteq(17342, video_compress_fb(uts, dev, false)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(20707, video_compress_fb(uts, dev, false)); + ut_asserteq(17342, video_compress_fb(uts, dev, false)); scene_set_highlight_id(scn, OBJ_MENU); ut_asserteq(OBJ_MENU, scn->highlight_id); @@ -754,7 +745,7 @@ static int expo_render_image(struct unit_test_state *uts) ut_assert(!(obj->flags & SCENEOF_HIDE)); ut_assertok(expo_render(exp)); - ut_asserteq(20707, video_compress_fb(uts, dev, false)); + ut_asserteq(17342, video_compress_fb(uts, dev, false)); /* move down */ ut_assertok(expo_send_key(exp, BKEY_DOWN)); @@ -767,12 +758,9 @@ static int expo_render_image(struct unit_test_state *uts) ut_asserteq(ITEM2, scene_menu_get_cur_item(scn, OBJ_MENU)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(19953, video_compress_fb(uts, dev, false)); + ut_asserteq(16637, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); - /* hide the text editor since the following tests don't need it */ - scene_obj_set_hide(scn, OBJ_TEXTED, true); - /* do some alignment checks */ ut_assertok(scene_obj_set_halign(scn, OBJ_TEXT3, SCENEOA_CENTRE)); ut_assertok(expo_render(exp)); @@ -1430,13 +1418,13 @@ static int expo_render_textline(struct unit_test_state *uts) expo_set_scene_id(exp, SCENE1); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(21007, video_compress_fb(uts, dev, false)); + ut_asserteq(17714, video_compress_fb(uts, dev, false)); /* highlight the textline and re-render */ scene_set_highlight_id(scn, OBJ_TEXTLINE); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(22693, video_compress_fb(uts, dev, false)); + ut_asserteq(19382, video_compress_fb(uts, dev, false)); /* open the textline and re-render */ ut_assertok(scene_set_open(scn, OBJ_TEXTLINE, true)); @@ -1444,13 +1432,13 @@ static int expo_render_textline(struct unit_test_state *uts) ut_assertok(expo_render(exp)); /* the cursor should be at the end */ - ut_asserteq(22695, video_compress_fb(uts, dev, false)); + ut_asserteq(19347, video_compress_fb(uts, dev, false)); /* send a keypress to add a character */ ut_assertok(expo_send_key(exp, 'a')); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(22818, video_compress_fb(uts, dev, false)); + ut_asserteq(19524, video_compress_fb(uts, dev, false)); /* move cursor left 3 times */ ut_assertok(expo_send_key(exp, CTL_CH('b'))); @@ -1461,7 +1449,7 @@ static int expo_render_textline(struct unit_test_state *uts) ut_asserteq_str("sample hopwinda", abuf_data(&tline->buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(22884, video_compress_fb(uts, dev, false)); + ut_asserteq(19552, video_compress_fb(uts, dev, false)); ut_assertok(expo_send_key(exp, CTL_CH('b'))); ut_assertok(expo_send_key(exp, CTL_CH('b'))); @@ -1473,7 +1461,7 @@ static int expo_render_textline(struct unit_test_state *uts) ut_asserteq_str("sample hopwinda", abuf_data(&tline->buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(22915, video_compress_fb(uts, dev, false)); + ut_asserteq(19570, video_compress_fb(uts, dev, false)); /* delete a character at the cursor */ ut_assertok(expo_send_key(exp, CTL_CH('d'))); @@ -1484,7 +1472,7 @@ static int expo_render_textline(struct unit_test_state *uts) ut_asserteq_str("sample hopwnda", abuf_data(&tline->buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(22856, video_compress_fb(uts, dev, false)); + ut_asserteq(19505, video_compress_fb(uts, dev, false)); /* close the textline with Enter (BKEY_SELECT) */ ut_assertok(expo_send_key(exp, BKEY_SELECT)); @@ -1498,7 +1486,7 @@ static int expo_render_textline(struct unit_test_state *uts) ut_asserteq_str("sample hopwnda", abuf_data(&tline->buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(22839, video_compress_fb(uts, dev, false)); + ut_asserteq(19543, video_compress_fb(uts, dev, false)); abuf_uninit(&buf); abuf_uninit(&logo_copy); @@ -1508,3 +1496,42 @@ static int expo_render_textline(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(expo_render_textline, UTF_DM | UTF_SCAN_FDT | UTF_NO_SILENT); + +/* Check rendering a textedit */ +static int expo_render_textedit(struct unit_test_state *uts) +{ + struct scene_obj_txtedit *ted; + struct scene_obj_menu *menu; + struct abuf buf, logo_copy; + struct abuf orig, *text; + struct scene *scn; + struct udevice *dev; + struct expo *exp; + int id; + + ut_assertok(create_test_expo(uts, &exp, &scn, &menu, &buf, &logo_copy)); + dev = exp->display; + + id = scene_texted(scn, "texted", OBJ_TEXTED, STR_TEXTED, &ted); + ut_asserteq(OBJ_TEXTED, id); + ut_assertok(scene_obj_set_bbox(scn, OBJ_TEXTED, 100, 200, 400, 300)); + ut_assertok(scene_txted_set_font(scn, OBJ_TEXTED, + "nimbus_sans_l_regular", 20)); + ut_assertok(expo_edit_str(exp, STR_TEXTED, &orig, &text)); + + abuf_printf(text, "This\nis the initial contents of the text editor " + "but it is quite likely that more will be added later"); + + expo_set_scene_id(exp, SCENE1); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(19601, video_compress_fb(uts, dev, false)); + + abuf_uninit(&buf); + abuf_uninit(&logo_copy); + + expo_destroy(exp); + + return 0; +} +BOOTSTD_TEST(expo_render_textedit, UTF_DM | UTF_SCAN_FDT | UTF_NO_SILENT);