From: Jacob Czekalla jczekalla@codeweavers.com
Wine-Debug: https://bugs.winehq.org/show_bug.cgi?id=56873 --- dlls/comctl32/tests/edit.c | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index bce0215ef19..f430c33523e 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3791,6 +3791,58 @@ static void test_ime(void) DestroyWindow(hwnd); }
+static void test_format_rect(void) +{ + HWND edit; + RECT rect, expected_rect; + int size_flag = -2; + + struct state_tests + { + int style; + int style_ex; + RECT input; + int 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}, 1}, + {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}, 1} + }; + + for (int i = 0; i < ARRAY_SIZE(tests); i++) + { + edit = create_editcontrol(tests[i].style, tests[i].style_ex); + + SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&expected_rect); + 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); + if (EqualRect(&expected_rect, &rect)) + size_flag = 0; + if ((expected_rect.right - expected_rect.left) > (rect.right - rect.left)) + size_flag = -1; + if ((rect.right - rect.left) > (expected_rect.right - expected_rect.left)) + size_flag = 1; + todo_wine ok(size_flag == tests[i].expected, "expected %d, but got %d\n", tests[i].expected, size_flag); + DestroyWindow(edit); + } +} + START_TEST(edit) { ULONG_PTR ctx_cookie; @@ -3838,6 +3890,7 @@ START_TEST(edit) test_change_focus(); test_cue_banner(); test_ime(); + test_format_rect();
UnregisterWindowClasses();