Commit 60e467a6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/rebar: Fix index check condition for RB_SHOWBAND.

parent c99c5a41
...@@ -2779,7 +2779,7 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT iBand, BOOL show) ...@@ -2779,7 +2779,7 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT iBand, BOOL show)
{ {
REBAR_BAND *lpBand; REBAR_BAND *lpBand;
if (iBand < 0 || iBand > infoPtr->uNumBands) if (iBand < 0 || iBand >= infoPtr->uNumBands)
return FALSE; return FALSE;
lpBand = REBAR_GetBand(infoPtr, iBand); lpBand = REBAR_GetBand(infoPtr, iBand);
......
...@@ -925,6 +925,36 @@ static HWND create_parent_window(void) ...@@ -925,6 +925,36 @@ static HWND create_parent_window(void)
return hwnd; 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) START_TEST(rebar)
{ {
HMODULE hComctl32; HMODULE hComctl32;
...@@ -948,6 +978,7 @@ START_TEST(rebar) ...@@ -948,6 +978,7 @@ START_TEST(rebar)
test_bandinfo(); test_bandinfo();
test_colors(); test_colors();
test_showband();
if(!is_font_installed("System") || !is_font_installed("Tahoma")) if(!is_font_installed("System") || !is_font_installed("Tahoma"))
{ {
......
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