Author: akhaldi Date: Thu Mar 19 12:07:45 2015 New Revision: 66801
URL: http://svn.reactos.org/svn/reactos?rev=66801&view=rev Log: [COMCTL32_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
Modified: trunk/rostests/winetests/comctl32/button.c trunk/rostests/winetests/comctl32/comboex.c trunk/rostests/winetests/comctl32/dpa.c trunk/rostests/winetests/comctl32/imagelist.c trunk/rostests/winetests/comctl32/misc.c trunk/rostests/winetests/comctl32/propsheet.c trunk/rostests/winetests/comctl32/tab.c trunk/rostests/winetests/comctl32/treeview.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] Thu Mar 19 12:07:45 2015 @@ -426,13 +426,6 @@ };
static const struct message setcheck_ignored_seq[] = -{ - { BM_SETCHECK, sent }, - { WM_APP, sent|wparam|lparam, 0, 0 }, - { 0 } -}; - -static const struct message setcheck_uncheck_seq[] = { { BM_SETCHECK, sent }, { WM_APP, sent|wparam|lparam, 0, 0 }, @@ -764,7 +757,7 @@ ok(!strcmp(buffA, "Button"), "got %s\n", buffA); DestroyWindow(hwnd);
- /* explicitely create with versioned class name */ + /* explicitly create with versioned class name */ hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL); todo_wine ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW));
Modified: trunk/rostests/winetests/comctl32/comboex.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/comboex... ============================================================================== --- trunk/rostests/winetests/comctl32/comboex.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/comboex.c [iso-8859-1] Thu Mar 19 12:07:45 2015 @@ -132,7 +132,7 @@
static void test_comboboxex(void) { HWND myHwnd = 0; - LONG res = -1; + LONG res; COMBOBOXEXITEMA cbexItem; static const char *first_item = "First Item", *second_item = "Second Item",
Modified: trunk/rostests/winetests/comctl32/dpa.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/dpa.c?r... ============================================================================== --- trunk/rostests/winetests/comctl32/dpa.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/dpa.c [iso-8859-1] Thu Mar 19 12:07:45 2015 @@ -276,7 +276,7 @@ ok(rc, "dw2=0x%x\n", dw2);
/* Clone into an old DPA */ - p = NULL; SetLastError(ERROR_SUCCESS); + SetLastError(ERROR_SUCCESS); p = pDPA_Clone(dpa, dpa3); ok(p == dpa3, "p=%p\n", p); rc=CheckDPA(dpa3, 0x123456, &dw3);
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] Thu Mar 19 12:07:45 2015 @@ -255,6 +255,51 @@ if (memcmp(bits, checkbits, (size * size)/8)) dump_bits(bits, checkbits, size); #endif /* VISIBLE */ +} + +static void test_begindrag(void) +{ + HIMAGELIST himl = createImageList(7,13); + HIMAGELIST drag; + BOOL ret; + int count; + POINT hotspot; + + count = ImageList_GetImageCount(himl); + ok(count > 2, "Tests need an ImageList with more than 2 images\n"); + + /* Two BeginDrag() without EndDrag() in between */ + ret = ImageList_BeginDrag(himl, 1, 0, 0); + drag = ImageList_GetDragImage(NULL, NULL); + ok(ret && drag, "ImageList_BeginDrag() failed\n"); + ret = ImageList_BeginDrag(himl, 0, 3, 5); + ok(!ret, "ImageList_BeginDrag() returned TRUE\n"); + drag = ImageList_GetDragImage(NULL, &hotspot); + ok(!!drag, "No active ImageList drag left\n"); + ok(hotspot.x == 0 && hotspot.y == 0, "New ImageList drag was created\n"); + ImageList_EndDrag(); + drag = ImageList_GetDragImage(NULL, NULL); + ok(!drag, "ImageList drag was not destroyed\n"); + + /* Invalid image index */ + ImageList_BeginDrag(himl, 0, 0, 0); + ret = ImageList_BeginDrag(himl, count, 3, 5); + ok(!ret, "ImageList_BeginDrag() returned TRUE\n"); + drag = ImageList_GetDragImage(NULL, &hotspot); + ok(drag && hotspot.x == 0 && hotspot.y == 0, "Active drag should not have been canceled\n"); + ImageList_EndDrag(); + drag = ImageList_GetDragImage(NULL, NULL); + ok(!drag, "ImageList drag was not destroyed\n"); + /* Invalid negative image indexes succeed */ + ret = ImageList_BeginDrag(himl, -17, 0, 0); + drag = ImageList_GetDragImage(NULL, NULL); + ok(ret && drag, "ImageList drag was created\n"); + ImageList_EndDrag(); + ret = ImageList_BeginDrag(himl, -1, 0, 0); + drag = ImageList_GetDragImage(NULL, NULL); + ok(ret && drag, "ImageList drag was created\n"); + ImageList_EndDrag(); + ImageList_Destroy(himl); }
static void test_hotspot(void) @@ -2091,6 +2136,7 @@ InitCommonControls();
test_create_destroy(); + test_begindrag(); test_hotspot(); test_add_remove(); test_imagecount();
Modified: trunk/rostests/winetests/comctl32/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/misc.c?... ============================================================================== --- trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] Thu Mar 19 12:07:45 2015 @@ -22,6 +22,9 @@ //#include <windows.h>
#include <wine/test.h> +#include <wingdi.h> +#include <winuser.h> +#include <commctrl.h> #include "v6util.h"
static PVOID (WINAPI * pAlloc)(LONG); @@ -33,6 +36,8 @@ static BOOL (WINAPI * pStr_SetPtrA)(LPSTR, LPCSTR); static INT (WINAPI * pStr_GetPtrW)(LPCWSTR, LPWSTR, INT); static BOOL (WINAPI * pStr_SetPtrW)(LPWSTR, LPCWSTR); + +static HRESULT (WINAPI * LoadIconMetric)(HINSTANCE, PCWSTR, INT, HICON*);
static HMODULE hComctl32 = 0;
@@ -75,7 +80,7 @@ static char dest[MAX_PATH]; int sourcelen; int destsize = MAX_PATH; - int count = -1; + int count;
sourcelen = strlen(source) + 1;
@@ -197,7 +202,12 @@ ptr = GetProcAddress(hinst, "TaskDialogIndirect"); if (!ptr) { +#ifdef __REACTOS__ + /* Skipped on 2k3 */ + skip("TaskDialogIndirect not exported by name\n"); +#else win_skip("TaskDialogIndirect not exported by name\n"); +#endif return; }
@@ -205,6 +215,91 @@ ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); }
+static void test_LoadIconMetric(void) +{ + static const WCHAR nonExistingFile[] = {'d','o','e','s','n','o','t','e','x','i','s','t','.','i','c','o','\0'}; + HINSTANCE hinst; + void *ptr; + HICON icon; + HRESULT result; + ICONINFO info; + BOOL res; + INT bytes; + BITMAP bmp; + + hinst = LoadLibraryA("comctl32.dll"); + + LoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric"); + if (!LoadIconMetric) + { +#ifdef __REACTOS__ + /* Skipped on 2k3 */ + skip("TaskDialogIndirect not exported by name\n"); +#else + win_skip("LoadIconMetric not exported by name\n"); +#endif + return; + } + + ptr = GetProcAddress(hinst, (const CHAR*)380); + ok(ptr == LoadIconMetric, "got wrong pointer for ordinal 380, %p expected %p\n", + ptr, LoadIconMetric); + + result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_SMALL, &icon); + ok(result == S_OK, "Expected S_OK, got %x\n", result); + if (result == S_OK) + { + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info\n"); + if (res && info.hbmColor) + { + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + if (bytes > 0) + { + ok(bmp.bmWidth == GetSystemMetrics( SM_CXSMICON ), "Wrong icon width\n"); + ok(bmp.bmHeight == GetSystemMetrics( SM_CYSMICON ), "Wrong icon height\n"); + } + } + DestroyIcon(icon); + } + + result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_LARGE, &icon); + ok(result == S_OK, "Expected S_OK, got %x\n", result); + if (result == S_OK) + { + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info\n"); + if (res && info.hbmColor) + { + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + if (bytes > 0) + { + ok(bmp.bmWidth == GetSystemMetrics( SM_CXICON ), "Wrong icon width\n"); + ok(bmp.bmHeight == GetSystemMetrics( SM_CYICON ), "Wrong icon height\n"); + } + } + DestroyIcon(icon); + } + + result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, 0x100, &icon); + ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result); + if (result == S_OK) DestroyIcon(icon); + + icon = (HICON)0x1234; + result = LoadIconMetric(NULL, NULL, LIM_LARGE, &icon); + ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result); + ok(icon == (HICON)0, "Expected 0x0, got %p\n", icon); + if (result == S_OK) DestroyIcon(icon); + + result = LoadIconMetric(NULL, nonExistingFile, LIM_LARGE, &icon); + ok(result == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), + "Expected 80070715, got %x\n", result); + if (result == S_OK) DestroyIcon(icon); +} + + START_TEST(misc) { ULONG_PTR ctx_cookie; @@ -220,6 +315,7 @@ return;
test_TaskDialogIndirect(); + test_LoadIconMetric();
unload_v6_module(ctx_cookie, hCtx); }
Modified: trunk/rostests/winetests/comctl32/propsheet.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/propshe... ============================================================================== --- trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] Thu Mar 19 12:07:45 2015 @@ -24,6 +24,7 @@ #include <wingdi.h> #include <winuser.h> #include <commctrl.h> +#include <reactos/undocuser.h> #include "msg.h"
#include "resources.h" @@ -281,6 +282,37 @@ return FALSE; }
+static WNDPROC old_nav_dialog_proc; + +static LRESULT CALLBACK new_nav_dialog_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) +{ + switch (msg) + { + case DM_SETDEFID: + ok( IsWindowEnabled( GetDlgItem(hwnd, wp) ), "button is not enabled\n" ); + break; + } + return CallWindowProcW( old_nav_dialog_proc, hwnd, msg, wp, lp ); +} + +static LRESULT CALLBACK hook_proc( int code, WPARAM wp, LPARAM lp ) +{ + static BOOL done; + if (code == HCBT_CREATEWND) + { + CBT_CREATEWNDW *c = (CBT_CREATEWNDW *)lp; + + /* The first dialog created will be the parent dialog */ + if (!done && c->lpcs->lpszClass == MAKEINTRESOURCEW(WC_DIALOG)) + { + old_nav_dialog_proc = (WNDPROC)SetWindowLongPtrW( (HWND)wp, GWLP_WNDPROC, (LONG_PTR)new_nav_dialog_proc ); + done = TRUE; + } + } + + return CallNextHookEx( NULL, code, wp, lp ); +} + static void test_wiznavigation(void) { HPROPSHEETPAGE hpsp[4]; @@ -293,6 +325,10 @@ BOOL hwndtoindex_supported = TRUE; const INT nextID = 12324; const INT backID = 12323; + HHOOK hook; + + /* set up a hook proc in order to subclass the main dialog early on */ + hook = SetWindowsHookExW( WH_CBT, hook_proc, NULL, GetCurrentThreadId() );
/* create the property sheet pages */ memset(psp, 0, sizeof(PROPSHEETPAGEA) * 4); @@ -402,6 +438,7 @@ ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));
DestroyWindow(hdlg); + UnhookWindowsHookEx( hook ); }
static void test_buttons(void) @@ -490,7 +527,7 @@
static void test_custom_default_button(void) { - HWND hdlg; + HWND hdlg, page; PROPSHEETPAGEA psp[1]; PROPSHEETHEADERA psh; MSG msg; @@ -534,7 +571,8 @@
/* At this point, the combobox should have keyboard focus, so we press ENTER. * Pull the lever, Kronk! */ - keybd_event(VK_RETURN, 0, 0, 0); + page = (HWND)SendMessageW(hdlg, PSM_GETCURRENTPAGEHWND, 0, 0); + PostMessageW(GetDlgItem(page, IDC_PS_COMBO1), WM_KEYDOWN, VK_RETURN, 0);
/* Process all the messages in the queue for this thread. */ while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
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] Thu Mar 19 12:07:45 2015 @@ -80,28 +80,6 @@ static HWND parent_wnd;
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; - -static const struct message create_parent_wnd_seq[] = { - { WM_GETMINMAXINFO, sent }, - { WM_NCCREATE, sent }, - { WM_NCCALCSIZE, sent|wparam, 0 }, - { WM_CREATE, sent }, - { WM_SHOWWINDOW, sent|wparam, 1 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_WINDOWPOSCHANGING, sent|wparam, 0 }, - { WM_ACTIVATEAPP, sent|wparam, 1 }, - { WM_NCACTIVATE, sent|wparam, 1 }, - { WM_ACTIVATE, sent|wparam, 1 }, - { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, - { WM_IME_NOTIFY, sent|defwinproc|optional }, - { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, - /* Win9x adds SWP_NOZORDER below */ - { WM_WINDOWPOSCHANGED, sent}, - { WM_NCCALCSIZE, sent|wparam|optional, 1 }, - { WM_SIZE, sent }, - { WM_MOVE, sent }, - { 0 } -};
static const struct message add_tab_to_parent[] = { { TCM_INSERTITEMA, sent }, @@ -159,12 +137,6 @@ };
static const struct message empty_sequence[] = { - { 0 } -}; - -static const struct message set_min_tab_width_seq[] = { - { TCM_SETMINTABWIDTH, sent|wparam, 0 }, - { TCM_SETMINTABWIDTH, sent|wparam, 0 }, { 0 } };
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] Thu Mar 19 12:07:45 2015 @@ -663,7 +663,7 @@
static void test_get_set_bkcolor(void) { - COLORREF crColor = RGB(0,0,0); + COLORREF crColor; HWND hTree;
hTree = create_treeview_control(0); @@ -719,9 +719,9 @@
static void test_get_set_indent(void) { - int ulIndent = -1; - int ulMinIndent = -1; - int ulMoreThanTwiceMin = -1; + int ulIndent; + int ulMinIndent; + int ulMoreThanTwiceMin; HWND hTree;
hTree = create_treeview_control(0); @@ -914,7 +914,7 @@ static void test_get_set_textcolor(void) { /* If the value is -1, the control is using the system color for the text color. */ - COLORREF crColor = RGB(0,0,0); + COLORREF crColor; HWND hTree;
hTree = create_treeview_control(0); @@ -974,8 +974,8 @@
static void test_get_set_unicodeformat(void) { - BOOL bPreviousSetting = FALSE; - BOOL bNewSetting = FALSE; + BOOL bPreviousSetting; + BOOL bNewSetting; HWND hTree;
hTree = create_treeview_control(0);