From: Anton Baskanov Subject: comctl32/tests: Test that buddy control is resized when updown receives UDM_SETBUDDY. Message-Id: <1428165931-26162-1-git-send-email-baskanov@gmail.com> Date: Sat, 4 Apr 2015 22:45:31 +0600 --- dlls/comctl32/tests/updown.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c index cc06f65..a2381ca 100644 --- a/dlls/comctl32/tests/updown.c +++ b/dlls/comctl32/tests/updown.c @@ -520,6 +520,8 @@ static void test_updown_buddy(void) HWND updown, buddyReturn, buddy; WNDPROC proc; DWORD style; + RECT r; + RECT r2; updown = create_updown_control(UDS_ALIGNRIGHT, g_edit); @@ -566,6 +568,34 @@ static void test_updown_buddy(void) DestroyWindow(updown); DestroyWindow(buddy); + + buddy = CreateWindowExA(0, WC_EDITA, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE, + 0, 0, 100, 100, parent_wnd, NULL, GetModuleHandleA(NULL), NULL); + ok(buddy != NULL, "Failed to create edit control\n"); + + updown = CreateWindowA (UPDOWN_CLASSA, 0, WS_CHILD | WS_BORDER | WS_VISIBLE | UDS_ALIGNRIGHT, + 0, 0, 20, 20, parent_wnd, (HMENU)(DWORD_PTR)1, GetModuleHandleA(NULL), 0); + ok(updown != NULL, "Failed to create updown control\n"); + + /* attach the buddy */ + SendMessageA(updown, UDM_SETBUDDY, (WPARAM)buddy, 0); + + /* check that the edit was resized */ + r.right = 0x1234ABCD; + GetClientRect(buddy, &r); + ok(r.right < 100, "Expected width < 100, got %d\n", r.right); + + /* attach the same buddy again */ + SendMessageA(updown, UDM_SETBUDDY, (WPARAM)buddy, 0); + + /* check that the edit was resized further */ + r2.right = 0x1234ABCD; + GetClientRect(buddy, &r2); + ok(r2.right < r.right, "Expected width < %d, got %d\n", r.right, r2.right); + + DestroyWindow(updown); + + DestroyWindow(buddy); } static void test_updown_base(void) -- 2.1.0