From: Jacob Czekalla jczekalla@codeweavers.com
--- dlls/user32/tests/edit.c | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index bbde9b16616..47472ea4634 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -3426,6 +3426,55 @@ static void test_dbcs_WM_CHAR(void) } }
+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, 994}}, + {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, 994}} + }; + + 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) { BOOL b; @@ -3464,6 +3513,7 @@ START_TEST(edit) test_EM_GETLINE(); test_wordbreak_proc(); test_dbcs_WM_CHAR(); + test_format_rect();
UnregisterWindowClasses(); }