From patchwork Thu Jan 22 04:11:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1775 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=1769055203; bh=wbFBZIcUOFW5hpDWZ3cGBZULIgygAcHhuzCUNZ7mo7g=; 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=FSLDl5Aou0obPmqEx/+C58lnXheer8MHpccfMTVgD2ZARcZ52A+cEUrHYS+M8gH5l K+SiEXWmL9OBOYKwYPwdpuKoBy8NbiGFuz3041w+1pwuOm24pB5kF/N78qTXnHKqtE dD7F3ioeMs0iYdM+Y5pTWCqq59ZPxf90qxjadIQlugThFKhgS74IgMhrBorJZKLi/E gWCWbKWmmUlqnP4ixd/JS5jdHy/DO1JBPJB1y6fgnYXUuu4zWspZhl6y2ZKO5XsUB3 VYRUkqD2qQ5GuPEbxOT8jQVt+evVTfICjLuTsjhpT93Ce+wZMToLywgrPDWyp0oj0r k+6dp6C5CL88w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 18EA36962C for ; Wed, 21 Jan 2026 21:13:23 -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 MGi5xME2lhQt for ; Wed, 21 Jan 2026 21:13:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055203; bh=wbFBZIcUOFW5hpDWZ3cGBZULIgygAcHhuzCUNZ7mo7g=; 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=FSLDl5Aou0obPmqEx/+C58lnXheer8MHpccfMTVgD2ZARcZ52A+cEUrHYS+M8gH5l K+SiEXWmL9OBOYKwYPwdpuKoBy8NbiGFuz3041w+1pwuOm24pB5kF/N78qTXnHKqtE dD7F3ioeMs0iYdM+Y5pTWCqq59ZPxf90qxjadIQlugThFKhgS74IgMhrBorJZKLi/E gWCWbKWmmUlqnP4ixd/JS5jdHy/DO1JBPJB1y6fgnYXUuu4zWspZhl6y2ZKO5XsUB3 VYRUkqD2qQ5GuPEbxOT8jQVt+evVTfICjLuTsjhpT93Ce+wZMToLywgrPDWyp0oj0r k+6dp6C5CL88w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07E0B69616 for ; Wed, 21 Jan 2026 21:13:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055201; bh=pyzpllo2xlwZniT/4yLXt05B8Ep7a6ko31EY8qMicH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wzk3RwJsPEZFh0z5LclbPUK+TXgBtFHkdrhZLhaUK2Txgt69/6GWXRy+3BPOB9o5R 2ZQatu0frm6INn6uQ3xxaijaT8eUP3AZGkHtZNxguikT/bWS6CKdpZt6t1tfr6qBHi ORPgEJLF/5gqNBZ+DhMThUdAiyEQjz9v4TmMJI2tdfjxr4TgO2q0jDpogCGWKrwQ4V 1dY7XYo+CtttpoZfPe3JMHMqzbeDY7JtWuHycAtG6CzbNP6kJ2T3jkHt4x32BeedNa aFsE6GkWE7r7O1BC6hvKmhYSf/9PSlMjjoMW6UcOWcjAO/hUQTY2Ugg0/Xu2Pfx45q OgTh4zydrUEAQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2C75B69616; Wed, 21 Jan 2026 21:13:21 -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 kgJ38JnXDr7K; Wed, 21 Jan 2026 21:13:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769055197; bh=Lbnb6+mRPoL28FyDcS0TL1D9UmcAoRFLXQt3JZiRDHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I4aWrWiGI941NhKOVDvvMoeHyQOh8TrTmAv8RefvWhpVuZ59+kTdPTFSvfFSyai1Q IEt3Jy6TtRFT7bAs0g7ZcvtB/ESdkwHUaQSRHlt64Un2hCDEs2s62R1f+ktNGNkiAo OdMQ0s1ZRRWtJ8aFkyUyLuhg5EVJWNrLEqcVjzW5eGSvYQb+5mRdS7ZkQENrcGBDLp lRcBopKm3wwnDxLfwMnyclziK6TbahM3eN+RCVIqNXHC23KGQt+MB3gQzw939UB+NH +aDcUyf1utx7/UQusk5PRFDlWqfIf/XOs7Pi+nGMq4tbGNa5ogMItgTXU6jmD52ku+ fP/QDzTLdGkbA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C721E694CC; Wed, 21 Jan 2026 21:13:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 21:11:44 -0700 Message-ID: <20260122041155.174721-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260122041155.174721-1-sjg@u-boot.org> References: <20260122041155.174721-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DAG3H5V573Y2WH7YDP7CL2ZEAKYZIYWZ X-Message-ID-Hash: DAG3H5V573Y2WH7YDP7CL2ZEAKYZIYWZ 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 16/16] test: expo: Add more keypress tests 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 tests for additional keypress operations in expo_render_textedit: - Ctrl-W twice to delete words ("lik" then "quite ") - Ctrl-B four times to move back 4 characters - Ctrl-N to move cursor to next visual line at same x position - Ctrl-A to go to start of buffer - Ctrl-D to delete character at cursor - Ctrl-E to go to end of buffer - Backspace to delete character before cursor Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/expo.c | 63 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/test/boot/expo.c b/test/boot/expo.c index 8006044c9c0..824fd0cca38 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1646,6 +1646,63 @@ static int expo_render_textedit(struct unit_test_state *uts) ut_asserteq(240, ctx->ycur); ut_asserteq(21538, video_compress_fb(uts, dev, false)); + /* delete the word before cursor (deletes "lik" from "likely") */ + ut_assertok(expo_send_key(exp, CTL_CH('w'))); + ut_asserteq(64, ted->tin.cls.num); + ut_asserteq(97, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21462, video_compress_fb(uts, dev, false)); + + /* delete another word (deletes "quite ") */ + ut_assertok(expo_send_key(exp, CTL_CH('w'))); + ut_asserteq(58, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21241, video_compress_fb(uts, dev, false)); + + /* go back 4 characters */ + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_assertok(expo_send_key(exp, CTL_CH('b'))); + ut_asserteq(54, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21225, video_compress_fb(uts, dev, false)); + + /* move cursor to next visual line at same x position */ + ut_assertok(expo_send_key(exp, CTL_CH('n'))); + ut_asserteq(87, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21211, video_compress_fb(uts, dev, false)); + + /* go to start of buffer and delete a character */ + ut_assertok(expo_send_key(exp, CTL_CH('a'))); + ut_asserteq(0, ted->tin.cls.num); + ut_asserteq(91, ted->tin.cls.eol_num); + ut_assertok(expo_send_key(exp, CTL_CH('d'))); + ut_asserteq(0, ted->tin.cls.num); + ut_asserteq(90, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21147, video_compress_fb(uts, dev, false)); + + /* go to end of buffer and backspace */ + ut_assertok(expo_send_key(exp, CTL_CH('e'))); + ut_asserteq(90, ted->tin.cls.num); + ut_asserteq(90, ted->tin.cls.eol_num); + ut_assertok(expo_send_key(exp, '\x7f')); + ut_asserteq(89, ted->tin.cls.num); + ut_asserteq(89, ted->tin.cls.eol_num); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(21083, video_compress_fb(uts, dev, false)); + /* close the textedit with Enter (BKEY_SELECT) */ ut_assertok(expo_send_key(exp, BKEY_SELECT)); ut_assertok(expo_action_get(exp, &act)); @@ -1655,12 +1712,12 @@ static int expo_render_textedit(struct unit_test_state *uts) /* check the textedit is closed and text is changed */ ut_asserteq(0, ted->obj.flags & SCENEOF_OPEN); - ut_asserteq_str("This\nis the initial contents of the text " - "editor but it is quite likely that more will be added latrX", + ut_asserteq_str("his\nis the initial contents of the text " + "editor but it is ely that more will be added latr", abuf_data(&ted->tin.buf)); ut_assertok(scene_arrange(scn)); ut_assertok(expo_render(exp)); - ut_asserteq(21659, video_compress_fb(uts, dev, false)); + ut_asserteq(21230, video_compress_fb(uts, dev, false)); abuf_uninit(&buf); abuf_uninit(&logo_copy);