Provide a way to click on an object and check that the expected action
resulted. Put it in a common file so it can be used by cedit and expo
tests.
Tidy up the include-order in both cedit and expo.
Signed-off-by: Simon Glass <sjg@chromium.org>
For a textline it is possible to click into the edit field. Provide a
function to check whether a position is within this field.
Signed-off-by: Simon Glass <sjg@chromium.org>
To implement mouse clicks we need a way to figure out what the user has
clicked on. As a starting point, create a scene_menu_within() function
which returns the item containing an x, y coordinate.
Provide a helper function in scene.c for use with this. Add a simple
for completeness.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
The bootflow menu creates an image at position -4, expecting that it
will be relative to the right side of the display.
With the recently added alignment feature, this is not supported. Update
the implementation to calculation the correct position instead. Update
the tests to match.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases it is useful to use expo with a mouse (or touchpad). Add
a way to tell expo to find and record a mouse device.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present boxes are not supported in the expo_build format. Also, it is
now possible to draw filled boxes, a recently added feature to the video
API.
Expand the box feature slightly to resolve these two items.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The 'bootflow list' command supports looking at the EFI device-path when
available. Move this piece into a common function so it can be used
elsewhere.
This updates the output from 'bootflow list'.
Signed-off-by: Simon Glass <sjg@chromium.org>
The bootflow contains fields which are connected to the struct. It
should be freed when it is finished with.
It isn't exactly clear why this fixes the problem, which shows up as:
=> ut -f bootstd vbe_test_abrec_oem_norun
Test: bootstd_setup_for_tests: bootstd_common.c
common/dlmalloc.c:793: do_check_free_chunk:
Assertion `next->prev_size == sz' failed.
Fix it by adding a bootflow_free() at the end, which is good practice in
any case.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 07f5b96985 ("boot: test: Add a test for the VBE OS flow")
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.
Most of the test is in C, with just the image-setup done in Python.
Enable the test for non-SPL sandbox builds.
Signed-off-by: Simon Glass <sjg@chromium.org>
Create two new images (vbe0 and vbe1) containing the two types of VBE-OS
setups: with and without an OEM FIT. Put this in a new img/ subdirectory
since the test_ut.py file is getting quite large.
Most of the test is in C, with just the image-setup done in Python.
Signed-off-by: Simon Glass <sjg@chromium.org>
This shows a message for the user. Implement it to keep the user
informed.
Series-to: u-boot
pxe: Support an automatic localboot
It seems that extlinux expects that boards know how to boot a local OS
from attached media. U-Boot currently assumes that boards define a
"localcmd" environment variable to support this. None does.
Provide an automatic means to find a kernel and ramdisk, using common
filenames. This addresses booting on MAAS, at least.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
The current localboot implementation assumes that a 'localcmd'
environment variable is provided, with the instructions to follow. This
may not be included, so provide a fallback in that case.
Add a test image and test as well.
Signed-off-by: Simon Glass <sjg@chromium.org>
The prep_mmc_bootdev() function replaces bootstd's bootdev_order with
its own static version, then returns it.
From then on std->bootdev_order cannot be freed, since it was not
allocated.
So long as the test passes, all is well. But if a test fails, the test
system will try to free std->bootdev_order and this will fail.
Adjust prep_mmc_bootdev() to allocate the boot_dev order, instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
The current priority of BOOTDEVP_4_SCAN_FAST means that virtio is
scanned after SCSI. But virtio-scsi provides higher performance.
It seems better to regard virtio has an internal device, since it is
paravirtualised and thus fast. Change its bootdev priority to
BOOTDEVP_2_INTERNAL_FAST
Disable the virtio-fs feature on sandbox, since the virtio queue is not
not yet supported by the emulator.
Signed-off-by: Simon Glass <sjg@chromium.org>
The existing filesystem support is fairly basic. It supports access to
only one filesystem at a time, does not allow caching, does not have an
equivalent of Linux's VFS and uses global variables to keep track of
which one is in use.
As a starting point to improving this, provide a filesystem uclass. For
now it only includes operations to mount and unmount.
Provide a bootdev so that it is possible to locate bootflows on a
filesystem.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add more enum values so we can use these in the tests, instead of adding
comments. This makes it easier to adjust tests when new hunters are
added.
Signed-off-by: Simon Glass <sjg@chromium.org>
The bootflow_img_find() function does not permit updating the image.
Some bootmeths may want to do this, e.g. to change the address. Add a
function which returns a writeable pointer.
Signed-off-by: Simon Glass <sjg@chromium.org>
The current margin between the menu label and the following objects is
much larger than is needed. Reduce it.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases we want to change the image data used by a scene_img. Add
a function to handle this.
Adjust the BMP function to use a const for the data, since it is not
allowed to change it.
Signed-off-by: Simon Glass <sjg@chromium.org>
While the text is measured correctly, taking account of kerning
information, this is not used when actually displaying the text. This
results in a mismatch between the measurement and the output.
Fix this by adding the kerning offset to each character position.
Signed-off-by: Simon Glass <sjg@chromium.org>
Insets are handled inconsistently at present, since menus use them to
offset the label text, whereas textlines don't. This is done because
menus need the margin to be visible when opened. However this causes an
alignment issue when menus and textlines appear in the same cedit.
Remove the offsets from menus and compensate by adjusting the bounding
boxes used for highlighting and the opened menu.
Line up menu items and textlines vertically and add a style option for
textlines to control how much padding is added.
Add a test to check the positions of objects in a cedit, since this is
more direct than the rendering tests. Add style information so that the
impact can be seen.
Signed-off-by: Simon Glass <sjg@chromium.org>
There is no need to create a new ID and it makes it harder for tests to
locate objects. Use the ID provided in the file, if any.
Signed-off-by: Simon Glass <sjg@chromium.org>
With fixed coordinates it is difficult to create scenes that can work on
any display size. Add a separate 'requested' bounding box for each
object and sync it when required.
With future work, this will allow scaling the nominal coordinates so
that an expo can be rendered correctly on a wider range of displays.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than hard-coding the distance between the labels and the key,
measure the width of the pointer to determine the space needed.
Tweak a few tests according. It isn't possible to get the same result
when the font-size differs.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is possible that positions, styling or even text have changed since
the scene was initially arranged, so recalculate the dimensions of all
objects before arranging the scene.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than drawing the poointer with a hard-coded position elsewhere in
the code, add a field to hold this value.
Move the check for the pointer position up so that the ordering of the
tests matches the order that the fields are dealt with in
scene_menu_arrange()
Signed-off-by: Simon Glass <sjg@chromium.org>
Check the framebuffer immediately after the first render, to make sure
it doesn't change when the scene is arranged a second time.
Check that the logic around menu-item highlight is correct.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rename the existing expo_apply_theme() to expo_setup_theme() and adjust
the former so that it applies a theme which has already been read into
the struct. This will make it easier for tests to check theme
adjustments, since they won't have to put them in a node.
Add the white-on-black property into the theme struct while we are.
Signed-off-by: Simon Glass <sjg@chromium.org>
When testing menu items it is easier to check that the correct preview
is shown if the preview images are different. Make a copy of the image
and modify the palette for the second menu item, so this is obvious.
Signed-off-by: Simon Glass <sjg@chromium.org>
The expo now has all that is needed to apply a suitable theme, so drop
this unnecessary code. Any further tweaks can be added to the generic
expo code.
Signed-off-by: Simon Glass <sjg@chromium.org>
The menu is currently quite basic. Make use of some recently added
features in expo, to:
- Show proper prompts
- Highlight the current item
- Centre text
- Use multi-line text instead of two independent lines
- Put a box around the items
Signed-off-by: Simon Glass <sjg@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>