Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- Changes in v2: * Use skip() instead of win_skip() for Unix systems without the test fonts.
dlls/kernel32/tests/console.c | 204 +++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 8b5abfa2da9..355eb296174 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3554,10 +3554,18 @@ 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); + unsigned int i, cp, font_family; + const WCHAR *fonts[] = { L"Courier New", L"Liberation Mono" }; + const WCHAR *face_name; + + font_family = TMPF_VECTOR | TMPF_TRUETYPE | FF_MODERN; + + /* Save current console font information */ + cp = GetConsoleOutputCP();
orig_cfix.cbSize = sizeof(CONSOLE_FONT_INFOEX);
@@ -3651,17 +3659,209 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output) ok(!ret, "got %d, expected 0\n", ret); todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError());
+ /* Try setting console font information for the current window size (maxwindow = FALSE) */ + SetConsoleOutputCP(CP_UTF8); + + cfix.cbSize = sizeof(cfix); + cfix.nFont = 0; + cfix.dwFontSize.X = 8; + cfix.dwFontSize.Y = 16; + cfix.FontFamily = font_family; + cfix.FontWeight = FW_NORMAL; + + tmp.cbSize = sizeof(tmp); + + /* Courier New is available in the console by default from Windows 10 build 1607 */ + for (i = 0; i < ARRAY_SIZE(fonts); i++) + { + face_name = fonts[i]; + lstrcpyW(cfix.FaceName, face_name); + + SetCurrentConsoleFontEx(std_output, FALSE, &cfix); + GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + + if (!lstrcmpW(tmp.FaceName, face_name)) break; + } + + if (i == ARRAY_SIZE(fonts)) + { + SetConsoleOutputCP(cp); + skip("%s not available. Skipping SetCurrentConsoleFontEx tests.\n", wine_dbgstr_w(face_name)); + return; + } + + /* Test font size 8x16 */ 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());
+ memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == cfix.dwFontSize.X, "got %u, expected font width of %u\n", + tmp.dwFontSize.X, cfix.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected font height of %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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size 10x20 */ + cfix.dwFontSize.X = 10; + cfix.dwFontSize.Y = 20; SetLastError(0xdeadbeef); - ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + 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()); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == cfix.dwFontSize.X, "got %u, expected font width of %u\n", + tmp.dwFontSize.X, cfix.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected font height of %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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size 5x12. We pass in 10x12. */ + cfix.dwFontSize.Y = 12; + 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()); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == 5, "got %u, expected font width of 5\n", tmp.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == 12, "got %u, expected font height of 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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size 10x20. Font height is 20. All other metrics are zero. */ + cfix.dwFontSize.X = 0; + cfix.dwFontSize.Y = 20; + cfix.FontFamily = 0; + 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()); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == 10, "got %u, expected font width of 10\n", tmp.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == 20, "got %u, expected font height of 20\n", tmp.dwFontSize.Y); + todo_wine ok(tmp.FontFamily == font_family, "got %u, expected %u\n", tmp.FontFamily, font_family); + ok(tmp.FontWeight == FW_NORMAL, "got %u, expected %u\n", tmp.FontWeight, FW_NORMAL); + ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name)); + + /* Test font size 7x14. We pass in 7x0. */ + cfix = tmp; + cfix.dwFontSize.X = 7; + 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());
+ memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == 5, "got %u, expected font width of 5\n", tmp.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == 12, "got %u, expected font height of 12\n", tmp.dwFontSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size with width and height set to 0x0. */ + cfix.dwFontSize.X = 0; + 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()); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == 5, "got %u, expected font width of 5\n", tmp.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == 12, "got %u, expected font height of 12\n", tmp.dwFontSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test with invalid font face name */ + cfix.dwFontSize.X = 8; + cfix.dwFontSize.Y = 16; + lstrcpyW(cfix.FaceName, L"MissingFont"); + 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()); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == cfix.dwFontSize.X, "got %u, expected font width of %u\n", + tmp.dwFontSize.X, cfix.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected font height of %u\n", + tmp.dwFontSize.Y, cfix.dwFontSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name)); + + /* Test with no font face name */ + cfix.FaceName[0] = 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()); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, FALSE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + todo_wine ok(tmp.dwFontSize.X == cfix.dwFontSize.X, "got %u, expected font width of %u\n", + tmp.dwFontSize.X, cfix.dwFontSize.X); + todo_wine ok(tmp.dwFontSize.Y == cfix.dwFontSize.Y, "got %u, expected font height of %u\n", + tmp.dwFontSize.Y, cfix.dwFontSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name)); + /* Restore original console font parameters */ + SetConsoleOutputCP(cp); + SetLastError(0xdeadbeef); ret = SetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); todo_wine ok(ret, "got %d, expected non-zero\n", ret);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- dlls/kernel32/tests/console.c | 225 +++++++++++++++++++++++++++++++++- 1 file changed, 223 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 355eb296174..186effa35ad 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3554,24 +3554,30 @@ static void test_GetCurrentConsoleFontEx(HANDLE std_output)
static void test_SetCurrentConsoleFontEx(HANDLE std_output) { - CONSOLE_FONT_INFOEX orig_cfix, cfix, tmp; + CONSOLE_FONT_INFOEX orig_cfix, orig_cfix_max, cfix, tmp; BOOL ret; HANDLE pipe1, pipe2; HANDLE std_input = GetStdHandle(STD_INPUT_HANDLE); unsigned int i, cp, font_family; const WCHAR *fonts[] = { L"Courier New", L"Liberation Mono" }; const WCHAR *face_name; + CONSOLE_SCREEN_BUFFER_INFO csbi;
font_family = TMPF_VECTOR | TMPF_TRUETYPE | FF_MODERN;
/* Save current console font information */ cp = GetConsoleOutputCP();
- orig_cfix.cbSize = sizeof(CONSOLE_FONT_INFOEX); + orig_cfix.cbSize = sizeof(orig_cfix); + orig_cfix_max.cbSize = sizeof(orig_cfix_max);
ret = GetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); ok(ret, "got %d, expected non-zero\n", ret);
+ ret = GetCurrentConsoleFontEx(std_output, TRUE, &orig_cfix_max); + ok(ret, "got %d, expected non-zero\n", ret); + + /* Test parameter validity */ cfix = orig_cfix; cfix.cbSize = 0;
@@ -3859,9 +3865,224 @@ static void test_SetCurrentConsoleFontEx(HANDLE std_output) ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name));
+ /* Try setting console font information for the maximum window size (maxwindow = TRUE) */ + memset(&cfix, 0, sizeof(cfix)); + cfix.cbSize = sizeof(cfix); + cfix.nFont = 0; + cfix.dwFontSize.X = 8; + cfix.dwFontSize.Y = 16; + cfix.FontFamily = font_family; + cfix.FontWeight = FW_NORMAL; + lstrcpyW(cfix.FaceName, face_name); + + /* Test font size 8x16 */ + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size 10x20 */ + cfix.dwFontSize.X = 10; + cfix.dwFontSize.Y = 20; + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size 5x12. We pass in 10x12. */ + cfix.dwFontSize.Y = 12; + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size 10x20. Font height is 20. All other metrics are zero. */ + cfix.dwFontSize.X = 0; + cfix.dwFontSize.Y = 20; + cfix.FontFamily = 0; + cfix.FontWeight = 0; + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.Y); + todo_wine ok(tmp.FontFamily == font_family, "got %u, expected %u\n", tmp.FontFamily, font_family); + ok(tmp.FontWeight == FW_NORMAL, "got %u, expected %u\n", tmp.FontWeight, FW_NORMAL); + ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name)); + + /* Test font size 7x14. We pass in 7x0. */ + cfix = tmp; + cfix.dwFontSize.X = 7; + cfix.dwFontSize.Y = 0; + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test font size with width and height set to 0x0. */ + cfix.dwFontSize.X = 0; + cfix.dwFontSize.Y = 0; + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, cfix.FaceName), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(cfix.FaceName)); + + /* Test with invalid font face name */ + cfix.dwFontSize.X = 8; + cfix.dwFontSize.Y = 16; + lstrcpyW(cfix.FaceName, L"MissingFont"); + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name)); + + /* Test with no font face name */ + cfix.FaceName[0] = 0; + SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &cfix); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + ret = GetConsoleScreenBufferInfo(std_output, &csbi); + ok(ret, "got %d, expected non-zero\n", ret); + + memset(&tmp, 0, sizeof(tmp)); + tmp.cbSize = sizeof(tmp); + ret = GetCurrentConsoleFontEx(std_output, TRUE, &tmp); + ok(ret, "got %d, expected non-zero\n", ret); + ok(tmp.nFont == cfix.nFont, "got %u, expected %u\n", tmp.nFont, cfix.nFont); + ok(tmp.dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %u, expected %u\n", + tmp.dwFontSize.X, csbi.dwMaximumWindowSize.X); + ok(tmp.dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %u, expected %u\n", + tmp.dwFontSize.Y, csbi.dwMaximumWindowSize.Y); + 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); + ok(!lstrcmpW(tmp.FaceName, face_name), "got %s, expected %s\n", + wine_dbgstr_w(tmp.FaceName), wine_dbgstr_w(face_name)); + /* Restore original console font parameters */ SetConsoleOutputCP(cp);
+ SetLastError(0xdeadbeef); + ret = SetCurrentConsoleFontEx(std_output, TRUE, &orig_cfix_max); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + SetLastError(0xdeadbeef); ret = SetCurrentConsoleFontEx(std_output, FALSE, &orig_cfix); todo_wine ok(ret, "got %d, expected non-zero\n", ret);