Commit 292cb4d2 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: toolbar: Fix the TB_SETBITMAPSIZE for width or height zero (with testcase).

parent 6cc4510b
...@@ -330,6 +330,16 @@ static void test_add_bitmap(void) ...@@ -330,6 +330,16 @@ static void test_add_bitmap(void)
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n"); ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n");
UpdateWindow(hToolbar); UpdateWindow(hToolbar);
CHECK_IMAGELIST(8, 30, 30); CHECK_IMAGELIST(8, 30, 30);
/* when the width or height is zero, set it to 1 */
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0, 0)) == TRUE, "TB_SETBITMAPSIZE failed\n");
UpdateWindow(hToolbar);
CHECK_IMAGELIST(208, 1, 1);
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0, 5)) == TRUE, "TB_SETBITMAPSIZE failed\n");
UpdateWindow(hToolbar);
CHECK_IMAGELIST(208, 1, 5);
ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(5, 0)) == TRUE, "TB_SETBITMAPSIZE failed\n");
UpdateWindow(hToolbar);
CHECK_IMAGELIST(41, 5, 1);
/* the control can add bitmaps to an existing image list */ /* the control can add bitmaps to an existing image list */
rebuild_toolbar(&hToolbar); rebuild_toolbar(&hToolbar);
......
...@@ -4489,8 +4489,11 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -4489,8 +4489,11 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (wParam != 0) if (wParam != 0)
FIXME("wParam is %d. Perhaps image list index?\n", wParam); FIXME("wParam is %d. Perhaps image list index?\n", wParam);
if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0)) if (LOWORD(lParam) == 0)
lParam = MAKELPARAM(16, 15); lParam = MAKELPARAM(1, HIWORD(lParam));
if (HIWORD(lParam)==0)
lParam = MAKELPARAM(LOWORD(lParam), 1);
if (infoPtr->nNumButtons > 0) if (infoPtr->nNumButtons > 0)
WARN("%d buttons, undoc increase to bitmap size : %d-%d -> %d-%d\n", WARN("%d buttons, undoc increase to bitmap size : %d-%d -> %d-%d\n",
......
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