From: Jacob Czekalla jczekalla@codeweavers.com
Wine-Debug: https://bugs.winehq.org/show_bug.cgi?id=56873 --- dlls/comctl32/tests/edit.c | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index bce0215ef19..e32c8aa0fd9 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3791,6 +3791,55 @@ static void test_ime(void) DestroyWindow(hwnd); }
+static void test_format_rect(void) +{ + HWND edit; + RECT rect, expected_rect; + + struct state_tests + { + int style; + int style_ex; + RECT input; + RECT expected; + } + tests[] = + { + {ES_MULTILINE | WS_VISIBLE, 0, {0, 0, 0, 0}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {0, 0, 10, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {1, 1, 10, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {1, 1, 10, 250}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {1, 1, 250, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {1, 1, 10, 1000}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {1, 1, 1000, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, 0, {1, 1, 1000, 1000}, {2, 2, 999, 999}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {0, 0, 0, 0}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {0, 0, 10, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {1, 1, 10, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {1, 1, 10, 250}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {1, 1, 250, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {1, 1, 10, 1000}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {1, 1, 1000, 10}, {0}}, + {ES_MULTILINE | WS_VISIBLE, WS_EX_CLIENTEDGE, {1, 1, 1000, 1000}, {2, 2, 999, 999}} + }; + + for (int i = 0; i < ARRAY_SIZE(tests); i++) + { + edit = create_editcontrol(tests[i].style, tests[i].style_ex); + if (IsRectEmpty(&tests[i].expected)) + SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&expected_rect); + else + expected_rect = tests[i].expected; + SetWindowTextA(edit, "Test Test Test\r\n\r\nTest Test Test Test Test Test Test Test Test Test Test Test\r\n\r\nTest Test Test"); + SendMessageA(edit, EM_SETRECT, 0, (LPARAM)&tests[i].input); + SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&rect); + todo_wine ok (EqualRect(&expected_rect, &rect), "Expected rect {%ld, %ld, %ld, %ld}, but got {%ld, %ld, %ld, %ld}.\n", + expected_rect.left, expected_rect.top, expected_rect.right, expected_rect.bottom, + rect.left, rect.top, rect.right, rect.bottom); + DestroyWindow(edit); + } +} + START_TEST(edit) { ULONG_PTR ctx_cookie; @@ -3838,6 +3887,7 @@ START_TEST(edit) test_change_focus(); test_cue_banner(); test_ime(); + test_format_rect();
UnregisterWindowClasses();