[PATCH 1/2] kernel32/tests: Add tests for SetCurrentConsoleFontEx
Hugh McMaster
hugh.mcmaster at outlook.com
Thu Dec 2 05:50:36 CST 2021
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
Changes:
- Simplify tests
dlls/kernel32/tests/console.c | 68 ++++++++++++++++++++++++++++++++++-
1 file changed, 67 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 8b5abfa2da9..a39a637f6ca 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -3554,7 +3554,7 @@ static void test_GetCurrentConsoleFontEx(HANDLE std_output)
static void test_SetCurrentConsoleFontEx(HANDLE std_output)
{
- CONSOLE_FONT_INFOEX orig_cfix, cfix;
+ CONSOLE_FONT_INFOEX orig_cfix, cfix, tmp;
BOOL ret;
HANDLE pipe1, pipe2;
HANDLE std_input = GetStdHandle(STD_INPUT_HANDLE);
@@ -3661,6 +3661,72 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output)
todo_wine ok(ret, "got %d, expected non-zero\n", ret);
todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError());
+ /* Request a TrueType font */
+ cfix.cbSize = sizeof(cfix);
+ cfix.nFont = 0;
+ cfix.dwFontSize.X = 0;
+ cfix.FontFamily = TMPF_VECTOR | TMPF_TRUETYPE | FF_MODERN;
+ cfix.FontWeight = FW_NORMAL;
+ lstrcpyW(cfix.FaceName, L"Lucida Console");
+
+ /* Try setting console font information for the current window size */
+ /* Test font height 16 */
+ cfix.dwFontSize.Y = 16;
+ SetLastError(0xdeadbeef);
+ ret = SetCurrentConsoleFontEx(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());
+
+ tmp.cbSize = sizeof(tmp);
+ ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp);
+ ok(ret, "got %d, expected non-zero\n", ret);
+ ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected %u\n", tmp.dwFontSize.Y, cfix.dwFontSize.Y);
+ todo_wine ok(tmp.FontFamily == cfix.FontFamily, "got %u, expected %u\n", tmp.FontFamily, cfix.FontFamily);
+ ok(tmp.FontWeight == cfix.FontWeight, "got %u, expected %u\n", tmp.FontWeight, cfix.FontWeight);
+
+ /* Test font height 20 */
+ cfix.dwFontSize.Y = 20;
+
+ SetLastError(0xdeadbeef);
+ ret = SetCurrentConsoleFontEx(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());
+
+ ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp);
+ ok(ret, "got %d, expected non-zero\n", ret);
+ todo_wine ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected %u\n", tmp.dwFontSize.Y, cfix.dwFontSize.Y);
+ todo_wine ok(tmp.FontFamily == cfix.FontFamily, "got %u, expected %u\n", tmp.FontFamily, cfix.FontFamily);
+ ok(tmp.FontWeight == cfix.FontWeight, "got %u, expected %u\n", tmp.FontWeight, cfix.FontWeight);
+
+ /* Test invalid font height */
+ cfix.dwFontSize.Y = 0;
+
+ SetLastError(0xdeadbeef);
+ ret = SetCurrentConsoleFontEx(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());
+
+ ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp);
+ ok(ret, "got %d, expected non-zero\n", ret);
+ todo_wine ok(tmp.dwFontSize.Y == 12, "got %u, expected 12\n", tmp.dwFontSize.Y);
+ todo_wine ok(tmp.FontFamily == cfix.FontFamily, "got %u, expected %u\n", tmp.FontFamily, cfix.FontFamily);
+ ok(tmp.FontWeight == cfix.FontWeight, "got %u, expected %u\n", tmp.FontWeight, cfix.FontWeight);
+
+ /* Test with no font weight */
+ cfix.dwFontSize.Y = 16;
+ cfix.FontWeight = 0;
+
+ SetLastError(0xdeadbeef);
+ ret = SetCurrentConsoleFontEx(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());
+
+ ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp);
+ ok(ret, "got %d, expected non-zero\n", ret);
+ ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected %u\n", tmp.dwFontSize.Y, cfix.dwFontSize.Y);
+ todo_wine ok(tmp.FontFamily == cfix.FontFamily, "got %u, expected %u\n", tmp.FontFamily, cfix.FontFamily);
+ ok(tmp.FontWeight == FW_NORMAL, "got %u, expected %u\n", tmp.FontWeight, FW_NORMAL);
+
/* Restore original console font parameters */
SetLastError(0xdeadbeef);
ret = SetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix);
--
2.34.1
More information about the wine-devel
mailing list