Akihiro Sagawa : user32/tests: Add Unicode version tests for Edit control margins.

Alexandre Julliard julliard at winehq.org
Mon Mar 18 16:20:16 CDT 2019


Module: wine
Branch: master
Commit: 11f059707482e6d26dde3afe8a54f96cc8cc2cac
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=11f059707482e6d26dde3afe8a54f96cc8cc2cac

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Thu Mar 14 23:55:26 2019 +0900

user32/tests: Add Unicode version tests for Edit control margins.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 107f190..21bd833 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);
 }
 




More information about the wine-cvs mailing list