Nikolay Sivov : comctl32/tab: Add a test for TCM_SETITEMEXTRA.
Alexandre Julliard
julliard at winehq.org
Tue Sep 28 11:13:32 CDT 2010
Module: wine
Branch: master
Commit: 1b2f7517ee6f9d7b8a0f64bee8e56f6499566cf0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1b2f7517ee6f9d7b8a0f64bee8e56f6499566cf0
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Sep 28 01:40:32 2010 +0400
comctl32/tab: Add a test for TCM_SETITEMEXTRA.
---
dlls/comctl32/tab.c | 9 +--------
dlls/comctl32/tests/tab.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 8807a11..0ecbb63 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -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;
}
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 6774d51..d74155d 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -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);
}
More information about the wine-cvs
mailing list