Mikołaj Zalewski : comctl32: toolbar: The iImage in TBN_GETDISPINFO should be initialized to -1.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 11 07:50:49 CDT 2007
Module: wine
Branch: master
Commit: e66523e19bf17f4b12852ce6d8168a21159fb139
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e66523e19bf17f4b12852ce6d8168a21159fb139
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Tue Jul 10 15:23:05 2007 +0200
comctl32: toolbar: The iImage in TBN_GETDISPINFO should be initialized to -1.
---
dlls/comctl32/tests/toolbar.c | 31 +++++++++++++++++++++++++++++++
dlls/comctl32/toolbar.c | 1 +
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 89e25a2..443e3eb 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -38,6 +38,7 @@ static BOOL g_fBlockHotItemChange;
static BOOL g_fReceivedHotItemChange;
static BOOL g_fExpectedHotItemOld;
static BOOL g_fExpectedHotItemNew;
+static DWORD g_dwExpectedDispInfoMask;
#define check_rect(name, val, exp) ok(val.top == exp.top && val.bottom == exp.bottom && \
val.left == exp.left && val.right == exp.right, "invalid rect (" name ") (%d,%d) (%d,%d) - expected (%d,%d) (%d,%d)\n", \
@@ -57,6 +58,7 @@ static LRESULT MyWnd_Notify(LPARAM lParam)
{
NMHDR *hdr = (NMHDR *)lParam;
NMTBHOTITEM *nmhi;
+ NMTBDISPINFO *nmdisp;
switch (hdr->code)
{
case TBN_HOTITEMCHANGE:
@@ -70,6 +72,15 @@ static LRESULT MyWnd_Notify(LPARAM lParam)
if (g_fBlockHotItemChange)
return 1;
break;
+
+ case TBN_GETDISPINFOA:
+ case TBN_GETDISPINFOW:
+ nmdisp = (NMTBDISPINFOA *)lParam;
+
+ compare(nmdisp->dwMask, g_dwExpectedDispInfoMask, "%x");
+ compare(nmdisp->iImage, -1, "%d");
+ ok(nmdisp->pszText == NULL, "pszText is not NULL\n");
+ break;
}
return 0;
}
@@ -974,6 +985,25 @@ static void test_createtoolbarex()
DestroyWindow(hToolbar);
}
+static void test_dispinfo(void)
+{
+ HWND hToolbar = NULL;
+ const TBBUTTON buttons_disp[] = {
+ {-1, 20, TBSTATE_ENABLED, 0, {0, }, 0, -1},
+ {0, 21, TBSTATE_ENABLED, 0, {0, }, 0, -1},
+ };
+
+ rebuild_toolbar(&hToolbar);
+ SendMessageA(hToolbar, TB_LOADIMAGES, IDB_HIST_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
+ SendMessageA(hToolbar, TB_ADDBUTTONS, 2, (LPARAM)buttons_disp);
+ g_dwExpectedDispInfoMask = 1;
+ /* some TBN_GETDISPINFO tests will be done in MyWnd_Notify function */
+ ShowWindow(hToolbar, SW_SHOW);
+ UpdateWindow(hToolbar);
+ DestroyWindow(hToolbar);
+ g_dwExpectedDispInfoMask = 0;
+}
+
START_TEST(toolbar)
{
@@ -1007,6 +1037,7 @@ START_TEST(toolbar)
test_sizes();
test_getbuttoninfo();
test_createtoolbarex();
+ test_dispinfo();
PostQuitMessage(0);
while(GetMessageA(&msg,0,0,0)) {
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 4b1e552..ec7b99d 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -366,6 +366,7 @@ TOOLBAR_GetBitmapIndex(const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
nmgd.idCommand = btnPtr->idCommand;
nmgd.lParam = btnPtr->dwData;
nmgd.dwMask = TBNF_IMAGE;
+ nmgd.iImage = -1;
TOOLBAR_SendNotify(&nmgd.hdr, infoPtr,
infoPtr->bUnicode ? TBN_GETDISPINFOW : TBN_GETDISPINFOA);
if (nmgd.dwMask & TBNF_DI_SETITEM)
More information about the wine-cvs
mailing list