comctl32/tab: Add a test for TCM_SETITEMEXTRA.

This commit is contained in:
Nikolay Sivov 2010-09-28 01:40:32 +04:00 committed by Alexandre Julliard
parent 70843e4f34
commit 1b2f7517ee
2 changed files with 39 additions and 8 deletions

View File

@ -3190,15 +3190,8 @@ TAB_SetItemExtra (TAB_INFO *infoPtr, INT cbInfo)
{
TRACE("(%p %d)\n", infoPtr, cbInfo);
if (cbInfo <= 0)
return FALSE;
if (cbInfo < 0 || infoPtr->uNumItem) return FALSE;
if (infoPtr->uNumItem)
{
/* FIXME: MSDN says this is not allowed, but this hasn't been verified */
return FALSE;
}
infoPtr->cbInfo = cbInfo;
return TRUE;
}

View File

@ -1196,6 +1196,43 @@ static void test_delete_selection(HWND parent_wnd)
DestroyWindow(hTab);
}
static void test_TCM_SETITEMEXTRA(HWND parent_wnd)
{
HWND hTab;
DWORD ret;
hTab = CreateWindowA(
WC_TABCONTROLA,
"TestTab",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | TCS_FIXEDWIDTH,
10, 10, 300, 100,
parent_wnd, NULL, NULL, 0);
/* zero is valid size too */
ret = SendMessageA(hTab, TCM_SETITEMEXTRA, 0, 0);
if (ret == FALSE)
{
win_skip("TCM_SETITEMEXTRA not supported\n");
DestroyWindow(hTab);
return;
}
ret = SendMessageA(hTab, TCM_SETITEMEXTRA, -1, 0);
ok(ret == FALSE, "got %d\n", ret);
ret = SendMessageA(hTab, TCM_SETITEMEXTRA, 2, 0);
ok(ret == TRUE, "got %d\n", ret);
DestroyWindow(hTab);
/* it's not possible to change extra data size for control with tabs */
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, 4);
ok(hTab != NULL, "Failed to create tab control\n");
ret = SendMessageA(hTab, TCM_SETITEMEXTRA, 2, 0);
ok(ret == FALSE, "got %d\n", ret);
DestroyWindow(hTab);
}
START_TEST(tab)
{
HWND parent_wnd;
@ -1240,6 +1277,7 @@ START_TEST(tab)
test_delete_focus(parent_wnd);
test_delete_selection(parent_wnd);
test_removeimage(parent_wnd);
test_TCM_SETITEMEXTRA(parent_wnd);
DestroyWindow(parent_wnd);
}