efi_selftest: Add box drawing character selftest

UEFI applications rely on Unicode output capability, and might use that
for drawing pseudo-graphical interfaces using Unicode defined box
drawing characters.

Add a simple test to display the most basic box characters, which would
need to be checked manually on the screen for correctness.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Andre Przywara 2024-03-16 22:50:22 +01:00 committed by Heinrich Schuchardt
parent 4dd134c0c7
commit 33b2899811

View file

@ -46,6 +46,20 @@ static int execute(void)
u"U+03C2 \u03C2 - Greek small letter final sigma\n"
u"U+1F19 \u1F19 - Greek capital letter epsilon with dasia\n";
const u16 boxes[] =
u"This should render as four boxes with text\n"
u"\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
u"\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502"
u" left top \u2502 right top \u2502\n\u251c\u2500"
u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
u"\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
u"\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 "
u"left bottom \u2502 right bottom \u2502\n\u2514\u2500\u2500\u2500"
u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534"
u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"
u"\u2500\u2500\u2500\u2500\u2518\n";
/* SetAttribute */
efi_st_printf("\nColor palette\n");
for (foreground = 0; foreground < 0x10; ++foreground) {
@ -140,6 +154,12 @@ static int execute(void)
return EFI_ST_FAILURE;
}
efi_st_printf("\n");
ret = con_out->output_string(con_out, boxes);
if (ret != EFI_ST_SUCCESS) {
efi_st_error("OutputString failed for box drawing chars\n");
return EFI_ST_FAILURE;
}
efi_st_printf("\n");
return EFI_ST_SUCCESS;
}