comctl32/tests: Write-strings warning fix.

This commit is contained in:
Andrew Talbot 2006-05-27 18:14:52 +01:00 committed by Alexandre Julliard
parent 46fc401b05
commit b836d1f7c3
2 changed files with 17 additions and 11 deletions

View File

@ -220,20 +220,21 @@ static void check_auto_format(void)
{
HDITEMA hdiCreate;
HDITEMA hdiRead;
static CHAR text[] = "Test";
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
/* Windows implicitly sets some format bits in INSERTITEM */
/* HDF_STRING is automaticaly set and cleared for no text */
hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
hdiCreate.cxy = 100;
hdiCreate.fmt=HDF_CENTER;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt);
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
hdiCreate.fmt = HDF_CENTER|HDF_STRING;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_CENTER), "HDF_STRING should be automatically cleared (fmt=%x)\n", hdiRead.fmt);
@ -273,20 +274,21 @@ static void check_auto_fields(void)
{
HDITEMA hdiCreate;
HDITEMA hdiRead;
static CHAR text[] = "Test";
LRESULT res;
/* Windows stores the format, width, lparam even if they are not in the item's mask */
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT;
hdiCreate.cxy = 100;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
addReadDelItem(hWndHeader, &hdiCreate, HDI_WIDTH, &hdiRead);
TEST_GET_ITEMCOUNT(6);
ok(hdiRead.cxy == hdiCreate.cxy, "cxy should be automatically set\n");
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
hdiCreate.lParam = 0x12345678;
addReadDelItem(hWndHeader, &hdiCreate, HDI_LPARAM, &hdiRead);
TEST_GET_ITEMCOUNT(6);
@ -294,7 +296,7 @@ static void check_auto_fields(void)
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
hdiCreate.fmt = HDF_STRING|HDF_CENTER;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
TEST_GET_ITEMCOUNT(6);
@ -303,7 +305,7 @@ static void check_auto_fields(void)
/* others fields are not set */
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
addReadDelItem(hWndHeader, &hdiCreate, HDI_BITMAP, &hdiRead);
TEST_GET_ITEMCOUNT(6);
@ -313,7 +315,7 @@ static void check_auto_fields(void)
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_IMAGE;
hdiCreate.iImage = 17;
hdiCreate.pszText = "Test";
hdiCreate.pszText = text;
addReadDelItem(hWndHeader, &hdiCreate, HDI_TEXT, &hdiRead);
TEST_GET_ITEMCOUNT(6);
ok(hdiRead.pszText==NULL, "pszText shouldn't be automatically set\n");
@ -324,13 +326,14 @@ static void check_auto_fields(void)
static void check_mask()
{
HDITEMA hdi;
static CHAR text[] = "ABC";
LRESULT ret;
/* don't create items if the mask is zero */
ZeroMemory(&hdi, sizeof(hdi));
hdi.mask = 0;
hdi.cxy = 200;
hdi.pszText = "ABC";
hdi.pszText = text;
hdi.fmt = 0;
hdi.iOrder = 0;
hdi.lParam = 17;

View File

@ -57,6 +57,9 @@ create_tabcontrol (DWORD style, DWORD mask)
{
HWND handle;
TCITEM tcNewTab;
static char text1[] = "Tab 1",
text2[] = "Wide Tab 2",
text3[] = "T 3";
handle = CreateWindow (
WC_TABCONTROLA,
@ -71,13 +74,13 @@ create_tabcontrol (DWORD style, DWORD mask)
SendMessage (handle, WM_SETFONT, 0, (LPARAM) hFont);
tcNewTab.mask = mask;
tcNewTab.pszText = "Tab 1";
tcNewTab.pszText = text1;
tcNewTab.iImage = 0;
SendMessage (handle, TCM_INSERTITEM, 0, (LPARAM) &tcNewTab);
tcNewTab.pszText = "Wide Tab 2";
tcNewTab.pszText = text2;
tcNewTab.iImage = 1;
SendMessage (handle, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab);
tcNewTab.pszText = "T 3";
tcNewTab.pszText = text3;
tcNewTab.iImage = 2;
SendMessage (handle, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab);