mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 06:35:42 +00:00
[COMCTL32_WINETEST]
* Sync with Wine 1.7.27. CORE-8540 svn path=/trunk/; revision=64323
This commit is contained in:
parent
210678bf03
commit
7d8a75747a
11 changed files with 306 additions and 52 deletions
|
@ -40,10 +40,12 @@ static BOOL g_get_rect_in_expand;
|
|||
static BOOL g_disp_A_to_W;
|
||||
static BOOL g_disp_set_stateimage;
|
||||
static BOOL g_beginedit_alter_text;
|
||||
static HFONT g_customdraw_font;
|
||||
|
||||
#define NUM_MSG_SEQUENCES 2
|
||||
#define NUM_MSG_SEQUENCES 3
|
||||
#define TREEVIEW_SEQ_INDEX 0
|
||||
#define PARENT_SEQ_INDEX 1
|
||||
#define PARENT_CD_SEQ_INDEX 2
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
|
||||
|
@ -204,7 +206,7 @@ static const struct message parent_expand_seq[] = {
|
|||
};
|
||||
|
||||
static const struct message parent_expand_kb_seq[] = {
|
||||
{ WM_NOTIFY, sent|id|optional, 0, 0, TVN_KEYDOWN },
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TVN_KEYDOWN },
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDINGA },
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDEDA },
|
||||
{ WM_CHANGEUISTATE, sent|optional },
|
||||
|
@ -219,7 +221,7 @@ static const struct message parent_collapse_2nd_kb_seq[] = {
|
|||
};
|
||||
|
||||
static const struct message parent_expand_empty_kb_seq[] = {
|
||||
{ WM_NOTIFY, sent|id|optional, 0, 0, TVN_KEYDOWN },
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TVN_KEYDOWN },
|
||||
{ WM_CHANGEUISTATE, sent|optional },
|
||||
{ 0 }
|
||||
};
|
||||
|
@ -242,6 +244,21 @@ static const struct message empty_seq[] = {
|
|||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message parent_cd_seq[] = {
|
||||
{ WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_PREPAINT },
|
||||
{ WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_ITEMPREPAINT },
|
||||
{ WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_ITEMPOSTPAINT },
|
||||
{ WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_POSTPAINT },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message parent_vk_return_seq[] = {
|
||||
{ WM_NOTIFY, sent|id, 0, 0, TVN_KEYDOWN },
|
||||
{ WM_NOTIFY, sent|id, 0, 0, NM_RETURN },
|
||||
{ WM_CHANGEUISTATE, sent|optional },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static HWND hMainWnd;
|
||||
|
||||
static HTREEITEM hRoot, hChild;
|
||||
|
@ -1017,7 +1034,6 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
message != WM_GETICON &&
|
||||
message != WM_DEVICECHANGE)
|
||||
{
|
||||
trace("parent: %p, %04x, %08lx, %08lx\n", hWnd, message, wParam, lParam);
|
||||
add_message(sequences, PARENT_SEQ_INDEX, &msg);
|
||||
}
|
||||
|
||||
|
@ -1149,6 +1165,38 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
|
||||
break;
|
||||
}
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
NMTVCUSTOMDRAW *nmcd = (NMTVCUSTOMDRAW*)lParam;
|
||||
COLORREF c0ffee = RGB(0xc0,0xff,0xee), cafe = RGB(0xca,0xfe,0x00);
|
||||
|
||||
msg.flags |= custdraw;
|
||||
msg.stage = nmcd->nmcd.dwDrawStage;
|
||||
add_message(sequences, PARENT_CD_SEQ_INDEX, &msg);
|
||||
|
||||
switch (msg.stage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYITEMERASE|CDRF_NOTIFYPOSTPAINT;
|
||||
case CDDS_ITEMPREPAINT:
|
||||
nmcd->clrTextBk = c0ffee;
|
||||
nmcd->clrText = cafe;
|
||||
if (g_customdraw_font)
|
||||
SelectObject(nmcd->nmcd.hdc, g_customdraw_font);
|
||||
return CDRF_NOTIFYPOSTPAINT|CDRF_NEWFONT;
|
||||
case CDDS_ITEMPOSTPAINT:
|
||||
/* at the point of post paint notification colors are already restored */
|
||||
ok(GetTextColor(nmcd->nmcd.hdc) != cafe, "got 0%x\n", GetTextColor(nmcd->nmcd.hdc));
|
||||
ok(GetBkColor(nmcd->nmcd.hdc) != c0ffee, "got 0%x\n", GetBkColor(nmcd->nmcd.hdc));
|
||||
if (g_customdraw_font)
|
||||
ok(GetCurrentObject(nmcd->nmcd.hdc, OBJ_FONT) != g_customdraw_font, "got %p\n",
|
||||
GetCurrentObject(nmcd->nmcd.hdc, OBJ_FONT));
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2053,6 +2101,60 @@ static void test_WM_GETDLGCODE(void)
|
|||
DestroyWindow(hTree);
|
||||
}
|
||||
|
||||
static void test_customdraw(void)
|
||||
{
|
||||
static const char *rootA = "root";
|
||||
TVINSERTSTRUCTA ins;
|
||||
HTREEITEM hRoot;
|
||||
LOGFONTA lf;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = create_treeview_control(0);
|
||||
|
||||
ins.hParent = TVI_ROOT;
|
||||
ins.hInsertAfter = TVI_ROOT;
|
||||
U(ins).item.mask = TVIF_TEXT;
|
||||
U(ins).item.pszText = (char*)rootA;
|
||||
hRoot = TreeView_InsertItemA(hwnd, &ins);
|
||||
ok(hRoot != NULL, "got %p\n", hRoot);
|
||||
|
||||
/* create additional font, custom draw handler will select it */
|
||||
SystemParametersInfoA(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
|
||||
lf.lfHeight *= 2;
|
||||
g_customdraw_font = CreateFontIndirectA(&lf);
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
UpdateWindow(hwnd);
|
||||
ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_cd_seq, "custom draw notifications", FALSE);
|
||||
DeleteObject(g_customdraw_font);
|
||||
g_customdraw_font = NULL;
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_WM_KEYDOWN(void)
|
||||
{
|
||||
static const char *rootA = "root";
|
||||
TVINSERTSTRUCTA ins;
|
||||
HTREEITEM hRoot;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = create_treeview_control(0);
|
||||
|
||||
ins.hParent = TVI_ROOT;
|
||||
ins.hInsertAfter = TVI_ROOT;
|
||||
U(ins).item.mask = TVIF_TEXT;
|
||||
U(ins).item.pszText = (char*)rootA;
|
||||
hRoot = TreeView_InsertItemA(hwnd, &ins);
|
||||
ok(hRoot != NULL, "got %p\n", hRoot);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
SendMessageA(hwnd, WM_KEYDOWN, VK_RETURN, 0);
|
||||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_vk_return_seq, "WM_KEYDOWN/VK_RETURN parent notification", TRUE);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(treeview)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
|
@ -2126,6 +2228,8 @@ START_TEST(treeview)
|
|||
test_TVM_GETNEXTITEM();
|
||||
test_TVM_HITTEST();
|
||||
test_WM_GETDLGCODE();
|
||||
test_customdraw();
|
||||
test_WM_KEYDOWN();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue