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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 16 10:07:57 CST 2007


Module: wine
Branch: master
Commit: 292cb4d2ac07a09aff9a88bf3d793cc8528f5bc8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=292cb4d2ac07a09aff9a88bf3d793cc8528f5bc8

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Tue Jan 16 15:41:44 2007 +0100

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

---

 dlls/comctl32/tests/toolbar.c |   10 ++++++++++
 dlls/comctl32/toolbar.c       |    7 +++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index f1f3187..164644e 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -330,6 +330,16 @@ static void test_add_bitmap(void)
     ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n");
     UpdateWindow(hToolbar);
     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 */
     rebuild_toolbar(&hToolbar);
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 85ada79..2dca16e 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -4489,8 +4489,11 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM
     if (wParam != 0)
         FIXME("wParam is %d. Perhaps image list index?\n", wParam);
 
-    if ((LOWORD(lParam) <= 0) || (HIWORD(lParam)<=0))
-        lParam = MAKELPARAM(16, 15);
+    if (LOWORD(lParam) == 0)
+        lParam = MAKELPARAM(1, HIWORD(lParam));
+
+    if (HIWORD(lParam)==0)
+        lParam = MAKELPARAM(LOWORD(lParam), 1);
 
     if (infoPtr->nNumButtons > 0)
         WARN("%d buttons, undoc increase to bitmap size : %d-%d -> %d-%d\n",




More information about the wine-cvs mailing list