aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-05-04 20:40:17 +0300
committerJoursoir <chat@joursoir.net>2022-05-04 20:40:49 +0300
commitf979707f1edfc6196119061e733ff1a7c143c795 (patch)
tree0ac62dd1e2ddd054a26b93e4174a00b38bab99ab
parent7e0ef4f0692e4b89fa3bd763900cd38bd56c0187 (diff)
downloadumt-f979707f1edfc6196119061e733ff1a7c143c795.tar.gz
umt-f979707f1edfc6196119061e733ff1a7c143c795.tar.bz2
umt-f979707f1edfc6196119061e733ff1a7c143c795.zip
add solid colors test
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c4
-rw-r--r--UefiMonitorTest/UefiMonitorTest.h1
-rw-r--r--UefiMonitorTest/UefiMonitorTest.inf1
-rw-r--r--UefiMonitorTest/UefiMonitorTestStrings.uni27
-rw-r--r--UefiMonitorTest/tests/SolidColors.c120
-rw-r--r--UefiMonitorTest/tests/SolidColors.h33
6 files changed, 185 insertions, 1 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 29efa8d..a180e63 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -11,10 +11,12 @@
#include "UefiMonitorTest.h"
#include "MainMenu.h"
#include "SettingsMenu.h"
+#include "tests/SolidColors.h"
STATIC CONST UMT_STATE_ACTIONS mStateActions[UMT_STATE_END] = {
{ MainMenuInit, MainMenuDoit, MainMenuTip, MainMenuChangeParam, MainMenuChangeValue },
- { SettingsMenuInit, SettingsMenuDoit, SettingsMenuTip, SettingsChangeParam, SettingsMenuChangeValue }
+ { SettingsMenuInit, SettingsMenuDoit, SettingsMenuTip, SettingsChangeParam, SettingsMenuChangeValue },
+ { SolidColorsTestInit, SolidColorsTestDoit, SolidColorsTestTip, SolidColorsTestChangeParam, SolidColorsTestChangeValue }
};
EFI_HII_HANDLE gUmtHiiHandle = NULL;
diff --git a/UefiMonitorTest/UefiMonitorTest.h b/UefiMonitorTest/UefiMonitorTest.h
index ac8c042..d02ead8 100644
--- a/UefiMonitorTest/UefiMonitorTest.h
+++ b/UefiMonitorTest/UefiMonitorTest.h
@@ -19,6 +19,7 @@ typedef struct {
enum UMT_STATE {
UMT_STATE_MAIN_MENU = 0,
UMT_STATE_SETTINGS,
+ UMT_STATE_SOLID_COLORS_TEST,
UMT_STATE_END
};
diff --git a/UefiMonitorTest/UefiMonitorTest.inf b/UefiMonitorTest/UefiMonitorTest.inf
index 73afa34..142ebdb 100644
--- a/UefiMonitorTest/UefiMonitorTest.inf
+++ b/UefiMonitorTest/UefiMonitorTest.inf
@@ -12,6 +12,7 @@
Graphics.c
MainMenu.c
SettingsMenu.c
+ tests/SolidColors.c
UefiMonitorTestStrings.uni
[Packages]
diff --git a/UefiMonitorTest/UefiMonitorTestStrings.uni b/UefiMonitorTest/UefiMonitorTestStrings.uni
index 0784930..24dfd65 100644
--- a/UefiMonitorTest/UefiMonitorTestStrings.uni
+++ b/UefiMonitorTest/UefiMonitorTestStrings.uni
@@ -30,3 +30,30 @@
"the test or exit from\n"
"application."
+// Test "Solid Colors"
+
+#string STR_SOLID_COLORS_BLACK_TITLE #language en-US "DEFECTIVE PIXELS ON BLACK"
+#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
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 */