Commit b836d1f7 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

comctl32/tests: Write-strings warning fix.

parent 46fc401b
...@@ -220,20 +220,21 @@ static void check_auto_format(void) ...@@ -220,20 +220,21 @@ static void check_auto_format(void)
{ {
HDITEMA hdiCreate; HDITEMA hdiCreate;
HDITEMA hdiRead; HDITEMA hdiRead;
static CHAR text[] = "Test";
ZeroMemory(&hdiCreate, sizeof(HDITEMA)); ZeroMemory(&hdiCreate, sizeof(HDITEMA));
/* Windows implicitly sets some format bits in INSERTITEM */ /* Windows implicitly sets some format bits in INSERTITEM */
/* HDF_STRING is automaticaly set and cleared for no text */ /* HDF_STRING is automaticaly set and cleared for no text */
hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT; hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
hdiCreate.cxy = 100; hdiCreate.cxy = 100;
hdiCreate.fmt=HDF_CENTER; hdiCreate.fmt=HDF_CENTER;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt); ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt);
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT; hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
hdiCreate.fmt = HDF_CENTER|HDF_STRING; hdiCreate.fmt = HDF_CENTER|HDF_STRING;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_CENTER), "HDF_STRING should be automatically cleared (fmt=%x)\n", hdiRead.fmt); 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) ...@@ -273,20 +274,21 @@ static void check_auto_fields(void)
{ {
HDITEMA hdiCreate; HDITEMA hdiCreate;
HDITEMA hdiRead; HDITEMA hdiRead;
static CHAR text[] = "Test";
LRESULT res; LRESULT res;
/* Windows stores the format, width, lparam even if they are not in the item's mask */ /* Windows stores the format, width, lparam even if they are not in the item's mask */
ZeroMemory(&hdiCreate, sizeof(HDITEMA)); ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT; hdiCreate.mask = HDI_TEXT;
hdiCreate.cxy = 100; hdiCreate.cxy = 100;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
addReadDelItem(hWndHeader, &hdiCreate, HDI_WIDTH, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_WIDTH, &hdiRead);
TEST_GET_ITEMCOUNT(6); TEST_GET_ITEMCOUNT(6);
ok(hdiRead.cxy == hdiCreate.cxy, "cxy should be automatically set\n"); ok(hdiRead.cxy == hdiCreate.cxy, "cxy should be automatically set\n");
ZeroMemory(&hdiCreate, sizeof(HDITEMA)); ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT; hdiCreate.mask = HDI_TEXT;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
hdiCreate.lParam = 0x12345678; hdiCreate.lParam = 0x12345678;
addReadDelItem(hWndHeader, &hdiCreate, HDI_LPARAM, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_LPARAM, &hdiRead);
TEST_GET_ITEMCOUNT(6); TEST_GET_ITEMCOUNT(6);
...@@ -294,7 +296,7 @@ static void check_auto_fields(void) ...@@ -294,7 +296,7 @@ static void check_auto_fields(void)
ZeroMemory(&hdiCreate, sizeof(HDITEMA)); ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT; hdiCreate.mask = HDI_TEXT;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
hdiCreate.fmt = HDF_STRING|HDF_CENTER; hdiCreate.fmt = HDF_STRING|HDF_CENTER;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
TEST_GET_ITEMCOUNT(6); TEST_GET_ITEMCOUNT(6);
...@@ -303,7 +305,7 @@ static void check_auto_fields(void) ...@@ -303,7 +305,7 @@ static void check_auto_fields(void)
/* others fields are not set */ /* others fields are not set */
ZeroMemory(&hdiCreate, sizeof(HDITEMA)); ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_TEXT; hdiCreate.mask = HDI_TEXT;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL); hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
addReadDelItem(hWndHeader, &hdiCreate, HDI_BITMAP, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_BITMAP, &hdiRead);
TEST_GET_ITEMCOUNT(6); TEST_GET_ITEMCOUNT(6);
...@@ -313,7 +315,7 @@ static void check_auto_fields(void) ...@@ -313,7 +315,7 @@ static void check_auto_fields(void)
ZeroMemory(&hdiCreate, sizeof(HDITEMA)); ZeroMemory(&hdiCreate, sizeof(HDITEMA));
hdiCreate.mask = HDI_IMAGE; hdiCreate.mask = HDI_IMAGE;
hdiCreate.iImage = 17; hdiCreate.iImage = 17;
hdiCreate.pszText = "Test"; hdiCreate.pszText = text;
addReadDelItem(hWndHeader, &hdiCreate, HDI_TEXT, &hdiRead); addReadDelItem(hWndHeader, &hdiCreate, HDI_TEXT, &hdiRead);
TEST_GET_ITEMCOUNT(6); TEST_GET_ITEMCOUNT(6);
ok(hdiRead.pszText==NULL, "pszText shouldn't be automatically set\n"); ok(hdiRead.pszText==NULL, "pszText shouldn't be automatically set\n");
...@@ -324,13 +326,14 @@ static void check_auto_fields(void) ...@@ -324,13 +326,14 @@ static void check_auto_fields(void)
static void check_mask() static void check_mask()
{ {
HDITEMA hdi; HDITEMA hdi;
static CHAR text[] = "ABC";
LRESULT ret; LRESULT ret;
/* don't create items if the mask is zero */ /* don't create items if the mask is zero */
ZeroMemory(&hdi, sizeof(hdi)); ZeroMemory(&hdi, sizeof(hdi));
hdi.mask = 0; hdi.mask = 0;
hdi.cxy = 200; hdi.cxy = 200;
hdi.pszText = "ABC"; hdi.pszText = text;
hdi.fmt = 0; hdi.fmt = 0;
hdi.iOrder = 0; hdi.iOrder = 0;
hdi.lParam = 17; hdi.lParam = 17;
......
...@@ -57,6 +57,9 @@ create_tabcontrol (DWORD style, DWORD mask) ...@@ -57,6 +57,9 @@ create_tabcontrol (DWORD style, DWORD mask)
{ {
HWND handle; HWND handle;
TCITEM tcNewTab; TCITEM tcNewTab;
static char text1[] = "Tab 1",
text2[] = "Wide Tab 2",
text3[] = "T 3";
handle = CreateWindow ( handle = CreateWindow (
WC_TABCONTROLA, WC_TABCONTROLA,
...@@ -71,13 +74,13 @@ create_tabcontrol (DWORD style, DWORD mask) ...@@ -71,13 +74,13 @@ create_tabcontrol (DWORD style, DWORD mask)
SendMessage (handle, WM_SETFONT, 0, (LPARAM) hFont); SendMessage (handle, WM_SETFONT, 0, (LPARAM) hFont);
tcNewTab.mask = mask; tcNewTab.mask = mask;
tcNewTab.pszText = "Tab 1"; tcNewTab.pszText = text1;
tcNewTab.iImage = 0; tcNewTab.iImage = 0;
SendMessage (handle, TCM_INSERTITEM, 0, (LPARAM) &tcNewTab); SendMessage (handle, TCM_INSERTITEM, 0, (LPARAM) &tcNewTab);
tcNewTab.pszText = "Wide Tab 2"; tcNewTab.pszText = text2;
tcNewTab.iImage = 1; tcNewTab.iImage = 1;
SendMessage (handle, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab); SendMessage (handle, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab);
tcNewTab.pszText = "T 3"; tcNewTab.pszText = text3;
tcNewTab.iImage = 2; tcNewTab.iImage = 2;
SendMessage (handle, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab); SendMessage (handle, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab);
......
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