Commit b6e707ee authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

kernel32/tests: Test whether font information and window size are copied to the new screen buffer.

parent 0a6d0e68
......@@ -973,6 +973,58 @@ static void testScreenBuffer(HANDLE hConOut)
SetConsoleOutputCP(oldcp);
}
static void test_new_screen_buffer_properties(HANDLE hConOut)
{
BOOL ret;
HANDLE hConOut2;
CONSOLE_FONT_INFOEX cfi, cfi2;
CONSOLE_SCREEN_BUFFER_INFO csbi, csbi2;
/* Font information */
cfi.cbSize = cfi2.cbSize = sizeof(CONSOLE_FONT_INFOEX);
ret = GetCurrentConsoleFontEx(hConOut, FALSE, &cfi);
ok(ret, "GetCurrentConsoleFontEx failed: error %u\n", GetLastError());
hConOut2 = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, NULL,
CONSOLE_TEXTMODE_BUFFER, NULL);
ok(hConOut2 != INVALID_HANDLE_VALUE, "CreateConsoleScreenBuffer failed: error %u\n", GetLastError());
ret = GetCurrentConsoleFontEx(hConOut2, FALSE, &cfi2);
ok(ret, "GetCurrentConsoleFontEx failed: error %u\n", GetLastError());
CloseHandle(hConOut2);
ok(cfi2.nFont == cfi.nFont, "Font index should match: "
"got %u, expected %u\n", cfi2.nFont, cfi.nFont);
ok(cfi2.dwFontSize.X == cfi.dwFontSize.X, "Font width should match: "
"got %d, expected %d\n", cfi2.dwFontSize.X, cfi.dwFontSize.X);
ok(cfi2.dwFontSize.Y == cfi.dwFontSize.Y, "Font height should match: "
"got %d, expected %d\n", cfi2.dwFontSize.Y, cfi.dwFontSize.Y);
ok(cfi2.FontFamily == cfi.FontFamily, "Font family should match: "
"got %u, expected %u\n", cfi2.FontFamily, cfi.FontFamily);
ok(cfi2.FontWeight == cfi.FontWeight, "Font weight should match: "
"got %u, expected %u\n", cfi2.FontWeight, cfi.FontWeight);
ok(!lstrcmpW(cfi2.FaceName, cfi.FaceName), "Font name should match: "
"got %s, expected %s\n", wine_dbgstr_w(cfi2.FaceName), wine_dbgstr_w(cfi.FaceName));
/* Display window size */
ret = GetConsoleScreenBufferInfo(hConOut, &csbi);
ok(ret, "GetConsoleScreenBufferInfo failed: error %u\n", GetLastError());
hConOut2 = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, NULL,
CONSOLE_TEXTMODE_BUFFER, NULL);
ok(hConOut2 != INVALID_HANDLE_VALUE, "CreateConsoleScreenBuffer failed: error %u\n", GetLastError());
ret = GetConsoleScreenBufferInfo(hConOut2, &csbi2);
ok(ret, "GetConsoleScreenBufferInfo failed: error %u\n", GetLastError());
CloseHandle(hConOut2);
ok(csbi2.srWindow.Left == csbi.srWindow.Left, "Left coordinate should match\n");
ok(csbi2.srWindow.Top == csbi.srWindow.Top, "Top coordinate should match\n");
ok(csbi2.srWindow.Right == csbi.srWindow.Right, "Right coordinate should match\n");
ok(csbi2.srWindow.Bottom == csbi.srWindow.Bottom, "Bottom coordinate should match\n");
}
static void test_new_screen_buffer_color_attributes(HANDLE hConOut)
{
CONSOLE_SCREEN_BUFFER_INFOEX csbi, csbi2;
......@@ -4583,6 +4635,7 @@ START_TEST(console)
testScroll(hConOut, sbi.dwSize);
/* will test sb creation / modification / codepage handling */
if (!test_current) testScreenBuffer(hConOut);
test_new_screen_buffer_properties(hConOut);
test_new_screen_buffer_color_attributes(hConOut);
/* Test waiting for a console handle */
testWaitForConsoleInput(hConIn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment