[COMCTL32_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=66801
This commit is contained in:
Amine Khaldi 2015-03-19 12:07:45 +00:00
parent aa6974689d
commit 2923acd08c
8 changed files with 193 additions and 48 deletions

View file

@ -432,13 +432,6 @@ static const struct message setcheck_ignored_seq[] =
{ 0 }
};
static const struct message setcheck_uncheck_seq[] =
{
{ BM_SETCHECK, sent },
{ WM_APP, sent|wparam|lparam, 0, 0 },
{ 0 }
};
static const struct message setcheck_static_seq[] =
{
{ BM_SETCHECK, sent },
@ -764,7 +757,7 @@ if (ret) /* TODO: remove once Wine is fixed */
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));

View file

@ -132,7 +132,7 @@ static HWND subclass_editbox(HWND hwndComboEx)
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",

View file

@ -276,7 +276,7 @@ static void test_dpa(void)
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);

View file

@ -257,6 +257,51 @@ static void check_bits(HWND hwnd, HIMAGELIST himl, int idx, int 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)
{
struct hotspot {
@ -2091,6 +2136,7 @@ START_TEST(imagelist)
InitCommonControls();
test_create_destroy();
test_begindrag();
test_hotspot();
test_add_remove();
test_imagecount();

View file

@ -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);
@ -34,6 +37,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;
#define COMCTL32_GET_PROC(ordinal, func) \
@ -75,7 +80,7 @@ static void test_GetPtrAW(void)
static char dest[MAX_PATH];
int sourcelen;
int destsize = MAX_PATH;
int count = -1;
int count;
sourcelen = strlen(source) + 1;
@ -197,7 +202,12 @@ static void test_TaskDialogIndirect(void)
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 @@ static void test_TaskDialogIndirect(void)
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 @@ START_TEST(misc)
return;
test_TaskDialogIndirect();
test_LoadIconMetric();
unload_v6_module(ctx_cookie, hCtx);
}

View file

@ -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 @@ static INT_PTR CALLBACK nav_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
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 @@ static void test_wiznavigation(void)
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 @@ static void test_wiznavigation(void)
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 @@ page_with_custom_default_button_dlg_proc(HWND hdlg, UINT msg, WPARAM wparam, LPA
static void test_custom_default_button(void)
{
HWND hdlg;
HWND hdlg, page;
PROPSHEETPAGEA psp[1];
PROPSHEETHEADERA psh;
MSG msg;
@ -534,7 +571,8 @@ static void test_custom_default_button(void)
/* 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))

View file

@ -81,28 +81,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 },
{ TCM_INSERTITEMA, sent|optional },
@ -162,12 +140,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 }
};
static const struct message get_item_count_seq[] = {
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
{ 0 }

View file

@ -663,7 +663,7 @@ static void test_focus(void)
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_imagelist(void)
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_scrolltime(void)
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_tooltips(void)
static void test_get_set_unicodeformat(void)
{
BOOL bPreviousSetting = FALSE;
BOOL bNewSetting = FALSE;
BOOL bPreviousSetting;
BOOL bNewSetting;
HWND hTree;
hTree = create_treeview_control(0);