comctl32/tests: Make treeview.c compile with -D__WINESRC__.

This commit is contained in:
Michael Stefaniuc 2013-12-04 00:44:52 +01:00 committed by Alexandre Julliard
parent 133c691f1f
commit 4ecd867706
1 changed files with 126 additions and 123 deletions

View File

@ -52,8 +52,8 @@ static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static struct msg_sequence *item_sequence[1];
static const struct message FillRootSeq[] = {
{ TVM_INSERTITEM, sent },
{ TVM_INSERTITEM, sent },
{ TVM_INSERTITEMA, sent },
{ TVM_INSERTITEMA, sent },
{ 0 }
};
@ -85,8 +85,8 @@ static const struct message getitemtext_seq[] = {
};
static const struct message focus_seq[] = {
{ TVM_INSERTITEM, sent },
{ TVM_INSERTITEM, sent },
{ TVM_INSERTITEMA, sent },
{ TVM_INSERTITEMA, sent },
{ TVM_SELECTITEM, sent|wparam, 9 },
/* The following end up out of order in wine */
{ WM_WINDOWPOSCHANGING, sent|defwinproc },
@ -330,13 +330,13 @@ static void fill_tree(HWND hTree)
ins.hInsertAfter = TVI_ROOT;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = root;
hRoot = TreeView_InsertItem(hTree, &ins);
hRoot = TreeView_InsertItemA(hTree, &ins);
ins.hParent = hRoot;
ins.hInsertAfter = TVI_FIRST;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = child;
hChild = TreeView_InsertItem(hTree, &ins);
hChild = TreeView_InsertItemA(hTree, &ins);
}
static void test_fillroot(void)
@ -362,7 +362,7 @@ static void test_fillroot(void)
/* UMLPad 1.15 depends on this being not -1 (I_IMAGECALLBACK) */
tvi.hItem = hRoot;
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
SendMessage( hTree, TVM_GETITEMA, 0, (LPARAM)&tvi );
SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tvi);
ok(tvi.iImage == 0, "tvi.iImage=%d\n", tvi.iImage);
ok(tvi.iSelectedImage == 0, "tvi.iSelectedImage=%d\n", tvi.iSelectedImage);
@ -388,15 +388,15 @@ static void test_callback(void)
ins.hParent = TVI_ROOT;
ins.hInsertAfter = TVI_ROOT;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = LPSTR_TEXTCALLBACK;
hRoot = TreeView_InsertItem(hTree, &ins);
U(ins).item.pszText = LPSTR_TEXTCALLBACKA;
hRoot = TreeView_InsertItemA(hTree, &ins);
assert(hRoot);
tvi.hItem = hRoot;
tvi.mask = TVIF_TEXT;
tvi.pszText = buf;
tvi.cchTextMax = sizeof(buf)/sizeof(buf[0]);
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Callback item text mismatch %s vs %s\n",
tvi.pszText, TEST_CALLBACK_TEXT);
@ -405,31 +405,31 @@ static void test_callback(void)
ins.hInsertAfter = TVI_FIRST;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = test_string;
hItem1 = TreeView_InsertItem(hTree, &ins);
hItem1 = TreeView_InsertItemA(hTree, &ins);
assert(hItem1);
tvi.hItem = hItem1;
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(strcmp(tvi.pszText, test_string) == 0, "Item text mismatch %s vs %s\n",
tvi.pszText, test_string);
/* undocumented: pszText of NULL also means LPSTR_CALLBACK: */
tvi.pszText = NULL;
ret = TreeView_SetItem(hTree, &tvi);
ret = TreeView_SetItemA(hTree, &tvi);
expect(TRUE, ret);
tvi.pszText = buf;
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n",
tvi.pszText, TEST_CALLBACK_TEXT);
U(ins).item.pszText = NULL;
hItem2 = TreeView_InsertItem(hTree, &ins);
hItem2 = TreeView_InsertItemA(hTree, &ins);
assert(hItem2);
tvi.hItem = hItem2;
memset(buf, 0, sizeof(buf));
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n",
tvi.pszText, TEST_CALLBACK_TEXT);
@ -438,7 +438,7 @@ static void test_callback(void)
g_disp_A_to_W = TRUE;
tvi.hItem = hItem2;
memset(buf, 0, sizeof(buf));
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(strcmp(tvi.pszText, test2A) == 0, "got %s, expected %s\n",
tvi.pszText, test2A);
@ -456,7 +456,7 @@ static void test_callback(void)
tvi.hItem = hRoot;
tvi.mask = TVIF_STATE;
tvi.state = TVIS_SELECTED;
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(tvi.state == INDEXTOSTATEIMAGEMASK(1), "got 0x%x\n", tvi.state);
@ -468,7 +468,7 @@ static void test_callback(void)
tvi.state = TVIS_FOCUSED;
tvi.stateMask = TVIS_FOCUSED;
tvi.iImage = I_IMAGECALLBACK;
ret = TreeView_SetItem(hTree, &tvi);
ret = TreeView_SetItemA(hTree, &tvi);
expect(TRUE, ret);
/* ask for item image index through callback - state is also set with state image index */
@ -477,7 +477,7 @@ static void test_callback(void)
tvi.hItem = hRoot;
tvi.mask = TVIF_IMAGE;
tvi.state = 0;
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
ok(tvi.state == (INDEXTOSTATEIMAGEMASK(1) | TVIS_FOCUSED), "got 0x%x\n", tvi.state);
@ -492,7 +492,7 @@ static void test_callback(void)
tvi.mask = TVIF_IMAGE;
tvi.state = INDEXTOSTATEIMAGEMASK(1);
tvi.stateMask = 0;
ret = TreeView_GetItem(hTree, &tvi);
ret = TreeView_GetItemA(hTree, &tvi);
expect(TRUE, ret);
/* handler sets TVIS_SELECTED as well */
ok(tvi.state == (TVIS_FOCUSED | TVIS_SELECTED | INDEXTOSTATEIMAGEMASK(2) | INDEXTOOVERLAYMASK(3)), "got 0x%x\n", tvi.state);
@ -587,7 +587,7 @@ static void test_getitemtext(void)
U(ins).item.mask = 0;
U(ins).item.pszText = NULL;
U(ins).item.cchTextMax = 0;
hChild = TreeView_InsertItem(hTree, &ins);
hChild = TreeView_InsertItemA(hTree, &ins);
assert(hChild);
/* retrieve it with TVIF_TEXT mask */
@ -627,17 +627,17 @@ static void test_focus(void)
ins.hInsertAfter = hChild;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = child1;
hChild1 = TreeView_InsertItem(hTree, &ins);
hChild1 = TreeView_InsertItemA(hTree, &ins);
assert(hChild1);
ins.hInsertAfter = hChild1;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = child2;
hChild2 = TreeView_InsertItem(hTree, &ins);
hChild2 = TreeView_InsertItemA(hTree, &ins);
assert(hChild2);
ShowWindow(hMainWnd,SW_SHOW);
SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hChild);
hEdit = (HWND)SendMessageA(hTree, TVM_EDITLABEL, 0, (LPARAM)hChild);
hEdit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hChild);
ScrollWindowEx(hTree, -10, 0, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN);
ok(GetFocus() == hEdit, "Edit control should have focus\n");
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, focus_seq, "focus test", TRUE);
@ -656,21 +656,21 @@ static void test_get_set_bkcolor(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* If the value is -1, the control is using the system color for the background color. */
crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 );
crColor = SendMessageA(hTree, TVM_GETBKCOLOR, 0, 0);
ok(crColor == ~0u, "Default background color reported as 0x%.8x\n", crColor);
/* Test for black background */
SendMessage( hTree, TVM_SETBKCOLOR, 0, RGB(0,0,0) );
crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 );
SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(0,0,0));
crColor = SendMessageA(hTree, TVM_GETBKCOLOR, 0, 0);
ok(crColor == RGB(0,0,0), "Black background color reported as 0x%.8x\n", crColor);
/* Test for white background */
SendMessage( hTree, TVM_SETBKCOLOR, 0, RGB(255,255,255) );
crColor = (COLORREF)SendMessage( hTree, TVM_GETBKCOLOR, 0, 0 );
SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(255,255,255));
crColor = SendMessageA(hTree, TVM_GETBKCOLOR, 0, 0);
ok(crColor == RGB(255,255,255), "White background color reported as 0x%.8x\n", crColor);
/* Reset the default background */
SendMessage( hTree, TVM_SETBKCOLOR, 0, -1 );
SendMessageA(hTree, TVM_SETBKCOLOR, 0, -1);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_bkcolor_seq,
"test get set bkcolor", FALSE);
@ -689,8 +689,8 @@ static void test_get_set_imagelist(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Test a NULL HIMAGELIST */
SendMessage( hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, 0 );
himl = (HIMAGELIST)SendMessage( hTree, TVM_GETIMAGELIST, TVSIL_NORMAL, 0 );
SendMessageA(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, 0);
himl = (HIMAGELIST)SendMessageA(hTree, TVM_GETIMAGELIST, TVSIL_NORMAL, 0);
ok(himl == NULL, "NULL image list, reported as %p, expected 0.\n", himl);
/* TODO: Test an actual image list */
@ -714,13 +714,13 @@ static void test_get_set_indent(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Finding the minimum indent */
SendMessage( hTree, TVM_SETINDENT, 0, 0 );
ulMinIndent = (int)SendMessage( hTree, TVM_GETINDENT, 0, 0 );
SendMessageA(hTree, TVM_SETINDENT, 0, 0);
ulMinIndent = SendMessageA(hTree, TVM_GETINDENT, 0, 0);
/* Checking an indent that is more than twice the default indent */
ulMoreThanTwiceMin = 2*ulMinIndent+1;
SendMessage( hTree, TVM_SETINDENT, ulMoreThanTwiceMin, 0 );
ulIndent = (DWORD)SendMessage( hTree, TVM_GETINDENT, 0, 0 );
SendMessageA(hTree, TVM_SETINDENT, ulMoreThanTwiceMin, 0);
ulIndent = SendMessageA(hTree, TVM_GETINDENT, 0, 0);
ok(ulIndent == ulMoreThanTwiceMin, "Indent reported as %d, expected %d\n", ulIndent, ulMoreThanTwiceMin);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_indent_seq,
@ -739,8 +739,8 @@ static void test_get_set_insertmark(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
SendMessage( hTree, TVM_SETINSERTMARKCOLOR, 0, crColor );
crColor = (COLORREF)SendMessage( hTree, TVM_GETINSERTMARKCOLOR, 0, 0 );
SendMessageA(hTree, TVM_SETINSERTMARKCOLOR, 0, crColor);
crColor = SendMessageA(hTree, TVM_GETINSERTMARKCOLOR, 0, 0);
ok(crColor == RGB(0,0,0), "Insert mark color reported as 0x%.8x, expected 0x00000000\n", crColor);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_insertmarkcolor_seq,
@ -764,7 +764,7 @@ static void test_get_set_item(void)
tviRoot.mask = TVIF_STATE;
tviRoot.state = TVIS_FOCUSED;
tviRoot.stateMask = TVIS_FOCUSED;
ret = SendMessage( hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot );
ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot);
expect(TRUE, ret);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
@ -776,24 +776,24 @@ static void test_get_set_item(void)
tviRoot.stateMask = 0;
tviRoot.cchTextMax = nBufferSize;
tviRoot.pszText = szBuffer;
ret = SendMessage( hTree, TVM_GETITEMA, 0, (LPARAM)&tviRoot );
ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
expect(TRUE, ret);
ok(!strcmp("Root", szBuffer), "GetItem: szBuffer=\"%s\", expected \"Root\"\n", szBuffer);
ok(tviRoot.state == TVIS_FOCUSED, "got 0x%0x\n", tviRoot.state);
/* Change the root text */
strncpy(szBuffer, "Testing123", nBufferSize);
ret = SendMessage( hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot );
lstrcpynA(szBuffer, "Testing123", nBufferSize);
ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot);
expect(TRUE, ret);
memset(szBuffer, 0, nBufferSize);
ret = SendMessage( hTree, TVM_GETITEMA, 0, (LPARAM)&tviRoot );
ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
expect(TRUE, ret);
ok(!strcmp("Testing123", szBuffer), "GetItem: szBuffer=\"%s\", expected \"Testing123\"\n", szBuffer);
/* Reset the root text */
memset(szBuffer, 0, nBufferSize);
strncpy(szBuffer, "Root", nBufferSize);
ret = SendMessage( hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot );
lstrcpynA(szBuffer, "Root", nBufferSize);
ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot);
expect(TRUE, ret);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_item_seq,
@ -805,7 +805,7 @@ static void test_get_set_item(void)
tviRoot.hItem = hRoot;
tviRoot.mask = TVIF_STATE;
tviRoot.state = 0;
ret = SendMessage( hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot );
ret = SendMessageA(hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
expect(TRUE, ret);
ok(tviRoot.state == TVIS_FOCUSED, "got state 0x%0x\n", tviRoot.state);
@ -825,50 +825,50 @@ static void test_get_set_itemheight(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Assuming default height to begin with */
ulOldHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
ulOldHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
/* Explicitly setting and getting the default height */
SendMessage( hTree, TVM_SETITEMHEIGHT, -1, 0 );
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
SendMessageA(hTree, TVM_SETITEMHEIGHT, -1, 0);
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == ulOldHeight, "Default height not set properly, reported %d, expected %d\n", ulNewHeight, ulOldHeight);
/* Explicitly setting and getting the height of twice the normal */
SendMessage( hTree, TVM_SETITEMHEIGHT, 2*ulOldHeight, 0 );
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
SendMessageA(hTree, TVM_SETITEMHEIGHT, 2*ulOldHeight, 0);
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == 2*ulOldHeight, "New height not set properly, reported %d, expected %d\n", ulNewHeight, 2*ulOldHeight);
/* Assuming tree doesn't have TVS_NONEVENHEIGHT set, so a set of 9 will round down to 8 */
SendMessage( hTree, TVM_SETITEMHEIGHT, 9, 0 );
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
SendMessageA(hTree, TVM_SETITEMHEIGHT, 9, 0);
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == 8, "Uneven height not set properly, reported %d, expected %d\n", ulNewHeight, 8);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_itemheight_seq,
"test get set item height", FALSE);
/* without TVS_NONEVENHEIGHT */
SetWindowLong(hTree, GWL_STYLE, GetWindowLong(hTree, GWL_STYLE) & ~TVS_NONEVENHEIGHT);
SetWindowLongA(hTree, GWL_STYLE, GetWindowLongA(hTree, GWL_STYLE) & ~TVS_NONEVENHEIGHT);
/* odd value */
ulOldHeight = SendMessage( hTree, TVM_SETITEMHEIGHT, 3, 0);
ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 3, 0);
ok(ulOldHeight == 8, "got %d, expected %d\n", ulOldHeight, 8);
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == 2, "got %d, expected %d\n", ulNewHeight, 2);
ulOldHeight = SendMessage( hTree, TVM_SETITEMHEIGHT, 4, 0);
ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 4, 0);
ok(ulOldHeight == 2, "got %d, expected %d\n", ulOldHeight, 2);
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == 4, "got %d, expected %d\n", ulNewHeight, 4);
/* with TVS_NONEVENHEIGHT */
SetWindowLong(hTree, GWL_STYLE, GetWindowLong(hTree, GWL_STYLE) | TVS_NONEVENHEIGHT);
SetWindowLongA(hTree, GWL_STYLE, GetWindowLongA(hTree, GWL_STYLE) | TVS_NONEVENHEIGHT);
/* odd value */
ulOldHeight = SendMessage( hTree, TVM_SETITEMHEIGHT, 3, 0);
ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 3, 0);
ok(ulOldHeight == 4, "got %d, expected %d\n", ulOldHeight, 4);
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == 3, "got %d, expected %d\n", ulNewHeight, 3);
/* even value */
ulOldHeight = SendMessage( hTree, TVM_SETITEMHEIGHT, 10, 0);
ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 10, 0);
ok(ulOldHeight == 3, "got %d, expected %d\n", ulOldHeight, 3);
ulNewHeight = (int) SendMessage( hTree, TVM_GETITEMHEIGHT, 0, 0 );
ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
ok(ulNewHeight == 10, "got %d, expected %d\n", ulNewHeight, 10);
DestroyWindow(hTree);
@ -885,8 +885,8 @@ static void test_get_set_scrolltime(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
SendMessage( hTree, TVM_SETSCROLLTIME, ulExpectedTime, 0 );
ulTime = (int)SendMessage( hTree, TVM_GETSCROLLTIME, 0, 0 );
SendMessageA(hTree, TVM_SETSCROLLTIME, ulExpectedTime, 0);
ulTime = SendMessageA(hTree, TVM_GETSCROLLTIME, 0, 0);
ok(ulTime == ulExpectedTime, "Scroll time reported as %d, expected %d\n", ulTime, ulExpectedTime);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_scrolltime_seq,
@ -906,21 +906,21 @@ static void test_get_set_textcolor(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
crColor = (COLORREF)SendMessage( hTree, TVM_GETTEXTCOLOR, 0, 0 );
crColor = SendMessageA(hTree, TVM_GETTEXTCOLOR, 0, 0);
ok(crColor == ~0u, "Default text color reported as 0x%.8x\n", crColor);
/* Test for black text */
SendMessage( hTree, TVM_SETTEXTCOLOR, 0, RGB(0,0,0) );
crColor = (COLORREF)SendMessage( hTree, TVM_GETTEXTCOLOR, 0, 0 );
SendMessageA(hTree, TVM_SETTEXTCOLOR, 0, RGB(0,0,0));
crColor = SendMessageA(hTree, TVM_GETTEXTCOLOR, 0, 0);
ok(crColor == RGB(0,0,0), "Black text color reported as 0x%.8x\n", crColor);
/* Test for white text */
SendMessage( hTree, TVM_SETTEXTCOLOR, 0, RGB(255,255,255) );
crColor = (COLORREF)SendMessage( hTree, TVM_GETTEXTCOLOR, 0, 0 );
SendMessageA(hTree, TVM_SETTEXTCOLOR, 0, RGB(255,255,255));
crColor = SendMessageA(hTree, TVM_GETTEXTCOLOR, 0, 0);
ok(crColor == RGB(255,255,255), "White text color reported as 0x%.8x\n", crColor);
/* Reset the default text color */
SendMessage( hTree, TVM_SETTEXTCOLOR, 0, CLR_NONE );
SendMessageA(hTree, TVM_SETTEXTCOLOR, 0, CLR_NONE);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_textcolor_seq,
"test get set text color", FALSE);
@ -940,12 +940,13 @@ static void test_get_set_tooltips(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* show even WS_POPUP treeview don't send NM_TOOLTIPSCREATED */
hPopupTreeView = CreateWindow(WC_TREEVIEW, NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, hMainWnd, NULL, NULL, NULL);
hPopupTreeView = CreateWindowA(WC_TREEVIEWA, NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100,
hMainWnd, NULL, NULL, NULL);
DestroyWindow(hPopupTreeView);
/* Testing setting a NULL ToolTip */
SendMessage( hTree, TVM_SETTOOLTIPS, 0, 0 );
hwndLastToolTip = (HWND)SendMessage( hTree, TVM_GETTOOLTIPS, 0, 0 );
SendMessageA(hTree, TVM_SETTOOLTIPS, 0, 0);
hwndLastToolTip = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
ok(hwndLastToolTip == NULL, "NULL tool tip, reported as 0x%p, expected 0.\n", hwndLastToolTip);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_tooltips_seq,
@ -965,23 +966,23 @@ static void test_get_set_unicodeformat(void)
fill_tree(hTree);
/* Check that an invalid format returned by NF_QUERY defaults to ANSI */
bPreviousSetting = (BOOL)SendMessage( hTree, TVM_GETUNICODEFORMAT, 0, 0 );
bPreviousSetting = SendMessageA(hTree, TVM_GETUNICODEFORMAT, 0, 0);
ok(bPreviousSetting == FALSE, "Format should be ANSI.\n");
flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Set to Unicode */
bPreviousSetting = (BOOL)SendMessage( hTree, TVM_SETUNICODEFORMAT, 1, 0 );
bNewSetting = (BOOL)SendMessage( hTree, TVM_GETUNICODEFORMAT, 0, 0 );
bPreviousSetting = SendMessageA(hTree, TVM_SETUNICODEFORMAT, 1, 0);
bNewSetting = SendMessageA(hTree, TVM_GETUNICODEFORMAT, 0, 0);
ok(bNewSetting == TRUE, "Unicode setting did not work.\n");
/* Set to ANSI */
SendMessage( hTree, TVM_SETUNICODEFORMAT, 0, 0 );
bNewSetting = (BOOL)SendMessage( hTree, TVM_GETUNICODEFORMAT, 0, 0 );
SendMessageA(hTree, TVM_SETUNICODEFORMAT, 0, 0);
bNewSetting = SendMessageA(hTree, TVM_GETUNICODEFORMAT, 0, 0);
ok(bNewSetting == FALSE, "ANSI setting did not work.\n");
/* Revert to original setting */
SendMessage( hTree, TVM_SETUNICODEFORMAT, bPreviousSetting, 0 );
SendMessageA(hTree, TVM_SETUNICODEFORMAT, bPreviousSetting, 0);
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_get_set_unicodeformat_seq,
"test get set unicode format", FALSE);
@ -1052,7 +1053,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
case TVN_GETDISPINFOA: {
NMTVDISPINFOA *disp = (NMTVDISPINFOA *)lParam;
if (disp->item.mask & TVIF_TEXT) {
lstrcpyn(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax);
lstrcpynA(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax);
}
if (g_disp_A_to_W && (disp->item.mask & TVIF_TEXT)) {
@ -1073,7 +1074,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
case TVN_BEGINLABELEDIT:
case TVN_BEGINLABELEDITA:
{
if (g_beginedit_alter_text)
{
@ -1088,7 +1089,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
case TVN_ENDLABELEDIT: return TRUE;
case TVN_ENDLABELEDITA: return TRUE;
case TVN_ITEMEXPANDINGA:
ok(pTreeView->itemNew.mask ==
(TVIF_HANDLE | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_PARAM | TVIF_STATE),
@ -1124,12 +1125,14 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
TVGN_FIRSTVISIBLE, 0);
ok(pTreeView->itemNew.hItem == visibleItem, "expanded item == first visible item\n");
*(HTREEITEM*)&rect = visibleItem;
ok(SendMessage(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect), "Failed to get rect for first visible item.\n");
ok(SendMessageA(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect),
"Failed to get rect for first visible item.\n");
visibleItem = (HTREEITEM)SendMessageA(pHdr->hwndFrom, TVM_GETNEXTITEM,
TVGN_NEXTVISIBLE, (LPARAM)visibleItem);
*(HTREEITEM*)&rect = visibleItem;
ok(visibleItem != NULL, "There must be a visible item after the first visisble item.\n");
ok(SendMessage(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect), "Failed to get rect for second visible item.\n");
ok(SendMessageA(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect),
"Failed to get rect for second visible item.\n");
}
break;
case TVN_DELETEITEMA:
@ -1192,7 +1195,7 @@ static void test_expandinvisible(void)
ins.hInsertAfter = TVI_ROOT;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = nodeText[0];
node[0] = TreeView_InsertItem(hTree, &ins);
node[0] = TreeView_InsertItemA(hTree, &ins);
assert(node[0]);
ins.hInsertAfter = TVI_LAST;
@ -1200,19 +1203,19 @@ static void test_expandinvisible(void)
ins.hParent = node[0];
U(ins).item.pszText = nodeText[1];
node[1] = TreeView_InsertItem(hTree, &ins);
node[1] = TreeView_InsertItemA(hTree, &ins);
assert(node[1]);
U(ins).item.pszText = nodeText[4];
node[4] = TreeView_InsertItem(hTree, &ins);
node[4] = TreeView_InsertItemA(hTree, &ins);
assert(node[4]);
ins.hParent = node[1];
U(ins).item.pszText = nodeText[2];
node[2] = TreeView_InsertItem(hTree, &ins);
node[2] = TreeView_InsertItemA(hTree, &ins);
assert(node[2]);
U(ins).item.pszText = nodeText[3];
node[3] = TreeView_InsertItem(hTree, &ins);
node[3] = TreeView_InsertItemA(hTree, &ins);
assert(node[3]);
@ -1259,47 +1262,47 @@ static void test_itemedit(void)
fill_tree(hTree);
/* try with null item */
edit = (HWND)SendMessage(hTree, TVM_EDITLABELA, 0, 0);
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, 0);
ok(!IsWindow(edit), "Expected valid handle\n");
/* trigger edit */
edit = (HWND)SendMessage(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
/* item shouldn't be selected automatically after TVM_EDITLABEL */
r = SendMessage(hTree, TVM_GETITEMSTATE, (WPARAM)hRoot, TVIS_SELECTED);
/* item shouldn't be selected automatically after TVM_EDITLABELA */
r = SendMessageA(hTree, TVM_GETITEMSTATE, (WPARAM)hRoot, TVIS_SELECTED);
expect(0, r);
/* try to cancel with wrong edit handle */
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), 0);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), 0);
expect(0, r);
ok(IsWindow(edit), "Expected edit control to be valid\n");
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
ok(!IsWindow(edit), "Expected edit control to be destroyed\n");
/* try to cancel without creating edit */
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), 0);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), 0);
expect(0, r);
/* try to cancel with wrong (not null) handle */
edit = (HWND)SendMessage(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)hTree);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)hTree);
expect(0, r);
ok(IsWindow(edit), "Expected edit control to be valid\n");
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
/* remove selection after starting edit */
r = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
expect(TRUE, r);
edit = (HWND)SendMessage(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
r = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, 0);
expect(TRUE, r);
/* alter text */
strcpy(buffA, "x");
r = SendMessage(edit, WM_SETTEXT, 0, (LPARAM)buffA);
r = SendMessageA(edit, WM_SETTEXT, 0, (LPARAM)buffA);
expect(TRUE, r);
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
ok(!IsWindow(edit), "Expected edit control to be destroyed\n");
/* check that text is saved */
@ -1307,7 +1310,7 @@ static void test_itemedit(void)
item.hItem = hRoot;
item.pszText = buffA;
item.cchTextMax = sizeof(buffA)/sizeof(CHAR);
r = SendMessage(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
r = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
expect(TRUE, r);
ok(!strcmp("x", buffA), "Expected item text to change\n");
@ -1315,14 +1318,14 @@ static void test_itemedit(void)
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
ok(IsWindowUnicode(edit), "got ansi window\n");
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
ok(!IsWindow(edit), "expected invalid handle\n");
edit = (HWND)SendMessageA(hTree, TVM_EDITLABELW, 0, (LPARAM)hRoot);
ok(IsWindow(edit), "Expected valid handle\n");
ok(IsWindowUnicode(edit), "got ansi window\n");
r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
r = SendMessageA(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)edit);
expect(0, r);
/* alter text during TVM_BEGINLABELEDIT, check that it's preserved */
@ -1332,7 +1335,7 @@ static void test_itemedit(void)
item.hItem = hRoot;
item.pszText = buffA;
item.cchTextMax = 0;
r = SendMessage(hTree, TVM_SETITEMA, 0, (LPARAM)&item);
r = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&item);
expect(TRUE, r);
g_beginedit_alter_text = TRUE;
@ -1351,7 +1354,7 @@ static void test_treeview_classinfo(void)
WNDCLASSA cls;
memset(&cls, 0, sizeof(cls));
GetClassInfo(GetModuleHandleA("comctl32.dll"), WC_TREEVIEWA, &cls);
GetClassInfoA(GetModuleHandleA("comctl32.dll"), WC_TREEVIEWA, &cls);
ok(cls.hbrBackground == NULL, "Expected NULL background brush, got %p\n", cls.hbrBackground);
ok(cls.style == (CS_GLOBALCLASS | CS_DBLCLKS), "Expected got %x\n", cls.style);
expect(0, cls.cbClsExtra);
@ -1365,7 +1368,7 @@ static void test_get_linecolor(void)
hTree = create_treeview_control(0);
/* newly created control has default color */
clr = (COLORREF)SendMessage(hTree, TVM_GETLINECOLOR, 0, 0);
clr = SendMessageA(hTree, TVM_GETLINECOLOR, 0, 0);
if (clr == 0)
win_skip("TVM_GETLINECOLOR is not supported on comctl32 < 5.80\n");
else
@ -1382,7 +1385,7 @@ static void test_get_insertmarkcolor(void)
hTree = create_treeview_control(0);
/* newly created control has default color */
clr = (COLORREF)SendMessage(hTree, TVM_GETINSERTMARKCOLOR, 0, 0);
clr = SendMessageA(hTree, TVM_GETINSERTMARKCOLOR, 0, 0);
if (clr == 0)
win_skip("TVM_GETINSERTMARKCOLOR is not supported on comctl32 < 5.80\n");
else
@ -1591,7 +1594,7 @@ static void test_TVS_SINGLEEXPAND(void)
BOOL ret;
hTree = create_treeview_control(0);
SetWindowLongA(hTree, GWL_STYLE, GetWindowLong(hTree, GWL_STYLE) | TVS_SINGLEEXPAND);
SetWindowLongA(hTree, GWL_STYLE, GetWindowLongA(hTree, GWL_STYLE) | TVS_SINGLEEXPAND);
/* to avoid painting related notifications */
ShowWindow(hTree, SW_HIDE);
fill_tree(hTree);
@ -1655,7 +1658,7 @@ static void test_delete_items(void)
/* check delete order */
flush_sequences(item_sequence, 1);
ret = SendMessage(hTree, TVM_DELETEITEM, 0, 0);
ret = SendMessageA(hTree, TVM_DELETEITEM, 0, 0);
ok(ret == TRUE, "got %d\n", ret);
msg = item_sequence[0]->sequence;
@ -1682,7 +1685,7 @@ static void test_cchildren(void)
hTree = create_treeview_control(0);
fill_tree(hTree);
ret = SendMessage(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
expect(TRUE, ret);
/* check cChildren - automatic mode */
@ -1710,7 +1713,7 @@ static void test_cchildren(void)
ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&item);
expect(TRUE, ret);
ret = SendMessage(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
expect(TRUE, ret);
/* check cChildren */
@ -1756,18 +1759,18 @@ static void test_htreeitem_layout(void)
ins.hParent = hChild;
ins.hInsertAfter = TVI_FIRST;
U(ins).item.mask = 0;
item1 = TreeView_InsertItem(hTree, &ins);
item1 = TreeView_InsertItemA(hTree, &ins);
check_item(item1, hChild, 0, 0);
ins.hParent = hRoot;
ins.hInsertAfter = TVI_FIRST;
U(ins).item.mask = 0;
item2 = TreeView_InsertItem(hTree, &ins);
item2 = TreeView_InsertItemA(hTree, &ins);
check_item(item2, hRoot, hChild, 0);
SendMessage(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
/* without children now */
check_item(hRoot, ((struct _ITEM_DATA*)hRoot)->parent, 0, item2);
@ -2009,13 +2012,13 @@ static void test_TVM_HITTEST(void)
fill_tree(hTree);
*(HTREEITEM*)&rc = hRoot;
ret = SendMessage(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc);
ret = SendMessageA(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc);
expect(TRUE, (BOOL)ret);
ht.pt.x = rc.left-1;
ht.pt.y = rc.top;
ret = SendMessage(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
ret = SendMessageA(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
ok((HTREEITEM)ret == hRoot, "got %p, expected %p\n", (HTREEITEM)ret, hRoot);
ok(ht.hItem == hRoot, "got %p, expected %p\n", ht.hItem, hRoot);
ok(ht.flags == TVHT_ONITEMBUTTON, "got %d, expected %d\n", ht.flags, TVHT_ONITEMBUTTON);
@ -2024,13 +2027,13 @@ static void test_TVM_HITTEST(void)
expect(TRUE, (BOOL)ret);
*(HTREEITEM*)&rc = hChild;
ret = SendMessage(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc);
ret = SendMessageA(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc);
expect(TRUE, (BOOL)ret);
ht.pt.x = rc.left-1;
ht.pt.y = rc.top;
ret = SendMessage(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
ret = SendMessageA(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
ok((HTREEITEM)ret == hChild, "got %p, expected %p\n", (HTREEITEM)ret, hChild);
ok(ht.hItem == hChild, "got %p, expected %p\n", ht.hItem, hChild);
/* Wine returns item button here, but this item has no button */
@ -2082,7 +2085,7 @@ START_TEST(treeview)
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = NULL;
wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_IBEAM);
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MyTestWnd";