From patchwork Mon Sep 15 12:28:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 337 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=1757939437; bh=uzk38dNdII0G/JWmgdedL57o3zhbcAq7fQ9nUYSuj5E=; 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=jpcY+ULin1K9y6RsyKu0Qt9/TSVrYQpVH30mgA5lm//Ie0o33SUHMyr9318cxLzRS 7Tgqk1gwQy7C5EcQ9RoP+tI40sUnp/5ghl/pHnTCSOvZTQbtCFAwJAbp24ILPXOCNQ /RooCkgmWJePPxvesnKeP4BKkVv81py0x6ZYCy7ZM2rpWayGJysQovQ3y3YGi1NrEP PpYUcFew3kiDmpeUEMFxNmmNSSjP5rAKl6F2bOFl4kO/dR61A/3bqw+w52he+yWRaG nqoJze4k6I4qqTZ2KMHLP/IDTxtP6odFJ/sS3GyNB+0uvFwHEu+idSHLmFC5aeWhjy uHZLXRIVpfIkg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF7BB67BD5 for ; Mon, 15 Sep 2025 06:30:37 -0600 (MDT) 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 Wetcds4fUTEI for ; Mon, 15 Sep 2025 06:30:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939437; bh=uzk38dNdII0G/JWmgdedL57o3zhbcAq7fQ9nUYSuj5E=; 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=jpcY+ULin1K9y6RsyKu0Qt9/TSVrYQpVH30mgA5lm//Ie0o33SUHMyr9318cxLzRS 7Tgqk1gwQy7C5EcQ9RoP+tI40sUnp/5ghl/pHnTCSOvZTQbtCFAwJAbp24ILPXOCNQ /RooCkgmWJePPxvesnKeP4BKkVv81py0x6ZYCy7ZM2rpWayGJysQovQ3y3YGi1NrEP PpYUcFew3kiDmpeUEMFxNmmNSSjP5rAKl6F2bOFl4kO/dR61A/3bqw+w52he+yWRaG nqoJze4k6I4qqTZ2KMHLP/IDTxtP6odFJ/sS3GyNB+0uvFwHEu+idSHLmFC5aeWhjy uHZLXRIVpfIkg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BF81067B44 for ; Mon, 15 Sep 2025 06:30:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939435; bh=P1DYPa7YVvNlByfrb76O9p+og2kR1dr1nMG0+8jr5E0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ToCFB4jfWDPV/b+cELQ7hApC7NGqE1VCUiO4jPYNOT9UFjEvYmj1AQjGG2leccZn0 X8+jrtGkhABR1Zf59zmH+qsXc+iOpUN/Ne5QeovUYJfumO+RL9OuRc668iGYO0kxSo XgRL24SV+xRggzGB+ehjqc5192/WCEE5JgbqUY4ZB8Sl8r08K80j8h5HvSeMcc6LO+ DlRzU9xyG24bXJyO2V5CHDWHDH9U2S8QI0ATw/nOjJtm/Nbj10b2EoNT84PX25RMV4 AMmWNgelWykN5+mZOWesjgM/ZYuJOBtlIvPaPL2hMduN9S1dDOkJQJ+JXKsRQz7CzF kP8O1WCDQTLYg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A567967A04; Mon, 15 Sep 2025 06:30:35 -0600 (MDT) 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 ZozCgB2howPQ; Mon, 15 Sep 2025 06:30:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939431; bh=mryv03BKHB1xwKINUBTy7xTLVjHBWztZ4l/5Sa/0ja4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmRhQDePvb7Dl26fH7CdsFKu+ysfriOYCQabgVVStGYljfme1qsg2cZrJ+vhjYNw7 MzKbDB+xDBaggZTXUKIsOQG7Qak/gsWkBoidTvH+QDyj7Ot0nwWTCNIiAOpXANGVD2 83EiFeJp5i32zTiJ5MWgkdd1HCCz7e+Lg6N0lxR+cZoZkCXC9ms6cFHnHBl7VZRTfa GCsoxJvGNWyhbwRqrkOynBxuf6NbWXQUg+P+pxN5lXEuoaUjIw6ztGPLGb9ll7G+K6 5hnEmYIS90o2iIpXNAKX6x9nPj7gwqftNF+CQb3tfL/xQ51g6yblgKnUiScmpOvrs7 DEPUSJ7UPZnWg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5177F67BE5; Mon, 15 Sep 2025 06:30:31 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 15 Sep 2025 06:28:55 -0600 Message-ID: <20250915122905.1217249-23-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250915122905.1217249-1-sjg@u-boot.org> References: <20250915122905.1217249-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MBNDPREMW6JHWFBG5KRWOOEMA3EBSYHX X-Message-ID-Hash: MBNDPREMW6JHWFBG5KRWOOEMA3EBSYHX 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: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 22/23] expo: Provide a test of cedit mouse behaviour 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 test which checks the various expected features of a cedit when used with a mouse. This includes clicking on menu items and textlines. For now, textedit is not supported. Signed-off-by: Simon Glass --- test/boot/cedit.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 425e4a1fe41..80150a29d37 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -548,3 +548,108 @@ static int cedit_position(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(cedit_position, UTF_DM | UTF_SCAN_FDT); + +/* Check the cedit handles mouse clicks correctly */ +static int cedit_mouse(struct unit_test_state *uts) +{ + struct scene_obj_menu *speed, *loss; + struct scene_obj_textline *mach; + struct video_priv *vid_priv; + extern struct expo *cur_exp; + struct scene_menitem *item; + struct udevice *dev, *con; + struct expo_action act; + struct stdio_dev *sdev; + struct scene *scn; + struct expo *exp; + + ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0)); + + exp = cur_exp; + sdev = stdio_get_by_name("vidconsole"); + ut_assertnonnull(sdev); + con = sdev->priv; + + dev = dev_get_parent(con); + vid_priv = dev_get_uclass_priv(dev); + ut_asserteq(ID_SCENE1, cedit_prepare(exp, dev, &scn)); + + speed = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_NONE); + ut_assertnonnull(speed); + ut_asserteq(ID_CPU_SPEED, scn->highlight_id); + + loss = scene_obj_find(scn, ID_POWER_LOSS, SCENEOBJT_NONE); + ut_assertnonnull(loss); + + mach = scene_obj_find(scn, ID_MACHINE_NAME, SCENEOBJT_NONE); + ut_assertnonnull(mach); + + item = scene_menuitem_find_seq(speed, 0); + + /* click on the title of the CPU speed (should do nothing) */ + ut_assertok(click_check(uts, scn, speed->title_id, EXPOACT_NONE, &act)); + + /* click on CPU speed to open it */ + ut_assertok(click_check(uts, scn, item->label_id, EXPOACT_OPEN, &act)); + ut_asserteq(ID_CPU_SPEED, act.select.id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, speed->obj.flags); + + /* click outside the label to close the menu */ + ut_assertok(scene_send_click(scn, 10, 10, &act)); + ut_asserteq(EXPOACT_CLOSE, act.type); + ut_asserteq(ID_CPU_SPEED, act.select.id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_asserteq(SCENEOF_SIZE_VALID, speed->obj.flags); + + /* click on CPU speed to open it again */ + ut_assertok(click_check(uts, scn, item->label_id, EXPOACT_OPEN, &act)); + ut_asserteq(ID_CPU_SPEED, act.select.id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, speed->obj.flags); + + /* click on the second item (1.5 GHz) */ + item = scene_menuitem_find_seq(speed, 1); + ut_assertnonnull(item); + ut_asserteq(ID_CPU_SPEED_2, item->id); + ut_assertok(click_check(uts, scn, item->label_id, + EXPOACT_POINT_CLOSE, &act)); + ut_asserteq(ID_CPU_SPEED_2, act.select.id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + + /* verify that the second item is now selected and menu is closed */ + ut_asserteq(ID_CPU_SPEED_2, speed->cur_item_id); + ut_asserteq(SCENEOF_SIZE_VALID, speed->obj.flags); + ut_asserteq(ID_CPU_SPEED, scn->highlight_id); + + /* click on the power loss menu to open it */ + item = scene_menuitem_find_seq(loss, 0); + ut_assertnonnull(item); + ut_assertok(click_check(uts, scn, item->label_id, EXPOACT_POINT_OPEN, + &act)); + ut_asserteq(ID_POWER_LOSS, act.select.id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, loss->obj.flags); + + /* click on CPU speed to open it again */ + item = scene_menuitem_find_seq(speed, 0); + ut_assertok(click_check(uts, scn, item->label_id, EXPOACT_REPOINT_OPEN, + &act)); + ut_asserteq(ID_CPU_SPEED, act.select.id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, speed->obj.flags); + + /* click on the lineedit */ + ut_assertok(click_check(uts, scn, mach->edit_id, + EXPOACT_REPOINT_OPEN, &act)); + ut_asserteq(ID_MACHINE_NAME, act.select.id); + ut_asserteq(ID_CPU_SPEED, act.select.prev_id); + ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); + ut_asserteq(ID_CPU_SPEED_2, speed->cur_item_id); + ut_asserteq(ID_MACHINE_NAME, scn->highlight_id); + ut_asserteq(SCENEOF_SIZE_VALID, loss->obj.flags); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, mach->obj.flags); + + return 0; +} +BOOTSTD_TEST(cedit_mouse, UTF_DM | UTF_SCAN_FDT);