Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- dlls/kernel32/tests/console.c | 191 +++++++++++++++++++++++++++++++++- 1 file changed, 189 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 0bce88716d0..4b6c099203c 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3538,10 +3538,17 @@ 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 cp, font_family; + WCHAR face_name[] = L"Courier New"; /* Liberation Mono on Unix systems */ + + font_family = TMPF_VECTOR | TMPF_TRUETYPE | FF_MODERN; + + /* Save current console font information */ + cp = GetConsoleOutputCP();
orig_cfix.cbSize = sizeof(CONSOLE_FONT_INFOEX);
@@ -3635,17 +3642,197 @@ 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; + lstrcpyW(cfix.FaceName, face_name); + + /* 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); + + /* Courier New is available in the console by default from Windows 10 build 1607 */ + if (lstrcmpW(tmp.FaceName, cfix.FaceName)) + { + SetConsoleOutputCP(cp); + win_skip("Courier New not available. Skipping SetCurrentConsoleFontEx tests.\n"); + return; + } + + 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, 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, 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 == 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 4b6c099203c..7450747c334 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3538,23 +3538,29 @@ 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 cp, font_family; WCHAR face_name[] = L"Courier New"; /* Liberation Mono on Unix systems */ + 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;
@@ -3830,9 +3836,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);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101846
Your paranoid android.
=== debiant2 (32 bit Japanese:Japan report) ===
kernel32: console.c:3677: Test failed: Courier New not available. Skipping SetCurrentConsoleFontEx tests.
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101845
Your paranoid android.
=== debiant2 (32 bit Japanese:Japan report) ===
kernel32: console.c:3671: Test failed: Courier New not available. Skipping SetCurrentConsoleFontEx tests.