Commit 31be5005 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: toolbar: Test and fix invalid indexes passed in TB_ISBUTTON*.

parent 648f7b1d
......@@ -147,6 +147,15 @@ static void basic_test(void)
ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
ok(!SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 not pressed\n");
ok(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 1008, 0), "B3 pressed\n");
/* tests with invalid index */
compare(SendMessage(hToolbar, TB_ISBUTTONCHECKED, 0xdeadbeef, 0), -1L, "%ld");
compare(SendMessage(hToolbar, TB_ISBUTTONPRESSED, 0xdeadbeef, 0), -1L, "%ld");
compare(SendMessage(hToolbar, TB_ISBUTTONENABLED, 0xdeadbeef, 0), -1L, "%ld");
compare(SendMessage(hToolbar, TB_ISBUTTONINDETERMINATE, 0xdeadbeef, 0), -1L, "%ld");
compare(SendMessage(hToolbar, TB_ISBUTTONHIGHLIGHTED, 0xdeadbeef, 0), -1L, "%ld");
compare(SendMessage(hToolbar, TB_ISBUTTONHIDDEN, 0xdeadbeef, 0), -1L, "%ld");
DestroyWindow(hToolbar);
}
......
......@@ -3840,7 +3840,7 @@ TOOLBAR_IsButtonChecked (HWND hwnd, WPARAM wParam, LPARAM lParam)
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return FALSE;
return -1;
return (infoPtr->buttons[nIndex].fsState & TBSTATE_CHECKED);
}
......@@ -3854,7 +3854,7 @@ TOOLBAR_IsButtonEnabled (HWND hwnd, WPARAM wParam, LPARAM lParam)
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return FALSE;
return -1;
return (infoPtr->buttons[nIndex].fsState & TBSTATE_ENABLED);
}
......@@ -3868,7 +3868,7 @@ TOOLBAR_IsButtonHidden (HWND hwnd, WPARAM wParam, LPARAM lParam)
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return TRUE;
return -1;
return (infoPtr->buttons[nIndex].fsState & TBSTATE_HIDDEN);
}
......@@ -3882,7 +3882,7 @@ TOOLBAR_IsButtonHighlighted (HWND hwnd, WPARAM wParam, LPARAM lParam)
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return FALSE;
return -1;
return (infoPtr->buttons[nIndex].fsState & TBSTATE_MARKED);
}
......@@ -3896,7 +3896,7 @@ TOOLBAR_IsButtonIndeterminate (HWND hwnd, WPARAM wParam, LPARAM lParam)
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return FALSE;
return -1;
return (infoPtr->buttons[nIndex].fsState & TBSTATE_INDETERMINATE);
}
......@@ -3910,7 +3910,7 @@ TOOLBAR_IsButtonPressed (HWND hwnd, WPARAM wParam, LPARAM lParam)
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
if (nIndex == -1)
return FALSE;
return -1;
return (infoPtr->buttons[nIndex].fsState & TBSTATE_PRESSED);
}
......
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