From 11f059707482e6d26dde3afe8a54f96cc8cc2cac Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Thu, 14 Mar 2019 23:55:26 +0900 Subject: [PATCH] user32/tests: Add Unicode version tests for Edit control margins. Signed-off-by: Akihiro Sagawa Signed-off-by: Alexandre Julliard --- dlls/user32/tests/edit.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index 107f190ebd9..21bd833c63e 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -1561,6 +1561,7 @@ static void test_margins_default(UINT charset) RECT rect; INT margins, expect; const UINT small_margins = MAKELONG(1, 5); + const WCHAR EditW[] = {'E','d','i','t',0}, strW[] = {'W',0}; memset(&lf, 0, sizeof(lf)); lf.lfHeight = -11; @@ -1571,8 +1572,8 @@ static void test_margins_default(UINT charset) hfont = CreateFontIndirectA(&lf); ok(hfont != NULL, "got %p\n", hfont); - /* Big window rectangle */ - hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 5000, 1000, NULL, NULL, NULL, NULL); + /* Unicode version */ + hwnd = CreateWindowExW(0, EditW, strW, WS_POPUP, 0, 0, 5000, 1000, NULL, NULL, NULL, NULL); ok(hwnd != NULL, "got %p\n", hwnd); GetClientRect(hwnd, &rect); ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect)); @@ -1614,6 +1615,31 @@ static void test_margins_default(UINT charset) } DestroyWindow(hwnd); + /* ANSI version */ + hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 5000, 1000, NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "got %p\n", hwnd); + GetClientRect(hwnd, &rect); + ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect)); + + margins = SendMessageA(hwnd, EM_GETMARGINS, 0, 0); + ok(margins == 0, "got %x\n", margins); + SendMessageA(hwnd, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, small_margins); + SendMessageA(hwnd, WM_SETFONT, (WPARAM)hfont, MAKELPARAM(TRUE, 0)); + margins = SendMessageA(hwnd, EM_GETMARGINS, 0, 0); + if (!cjk_charset) + ok(margins == expect, "%d: got %d, %d\n", charset, HIWORD(margins), LOWORD(margins)); + SendMessageA(hwnd, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, small_margins); + SendMessageA(hwnd, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(EC_USEFONTINFO, EC_USEFONTINFO)); + margins = SendMessageA(hwnd, EM_GETMARGINS, 0, 0); + if (!cjk_charset) + ok(margins == expect, "%d: got %d, %d\n", charset, HIWORD(margins), LOWORD(margins)); + else + { + ok(HIWORD(margins) <= HIWORD(expect), "%d: got %d\n", charset, HIWORD(margins)); + ok(LOWORD(margins) <= LOWORD(expect), "%d: got %d\n", charset, LOWORD(margins)); + } + DestroyWindow(hwnd); + DeleteObject(hfont); }