diff options
author | Joursoir <chat@joursoir.net> | 2022-05-04 20:40:17 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-05-04 20:40:49 +0300 |
commit | f979707f1edfc6196119061e733ff1a7c143c795 (patch) | |
tree | 0ac62dd1e2ddd054a26b93e4174a00b38bab99ab /UefiMonitorTest/tests | |
parent | 7e0ef4f0692e4b89fa3bd763900cd38bd56c0187 (diff) | |
download | umt-f979707f1edfc6196119061e733ff1a7c143c795.tar.gz umt-f979707f1edfc6196119061e733ff1a7c143c795.tar.bz2 umt-f979707f1edfc6196119061e733ff1a7c143c795.zip |
add solid colors test
Diffstat (limited to 'UefiMonitorTest/tests')
-rw-r--r-- | UefiMonitorTest/tests/SolidColors.c | 120 | ||||
-rw-r--r-- | UefiMonitorTest/tests/SolidColors.h | 33 |
2 files changed, 153 insertions, 0 deletions
diff --git a/UefiMonitorTest/tests/SolidColors.c b/UefiMonitorTest/tests/SolidColors.c new file mode 100644 index 0000000..14fe23b --- /dev/null +++ b/UefiMonitorTest/tests/SolidColors.c @@ -0,0 +1,120 @@ +#include <Library/DebugLib.h> +#include <Library/HiiLib.h> +#include <Library/MemoryAllocationLib.h> + +#include "SolidColors.h" + +STATIC enum UMT_COLORS CurrentColor = 0; + +VOID +SolidColorsTestInit ( + IN UMT_CONTEXT *Ctx + ) +{ + GRAPHICS_CONTEXT *Graphics = Ctx->Graphics; + + PutRect (Graphics, 0, 0, Graphics->Width, Graphics->Height, &gUmtColors[CurrentColor]); + if (Ctx->ShowTip) + SolidColorsTestTip (Ctx); +} + +VOID +SolidColorsTestDoit ( + IN UMT_CONTEXT *Ctx + ) +{ + +} + +VOID +SolidColorsTestTip ( + IN UMT_CONTEXT *Ctx + ) +{ + GRAPHICS_CONTEXT *Graphics; + EFI_STRING_ID TitleToken; + EFI_STRING_ID MsgToken; + CHAR16 *Title; + CHAR16 *Msg; + + Graphics = Ctx->Graphics; + + if (Ctx->ShowTip == FALSE) { + // Restore + PutRect (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15, &gUmtColors[CurrentColor]); + 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: + ASSERT (FALSE); + break; + } + + Title = HiiGetString (gUmtHiiHandle, TitleToken, NULL); + Msg = HiiGetString (gUmtHiiHandle, MsgToken, NULL); + + DrawRectWithBorder (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15, + 3, &gUmtColors[UMT_COLOR_WHITE], &gUmtColors[UMT_COLOR_NAVY]); + DrawStringF (Graphics, 25, Graphics->Height - 15 - 94, &gUmtColors[UMT_COLOR_NAVY], Title); + DrawStringF (Graphics, 25, Graphics->Height - 15 - 74, &gUmtColors[UMT_COLOR_BLACK], Msg); + + FreePool (Title); + FreePool (Msg); +} + +VOID +SolidColorsTestChangeValue ( + IN UMT_CONTEXT *Ctx, + IN INT8 ValueStep + ) +{ + if (CurrentColor == 0 && ValueStep < 0) + CurrentColor = UMT_COLOR_BLUE; + else { + CurrentColor += ValueStep; + if (CurrentColor >= UMT_COLOR_BLUE) + CurrentColor = 0; + } + + SolidColorsTestInit (Ctx); +} + +VOID +SolidColorsTestChangeParam ( + IN UMT_CONTEXT *Ctx, + IN INT8 ParamStep + ) +{ + +} + +VOID +SolidColorsTestChangeVar ( + IN UMT_CONTEXT *Ctx, + IN INT8 VariableStep // -1, +1 + ) +{ + +} diff --git a/UefiMonitorTest/tests/SolidColors.h b/UefiMonitorTest/tests/SolidColors.h new file mode 100644 index 0000000..a4d7f72 --- /dev/null +++ b/UefiMonitorTest/tests/SolidColors.h @@ -0,0 +1,33 @@ +#ifndef UMT_SOLID_COLORS_TEST_H +#define UMT_SOLID_COLORS_TEST_H + +#include "UefiMonitorTest.h" + +VOID +SolidColorsTestInit ( + IN UMT_CONTEXT *Ctx + ); + +VOID +SolidColorsTestDoit ( + IN UMT_CONTEXT *Ctx + ); + +VOID +SolidColorsTestTip ( + IN UMT_CONTEXT *Ctx + ); + +VOID +SolidColorsTestChangeParam ( + IN UMT_CONTEXT *Ctx, + IN INT8 ParamStep + ); + +VOID +SolidColorsTestChangeValue ( + IN UMT_CONTEXT *Ctx, + IN INT8 ValueStep + ); + +#endif /* UMT_SOLID_COLORS_TEST_H */ |