From 017ba0c5a7648bb0241160c79a8d78baeedf2705 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 16 Mar 2013 17:07:05 +0000 Subject: [PATCH] [COMCTL32_WINETEST] * Sync with Wine 1.5.26. svn path=/trunk/; revision=58522 --- rostests/winetests/comctl32/comboex.c | 8 +- rostests/winetests/comctl32/datetime.c | 12 +- rostests/winetests/comctl32/dpa.c | 17 +- rostests/winetests/comctl32/header.c | 14 +- rostests/winetests/comctl32/imagelist.c | 115 +++- rostests/winetests/comctl32/ipaddress.c | 6 +- rostests/winetests/comctl32/listview.c | 668 ++++++++++++++++++++++-- rostests/winetests/comctl32/misc.c | 6 +- rostests/winetests/comctl32/monthcal.c | 25 +- rostests/winetests/comctl32/mru.c | 18 +- rostests/winetests/comctl32/msg.h | 4 +- rostests/winetests/comctl32/pager.c | 7 +- rostests/winetests/comctl32/propsheet.c | 10 +- rostests/winetests/comctl32/rebar.c | 12 +- rostests/winetests/comctl32/rsrc.rc | 2 +- rostests/winetests/comctl32/status.c | 12 +- rostests/winetests/comctl32/syslink.c | 8 +- rostests/winetests/comctl32/tab.c | 9 +- rostests/winetests/comctl32/testlist.c | 5 +- rostests/winetests/comctl32/tooltips.c | 11 +- rostests/winetests/comctl32/trackbar.c | 8 +- rostests/winetests/comctl32/treeview.c | 21 +- rostests/winetests/comctl32/updown.c | 8 +- 23 files changed, 856 insertions(+), 150 deletions(-) diff --git a/rostests/winetests/comctl32/comboex.c b/rostests/winetests/comctl32/comboex.c index 7cddbafdf08..ed331a58f88 100644 --- a/rostests/winetests/comctl32/comboex.c +++ b/rostests/winetests/comctl32/comboex.c @@ -18,10 +18,14 @@ */ #include -#include +//#include +#include +#include +#include +#include #include -#include "wine/test.h" +//#include "wine/test.h" #include "msg.h" #define EDITBOX_SEQ_INDEX 0 diff --git a/rostests/winetests/comctl32/datetime.c b/rostests/winetests/comctl32/datetime.c index 24d339fc80d..dc75f9c93d8 100644 --- a/rostests/winetests/comctl32/datetime.c +++ b/rostests/winetests/comctl32/datetime.c @@ -17,10 +17,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +//#include +#include +#include +#include +#include +#include +#include #include - -#include "wine/test.h" +//#include "wine/test.h" #include "msg.h" #define expect(EXPECTED, GOT) ok((GOT)==(EXPECTED), "Expected %d, got %ld\n", (EXPECTED), (GOT)) @@ -147,6 +152,7 @@ static LRESULT WINAPI datetime_subclass_proc(HWND hwnd, UINT message, WPARAM wPa if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, DATETIME_SEQ_INDEX, &msg); defwndproc_counter++; diff --git a/rostests/winetests/comctl32/dpa.c b/rostests/winetests/comctl32/dpa.c index e3591397fd5..7c7f99b2dc7 100644 --- a/rostests/winetests/comctl32/dpa.c +++ b/rostests/winetests/comctl32/dpa.c @@ -19,17 +19,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + #define COBJMACROS #include -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "commctrl.h" -#include "objidl.h" +#include +#include +#include +#include +#include +//#include "objidl.h" -#include "wine/test.h" +#include #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) diff --git a/rostests/winetests/comctl32/header.c b/rostests/winetests/comctl32/header.c index 08d5065bbcb..ca34e41174e 100644 --- a/rostests/winetests/comctl32/header.c +++ b/rostests/winetests/comctl32/header.c @@ -18,12 +18,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H -#include +//#include +#include +#include +#include +#include +#include +#include #include #include -#include "wine/test.h" +#include #include "v6util.h" #include "msg.h" @@ -409,6 +418,7 @@ static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wPara if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, HEADER_SEQ_INDEX, &msg); defwndproc_counter++; diff --git a/rostests/winetests/comctl32/imagelist.c b/rostests/winetests/comctl32/imagelist.c index 98b84a62d09..7559806a0d1 100644 --- a/rostests/winetests/comctl32/imagelist.c +++ b/rostests/winetests/comctl32/imagelist.c @@ -21,24 +21,28 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + #define COBJMACROS #define CONST_VTABLE -#include +//#include #include #include -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "objbase.h" -#include "commctrl.h" /* must be included after objbase.h to get ImageList_Write */ -#include "initguid.h" -#include "commoncontrols.h" -#include "shellapi.h" +#include +#include +#include +//#include "winuser.h" +#include +#include /* must be included after objbase.h to get ImageList_Write */ +#include +#include +#include -#include "wine/test.h" +#include #include "v6util.h" #undef VISIBLE @@ -492,6 +496,70 @@ static void test_DrawIndirect(void) DestroyWindow(hwndfortest); } +static int get_color_format(HBITMAP bmp) +{ + BITMAPINFO bmi; + HDC hdc = CreateCompatibleDC(0); + HBITMAP hOldBmp = SelectObject(hdc, bmp); + int ret; + + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + ret = GetDIBits(hdc, bmp, 0, 0, 0, &bmi, DIB_RGB_COLORS); + ok(ret, "GetDIBits failed\n"); + + SelectObject(hdc, hOldBmp); + DeleteDC(hdc); + return bmi.bmiHeader.biBitCount; +} + +static void test_merge_colors(void) +{ + HIMAGELIST himl[8], hmerge; + int sizes[] = { ILC_COLOR, ILC_COLOR | ILC_MASK, ILC_COLOR4, ILC_COLOR8, ILC_COLOR16, ILC_COLOR24, ILC_COLOR32, ILC_COLORDDB }; + HICON hicon1; + IMAGEINFO info; + int bpp, i, j; + + hicon1 = CreateIcon(hinst, 32, 32, 1, 1, icon_bits, icon_bits); + ok(hicon1 != NULL, "failed to create hicon1\n"); + + for (i = 0; i < 8; i++) + { + himl[i] = ImageList_Create(32, 32, sizes[i], 0, 3); + ok(himl[i] != NULL, "failed to create himl[%d]\n", i); + ok(0 == ImageList_AddIcon(himl[i], hicon1), "add icon1 to himl[%d] failed\n", i); + if (i == 0 || i == 1 || i == 7) + { + ImageList_GetImageInfo(himl[i], 0, &info); + sizes[i] = get_color_format(info.hbmImage); + } + } + DestroyIcon(hicon1); + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + hmerge = ImageList_Merge(himl[i], 0, himl[j], 0, 0, 0); + ok(hmerge != NULL, "merge himl[%d], himl[%d] failed\n", i, j); + + ImageList_GetImageInfo(hmerge, 0, &info); + bpp = get_color_format(info.hbmImage); + /* ILC_COLOR[X] is defined as [X] */ + if (i == 4 && j == 7) + ok(bpp == 16, /* merging ILC_COLOR16 with ILC_COLORDDB seems to be a special case */ + "wrong biBitCount %d when merging lists %d (%d) and %d (%d)\n", bpp, i, sizes[i], j, sizes[j]); + else + ok(bpp == (i > j ? sizes[i] : sizes[j]), + "wrong biBitCount %d when merging lists %d (%d) and %d (%d)\n", bpp, i, sizes[i], j, sizes[j]); + ok(info.hbmMask != 0, "Imagelist merged from %d and %d had no mask\n", i, j); + + if (hmerge) ImageList_Destroy(hmerge); + } + + for (i = 0; i < 8; i++) + ImageList_Destroy(himl[i]); +} + static void test_merge(void) { HIMAGELIST himl1, himl2, hmerge; @@ -782,22 +850,21 @@ static void check_ilhead_data(const char *ilh_data, INT cx, INT cy, INT cur, INT static HBITMAP create_bitmap(INT cx, INT cy, COLORREF color, const char *comment) { HDC hdc; - char bmibuf[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)]; - BITMAPINFO *bmi = (BITMAPINFO *)bmibuf; + BITMAPINFO bmi; HBITMAP hbmp, hbmp_old; HBRUSH hbrush; RECT rc = { 0, 0, cx, cy }; hdc = CreateCompatibleDC(0); - memset(bmi, 0, sizeof(*bmi)); - bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader); - bmi->bmiHeader.biHeight = cx; - bmi->bmiHeader.biWidth = cy; - bmi->bmiHeader.biBitCount = 24; - bmi->bmiHeader.biPlanes = 1; - bmi->bmiHeader.biCompression = BI_RGB; - hbmp = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, NULL, 0); + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biHeight = cx; + bmi.bmiHeader.biWidth = cy; + bmi.bmiHeader.biBitCount = 24; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biCompression = BI_RGB; + hbmp = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, NULL, NULL, 0); hbmp_old = SelectObject(hdc, hbmp); @@ -1161,6 +1228,7 @@ static void test_shell_imagelist(void) if (!pSHGetImageList) { win_skip("SHGetImageList not available, skipping test\n"); + FreeLibrary(hShell32); return; } @@ -1169,8 +1237,10 @@ static void test_shell_imagelist(void) ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr); - if (hr != S_OK) + if (hr != S_OK) { + FreeLibrary(hShell32); return; + } IImageList_GetImageCount(iml, &out); ok(out > 0, "IImageList_GetImageCount returned out <= 0\n"); @@ -2015,6 +2085,7 @@ START_TEST(imagelist) test_imagecount(); test_DrawIndirect(); test_merge(); + test_merge_colors(); test_imagelist_storage(); test_iconsize(); diff --git a/rostests/winetests/comctl32/ipaddress.c b/rostests/winetests/comctl32/ipaddress.c index 96540cbe68e..4acdd83cb06 100644 --- a/rostests/winetests/comctl32/ipaddress.c +++ b/rostests/winetests/comctl32/ipaddress.c @@ -17,12 +17,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include -#include +//#include +#include #include -#include "wine/test.h" - #define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got) static HWND create_ipaddress_control (void) diff --git a/rostests/winetests/comctl32/listview.c b/rostests/winetests/comctl32/listview.c index 255ef50d140..62b9b779823 100644 --- a/rostests/winetests/comctl32/listview.c +++ b/rostests/winetests/comctl32/listview.c @@ -3,7 +3,7 @@ * * Copyright 2006 Mike McCormack for CodeWeavers * Copyright 2007 George Gov - * Copyright 2009-2012 Nikolay Sivov + * Copyright 2009-2013 Nikolay Sivov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include + +//#include +//#include +#include +#include #include -#include "wine/test.h" #include "v6util.h" #include "msg.h" @@ -52,6 +55,8 @@ static BOOL blockEdit; static BOOL g_block_hover; /* notification data for LVN_ITEMCHANGED */ static NMLISTVIEW g_nmlistview; +/* notification data for LVN_ITEMCHANGING */ +static NMLISTVIEW g_nmlistview_changing; /* format reported to control: -1 falls to defproc, anything else returned */ static INT notifyFormat; @@ -63,6 +68,8 @@ static LVITEMA g_itema; static BOOL g_disp_A_to_W; /* dispinfo data sent with LVN_LVN_ENDLABELEDIT */ static NMLVDISPINFO g_editbox_disp_info; +/* when this is set focus will be tested on LVN_DELETEITEM */ +static BOOL g_focus_test_LVN_DELETEITEM; static HWND subclass_editbox(HWND hwndListview); @@ -207,7 +214,7 @@ static const struct message ownerdata_deselect_all_parent_seq[] = { { 0 } }; -static const struct message select_all_parent_seq[] = { +static const struct message change_all_parent_seq[] = { { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED }, @@ -225,6 +232,15 @@ static const struct message select_all_parent_seq[] = { { 0 } }; +static const struct message changing_all_parent_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { 0 } +}; + static const struct message textcallback_set_again_parent_seq[] = { { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED }, @@ -247,6 +263,18 @@ static const struct message getitemposition_seq2[] = { { 0 } }; +static const struct message getsubitemrect_seq[] = { + { LVM_GETSUBITEMRECT, sent|id|wparam, -1, 0, LISTVIEW_ID }, + { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID }, + { LVM_GETSUBITEMRECT, sent|id|wparam, 0, 0, LISTVIEW_ID }, + { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID }, + { LVM_GETSUBITEMRECT, sent|id|wparam, -10, 0, LISTVIEW_ID }, + { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID }, + { LVM_GETSUBITEMRECT, sent|id|wparam, 20, 0, LISTVIEW_ID }, + { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID }, + { 0 } +}; + static const struct message editbox_create_pos[] = { /* sequence sent after LVN_BEGINLABELEDIT */ /* next two are 4.7x specific */ @@ -312,6 +340,41 @@ static const struct message listview_header_changed_seq[] = { { 0 } }; +static const struct message parent_header_click_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, LVN_COLUMNCLICK }, + { WM_NOTIFY, sent|id, 0, 0, HDN_ITEMCLICKA }, + { 0 } +}; + +static const struct message parent_header_divider_dclick_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, HDN_ITEMCHANGINGA }, + { WM_NOTIFY, sent|id, 0, 0, NM_CUSTOMDRAW }, + { WM_NOTIFY, sent|id, 0, 0, NM_CUSTOMDRAW }, + { WM_NOTIFY, sent|id, 0, 0, HDN_ITEMCHANGEDA }, + { WM_NOTIFY, sent|id, 0, 0, HDN_DIVIDERDBLCLICKA }, + { 0 } +}; + +static const struct message listview_set_imagelist[] = { + { LVM_SETIMAGELIST, sent|id, 0, 0, LISTVIEW_ID }, + { 0 } +}; + +static const struct message listview_header_set_imagelist[] = { + { LVM_SETIMAGELIST, sent|id, 0, 0, LISTVIEW_ID }, + { HDM_SETIMAGELIST, sent|id, 0, 0, HEADER_ID }, + { 0 } +}; + +static const struct message parent_insert_focused_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING }, + { 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 LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; @@ -390,6 +453,12 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP "BEGIN" : "END", pScroll->dx, pScroll->dy); } break; + case LVN_ITEMCHANGING: + { + NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam; + g_nmlistview_changing = *nmlv; + } + break; case LVN_ITEMCHANGED: { NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam; @@ -416,6 +485,16 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP "buffer size %d\n", dispinfo->item.cchTextMax); } break; + case LVN_DELETEITEM: + if (g_focus_test_LVN_DELETEITEM) + { + NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam; + UINT state; + + state = SendMessageA(((NMHDR*)lParam)->hwndFrom, LVM_GETITEMSTATE, nmlv->iItem, LVIS_FOCUSED); + ok(state == 0, "got state %x\n", state); + } + break; case NM_HOVER: if (g_block_hover) return 1; break; @@ -626,6 +705,7 @@ static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wPar if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; /* all we need is sizing */ if (message == WM_WINDOWPOSCHANGING || @@ -1586,6 +1666,8 @@ static void test_create(void) rect.top = 1; rect.right = rect.bottom = -10; r = SendMessage(hList, LVM_GETSUBITEMRECT, -1, (LPARAM)&rect); + /* right value contains garbage, probably because header columns are not set up */ + expect(0, rect.bottom); expect(1, r); hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0); @@ -1686,7 +1768,10 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) return CDRF_NOTIFYSUBITEMDRAW; case CDDS_ITEMPREPAINT | CDDS_SUBITEM: clr = GetBkColor(nmlvcd->nmcd.hdc); - todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); + if (nmlvcd->iSubItem) + todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); + else + ok(clr == c0ffee, "clr=%.8x\n", clr); return CDRF_NOTIFYPOSTPAINT; case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM: clr = GetBkColor(nmlvcd->nmcd.hdc); @@ -2092,28 +2177,32 @@ static void test_multiselect(void) hwnd = create_listview_control(LVS_REPORT); - for (i=0;i rect2.top, "expected not zero height\n"); -} arr[0] = 1; arr[1] = 0; arr[2] = 2; r = SendMessage(hwnd, LVM_SETCOLUMNORDERARRAY, 3, (LPARAM)arr); @@ -2956,7 +3126,7 @@ static void test_ownerdata(void) res = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); expect(TRUE, res); - ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "ownerdata deselect all notification", TRUE); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "ownerdata deselect all notification", FALSE); /* select one, then deselect all */ item.stateMask = LVIS_SELECTED; @@ -4434,9 +4604,7 @@ static void test_getitemspacing(void) HWND hwnd; DWORD ret; INT cx, cy; - HIMAGELIST himl; - HBITMAP hbmp; - LVITEMA itema; + HIMAGELIST himl40, himl80; cx = GetSystemMetrics(SM_CXICONSPACING) - GetSystemMetrics(SM_CXICON); cy = GetSystemMetrics(SM_CYICONSPACING) - GetSystemMetrics(SM_CYICON); @@ -4444,56 +4612,113 @@ static void test_getitemspacing(void) /* LVS_ICON */ hwnd = create_listview_control(LVS_ICON); ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); -todo_wine { expect(cx, LOWORD(ret)); expect(cy, HIWORD(ret)); -} + /* now try with icons */ - himl = ImageList_Create(40, 40, 0, 4, 4); - ok(himl != NULL, "failed to create imagelist\n"); - hbmp = CreateBitmap(40, 40, 1, 1, NULL); - ok(hbmp != NULL, "failed to create bitmap\n"); - ret = ImageList_Add(himl, hbmp, 0); - expect(0, ret); - ret = SendMessage(hwnd, LVM_SETIMAGELIST, 0, (LPARAM)himl); + himl40 = ImageList_Create(40, 40, 0, 4, 4); + ok(himl40 != NULL, "failed to create imagelist\n"); + himl80 = ImageList_Create(80, 80, 0, 4, 4); + ok(himl80 != NULL, "failed to create imagelist\n"); + ret = SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40); expect(0, ret); - itema.mask = LVIF_IMAGE; - itema.iImage = 0; - itema.iItem = 0; - itema.iSubItem = 0; - ret = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM)&itema); - expect(0, ret); ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); -todo_wine { /* spacing + icon size returned */ expect(cx + 40, LOWORD(ret)); expect(cy + 40, HIWORD(ret)); -} + /* try changing icon size */ + SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl80); + + ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); + /* spacing + icon size returned */ + expect(cx + 80, LOWORD(ret)); + expect(cy + 80, HIWORD(ret)); + + /* set own icon spacing */ + ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(100, 100)); + expect(cx + 80, LOWORD(ret)); + expect(cy + 80, HIWORD(ret)); + + ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); + /* set size returned */ + expect(100, LOWORD(ret)); + expect(100, HIWORD(ret)); + + /* now change image list - icon spacing should be unaffected */ + SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40); + + ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); + /* set size returned */ + expect(100, LOWORD(ret)); + expect(100, HIWORD(ret)); + + /* spacing = 0 - keep previous value */ + ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELPARAM(0, -1)); + expect(100, LOWORD(ret)); + expect(100, HIWORD(ret)); + + ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); + expect(100, LOWORD(ret)); + + expect(0xFFFF, HIWORD(ret)); + + if (sizeof(void*) == 8) + { + /* NOTE: -1 is not treated the same as (DWORD)-1 by 64bit listview */ + ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, (DWORD)-1); + expect(100, LOWORD(ret)); + expect(0xFFFF, HIWORD(ret)); + + ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, -1); + expect(0xFFFF, LOWORD(ret)); + expect(0xFFFF, HIWORD(ret)); + } + else + { + ret = SendMessage(hwnd, LVM_SETICONSPACING, 0, -1); + expect(100, LOWORD(ret)); + expect(0xFFFF, HIWORD(ret)); + } + ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); + /* spacing + icon size returned */ + expect(cx + 40, LOWORD(ret)); + expect(cy + 40, HIWORD(ret)); + + SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0); + ImageList_Destroy(himl80); DestroyWindow(hwnd); /* LVS_SMALLICON */ hwnd = create_listview_control(LVS_SMALLICON); ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); -todo_wine { expect(cx, LOWORD(ret)); expect(cy, HIWORD(ret)); -} + + /* spacing does not depend on selected view type */ + ret = SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl40); + expect(0, ret); + + ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); + /* spacing + icon size returned */ + expect(cx + 40, LOWORD(ret)); + expect(cy + 40, HIWORD(ret)); + + SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, 0); + ImageList_Destroy(himl40); DestroyWindow(hwnd); /* LVS_REPORT */ hwnd = create_listview_control(LVS_REPORT); ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); -todo_wine { expect(cx, LOWORD(ret)); expect(cy, HIWORD(ret)); -} + DestroyWindow(hwnd); /* LVS_LIST */ hwnd = create_listview_control(LVS_LIST); ret = SendMessage(hwnd, LVM_GETITEMSPACING, FALSE, 0); -todo_wine { expect(cx, LOWORD(ret)); expect(cy, HIWORD(ret)); -} + DestroyWindow(hwnd); } @@ -4910,6 +5135,146 @@ static void test_header_notification(void) DestroyWindow(list); } +static void test_header_notification2(void) +{ + static char textA[] = "newtext"; + HWND list, header; + HDITEMW itemW; + NMHEADERW nmhdr; + LVCOLUMNA col; + DWORD ret; + WCHAR buffer[100]; + struct message parent_header_notify_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, 0 }, + { 0 } + }; + + list = create_listview_control(LVS_REPORT); + ok(list != NULL, "failed to create listview window\n"); + + memset(&col, 0, sizeof(col)); + col.mask = LVCF_WIDTH | LVCF_TEXT; + col.cx = 100; + col.pszText = textA; + ret = SendMessage(list, LVM_INSERTCOLUMNA, 0, (LPARAM)&col); + expect(0, ret); + + header = ListView_GetHeader(list); + ok(header != 0, "No header\n"); + memset(&itemW, 0, sizeof(itemW)); + itemW.mask = HDI_WIDTH | HDI_ORDER | HDI_TEXT; + itemW.pszText = buffer; + itemW.cchTextMax = sizeof(buffer); + ret = SendMessageW(header, HDM_GETITEMW, 0, (LPARAM)&itemW); + expect(1, ret); + + nmhdr.hdr.hwndFrom = header; + nmhdr.hdr.idFrom = GetWindowLongPtr(header, GWLP_ID); + nmhdr.iItem = 0; + nmhdr.iButton = 0; + nmhdr.pitem = &itemW; + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ITEMCHANGINGW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + parent_header_notify_seq[0].id = HDN_ITEMCHANGINGA; + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, + "header notify, parent", TRUE); + todo_wine + ok(nmhdr.hdr.code == HDN_ITEMCHANGINGA, "Expected ANSI notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ITEMCHANGEDW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + parent_header_notify_seq[0].id = HDN_ITEMCHANGEDA; + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, + "header notify, parent", TRUE); + todo_wine + ok(nmhdr.hdr.code == HDN_ITEMCHANGEDA, "Expected ANSI notification code\n"); + /* HDN_ITEMCLICK sets focus to list, which generates messages we don't want to check */ + SetFocus(list); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ITEMCLICKW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_click_seq, + "header notify, parent", FALSE); + ok(nmhdr.hdr.code == HDN_ITEMCLICKA, "Expected ANSI notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ITEMDBLCLICKW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + ok(nmhdr.hdr.code == HDN_ITEMDBLCLICKW, "Expected Unicode notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_DIVIDERDBLCLICKW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_divider_dclick_seq, + "header notify, parent", TRUE); + ok(nmhdr.hdr.code == HDN_DIVIDERDBLCLICKA, "Expected ANSI notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_BEGINTRACKW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + ok(nmhdr.hdr.code == HDN_BEGINTRACKW, "Expected Unicode notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ENDTRACKW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + parent_header_notify_seq[0].id = HDN_ENDTRACKA; + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, + "header notify, parent", FALSE); + ok(nmhdr.hdr.code == HDN_ENDTRACKA, "Expected ANSI notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_TRACKW; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + parent_header_notify_seq[0].id = HDN_TRACKA; + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, + "header notify, parent", FALSE); + ok(nmhdr.hdr.code == HDN_TRACKA, "Expected ANSI notification code\n"); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_BEGINDRAG; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ENDDRAG; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + parent_header_notify_seq[0].id = HDN_ENDDRAG; + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, + "header notify, parent", FALSE); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_FILTERCHANGE; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + parent_header_notify_seq[0].id = HDN_FILTERCHANGE; + parent_header_notify_seq[0].flags |= optional; /* NT4 does not send this message */ + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, + "header notify, parent", FALSE); + parent_header_notify_seq[0].flags &= ~optional; + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_BEGINFILTEREDIT; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ENDFILTEREDIT; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ITEMSTATEICONCLICK; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + nmhdr.hdr.code = HDN_ITEMKEYDOWN; + ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, + "header notify, parent", FALSE); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + DestroyWindow(list); +} + static void test_createdragimage(void) { HIMAGELIST himl; @@ -4999,6 +5364,198 @@ static void test_LVM_SETITEMTEXT(void) DestroyWindow(hwnd); } +static void test_imagelists(void) +{ + HWND hwnd, header; + HIMAGELIST himl1, himl2, himl3; + LRESULT ret; + + himl1 = ImageList_Create(40, 40, 0, 4, 4); + himl2 = ImageList_Create(40, 40, 0, 4, 4); + himl3 = ImageList_Create(40, 40, 0, 4, 4); + ok(himl1 != NULL, "Failed to create imagelist\n"); + ok(himl2 != NULL, "Failed to create imagelist\n"); + ok(himl3 != NULL, "Failed to create imagelist\n"); + + hwnd = create_listview_control(LVS_REPORT | LVS_SHAREIMAGELISTS); + header = subclass_header(hwnd); + + ok(header != NULL, "Expected header\n"); + ret = SendMessage(header, HDM_GETIMAGELIST, 0, 0); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + ret = SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl1); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_set_imagelist, + "set normal image list", FALSE); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + ret = SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl2); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_set_imagelist, + "set state image list", TRUE); + + ret = SendMessage(header, HDM_GETIMAGELIST, 0, 0); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + ret = SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)himl3); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_header_set_imagelist, + "set small image list", FALSE); + + ret = SendMessage(header, HDM_GETIMAGELIST, 0, 0); + ok((HIMAGELIST)ret == himl3, "Expected imagelist %p, got %p\n", himl3, (HIMAGELIST)ret); + DestroyWindow(hwnd); + + hwnd = create_listview_control(WS_VISIBLE | LVS_ICON); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + ret = SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)himl1); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_set_imagelist, + "set normal image list", FALSE); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + ret = SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl2); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_set_imagelist, + "set state image list", FALSE); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + ret = SendMessageW(hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)himl3); + ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret); + ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_set_imagelist, + "set small image list", FALSE); + + header = ListView_GetHeader(hwnd); + ok(header == NULL, "Expected no header, got %p\n", header); + + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | LVS_REPORT); + + header = (HWND)SendMessage(hwnd, LVM_GETHEADER, 0, 0); + ok(header != NULL, "Expected header, got NULL\n"); + + ret = SendMessage(header, HDM_GETIMAGELIST, 0, 0); + ok((HIMAGELIST)ret == himl3, "Expected imagelist %p, got %p\n", himl3, (HIMAGELIST)ret); + + DestroyWindow(hwnd); +} + +static void test_deleteitem(void) +{ + LVITEMA item; + UINT state; + HWND hwnd; + BOOL ret; + + hwnd = create_listview_control(LVS_REPORT); + + insert_item(hwnd, 0); + insert_item(hwnd, 0); + insert_item(hwnd, 0); + insert_item(hwnd, 0); + insert_item(hwnd, 0); + + g_focus_test_LVN_DELETEITEM = TRUE; + + /* delete focused item (not the last index) */ + item.stateMask = LVIS_FOCUSED; + item.state = LVIS_FOCUSED; + ret = SendMessageA(hwnd, LVM_SETITEMSTATE, 2, (LPARAM)&item); + ok(ret == TRUE, "got %d\n", ret); + ret = SendMessageA(hwnd, LVM_DELETEITEM, 2, 0); + ok(ret == TRUE, "got %d\n", ret); + /* next item gets focus */ + state = SendMessageA(hwnd, LVM_GETITEMSTATE, 2, LVIS_FOCUSED); + ok(state == LVIS_FOCUSED, "got %x\n", state); + + /* focus last item and delete it */ + item.stateMask = LVIS_FOCUSED; + item.state = LVIS_FOCUSED; + ret = SendMessageA(hwnd, LVM_SETITEMSTATE, 3, (LPARAM)&item); + ok(ret == TRUE, "got %d\n", ret); + ret = SendMessageA(hwnd, LVM_DELETEITEM, 3, 0); + ok(ret == TRUE, "got %d\n", ret); + /* new last item gets focus */ + state = SendMessageA(hwnd, LVM_GETITEMSTATE, 2, LVIS_FOCUSED); + ok(state == LVIS_FOCUSED, "got %x\n", state); + + /* focus first item and delete it */ + item.stateMask = LVIS_FOCUSED; + item.state = LVIS_FOCUSED; + ret = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item); + ok(ret == TRUE, "got %d\n", ret); + ret = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + ok(ret == TRUE, "got %d\n", ret); + /* new first item gets focus */ + state = SendMessageA(hwnd, LVM_GETITEMSTATE, 0, LVIS_FOCUSED); + ok(state == LVIS_FOCUSED, "got %x\n", state); + + g_focus_test_LVN_DELETEITEM = FALSE; + + DestroyWindow(hwnd); +} + +static void test_insertitem(void) +{ + LVITEMA item; + UINT state; + HWND hwnd; + INT ret; + + hwnd = create_listview_control(LVS_REPORT); + + /* insert item 0 focused */ + item.mask = LVIF_STATE; + item.state = LVIS_FOCUSED; + item.stateMask = LVIS_FOCUSED; + item.iItem = 0; + item.iSubItem = 0; + ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item); + ok(ret == 0, "got %d\n", ret); + + state = SendMessageA(hwnd, LVM_GETITEMSTATE, 0, LVIS_FOCUSED); + ok(state == LVIS_FOCUSED, "got %x\n", state); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + /* insert item 1, focus shift */ + item.mask = LVIF_STATE; + item.state = LVIS_FOCUSED; + item.stateMask = LVIS_FOCUSED; + item.iItem = 1; + item.iSubItem = 0; + ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item); + ok(ret == 1, "got %d\n", ret); + + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_insert_focused_seq, "insert focused", TRUE); + + state = SendMessageA(hwnd, LVM_GETITEMSTATE, 1, LVIS_FOCUSED); + ok(state == LVIS_FOCUSED, "got %x\n", state); + + /* insert item 2, no focus shift */ + item.mask = LVIF_STATE; + item.state = 0; + item.stateMask = LVIS_FOCUSED; + item.iItem = 2; + item.iSubItem = 0; + ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item); + ok(ret == 2, "got %d\n", ret); + + state = SendMessageA(hwnd, LVM_GETITEMSTATE, 1, LVIS_FOCUSED); + ok(state == LVIS_FOCUSED, "got %x\n", state); + + DestroyWindow(hwnd); +} + START_TEST(listview) { HMODULE hComctl32; @@ -5028,6 +5585,7 @@ START_TEST(listview) g_is_below_5 = is_below_comctl_5(); test_header_notification(); + test_header_notification2(); test_images(); test_checkboxes(); test_items(); @@ -5064,6 +5622,9 @@ START_TEST(listview) test_createdragimage(); test_dispinfo(); test_LVM_SETITEMTEXT(); + test_imagelists(); + test_deleteitem(); + test_insertitem(); if (!load_v6_module(&ctx_cookie, &hCtx)) { @@ -5093,6 +5654,9 @@ START_TEST(listview) test_scrollnotify(); test_LVS_EX_TRANSPARENTBKGND(); test_LVS_EX_HEADERINALLVIEWS(); + test_deleteitem(); + test_multiselect(); + test_insertitem(); unload_v6_module(ctx_cookie, hCtx); diff --git a/rostests/winetests/comctl32/misc.c b/rostests/winetests/comctl32/misc.c index 5aff06f95ea..72dcc662725 100644 --- a/rostests/winetests/comctl32/misc.c +++ b/rostests/winetests/comctl32/misc.c @@ -18,10 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +//#include +//#include -#include "wine/test.h" +#include static PVOID (WINAPI * pAlloc)(LONG); static PVOID (WINAPI * pReAlloc)(PVOID, LONG); diff --git a/rostests/winetests/comctl32/monthcal.c b/rostests/winetests/comctl32/monthcal.c index 1fed8319b4d..1d8ccfa8c78 100644 --- a/rostests/winetests/comctl32/monthcal.c +++ b/rostests/winetests/comctl32/monthcal.c @@ -19,18 +19,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include -#include "windef.h" -#include "winbase.h" -#include "winuser.h" +//#include -#include "commctrl.h" +//#include "windef.h" +//#include "winbase.h" +#include +#include +#include +#include -#include "wine/test.h" #include "v6util.h" -#include -#include +//#include +//#include #include "msg.h" #define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got); @@ -588,6 +590,7 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, MONTHCAL_SEQ_INDEX, &msg); /* some debug output for style changing */ @@ -1367,10 +1370,8 @@ static void test_monthrange(void) hwnd = create_monthcal_control(0); - st_visible[0].wYear = 0; - st_visible[0].wMonth = 0; - st_visible[0].wDay = 0; - st_daystate[1] = st_daystate[0] = st_visible[1] = st_visible[0]; + memset(&st_visible, 0, sizeof(st_visible)); + memset(&st_daystate, 0, sizeof(st_daystate)); st.wYear = 2000; st.wMonth = 11; diff --git a/rostests/winetests/comctl32/mru.c b/rostests/winetests/comctl32/mru.c index 1d8ad9a867e..075281c9fb7 100644 --- a/rostests/winetests/comctl32/mru.c +++ b/rostests/winetests/comctl32/mru.c @@ -19,16 +19,16 @@ */ #include -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winreg.h" -#include "commctrl.h" -#include "shlwapi.h" +#include +#include +//#include "wingdi.h" +#include +//#include "winnls.h" +#include +#include +//#include "shlwapi.h" -#include "wine/test.h" +#include /* Keys for testing MRU functions */ #define REG_TEST_BASEKEYA "Software\\Wine" diff --git a/rostests/winetests/comctl32/msg.h b/rostests/winetests/comctl32/msg.h index 1d78ffea94e..fd6fb99c57f 100644 --- a/rostests/winetests/comctl32/msg.h +++ b/rostests/winetests/comctl32/msg.h @@ -19,8 +19,8 @@ */ #include -#include -#include "wine/test.h" +//#include +#include /* undocumented SWP flags - from SDK 3.1 */ #define SWP_NOCLIENTSIZE 0x0800 diff --git a/rostests/winetests/comctl32/pager.c b/rostests/winetests/comctl32/pager.c index 8ac062da2a6..21f619baa96 100644 --- a/rostests/winetests/comctl32/pager.c +++ b/rostests/winetests/comctl32/pager.c @@ -18,10 +18,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include + +//#include +#include +#include #include -#include "wine/test.h" #include "msg.h" #define NUM_MSG_SEQUENCES 1 diff --git a/rostests/winetests/comctl32/propsheet.c b/rostests/winetests/comctl32/propsheet.c index 992b60fb34e..35373adcd30 100644 --- a/rostests/winetests/comctl32/propsheet.c +++ b/rostests/winetests/comctl32/propsheet.c @@ -18,14 +18,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include + +//#include +#include +#include #include #include "msg.h" #include "resources.h" -#include "wine/test.h" - static HWND parenthwnd; static HWND sheethwnd; @@ -821,7 +823,7 @@ if (0) ok(r == 4, "got %d\n", r); /* select page that can't be created */ - ret = SendMessageA(hdlg, PSM_SETCURSEL, 3, 0); + ret = SendMessageA(hdlg, PSM_SETCURSEL, 3, 1); ok(ret == TRUE, "got %d\n", ret); r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); diff --git a/rostests/winetests/comctl32/rebar.c b/rostests/winetests/comctl32/rebar.c index 88c931c633a..a608603c511 100644 --- a/rostests/winetests/comctl32/rebar.c +++ b/rostests/winetests/comctl32/rebar.c @@ -21,14 +21,16 @@ #define _WIN32_WINNT 0x500 #define _WIN32_IE 0x500 +#include + #include -#include +//#include -#include +//#include +#include +#include #include -#include - -#include "wine/test.h" +//#include static RECT height_change_notify_rect; static HWND hMainWnd; diff --git a/rostests/winetests/comctl32/rsrc.rc b/rostests/winetests/comctl32/rsrc.rc index 4f7a2253f17..5c131ef943e 100644 --- a/rostests/winetests/comctl32/rsrc.rc +++ b/rostests/winetests/comctl32/rsrc.rc @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "windef.h" +//#include "windef.h" #include "winuser.h" #include "resources.h" diff --git a/rostests/winetests/comctl32/status.c b/rostests/winetests/comctl32/status.c index d8b3dbe0d26..69c3d9623e1 100644 --- a/rostests/winetests/comctl32/status.c +++ b/rostests/winetests/comctl32/status.c @@ -18,11 +18,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include +#include -#include "wine/test.h" +#include +//#include +#include +#include +#include #define SUBCLASS_NAME "MyStatusBar" @@ -492,7 +494,7 @@ static void test_gettext(void) expect(4, r); /* A size of 0 returns the length of the text */ r = SendMessage(hwndStatus, WM_GETTEXT, 0, 0); - expect(4, r); + ok( r == 4 || broken(r == 2) /* win8 */, "Expected 4 got %d\n", r ); /* A size of 1 only stores the NULL terminator */ buf[0] = 0xa; r = SendMessage(hwndStatus, WM_GETTEXT, 1, (LPARAM)buf); diff --git a/rostests/winetests/comctl32/syslink.c b/rostests/winetests/comctl32/syslink.c index ea92d428b71..039577f2048 100644 --- a/rostests/winetests/comctl32/syslink.c +++ b/rostests/winetests/comctl32/syslink.c @@ -17,10 +17,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include + +//#include +#include +#include #include -#include "wine/test.h" #include "v6util.h" #include "msg.h" @@ -155,6 +158,7 @@ static LRESULT WINAPI syslink_subclass_proc(HWND hwnd, UINT message, WPARAM wPar if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, SYSLINK_SEQ_INDEX, &msg); defwndproc_counter++; diff --git a/rostests/winetests/comctl32/tab.c b/rostests/winetests/comctl32/tab.c index 51a8a912902..adebcfdea46 100644 --- a/rostests/winetests/comctl32/tab.c +++ b/rostests/winetests/comctl32/tab.c @@ -18,12 +18,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include + #include -#include +//#include +#include +#include #include #include -#include "wine/test.h" #include "msg.h" #define DEFAULT_MIN_TAB_WIDTH 54 @@ -352,6 +355,7 @@ static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, PARENT_SEQ_INDEX, &msg); } @@ -419,6 +423,7 @@ static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, TAB_SEQ_INDEX, &msg); } diff --git a/rostests/winetests/comctl32/testlist.c b/rostests/winetests/comctl32/testlist.c index d90fbadb06c..d3990f77768 100644 --- a/rostests/winetests/comctl32/testlist.c +++ b/rostests/winetests/comctl32/testlist.c @@ -1,10 +1,7 @@ /* Automatically generated file; DO NOT EDIT!! */ -#define WIN32_LEAN_AND_MEAN -#include - #define STANDALONE -#include "wine/test.h" +#include extern void func_comboex(void); extern void func_datetime(void); diff --git a/rostests/winetests/comctl32/tooltips.c b/rostests/winetests/comctl32/tooltips.c index 71c66a5517b..e17de9a2297 100644 --- a/rostests/winetests/comctl32/tooltips.c +++ b/rostests/winetests/comctl32/tooltips.c @@ -17,11 +17,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include +#include -#include "wine/test.h" +#include +//#include +#include +#include +#include +#include #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) diff --git a/rostests/winetests/comctl32/trackbar.c b/rostests/winetests/comctl32/trackbar.c index 7a0e398c107..aa0d65fb4ec 100644 --- a/rostests/winetests/comctl32/trackbar.c +++ b/rostests/winetests/comctl32/trackbar.c @@ -17,11 +17,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include + +//#include +#include +#include #include #include -#include "wine/test.h" #include "msg.h" #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) @@ -442,6 +445,7 @@ static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wPa if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, TRACKBAR_SEQ_INDEX, &msg); defwndproc_counter++; diff --git a/rostests/winetests/comctl32/treeview.c b/rostests/winetests/comctl32/treeview.c index 2fe468be4a9..3c437de8d79 100644 --- a/rostests/winetests/comctl32/treeview.c +++ b/rostests/winetests/comctl32/treeview.c @@ -292,6 +292,7 @@ static LRESULT WINAPI TreeviewWndProc(HWND hwnd, UINT message, WPARAM wParam, LP if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, TREEVIEW_SEQ_INDEX, &msg); defwndproc_counter++; @@ -1001,7 +1002,10 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - if (message == WM_NOTIFY && lParam) msg.id = ((NMHDR*)lParam)->code; + if (message == WM_NOTIFY && lParam) + msg.id = ((NMHDR*)lParam)->code; + else + msg.id = 0; /* log system messages, except for painting */ if (message < WM_USER && @@ -1946,6 +1950,19 @@ static void test_TVM_HITTEST(void) DestroyWindow(hTree); } +static void test_WM_GETDLGCODE(void) +{ + DWORD code; + HWND hTree; + + hTree = create_treeview_control(0); + + code = SendMessageA(hTree, WM_GETDLGCODE, VK_TAB, 0); + ok(code == (DLGC_WANTCHARS | DLGC_WANTARROWS), "0x%08x\n", code); + + DestroyWindow(hTree); +} + START_TEST(treeview) { HMODULE hComctl32; @@ -2019,6 +2036,7 @@ START_TEST(treeview) test_TVS_CHECKBOXES(); test_TVM_GETNEXTITEM(); test_TVM_HITTEST(); + test_WM_GETDLGCODE(); if (!load_v6_module(&ctx_cookie, &hCtx)) { @@ -2044,6 +2062,7 @@ START_TEST(treeview) /* comctl32 version 6 tests start here */ test_expandedimage(); test_htreeitem_layout(); + test_WM_GETDLGCODE(); unload_v6_module(ctx_cookie, hCtx); diff --git a/rostests/winetests/comctl32/updown.c b/rostests/winetests/comctl32/updown.c index e2a640f8d56..bacc1126dc3 100644 --- a/rostests/winetests/comctl32/updown.c +++ b/rostests/winetests/comctl32/updown.c @@ -44,11 +44,14 @@ * - more stuff to test */ -#include +#include + +//#include +#include +#include #include #include -#include "wine/test.h" #include "msg.h" #define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT)) @@ -186,6 +189,7 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, PARENT_SEQ_INDEX, &msg); }