]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
efi_selftest: Add box drawing character selftest
authorAndre Przywara <andre.przywara@arm.com>
Sat, 16 Mar 2024 21:50:22 +0000 (22:50 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 21 Mar 2024 05:56:13 +0000 (06:56 +0100)
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>
lib/efi_selftest/efi_selftest_textoutput.c

index 21a6e1c842d79468bea44488000186af8925a1f8..889b2678ff55d81d2b60781a320d06b07c57942a 100644 (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;
 }