Hi Hugh,
On 8/16/21 2:27 PM, Hugh McMaster wrote:
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com
dlls/kernel32/tests/console.c | 149 ++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index bd5cad428bc..2097e8e53d3 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3536,6 +3536,154 @@ static void test_GetCurrentConsoleFontEx(HANDLE std_output) ok(cfix.dwFontSize.Y == cfi.dwFontSize.Y, "expected values to match\n"); }
+static void test_SetCurrentConsoleFontEx(HANDLE std_output) +{
- HANDLE hmod;
- BOOL (WINAPI *pGetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *);
- BOOL (WINAPI *pSetCurrentConsoleFontEx)(HANDLE, BOOL, CONSOLE_FONT_INFOEX *);
- CONSOLE_FONT_INFOEX orig_cfix, cfix;
- BOOL ret;
- HANDLE pipe1, pipe2;
- HANDLE std_input = GetStdHandle(STD_INPUT_HANDLE);
- hmod = GetModuleHandleA("kernel32.dll");
- pGetCurrentConsoleFontEx = (void *)GetProcAddress(hmod, "GetCurrentConsoleFontEx");
- pSetCurrentConsoleFontEx = (void *)GetProcAddress(hmod, "SetCurrentConsoleFontEx");
- if (!pGetCurrentConsoleFontEx || !pSetCurrentConsoleFontEx)
- {
win_skip("GetCurrentConsoleFontEx and SetCurrentConsoleFontEx are not available\n");
return;
- }
Those seem to be available since Vista, so you may just link to them directly, there is no need for GetProcAddress.
- cfix.cbSize = sizeof(CONSOLE_FONT_INFOEX);
(...)
- SetLastError(0xdeadbeef);
- ret = pSetCurrentConsoleFontEx(std_output, FALSE, &cfix);
- todo_wine ok(ret, "got %d, expected non-zero\n", ret);
- todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError());
You only initialize cbSize of cfix, so other fields are uninitialized. Maybe those functions accept any input or maybe you're lucky that it works. In any case I would suggest to initialize entire struct to make tests more predictable.
Thanks,
Jacek