[PATCH v2 2/2] kernel32/tests: Test whether font information and window size are copied to the new screen buffer
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Jul 21 07:24:48 CDT 2021
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
dlls/kernel32/tests/console.c | 53 +++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 6b723c3d6c8..9fa0ce06854 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -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);
--
2.32.0
More information about the wine-devel
mailing list