From patchwork Mon Sep 15 12:28:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 325 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=1757939399; bh=dH5xgHAtW/TPe2AQRrLqT3VQ5JZe/SdrCevIcTKxDEQ=; 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=s18fR0qGtw7wscZ7dwOFdgyMLHsHklYQBtZEG4Ud7Hxva0ItzaLhsXoCoklsTR1/Y N2BWShLMmwDEDnaOX2DBaqqGsjYh/zELTSI0mx07rTct2bN5xNh9tdexD+rxUVKKNm KwF9BYW9r5jss56pLiV3gMC7CYZMwKYqa0Rdo8699m/M31oNvmhI+6R9pA7oHOlzFB nhERk/uVdrq53Cf/UfFoyxTjAX4WzjvYHcCUak1wWZ1bdkEgWtYSGUfMp9rr63M81c UM4LEw79ydTbV5ouh4fXtBbOVvpodHiwWZ9Py5TRq68zTgw8TdYRKH8hhh4Ljf86RK EqDdK6m1FDFmA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A766767BCC for ; Mon, 15 Sep 2025 06:29:59 -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 f0mqDcbF0BOY for ; Mon, 15 Sep 2025 06:29:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939399; bh=dH5xgHAtW/TPe2AQRrLqT3VQ5JZe/SdrCevIcTKxDEQ=; 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=s18fR0qGtw7wscZ7dwOFdgyMLHsHklYQBtZEG4Ud7Hxva0ItzaLhsXoCoklsTR1/Y N2BWShLMmwDEDnaOX2DBaqqGsjYh/zELTSI0mx07rTct2bN5xNh9tdexD+rxUVKKNm KwF9BYW9r5jss56pLiV3gMC7CYZMwKYqa0Rdo8699m/M31oNvmhI+6R9pA7oHOlzFB nhERk/uVdrq53Cf/UfFoyxTjAX4WzjvYHcCUak1wWZ1bdkEgWtYSGUfMp9rr63M81c UM4LEw79ydTbV5ouh4fXtBbOVvpodHiwWZ9Py5TRq68zTgw8TdYRKH8hhh4Ljf86RK EqDdK6m1FDFmA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9682C67BAC for ; Mon, 15 Sep 2025 06:29:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939398; bh=ftnKgXK9l6YS07G+q2Ifq7uQapjZkKixFYd0lOuqtT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EqRvA+VsTFtZHlAL0f+kHFFXFXYPch1A0vikw9zfQwXGyejJzTJaOf26mVr1j3Gzj eF93QFJi2n2BQ7SpNtPXG9+W/jmwa8RlxM3bIKhLxL6bbOpB6ia//e/oukJGT07yYu aVDzR6p3+126ZKLPQnMcYL140g0gSPei0CpmOpvhFpXg0EVHFS7RMgo/kFTbjpNEzG jEcJK2Gszj/prAcjklIT85euMjBQpZm+hXOykErFsQ3vFTDh9nMKWC6mO1AS+0eKlf yrvAOK2a+JkHX5G2rJFuCe9gsXfRf4bljMzlOjM9O/TDJHysBGZFv0GQXxVOXWSj43 0RSOmJ7YFhGjA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7922C67BC8; Mon, 15 Sep 2025 06:29:58 -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 n475Zl5_j8vY; Mon, 15 Sep 2025 06:29:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939393; bh=J3YX4RK2ixZsuN9MRdeWY5s+iQvCzCA7KajBq+b0q2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JFbFjHkHcafzlMLIOOkdox0chrG1ymtK1vPzZ0m6lZA7z75/6fUJJc1juex0ni2Tj dmi5P6ZQjFOl81W/EWYfBLRgPsM96UPL8/zDHjqrAfM0YALqtdiXz/Dz6Z3kVGlcEW W7jQLDjw9WlAXEJdko5sSiVY0PDxQ9Wr0def8W6gapOh/PTK8RbAWM7VQ094MHMiFe O/TLo50C5E1+8uYhHLv62fsX76ia3LwP5U4kXiD/nw+GMNJnewbUmBW+cUbty3UUil JTtuvpCbv4LPo2E4LsnS5eDQQJN26kId7TSFDTkI7voZkKPjsX9bPchguUPLcOSJLU ijTXmwgTGvJxA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E7F6767BAC; Mon, 15 Sep 2025 06:29:52 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 15 Sep 2025 06:28:43 -0600 Message-ID: <20250915122905.1217249-11-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: 6VQMZT4KBDWVO6QG32ZFGA7A4RZPBSPI X-Message-ID-Hash: 6VQMZT4KBDWVO6QG32ZFGA7A4RZPBSPI 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 10/23] expo: test: Move expo creation into a separate function 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 In preparation for adding more tests which use a common expo, move the creation code out of expo_render_image() and into a new function. Signed-off-by: Simon Glass --- test/boot/expo.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/test/boot/expo.c b/test/boot/expo.c index 0c7230aee7c..d407ad839f6 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -465,15 +465,25 @@ static int expo_object_menu(struct unit_test_state *uts) } BOOTSTD_TEST(expo_object_menu, UTF_DM | UTF_SCAN_FDT); -/* Check rendering a scene */ -static int expo_render_image(struct unit_test_state *uts) +/** + * create_test_expo() - Create a test expo with menu items for testing + * + * @uts: Unit test state + * @expp: Returns pointer to expo + * @scnp: Returns pointer to scene + * @menup: Returns pointer to menu + * @bufp: Returns pointer to buf (caller must uninit) + * @logo_copyp: Returns pointer to logo_copy (caller must uninit) + * Returns: 0 if OK, -ve on error + */ +static int create_test_expo(struct unit_test_state *uts, struct expo **expp, + struct scene **scnp, struct scene_obj_menu **menup, + struct abuf *bufp, struct abuf *logo_copyp) { struct scene_obj_menu *menu; struct abuf buf, logo_copy; - struct scene *scn, *scn2; + struct scene *scn; struct abuf orig, *text; - struct expo_action act; - struct scene_obj *obj; struct udevice *dev; struct expo *exp; int id, size; @@ -586,6 +596,29 @@ static int expo_render_image(struct unit_test_state *uts) abuf_printf(text, "This\nis the initial contents of the text editor " "but it is quite likely that more will be added later"); + *expp = exp; + *scnp = scn; + *menup = menu; + *bufp = buf; + *logo_copyp = logo_copy; + + return 0; +} + +/* Check rendering a scene */ +static int expo_render_image(struct unit_test_state *uts) +{ + struct scene_obj_menu *menu; + struct abuf buf, logo_copy; + struct scene *scn, *scn2; + struct expo_action act; + struct scene_obj *obj; + struct udevice *dev; + struct expo *exp; + + ut_assertok(create_test_expo(uts, &exp, &scn, &menu, &buf, &logo_copy)); + dev = exp->display; + scn2 = expo_lookup_scene_id(exp, SCENE1); ut_asserteq_ptr(scn, scn2); scn2 = expo_lookup_scene_id(exp, SCENE2);