From 0a723eefe5a06c7f9b71a5084005f5778c046d87 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Tue, 10 May 2022 01:37:10 +0300 Subject: tests/SolidColors: replace prepared with formatted title --- UefiMonitorTest/UefiMonitorTestStrings.uni | 7 ++----- UefiMonitorTest/tests/SolidColors.c | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/UefiMonitorTest/UefiMonitorTestStrings.uni b/UefiMonitorTest/UefiMonitorTestStrings.uni index 3e37065..a0e1ef1 100644 --- a/UefiMonitorTest/UefiMonitorTestStrings.uni +++ b/UefiMonitorTest/UefiMonitorTestStrings.uni @@ -51,28 +51,25 @@ // Test "Solid Colors" -#string STR_SOLID_COLORS_BLACK_TITLE #language en-US "DEFECTIVE PIXELS ON BLACK" +#string STR_SOLID_COLORS_TITLE #language en-US "DEFECTIVE PIXELS ON %s" + #string STR_SOLID_COLORS_BLACK_MSG #language en-US "Check if there are any defective pixels on the monitor.\n" "All of the pixels should be black. If you see a pixel\n" "illuminated in color, this indicates a continuously\n" "illuminated subpixel.\n" -#string STR_SOLID_COLORS_WHITE_TITLE #language en-US "DEFECTIVE PIXELS ON WHITE" #string STR_SOLID_COLORS_WHITE_MSG #language en-US "Check if there are any defective pixels on the monitor.\n" "All of the pixels should be white. If you see a black\n" "pixel, this indicates a missing pixel.\n" -#string STR_SOLID_COLORS_RED_TITLE #language en-US "DEFECTIVE PIXELS ON RED" #string STR_SOLID_COLORS_RED_MSG #language en-US "Check if there are any defective pixels on the monitor.\n" "All of the pixels should be red. If you see a black\n" "pixel, this indicates a missing red subpixel.\n" -#string STR_SOLID_COLORS_GREEN_TITLE #language en-US "DEFECTIVE PIXELS ON GREEN" #string STR_SOLID_COLORS_GREEN_MSG #language en-US "Check if there are any defective pixels on the monitor.\n" "All of the pixels should be green. If you see a black\n" "pixel, this indicates a missing green subpixel.\n" -#string STR_SOLID_COLORS_BLUE_TITLE #language en-US "DEFECTIVE PIXELS ON BLUE" #string STR_SOLID_COLORS_BLUE_MSG #language en-US "Check if there are any defective pixels on the monitor.\n" "All of the pixels should be blue. If you see a black\n" "pixel, this indicates a missing blue subpixel.\n" diff --git a/UefiMonitorTest/tests/SolidColors.c b/UefiMonitorTest/tests/SolidColors.c index b0ed993..867c385 100644 --- a/UefiMonitorTest/tests/SolidColors.c +++ b/UefiMonitorTest/tests/SolidColors.c @@ -32,9 +32,8 @@ SolidColorsTestTip ( ) { GRAPHICS_CONTEXT *Graphics; - EFI_STRING_ID TitleToken; EFI_STRING_ID MsgToken; - CHAR16 *Title; + CHAR16 *ColorName; CHAR16 *Msg; Graphics = Ctx->Graphics; @@ -45,26 +44,20 @@ SolidColorsTestTip ( return; } - // TODO: or use CatSPrint()? switch (CurrentColor) { case UMT_COLOR_BLACK: - TitleToken = STRING_TOKEN (STR_SOLID_COLORS_BLACK_TITLE); MsgToken = STRING_TOKEN (STR_SOLID_COLORS_BLACK_MSG); break; case UMT_COLOR_WHITE: - TitleToken = STRING_TOKEN (STR_SOLID_COLORS_WHITE_TITLE); MsgToken = STRING_TOKEN (STR_SOLID_COLORS_WHITE_MSG); break; case UMT_COLOR_RED: - TitleToken = STRING_TOKEN (STR_SOLID_COLORS_RED_TITLE); MsgToken = STRING_TOKEN (STR_SOLID_COLORS_RED_MSG); break; case UMT_COLOR_LIME: - TitleToken = STRING_TOKEN (STR_SOLID_COLORS_GREEN_TITLE); MsgToken = STRING_TOKEN (STR_SOLID_COLORS_GREEN_MSG); break; case UMT_COLOR_BLUE: - TitleToken = STRING_TOKEN (STR_SOLID_COLORS_BLUE_TITLE); MsgToken = STRING_TOKEN (STR_SOLID_COLORS_BLUE_MSG); break; default: @@ -72,15 +65,21 @@ SolidColorsTestTip ( break; } - Title = HiiGetString (gUmtHiiHandle, TitleToken, NULL); - Msg = HiiGetString (gUmtHiiHandle, MsgToken, NULL); + ColorName = HiiGetString (gUmtHiiHandle, gUmtColors[CurrentColor].StringId, NULL); + Msg = HiiGetString (gUmtHiiHandle, MsgToken, NULL); DrawRectWithBorder (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15, 3, &gUmtColors[UMT_COLOR_WHITE].Color, &gUmtColors[UMT_COLOR_NAVY].Color); - DrawStringF (Graphics, 25, Graphics->Height - 15 - 94, &gUmtColors[UMT_COLOR_NAVY].Color, Title); + + DrawHiiStringF (Graphics, + 25, + Graphics->Height - 15 - 94, + &gUmtColors[UMT_COLOR_NAVY].Color, + STRING_TOKEN (STR_SOLID_COLORS_TITLE), gUmtHiiHandle, + ColorName); DrawStringF (Graphics, 25, Graphics->Height - 15 - 74, &gUmtColors[UMT_COLOR_BLACK].Color, Msg); - FreePool (Title); + FreePool (ColorName); FreePool (Msg); } -- cgit v1.2.3-18-g5258