comctl32/rebar: Fix index check condition for RB_SHOWBAND.

This commit is contained in:
Nikolay Sivov 2010-06-07 01:15:43 +04:00 committed by Alexandre Julliard
parent c99c5a41e9
commit 60e467a6cd
2 changed files with 32 additions and 1 deletions

View File

@ -2779,7 +2779,7 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT iBand, BOOL show)
{
REBAR_BAND *lpBand;
if (iBand < 0 || iBand > infoPtr->uNumBands)
if (iBand < 0 || iBand >= infoPtr->uNumBands)
return FALSE;
lpBand = REBAR_GetBand(infoPtr, iBand);

View File

@ -925,6 +925,36 @@ static HWND create_parent_window(void)
return hwnd;
}
static void test_showband(void)
{
HWND hRebar;
REBARBANDINFOA rbi;
BOOL ret;
hRebar = create_rebar_control();
/* no bands */
ret = SendMessageA(hRebar, RB_SHOWBAND, 0, TRUE);
ok(ret == FALSE, "got %d\n", ret);
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
rbi.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD;
rbi.cx = 200;
rbi.cxMinChild = 100;
rbi.cyMinChild = 30;
rbi.hwndChild = NULL;
SendMessageA(hRebar, RB_INSERTBAND, -1, (LPARAM)&rbi);
/* index out of range */
ret = SendMessageA(hRebar, RB_SHOWBAND, 1, TRUE);
ok(ret == FALSE, "got %d\n", ret);
ret = SendMessageA(hRebar, RB_SHOWBAND, 0, TRUE);
ok(ret == TRUE, "got %d\n", ret);
DestroyWindow(hRebar);
}
START_TEST(rebar)
{
HMODULE hComctl32;
@ -948,6 +978,7 @@ START_TEST(rebar)
test_bandinfo();
test_colors();
test_showband();
if(!is_font_installed("System") || !is_font_installed("Tahoma"))
{