Author: akhaldi Date: Sat Sep 27 00:19:59 2014 New Revision: 64323
URL: http://svn.reactos.org/svn/reactos?rev=64323&view=rev Log: [COMCTL32_WINETEST] * Sync with Wine 1.7.27. CORE-8540
Modified: trunk/rostests/winetests/comctl32/button.c trunk/rostests/winetests/comctl32/imagelist.c trunk/rostests/winetests/comctl32/listview.c trunk/rostests/winetests/comctl32/msg.h trunk/rostests/winetests/comctl32/syslink.c trunk/rostests/winetests/comctl32/tab.c trunk/rostests/winetests/comctl32/toolbar.c trunk/rostests/winetests/comctl32/tooltips.c trunk/rostests/winetests/comctl32/trackbar.c trunk/rostests/winetests/comctl32/treeview.c trunk/rostests/winetests/comctl32/updown.c
Modified: trunk/rostests/winetests/comctl32/button.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/button.... ============================================================================== --- trunk/rostests/winetests/comctl32/button.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/button.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -748,10 +748,10 @@ ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW));
ret = GetClassInfoExW(NULL, nameW, &ex2W); -todo_wine { +todo_wine ok(ret, "got %d\n", ret); +if (ret) /* TODO: remove once Wine is fixed */ ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc); -}
/* Check reported class name */ hwnd = create_button(BS_CHECKBOX, NULL);
Modified: trunk/rostests/winetests/comctl32/imagelist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/imageli... ============================================================================== --- trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -1481,6 +1481,7 @@ static void test_iimagelist(void) { IImageList *imgl, *imgl2; + IImageList2 *imagelist; HIMAGELIST himl; HRESULT hr; ULONG ret; @@ -1545,6 +1546,16 @@ IImageList_Release(imgl);
ImageList_Destroy(himl); + + /* IImageList2 */ + hr = pImageList_CoCreateInstance(&CLSID_ImageList, NULL, &IID_IImageList2, (void**)&imagelist); + if (hr != S_OK) + { + win_skip("IImageList2 is not supported.\n"); + return; + } + ok(hr == S_OK, "got 0x%08x\n", hr); + IImageList2_Release(imagelist); }
static void test_hotspot_v6(void)
Modified: trunk/rostests/winetests/comctl32/listview.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/listvie... ============================================================================== --- trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -3,7 +3,7 @@ * * Copyright 2006 Mike McCormack for CodeWeavers * Copyright 2007 George Gov - * Copyright 2009-2013 Nikolay Sivov + * Copyright 2009-2014 Nikolay Sivov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -31,12 +31,15 @@ #include "v6util.h" #include "msg.h"
-#define PARENT_SEQ_INDEX 0 -#define PARENT_FULL_SEQ_INDEX 1 -#define LISTVIEW_SEQ_INDEX 2 -#define EDITBOX_SEQ_INDEX 3 -#define COMBINED_SEQ_INDEX 4 -#define NUM_MSG_SEQUENCES 5 +enum seq_index { + PARENT_SEQ_INDEX, + PARENT_FULL_SEQ_INDEX, + PARENT_CD_SEQ_INDEX, + LISTVIEW_SEQ_INDEX, + EDITBOX_SEQ_INDEX, + COMBINED_SEQ_INDEX, + NUM_MSG_SEQUENCES +};
#define LISTVIEW_ID 0 #define HEADER_ID 1 @@ -389,6 +392,26 @@ { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED }, { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED }, { WM_NOTIFY, sent|id, 0, 0, LVN_INSERTITEM }, + { 0 } +}; + +static const struct message parent_report_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_ITEMPREPAINT|CDDS_SUBITEM }, + { WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_ITEMPOSTPAINT|CDDS_SUBITEM }, + { WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_ITEMPREPAINT|CDDS_SUBITEM }, + { WM_NOTIFY, sent|id|custdraw, 0, 0, NM_CUSTOMDRAW, CDDS_ITEMPOSTPAINT|CDDS_SUBITEM }, + { 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_list_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 } };
@@ -1761,24 +1784,36 @@ DestroyWindow(hwnd); }
-static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { COLORREF clr, c0ffee = RGB(0xc0, 0xff, 0xee);
- if(msg == WM_NOTIFY) { - NMHDR *nmhdr = (PVOID)lp; + if(message == WM_NOTIFY) { + NMHDR *nmhdr = (NMHDR*)lParam; if(nmhdr->code == NM_CUSTOMDRAW) { NMLVCUSTOMDRAW *nmlvcd = (NMLVCUSTOMDRAW*)nmhdr; + struct message msg; + + msg.message = message; + msg.flags = sent|wparam|lparam|custdraw; + msg.wParam = wParam; + msg.lParam = lParam; + msg.id = nmhdr->code; + msg.stage = nmlvcd->nmcd.dwDrawStage; + add_message(sequences, PARENT_CD_SEQ_INDEX, &msg);
switch(nmlvcd->nmcd.dwDrawStage) { case CDDS_PREPAINT: SetBkColor(nmlvcd->nmcd.hdc, c0ffee); - return CDRF_NOTIFYITEMDRAW; + return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTPAINT; case CDDS_ITEMPREPAINT: nmlvcd->clrTextBk = CLR_DEFAULT; - return CDRF_NOTIFYSUBITEMDRAW; + nmlvcd->clrText = RGB(0, 255, 0); + return CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT; case CDDS_ITEMPREPAINT | CDDS_SUBITEM: clr = GetBkColor(nmlvcd->nmcd.hdc); + ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk); + ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText); if (nmlvcd->iSubItem) todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); else @@ -1787,13 +1822,15 @@ case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM: clr = GetBkColor(nmlvcd->nmcd.hdc); todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); + ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk); + ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText); return CDRF_DODEFAULT; } return CDRF_DODEFAULT; } }
- return DefWindowProcA(hwnd, msg, wp, lp); + return DefWindowProcA(hwnd, message, wParam, lParam); }
static void test_customdraw(void) @@ -1813,8 +1850,26 @@ InvalidateRect(hwnd, NULL, TRUE); UpdateWindow(hwnd);
+ /* message tests */ + flush_sequences(sequences, NUM_MSG_SEQUENCES); + InvalidateRect(hwnd, NULL, TRUE); + UpdateWindow(hwnd); + ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT", FALSE); + + DestroyWindow(hwnd); + + hwnd = create_listview_control(LVS_LIST); + + insert_column(hwnd, 0); + insert_column(hwnd, 1); + insert_item(hwnd, 0); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + InvalidateRect(hwnd, NULL, TRUE); + UpdateWindow(hwnd); + ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_list_cd_seq, "parent customdraw, LVS_LIST", FALSE); + SetWindowLongPtrA(hwndparent, GWLP_WNDPROC, (LONG_PTR)oldwndproc); - DestroyWindow(hwnd); }
Modified: trunk/rostests/winetests/comctl32/msg.h URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/msg.h?r... ============================================================================== --- trunk/rostests/winetests/comctl32/msg.h [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/msg.h [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -38,7 +38,8 @@ optional = 0x80, hook = 0x100, winevent_hook =0x200, - id = 0x400 + id = 0x400, + custdraw = 0x800 } msg_flags_t;
struct message @@ -49,6 +50,7 @@ LPARAM lParam; /* expected value of lParam */ UINT id; /* extra message data: id of the window, notify code etc. */ + DWORD stage; /* custom draw stage */ };
struct msg_sequence @@ -80,12 +82,7 @@
assert(msg_seq->sequence);
- msg_seq->sequence[msg_seq->count].message = msg->message; - msg_seq->sequence[msg_seq->count].flags = msg->flags; - msg_seq->sequence[msg_seq->count].wParam = msg->wParam; - msg_seq->sequence[msg_seq->count].lParam = msg->lParam; - msg_seq->sequence[msg_seq->count].id = msg->id; - + msg_seq->sequence[msg_seq->count] = *msg; msg_seq->count++; }
@@ -105,6 +102,68 @@ flush_sequence(seq, i); }
+static void dump_sequence( struct msg_sequence **seq, int sequence_index, + const struct message *expected, const char *context, + const char *file, int line ) +{ + struct msg_sequence *msg_seq = seq[sequence_index]; + const struct message *actual, *sequence; + unsigned int count = 0; + + sequence = msg_seq->sequence; + actual = sequence; + + trace_(file, line)("Failed sequence %s:\n", context ); + while (expected->message && actual->message) + { + trace_(file, line)( " %u: expected: %04x - actual: %04x wp %08lx lp %08lx\n", + count, expected->message, actual->message, actual->wParam, actual->lParam ); + + if (expected->message == actual->message) + { + if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && + (expected->flags & optional)) + { + /* don't match messages if their defwinproc status differs */ + expected++; + } + else + { + expected++; + actual++; + } + } + else + { + expected++; + actual++; + } + count++; + } + + /* optional trailing messages */ + while (expected->message && expected->flags & optional) + { + trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message ); + expected++; + count++; + } + + if (expected->message) + { + trace_(file, line)( " %u: expected: msg %04x - actual: nothing\n", count, expected->message ); + return; + } + + while (actual->message) + { + trace_(file, line)( " %u: expected: nothing - actual: %04x wp %08lx lp %08lx\n", + count, actual->message, actual->wParam, actual->lParam ); + actual++; + count++; + } +} + static void ok_sequence_(struct msg_sequence **seq, int sequence_index, const struct message *expected, const char *context, BOOL todo, const char *file, int line) @@ -112,7 +171,7 @@ struct msg_sequence *msg_seq = seq[sequence_index]; static const struct message end_of_sequence = {0, 0, 0, 0}; const struct message *actual, *sequence; - int failcount = 0; + int failcount = 0, dump = 0;
add_message(seq, sequence_index, &end_of_sequence);
@@ -121,8 +180,6 @@
while (expected->message && actual->message) { - trace_( file, line)("expected %04x - actual %04x\n", expected->message, actual->message); - if (expected->message == actual->message) { if (expected->flags & wparam) @@ -132,6 +189,7 @@ todo_wine { failcount++; + dump++; ok_(file, line) (FALSE, "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n", context, expected->message, expected->wParam, actual->wParam); @@ -142,6 +200,7 @@ ok_(file, line) (expected->wParam == actual->wParam, "%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n", context, expected->message, expected->wParam, actual->wParam); + if (expected->wParam != actual->wParam) dump++; } }
@@ -152,6 +211,7 @@ todo_wine { failcount++; + dump++; ok_(file, line) (FALSE, "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n", context, expected->message, expected->lParam, actual->lParam); @@ -162,21 +222,45 @@ ok_(file, line) (expected->lParam == actual->lParam, "%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n", context, expected->message, expected->lParam, actual->lParam); - } - } - - if (expected->flags & id) - { - if (expected->id != actual->id && expected->flags & optional) - { - expected++; - continue; - } - if (expected->id != actual->id && todo) + if (expected->lParam != actual->lParam) dump++; + } + } + + if (expected->flags & custdraw) + { + if (expected->stage != actual->stage && todo) { todo_wine { failcount++; + dump++; + ok_(file, line) (FALSE, + "%s: in msg 0x%04x expecting cd stage 0x%08x got 0x%08x\n", + context, expected->message, expected->stage, actual->stage); + } + } + else + { + ok_(file, line) (expected->stage == actual->stage, + "%s: in msg 0x%04x expecting cd stage 0x%08x got 0x%08x\n", + context, expected->message, expected->stage, actual->stage); + if (expected->stage != actual->stage) dump++; + } + } + + if (expected->flags & id) + { + if (expected->id != actual->id && expected->flags & optional) + { + expected++; + continue; + } + if (expected->id != actual->id && todo) + { + todo_wine + { + failcount++; + dump++; ok_(file, line) (FALSE, "%s: in msg 0x%04x expecting id 0x%x got 0x%x\n", context, expected->message, expected->id, actual->id); @@ -187,6 +271,7 @@ ok_(file, line) (expected->id == actual->id, "%s: in msg 0x%04x expecting id 0x%x got 0x%x\n", context, expected->message, expected->id, actual->id); + if (expected->id != actual->id) dump++; } }
@@ -195,6 +280,7 @@ todo_wine { failcount++; + dump++; ok_(file, line) (FALSE, "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n", context, expected->message, (expected->flags & defwinproc) ? "" : "NOT "); @@ -205,23 +291,34 @@ ok_(file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc), "%s: the msg 0x%04x should %shave been sent by DefWindowProc\n", context, expected->message, (expected->flags & defwinproc) ? "" : "NOT "); + if ((expected->flags & defwinproc) != (actual->flags & defwinproc)) dump++; }
ok_(file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint), "%s: the msg 0x%04x should %shave been sent by BeginPaint\n", context, expected->message, (expected->flags & beginpaint) ? "" : "NOT "); + if ((expected->flags & beginpaint) != (actual->flags & beginpaint)) dump++; + ok_(file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)), "%s: the msg 0x%04x should have been %s\n", context, expected->message, (expected->flags & posted) ? "posted" : "sent"); + if ((expected->flags & (sent|posted)) != (actual->flags & (sent|posted))) dump++; + ok_(file, line) ((expected->flags & parent) == (actual->flags & parent), "%s: the msg 0x%04x was expected in %s\n", context, expected->message, (expected->flags & parent) ? "parent" : "child"); + if ((expected->flags & parent) != (actual->flags & parent)) dump++; + ok_(file, line) ((expected->flags & hook) == (actual->flags & hook), "%s: the msg 0x%04x should have been sent by a hook\n", context, expected->message); + if ((expected->flags & hook) != (actual->flags & hook)) dump++; + ok_(file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook), "%s: the msg 0x%04x should have been sent by a winevent hook\n", context, expected->message); + if ((expected->flags & winevent_hook) != (actual->flags & winevent_hook)) dump++; + expected++; actual++; } @@ -230,19 +327,19 @@ else if (todo) { failcount++; + dump++; todo_wine { ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n", context, expected->message, actual->message); } - - flush_sequence(seq, sequence_index); - return; + goto done; } else { ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n", context, expected->message, actual->message); + dump++; expected++; actual++; } @@ -259,6 +356,7 @@ if (expected->message || actual->message) { failcount++; + dump++; ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n", context, expected->message, actual->message); } @@ -266,18 +364,22 @@ } else if (expected->message || actual->message) { + dump++; ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n", context, expected->message, actual->message); }
if(todo && !failcount) /* succeeded yet marked todo */ { + dump++; todo_wine { ok_(file, line)(TRUE, "%s: marked "todo_wine" but succeeds\n", context); } }
+done: + if (dump) dump_sequence( seq, sequence_index, expected, context, file, line ); flush_sequence(seq, sequence_index); }
Modified: trunk/rostests/winetests/comctl32/syslink.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/syslink... ============================================================================== --- trunk/rostests/winetests/comctl32/syslink.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/syslink.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -94,8 +94,6 @@ message != WM_GETICON && message != WM_DEVICECHANGE) { - trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; @@ -151,8 +149,6 @@ LRESULT ret; struct message msg;
- trace("syslink: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc;
Modified: trunk/rostests/winetests/comctl32/tab.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/tab.c?r... ============================================================================== --- trunk/rostests/winetests/comctl32/tab.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/tab.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -344,8 +344,6 @@ message != WM_GETICON && message != WM_DEVICECHANGE) { - trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; @@ -409,8 +407,6 @@ message != WM_GETICON && message != WM_DEVICECHANGE) { - trace("tab: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc;
Modified: trunk/rostests/winetests/comctl32/toolbar.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/toolbar... ============================================================================== --- trunk/rostests/winetests/comctl32/toolbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/toolbar.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -160,7 +160,6 @@ message != WM_GETICON && message != WM_DEVICECHANGE) { - trace("parent: %p, %04x, %08lx, %08lx\n", hWnd, message, wParam, lParam); add_message(sequences, PARENT_SEQ_INDEX, &msg); }
Modified: trunk/rostests/winetests/comctl32/tooltips.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/tooltip... ============================================================================== --- trunk/rostests/winetests/comctl32/tooltips.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/tooltips.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -470,6 +470,7 @@ tiW.hwnd = NULL; tiW.uId = 0x1234ABCD; tiW.lParam = 0xaaaaaaaa; + tiW.lpszText = NULL; r = SendMessageA(hwnd, TTM_GETTOOLINFOW, 0, (LPARAM)&tiW); ok(r, "Getting tooltip info failed\n"); ok(0x1abe11ed == tiW.lParam ||
Modified: trunk/rostests/winetests/comctl32/trackbar.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/trackba... ============================================================================== --- trunk/rostests/winetests/comctl32/trackbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/trackbar.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -387,8 +387,6 @@ message != WM_GETICON && message != WM_DEVICECHANGE) { - trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; @@ -435,8 +433,6 @@ static LONG defwndproc_counter = 0; LRESULT ret; struct message msg; - - trace("trackbar: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
msg.message = message; msg.flags = sent|wparam|lparam;
Modified: trunk/rostests/winetests/comctl32/treeview.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/treevie... ============================================================================== --- trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -40,10 +40,12 @@ static BOOL g_disp_A_to_W; static BOOL g_disp_set_stateimage; static BOOL g_beginedit_alter_text; - -#define NUM_MSG_SEQUENCES 2 +static HFONT g_customdraw_font; + +#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_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_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 } }; @@ -239,6 +241,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 } };
@@ -1017,7 +1034,6 @@ 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 @@
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; @@ -2051,6 +2099,60 @@ ok(code == (DLGC_WANTCHARS | DLGC_WANTARROWS), "0x%08x\n", code);
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) @@ -2126,6 +2228,8 @@ test_TVM_GETNEXTITEM(); test_TVM_HITTEST(); test_WM_GETDLGCODE(); + test_customdraw(); + test_WM_KEYDOWN();
if (!load_v6_module(&ctx_cookie, &hCtx)) {
Modified: trunk/rostests/winetests/comctl32/updown.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/updown.... ============================================================================== --- trunk/rostests/winetests/comctl32/updown.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/updown.c [iso-8859-1] Sat Sep 27 00:19:59 2014 @@ -182,8 +182,6 @@ message != WM_GETICON && message != WM_DEVICECHANGE) { - trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; @@ -237,8 +235,6 @@ LRESULT ret; struct message msg;
- trace("edit: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); - msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; @@ -278,8 +274,6 @@ static LONG defwndproc_counter = 0; LRESULT ret; struct message msg; - - trace("updown: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
msg.message = message; msg.flags = sent|wparam|lparam;