aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt2018-04-29 16:24:26 +0200
committerAlexander Graf2018-06-03 15:27:20 +0200
commitf2431415d6ae920995a717b1e1bc3f57d53938b5 (patch)
tree38d82013315038be83d855856ca02be1c4590893
parent7ca7c3c0f927b91dad3a5b2d185fe79d12872b6d (diff)
efi_selftest: updating the cursor position
The test case for text output is updated to check correct updating of the cursor position. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--lib/efi_selftest/efi_selftest_textoutput.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c
index 3533647fd49..a87f65e197f 100644
--- a/lib/efi_selftest/efi_selftest_textoutput.c
+++ b/lib/efi_selftest/efi_selftest_textoutput.c
@@ -23,6 +23,13 @@ static int execute(void)
size_t background;
size_t attrib;
efi_status_t ret;
+ s16 col;
+ u16 cr[] = { 0x0d, 0x00 };
+ u16 lf[] = { 0x0a, 0x00 };
+ u16 brahmi[] = { /* 2 Brahmi letters */
+ 0xD804, 0xDC05,
+ 0xD804, 0xDC22,
+ 0};
/* SetAttribute */
efi_st_printf("\nColor palette\n");
@@ -42,6 +49,77 @@ static int execute(void)
efi_st_error("TestString failed for ANSI characters\n");
return EFI_ST_FAILURE;
}
+ /* OutputString */
+ ret = con_out->output_string(con_out,
+ L"Testing cursor column update\n");
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for ANSI characters");
+ return EFI_ST_FAILURE;
+ }
+ col = con_out->mode->cursor_column;
+ ret = con_out->output_string(con_out, lf);
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for line feed\n");
+ return EFI_ST_FAILURE;
+ }
+ if (con_out->mode->cursor_column != col) {
+ efi_st_error("Cursor column changed by line feed\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = con_out->output_string(con_out, cr);
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for carriage return\n");
+ return EFI_ST_FAILURE;
+ }
+ if (con_out->mode->cursor_column) {
+ efi_st_error("Cursor column not 0 at beginning of line\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = con_out->output_string(con_out, L"123");
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for ANSI characters\n");
+ return EFI_ST_FAILURE;
+ }
+ if (con_out->mode->cursor_column != 3) {
+ efi_st_error("Cursor column not incremented properly\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = con_out->output_string(con_out, L"\b");
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for backspace\n");
+ return EFI_ST_FAILURE;
+ }
+ if (con_out->mode->cursor_column != 2) {
+ efi_st_error("Cursor column not decremented properly\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = con_out->output_string(con_out, L"\b\b");
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for backspace\n");
+ return EFI_ST_FAILURE;
+ }
+ if (con_out->mode->cursor_column) {
+ efi_st_error("Cursor column not decremented properly\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = con_out->output_string(con_out, L"\b\b");
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_error("OutputString failed for backspace\n");
+ return EFI_ST_FAILURE;
+ }
+ if (con_out->mode->cursor_column) {
+ efi_st_error("Cursor column decremented past zero\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = con_out->output_string(con_out, brahmi);
+ if (ret != EFI_ST_SUCCESS) {
+ efi_st_todo("Unicode output not fully supported\n");
+ } else if (con_out->mode->cursor_column != 2) {
+ efi_st_printf("Unicode not handled properly\n");
+ return EFI_ST_FAILURE;
+ }
+ efi_st_printf("\n");
+
return EFI_ST_SUCCESS;
}