Commit 9618aae3 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/tooltips: Fix TTM_GETMARGIN/TTM_SETMARGIN handling.

parent 887db340
...@@ -1010,6 +1010,43 @@ static void test_setinfo(void) ...@@ -1010,6 +1010,43 @@ static void test_setinfo(void)
DestroyWindow(parent2); DestroyWindow(parent2);
} }
static void test_margin(void)
{
RECT r, r1;
HWND hwnd;
DWORD ret;
hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
10, 10, 300, 100,
NULL, NULL, NULL, 0);
ok(hwnd != NULL, "failed to create tooltip wnd\n");
ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0);
ok(!ret, "got %d\n", ret);
SetRect(&r, -1, -1, 1, 1);
ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, (LPARAM)&r);
ok(!ret, "got %d\n", ret);
SetRect(&r1, 0, 0, 0, 0);
ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1);
ok(!ret, "got %d\n", ret);
ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r));
ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0);
ok(!ret, "got %d\n", ret);
SetRect(&r1, 0, 0, 0, 0);
ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1);
ok(!ret, "got %d\n", ret);
ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r));
ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, 0);
ok(!ret, "got %d\n", ret);
DestroyWindow(hwnd);
}
START_TEST(tooltips) START_TEST(tooltips)
{ {
InitCommonControls(); InitCommonControls();
...@@ -1022,4 +1059,5 @@ START_TEST(tooltips) ...@@ -1022,4 +1059,5 @@ START_TEST(tooltips)
test_longtextW(); test_longtextW();
test_track(); test_track();
test_setinfo(); test_setinfo();
test_margin();
} }
...@@ -1323,12 +1323,10 @@ TOOLTIPS_GetDelayTime (const TOOLTIPS_INFO *infoPtr, DWORD duration) ...@@ -1323,12 +1323,10 @@ TOOLTIPS_GetDelayTime (const TOOLTIPS_INFO *infoPtr, DWORD duration)
static LRESULT static LRESULT
TOOLTIPS_GetMargin (const TOOLTIPS_INFO *infoPtr, LPRECT lpRect) TOOLTIPS_GetMargin (const TOOLTIPS_INFO *infoPtr, RECT *rect)
{ {
lpRect->left = infoPtr->rcMargin.left; if (rect)
lpRect->right = infoPtr->rcMargin.right; *rect = infoPtr->rcMargin;
lpRect->bottom = infoPtr->rcMargin.bottom;
lpRect->top = infoPtr->rcMargin.top;
return 0; return 0;
} }
...@@ -1600,12 +1598,10 @@ TOOLTIPS_SetDelayTime (TOOLTIPS_INFO *infoPtr, DWORD duration, INT nTime) ...@@ -1600,12 +1598,10 @@ TOOLTIPS_SetDelayTime (TOOLTIPS_INFO *infoPtr, DWORD duration, INT nTime)
static LRESULT static LRESULT
TOOLTIPS_SetMargin (TOOLTIPS_INFO *infoPtr, const RECT *lpRect) TOOLTIPS_SetMargin (TOOLTIPS_INFO *infoPtr, const RECT *rect)
{ {
infoPtr->rcMargin.left = lpRect->left; if (rect)
infoPtr->rcMargin.right = lpRect->right; infoPtr->rcMargin = *rect;
infoPtr->rcMargin.bottom = lpRect->bottom;
infoPtr->rcMargin.top = lpRect->top;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment