mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 19:49:50 +00:00
comctl32/treeview: Properly initialize expanded image index.
This commit is contained in:
parent
47d28ace15
commit
b3a61c1329
2 changed files with 72 additions and 2 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "commctrl.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
#include "v6util.h"
|
||||
#include "msg.h"
|
||||
|
||||
const char *TEST_CALLBACK_TEXT = "callback_text";
|
||||
|
@ -1191,12 +1192,55 @@ static void test_rect_retrieval_after_expand_with_select(void) {
|
|||
ok(ret,"TreeView_Select should return true\n");
|
||||
}
|
||||
|
||||
static void test_expandedimage(void)
|
||||
{
|
||||
TVITEMEX item;
|
||||
HWND hTree;
|
||||
BOOL ret;
|
||||
|
||||
hTree = create_treeview_control();
|
||||
fill_tree(hTree);
|
||||
|
||||
item.mask = TVIF_EXPANDEDIMAGE;
|
||||
item.iExpandedImage = 1;
|
||||
item.hItem = hRoot;
|
||||
ret = SendMessageA(hTree, TVM_SETITEM, 0, (LPARAM)&item);
|
||||
ok(ret, "got %d\n", ret);
|
||||
|
||||
item.mask = TVIF_EXPANDEDIMAGE;
|
||||
item.iExpandedImage = -1;
|
||||
item.hItem = hRoot;
|
||||
ret = SendMessageA(hTree, TVM_GETITEM, 0, (LPARAM)&item);
|
||||
ok(ret, "got %d\n", ret);
|
||||
|
||||
if (item.iExpandedImage != 1)
|
||||
{
|
||||
win_skip("TVIF_EXPANDEDIMAGE not supported\n");
|
||||
DestroyWindow(hTree);
|
||||
return;
|
||||
}
|
||||
|
||||
/* test for default iExpandedImage value */
|
||||
item.mask = TVIF_EXPANDEDIMAGE;
|
||||
item.iExpandedImage = -1;
|
||||
item.hItem = hChild;
|
||||
ret = SendMessageA(hTree, TVM_GETITEM, 0, (LPARAM)&item);
|
||||
ok(ret, "got %d\n", ret);
|
||||
ok(item.iExpandedImage == (WORD)I_IMAGENONE, "got %d\n", item.iExpandedImage);
|
||||
|
||||
DestroyWindow(hTree);
|
||||
}
|
||||
|
||||
START_TEST(treeview)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
WNDCLASSA wc;
|
||||
MSG msg;
|
||||
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
HWND hwnd;
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
|
||||
|
@ -1253,6 +1297,32 @@ START_TEST(treeview)
|
|||
test_expandnotify();
|
||||
test_rect_retrieval_after_expand_with_select();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
{
|
||||
DestroyWindow(hMainWnd);
|
||||
return;
|
||||
}
|
||||
|
||||
/* this is a XP SP3 failure workaround */
|
||||
hwnd = CreateWindowExA(0, WC_TREEVIEW, "foo",
|
||||
WS_CHILD | WS_BORDER | WS_VISIBLE,
|
||||
0, 0, 100, 100,
|
||||
hMainWnd, NULL, GetModuleHandleA(NULL), NULL);
|
||||
if (!IsWindow(hwnd))
|
||||
{
|
||||
win_skip("FIXME: failed to create TreeView window.\n");
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
DestroyWindow(hMainWnd);
|
||||
return;
|
||||
}
|
||||
else
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
/* comctl32 version 6 tests start here */
|
||||
test_expandedimage();
|
||||
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
PostMessageA(hMainWnd, WM_CLOSE, 0, 0);
|
||||
while(GetMessageA(&msg,0,0,0)) {
|
||||
TranslateMessage(&msg);
|
||||
|
|
|
@ -1005,7 +1005,7 @@ TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
|
|||
* inc/dec to toggle the images. */
|
||||
newItem->iImage = 0;
|
||||
newItem->iSelectedImage = 0;
|
||||
newItem->iExpandedImage = 0;
|
||||
newItem->iExpandedImage = (WORD)I_IMAGENONE;
|
||||
|
||||
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
|
||||
{
|
||||
|
@ -2575,7 +2575,7 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem
|
|||
/* The item is currently selected */
|
||||
imageIndex = wineItem->iSelectedImage;
|
||||
}
|
||||
else if ((wineItem->state & TVIS_EXPANDED) && (wineItem->iExpandedImage >= 0))
|
||||
else if ((wineItem->state & TVIS_EXPANDED) && (wineItem->iExpandedImage != (WORD)I_IMAGENONE))
|
||||
{
|
||||
/* The item is currently not selected but expanded */
|
||||
imageIndex = wineItem->iExpandedImage;
|
||||
|
|
Loading…
Reference in a new issue