summaryrefslogtreecommitdiff
path: root/test/boot/expo.c
AgeCommit message (Collapse)Author
2025-05-30expo: Support highlighting menu itemsSimon Glass
Expo normally uses a pointer to show the current item. Add support for highlighting as well, since this makes it easier for the user to see the current item. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Begin implementation of a text editorSimon Glass
It is useful to be able to edit text, e.g. to allow the user to edit the environment or the command-line arguments for the OS. Add the beginnings of an implementation. Future work is needed to finish this: keypress handling and scrolling. For now it just displays the text. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Support object alignmentSimon Glass
Add support for left, right and centred alignment for text, in the horizontal dimension. Also support top, bottom and centred in the vertical dimension, for the text object as a whole. Alignment is not yet implemented for images. It has no meaning for menus. A textline object uses a text object internally, so alignment is supported there. Provide some documentation to explain how objects are positioned. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Implement a boxSimon Glass
It is useful to be able to draw a box around elements in the menu. Add support for an unfilled box with a selectable thickness. Note that there is no support for selecting the colour for any expo objects yet. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Support rendering multiple lines of textSimon Glass
Use the measurement info to write each line of text separately, thus respecting word-wrapping and newlines. Fix up the comment for scene_obj_render() while we are here. Since a lineedit does not support alignment, add a special case to just display the text if there is no measurement. This happens assuming the lineedit is initially empty. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Check the screen contents after renderingSimon Glass
Make sure that the screen contents are as expected when a scene has been rendered. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Allow strings to be editableSimon Glass
In some cases dynamic text is needed, e.g. for a menu countdown. Add a function which handles this, allowing the caller to take control of the text that is shown on each render. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Create a struct for generic text attributesSimon Glass
In preparation for adding more text types, refactor the common fields into a new structure. This will allow common code to be used. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Line up all menu objectsSimon Glass
At present labels are lined up vertically. Do the same with keys and descriptions, since it looks nicer. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Support setting the size and bounds of an objectSimon Glass
Add a function to allow the size of an object to be set independently of its position. Also add a function to permit the object's bounding box to be set independently of its dimensions. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Separate dimensions from the bounding boxSimon Glass
At present each object has a width and height and the bounding box is implicit in that. This is not flexible enough to handle objects which are larger than their contents might need. For example, when centring a text object we might want to have it stretch across the whole width of the display even if the text itself does not need that much space. Create a new 'dimensions' field and convert the existing width/height into x1/y1 coordinates. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Rename x and y in struct scene_obj_bboxSimon Glass
These coordinates are the top left values, so rename them to x0 and y0 in preparation for changing the width and height to x1 and y1 Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Rename scene_dim to scene_obj_bboxSimon Glass
At present we assume that each object is a simple box and that it fills the whole box. This is quite limiting for text objects, which we may want to centre within the box. We need a position within the box where drawing starts. Rename the scene_dim struct to indicate that it is a bounding box. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Adjust how menu items are highlightedSimon Glass
At present when the user moves to a new menu item, the menu code handles this immediately. This means it is not possible to use an expo action to effect the same change. Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action(). Expand the test to cover this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-30expo: Provide access to the current menu itemSimon Glass
Add functions to allow a caller to find out the current menu item and to select a different one. Update the event handling so that an attempt to change the current item (e.g. by pressing the up-arrow key) is reported to the caller, since this may be used to cancel an autoboot timeout. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-11test: Drop suites.hSimon Glass
This file is empty now. Remove it and its uses. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18expo: Drop scene_title_set()Simon Glass
This function is really just an assignment, so serves no useful purpose. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18expo: Allow menu items to have valuesSimon Glass
At present menu items are stored according to their sequence number in the menu. In some cases we may want to have holes in that sequence, or not use a sequence at all. Add a new 'value' property for menu items. This will be used for reading and writing, if present. If there is no 'value' property, then the normal sequence number will be used instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18expo: Use standard numbering for save and discardSimon Glass
Set aside some expo IDs for 'save' and 'discard' buttons. This avoids needing to store the IDs for these. Adjust the documentation and expo tool for the new EXPOID_BASE_ID value. Ignore these objects when saving and loading the cedit, since they do not contain real data. Adjust 'cedit run' to return failure when the user exits the expo without saving. Update the test for this change as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18expo: Set the initial next_id to 1Simon Glass
If expo_set_dynamic_start() is never called, the first scene created will have an ID of 0, which is invalid. Correct this by setting a default value. Add a test to check this. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-30list: use list_count_nodes() to count list entriesSughosh Ganu
Use the API function list_count_nodes() to count the number of list entries. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-08-26test: boot: Use UTF_CONSOLE in testsSimon Glass
Set this flag rather than doing things manually in the test. Drop unnecessary calls to console_record_reset_enable() Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-08-26test: Rename unit-test flagsSimon Glass
The UT_TESTF_ macros read as 'unit test test flags' which is not right. Rename to UTF ('unit test flags'). This has the benefit of being shorter, which helps keep UNIT_TEST() declarations on a single line. Give the enum a name and reference it from the UNIT_TEST() macros while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-06test: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from all "test/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-11expo: Update tests to include textlineSimon Glass
Provide test coverage for the new expo object type, including building and reading/writing settings. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: Move cedit test into its own file and tidySimon Glass
Move this test out so it can have its own file. Rename the test to use a cedit_ prefix. This allows us to drop the check for CONFIG_CMD_CEDIT in the test. Also we don't need driver model objects for this test, so drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25expo: Provide a way to iterate through all scene objectsSimon Glass
For some operations it is necessary to process all objects in an expo. Provide an iterator to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Add tests for the configuration editorSimon Glass
Add some simple tests and a helpful script to make the configuration editor easier to set up. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Support building an expo from a description fileSimon Glass
The only way to create an expo at present is by calling the functions to create each object. It is useful to have more data-driven approach, where the objects can be specified in a suitable file format and created from that. This makes testing easier as well. Add support for describing an expo in a devicetree node. This allows more complex tests to be set up, as well as providing an easier format for users. It also provides a better basis for the upcoming configuration editor. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEMSimon Glass
At present we only support a single menu, so all that can be pointed to is the current menu item. Rename this action so that we can also add an action for pointing to an object. This will allow cycling through the objects in a scene. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Move menu-item selection into a functionSimon Glass
The current implementation supports a 'pointer' object which points to the currently highlighted menu item. We want to support highlighting the label of the menu item instead, e.g. with inverse video. In this case we will need to 'unhighlight' the old item and highlight the new one. As a first step, move the pointer logic into a function. This fixes a bug where the item is hidden when it should not be. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Support simple themesSimon Glass
It is a pain to manually set the fonts of all objects to be consistent. Some spacing settings are also better set globally than by manually positioning each object. Add a 'theme' to the expo, to hold this information. For now it includes only the font size. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Set up the width and height of objectsSimon Glass
Provide a way to set the full dimensions of objects, i.e. including the width and height. For menus, calculate the bounding box of all objects in the menu. Set all labels to be the same size, so that highlighting works correct, once implemented. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Use flags for objectsSimon Glass
We currently have just a 'hide' property for each object. In preparation for adding more properties, convert the struct to use a flags value, instead of individual booleans. This is more extensible. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Add width and height to objectsSimon Glass
At present objects only have a position so it is not possible to determine the amount of space they take up on the display. Add width and height properties, using a struct to keep all the dimensions together. For now this is not used. Future work will set up these new properties. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Rename exp_set_text_mode()Simon Glass
Rename this function to match its peers, using the full "expo' prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Avoid automatically arranging the sceneSimon Glass
This should ideally be done once after all scene changes have been made. Require an explicit call when everything is ready. Always arrange after a key it sent, just for convenience. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Convert to using a string ID for the scene titleSimon Glass
This is easier to deal with if it uses the existing string handling, since we will be able to use translations, etc. in the future. Update it to use an ID instead of a string. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16expo: Add basic testsSimon Glass
Add some tests for the expo, including setting up and rendering an expo. Signed-off-by: Simon Glass <sjg@chromium.org>