Hugh McMaster : kernel32/tests: Add tests for GetConsoleFontSize.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 2 09:47:15 CST 2015
Module: wine
Branch: master
Commit: 77a75d74a27bffc2e9f90838a260721002fb76cb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=77a75d74a27bffc2e9f90838a260721002fb76cb
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Thu Oct 29 23:17:22 2015 +1100
kernel32/tests: Add tests for GetConsoleFontSize.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/console.c | 55 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 454f963..240d9d8 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -2627,6 +2627,60 @@ static void test_GetCurrentConsoleFont(HANDLE std_output)
"got %d, expected %d\n", cfi.dwFontSize.Y, height);
}
+static void test_GetConsoleFontSize(HANDLE std_output)
+{
+ COORD c;
+ DWORD index = 0;
+ CONSOLE_FONT_INFO cfi;
+ RECT r;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ LONG font_width, font_height;
+ HMODULE hmod;
+ DWORD (WINAPI *pGetNumberOfConsoleFonts)(void);
+
+ memset(&c, 10, sizeof(COORD));
+ SetLastError(0xdeadbeef);
+ c = GetConsoleFontSize(NULL, index);
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError());
+ ok(!c.X, "got %d, expected 0\n", c.X);
+ ok(!c.Y, "got %d, expected 0\n", c.Y);
+
+ memset(&c, 10, sizeof(COORD));
+ SetLastError(0xdeadbeef);
+ c = GetConsoleFontSize(GetStdHandle(STD_INPUT_HANDLE), index);
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError());
+ ok(!c.X, "got %d, expected 0\n", c.X);
+ ok(!c.Y, "got %d, expected 0\n", c.Y);
+
+ GetCurrentConsoleFont(std_output, FALSE, &cfi);
+ memset(&c, 10, sizeof(COORD));
+ SetLastError(0xdeadbeef);
+ c = GetConsoleFontSize(std_output, cfi.nFont);
+ ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError());
+ GetClientRect(GetConsoleWindow(), &r);
+ GetConsoleScreenBufferInfo(std_output, &csbi);
+ font_width = (r.right - r.left + 1) / csbi.srWindow.Right;
+ font_height = (r.bottom - r.top + 1) / csbi.srWindow.Bottom;
+ ok(c.X == font_width, "got %d, expected %d\n", c.X, font_width);
+ ok(c.Y == font_height, "got %d, expected %d\n", c.Y, font_height);
+
+ hmod = GetModuleHandleA("kernel32.dll");
+ pGetNumberOfConsoleFonts = (void *)GetProcAddress(hmod, "GetNumberOfConsoleFonts");
+ if (!pGetNumberOfConsoleFonts)
+ {
+ win_skip("GetNumberOfConsoleFonts is not available\n");
+ return;
+ }
+ index = pGetNumberOfConsoleFonts();
+
+ memset(&c, 10, sizeof(COORD));
+ SetLastError(0xdeadbeef);
+ c = GetConsoleFontSize(std_output, index);
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %u, expected 87\n", GetLastError());
+ ok(!c.X, "got %d, expected 0\n", c.X);
+ ok(!c.Y, "got %d, expected 0\n", c.Y);
+}
+
START_TEST(console)
{
static const char font_name[] = "Lucida Console";
@@ -2760,4 +2814,5 @@ START_TEST(console)
test_ReadConsoleOutputCharacterW(hConOut);
test_ReadConsoleOutputAttribute(hConOut);
test_GetCurrentConsoleFont(hConOut);
+ test_GetConsoleFontSize(hConOut);
}
More information about the wine-cvs
mailing list