[COMCTL32_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536

svn path=/trunk/; revision=70081
This commit is contained in:
Amine Khaldi 2015-11-24 10:38:33 +00:00
parent 1f1e8b05a2
commit 785a2d5575
8 changed files with 333 additions and 75 deletions

View file

@ -1258,7 +1258,7 @@ static void test_imagelist_storage(void)
static void test_shell_imagelist(void)
{
BOOL (WINAPI *pSHGetImageList)(INT, REFIID, void**);
HRESULT (WINAPI *pSHGetImageList)(INT, REFIID, void**);
IImageList *iml = NULL;
HMODULE hShell32;
HRESULT hr;
@ -1278,8 +1278,7 @@ static void test_shell_imagelist(void)
}
/* Get system image list */
hr = (pSHGetImageList)(SHIL_SYSSMALL, &IID_IImageList, (void**)&iml);
hr = pSHGetImageList(SHIL_SYSSMALL, &IID_IImageList, (void**)&iml);
ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr);
if (hr != S_OK) {

View file

@ -5345,6 +5345,7 @@ static void test_header_notification2(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
nmhdr.hdr.code = HDN_ITEMCHANGINGW;
ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
ok(ret == 0, "got %d\n", ret);
parent_header_notify_seq[0].id = HDN_ITEMCHANGINGA;
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
"header notify, parent", TRUE);
@ -5353,6 +5354,7 @@ static void test_header_notification2(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
nmhdr.hdr.code = HDN_ITEMCHANGEDW;
ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
ok(ret == 0, "got %d\n", ret);
parent_header_notify_seq[0].id = HDN_ITEMCHANGEDA;
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
"header notify, parent", TRUE);
@ -5363,30 +5365,35 @@ static void test_header_notification2(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
nmhdr.hdr.code = HDN_ITEMCLICKW;
ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
ok(ret == 0, "got %d\n", ret);
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(ret == 0, "got %d\n", ret);
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(ret == 0, "got %d\n", ret);
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(ret == 0, "got %d\n", ret);
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);
ok(ret == 0, "got %d\n", ret);
parent_header_notify_seq[0].id = HDN_ENDTRACKA;
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
"header notify, parent", FALSE);
@ -5394,6 +5401,7 @@ static void test_header_notification2(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
nmhdr.hdr.code = HDN_TRACKW;
ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
ok(ret == 0, "got %d\n", ret);
parent_header_notify_seq[0].id = HDN_TRACKA;
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
"header notify, parent", FALSE);
@ -5401,17 +5409,20 @@ static void test_header_notification2(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
nmhdr.hdr.code = HDN_BEGINDRAG;
ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
ok(ret == 1, "got %d\n", ret);
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);
ok(ret == 0, "got %d\n", ret);
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);
ok(ret == 0, "got %d\n", ret);
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,
@ -5420,21 +5431,25 @@ static void test_header_notification2(void)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
nmhdr.hdr.code = HDN_BEGINFILTEREDIT;
ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
ok(ret == 0, "got %d\n", ret);
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(ret == 0, "got %d\n", ret);
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(ret == 0, "got %d\n", ret);
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(ret == 0, "got %d\n", ret);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
"header notify, parent", FALSE);
@ -5748,6 +5763,76 @@ static void test_header_proc(void)
DestroyWindow(hwnd);
}
static void flush_events(void)
{
MSG msg;
int diff = 200;
int min_timeout = 100;
DWORD time = GetTickCount() + diff;
while (diff > 0)
{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
diff = time - GetTickCount();
}
}
static void test_oneclickactivate(void)
{
TRACKMOUSEEVENT track;
char item1[] = "item1";
LVITEMA item;
HWND hwnd, fg;
RECT rect;
INT r;
hwnd = CreateWindowExA(0, "SysListView32", "foo", WS_VISIBLE|WS_CHILD|LVS_LIST,
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
ok(hwnd != NULL, "failed to create listview window\n");
r = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_ONECLICKACTIVATE);
ok(r == 0, "should return zero\n");
SetForegroundWindow(hwndparent);
flush_events();
fg = GetForegroundWindow();
if (fg != hwndparent)
{
skip("Window is not in the foreground. Skipping oneclickactivate tests.\n");
DestroyWindow(hwnd);
return;
}
item.mask = LVIF_TEXT;
item.iItem = 0;
item.iSubItem = 0;
item.iImage = 0;
item.pszText = item1;
r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
ok(r == 0, "should not fail\n");
GetWindowRect(hwnd, &rect);
SetCursorPos(rect.left+5, rect.top+5);
flush_events();
r = SendMessageA(hwnd, WM_MOUSEMOVE, MAKELONG(1, 1), 0);
expect(0, r);
track.cbSize = sizeof(track);
track.dwFlags = TME_QUERY;
_TrackMouseEvent(&track);
ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n");
ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags);
r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
expect(0, r);
r = SendMessageA(hwnd, WM_MOUSEHOVER, MAKELONG(1, 1), 0);
expect(0, r);
r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
expect(1, r);
DestroyWindow(hwnd);
}
START_TEST(listview)
{
HMODULE hComctl32;
@ -5817,6 +5902,7 @@ START_TEST(listview)
test_deleteitem();
test_insertitem();
test_header_proc();
test_oneclickactivate();
if (!load_v6_module(&ctx_cookie, &hCtx))
{

View file

@ -37,10 +37,20 @@ 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;
static char testicon_data[] =
{
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x00,
0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x0b,
0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xde, 0xde, 0xde, 0xff, 0xde, 0xde, 0xde, 0xff, 0xde, 0xde,
0xde, 0xff, 0xde, 0xde, 0xde, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};
#define COMCTL32_GET_PROC(ordinal, func) \
p ## func = (void*)GetProcAddress(hComctl32, (LPSTR)ordinal); \
if(!p ## func) { \
@ -215,91 +225,149 @@ 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 void test_LoadIconWithScaleDown(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;
static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0};
static const WCHAR nonexisting_resourceW[] = {'N','o','n','e','x','i','s','t','i','n','g',0};
static const WCHAR prefixW[] = {'I','C','O',0};
HRESULT (WINAPI *pLoadIconMetric)(HINSTANCE, const WCHAR *, int, HICON *);
HRESULT (WINAPI *pLoadIconWithScaleDown)(HINSTANCE, const WCHAR *, int, int, HICON *);
WCHAR tmp_path[MAX_PATH], icon_path[MAX_PATH];
ICONINFO info;
BOOL res;
INT bytes;
HMODULE hinst;
HANDLE handle;
DWORD written;
HRESULT hr;
BITMAP bmp;
HICON icon;
void *ptr;
int bytes;
BOOL res;
hinst = LoadLibraryA("comctl32.dll");
LoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric");
if (!LoadIconMetric)
pLoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric");
pLoadIconWithScaleDown = (void *)GetProcAddress(hinst, "LoadIconWithScaleDown");
if (!pLoadIconMetric || !pLoadIconWithScaleDown)
{
#ifdef __REACTOS__
/* Skipped on 2k3 */
skip("TaskDialogIndirect not exported by name\n");
skip("LoadIconMetric or pLoadIconWithScaleDown not exported by name\n");
#else
win_skip("LoadIconMetric not exported by name\n");
win_skip("LoadIconMetric or pLoadIconWithScaleDown not exported by name\n");
#endif
FreeLibrary(hinst);
return;
}
ptr = GetProcAddress(hinst, (const CHAR*)380);
ok(ptr == LoadIconMetric, "got wrong pointer for ordinal 380, %p expected %p\n",
ptr, LoadIconMetric);
GetTempPathW(MAX_PATH, tmp_path);
GetTempFileNameW(tmp_path, prefixW, 0, icon_path);
handle = CreateFileW(icon_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
ok(handle != INVALID_HANDLE_VALUE, "CreateFileW failed with error %u\n", GetLastError());
res = WriteFile(handle, testicon_data, sizeof(testicon_data), &written, NULL);
ok(res && written == sizeof(testicon_data), "Failed to write icon file\n");
CloseHandle(handle);
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);
}
/* test ordinals */
ptr = GetProcAddress(hinst, (const char *)380);
ok(ptr == pLoadIconMetric,
"got wrong pointer for ordinal 380, %p expected %p\n", ptr, pLoadIconMetric);
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);
}
ptr = GetProcAddress(hinst, (const char *)381);
ok(ptr == pLoadIconWithScaleDown,
"got wrong pointer for ordinal 381, %p expected %p\n", ptr, pLoadIconWithScaleDown);
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);
/* invalid arguments */
icon = (HICON)0x1234;
hr = pLoadIconMetric(NULL, (LPWSTR)IDI_APPLICATION, 0x100, &icon);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", hr);
ok(icon == NULL, "Expected NULL, got %p\n", 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);
hr = pLoadIconMetric(NULL, NULL, LIM_LARGE, &icon);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", hr);
ok(icon == NULL, "Expected NULL, got %p\n", 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);
icon = (HICON)0x1234;
hr = pLoadIconWithScaleDown(NULL, NULL, 32, 32, &icon);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", hr);
ok(icon == NULL, "Expected NULL, got %p\n", icon);
/* non-existing filename */
hr = pLoadIconMetric(NULL, nonexisting_fileW, LIM_LARGE, &icon);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND),
"Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr);
hr = pLoadIconWithScaleDown(NULL, nonexisting_fileW, 32, 32, &icon);
todo_wine
ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND),
"Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr);
/* non-existing resource name */
hr = pLoadIconMetric(hinst, nonexisting_resourceW, LIM_LARGE, &icon);
ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND),
"Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr);
hr = pLoadIconWithScaleDown(hinst, nonexisting_resourceW, 32, 32, &icon);
ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND),
"Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr);
/* load icon using predefined identifier */
hr = pLoadIconMetric(NULL, (LPWSTR)IDI_APPLICATION, LIM_SMALL, &icon);
ok(hr == S_OK, "Expected S_OK, got %x\n", hr);
res = GetIconInfo(icon, &info);
ok(res, "Failed to get icon info, error %u\n", GetLastError());
bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
ok(bytes > 0, "Failed to get bitmap info for icon\n");
ok(bmp.bmWidth == GetSystemMetrics(SM_CXSMICON), "Wrong icon width %d\n", bmp.bmWidth);
ok(bmp.bmHeight == GetSystemMetrics(SM_CYSMICON), "Wrong icon height %d\n", bmp.bmHeight);
DestroyIcon(icon);
hr = pLoadIconMetric(NULL, (LPWSTR)IDI_APPLICATION, LIM_LARGE, &icon);
ok(hr == S_OK, "Expected S_OK, got %x\n", hr);
res = GetIconInfo(icon, &info);
ok(res, "Failed to get icon info, error %u\n", GetLastError());
bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
ok(bytes > 0, "Failed to get bitmap info for icon\n");
ok(bmp.bmWidth == GetSystemMetrics(SM_CXICON), "Wrong icon width %d\n", bmp.bmWidth);
ok(bmp.bmHeight == GetSystemMetrics(SM_CYICON), "Wrong icon height %d\n", bmp.bmHeight);
DestroyIcon(icon);
hr = pLoadIconWithScaleDown(NULL, (LPWSTR)IDI_APPLICATION, 42, 42, &icon);
ok(hr == S_OK, "Expected S_OK, got %x\n", hr);
res = GetIconInfo(icon, &info);
ok(res, "Failed to get icon info, error %u\n", GetLastError());
bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
ok(bytes > 0, "Failed to get bitmap info for icon\n");
ok(bmp.bmWidth == 42, "Wrong icon width %d\n", bmp.bmWidth);
ok(bmp.bmHeight == 42, "Wrong icon height %d\n", bmp.bmHeight);
DestroyIcon(icon);
/* load icon from file */
hr = pLoadIconMetric(NULL, icon_path, LIM_SMALL, &icon);
ok(hr == S_OK, "Expected S_OK, got %x\n", hr);
res = GetIconInfo(icon, &info);
ok(res, "Failed to get icon info, error %u\n", GetLastError());
bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
ok(bytes > 0, "Failed to get bitmap info for icon\n");
ok(bmp.bmWidth == GetSystemMetrics(SM_CXSMICON), "Wrong icon width %d\n", bmp.bmWidth);
ok(bmp.bmHeight == GetSystemMetrics(SM_CYSMICON), "Wrong icon height %d\n", bmp.bmHeight);
DestroyIcon(icon);
hr = pLoadIconWithScaleDown(NULL, icon_path, 42, 42, &icon);
ok(hr == S_OK, "Expected S_OK, got %x\n", hr);
res = GetIconInfo(icon, &info);
ok(res, "Failed to get icon info, error %u\n", GetLastError());
bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp);
ok(bytes > 0, "Failed to get bitmap info for icon\n");
ok(bmp.bmWidth == 42, "Wrong icon width %d\n", bmp.bmWidth);
ok(bmp.bmHeight == 42, "Wrong icon height %d\n", bmp.bmHeight);
DestroyIcon(icon);
DeleteFileW(icon_path);
FreeLibrary(hinst);
}
START_TEST(misc)
{
ULONG_PTR ctx_cookie;
@ -315,7 +383,7 @@ START_TEST(misc)
return;
test_TaskDialogIndirect();
test_LoadIconMetric();
test_LoadIconWithScaleDown();
unload_v6_module(ctx_cookie, hCtx);
}

View file

@ -303,7 +303,7 @@ static LRESULT CALLBACK hook_proc( int code, WPARAM wp, LPARAM lp )
CBT_CREATEWNDW *c = (CBT_CREATEWNDW *)lp;
/* The first dialog created will be the parent dialog */
if (!done && c->lpcs->lpszClass == MAKEINTRESOURCEW(WC_DIALOG))
if (!done && c->lpcs->lpszClass == (LPWSTR)WC_DIALOG)
{
old_nav_dialog_proc = (WNDPROC)SetWindowLongPtrW( (HWND)wp, GWLP_WNDPROC, (LONG_PTR)new_nav_dialog_proc );
done = TRUE;
@ -809,7 +809,7 @@ static void test_PSM_ADDPAGE(void)
psp.pfnDlgProc = page_dlg_proc_messages;
psp.lParam = 0;
/* two page with the same data */
/* multiple pages with the same data */
hpsp[0] = CreatePropertySheetPageA(&psp);
hpsp[1] = CreatePropertySheetPageA(&psp);
hpsp[2] = CreatePropertySheetPageA(&psp);
@ -881,6 +881,100 @@ if (0)
DestroyWindow(hdlg);
}
static void test_PSM_INSERTPAGE(void)
{
HPROPSHEETPAGE hpsp[5];
PROPSHEETPAGEA psp;
PROPSHEETHEADERA psh;
HWND hdlg, tab;
BOOL ret;
DWORD r;
memset(&psp, 0, sizeof(psp));
psp.dwSize = sizeof(psp);
psp.dwFlags = 0;
psp.hInstance = GetModuleHandleA(NULL);
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST);
U2(psp).pszIcon = NULL;
psp.pfnDlgProc = page_dlg_proc_messages;
psp.lParam = 0;
/* multiple pages with the same data */
hpsp[0] = CreatePropertySheetPageA(&psp);
hpsp[1] = CreatePropertySheetPageA(&psp);
hpsp[2] = CreatePropertySheetPageA(&psp);
U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR);
hpsp[3] = CreatePropertySheetPageA(&psp);
psp.dwFlags = PSP_PREMATURE;
hpsp[4] = CreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
psh.dwFlags = PSH_MODELESS;
psh.pszCaption = "test caption";
psh.nPages = 1;
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
hdlg = (HWND)PropertySheetA(&psh);
ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);
/* add pages one by one */
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 5, (LPARAM)hpsp[1]);
ok(ret == TRUE, "got %d\n", ret);
/* try with invalid values */
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, 0);
ok(ret == FALSE, "got %d\n", ret);
if (0)
{
/* crashes on native */
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)INVALID_HANDLE_VALUE);
}
ret = SendMessageA(hdlg, PSM_INSERTPAGE, (LPARAM)INVALID_HANDLE_VALUE, (LPARAM)hpsp[2]);
ok(ret == FALSE, "got %d\n", ret);
/* check item count */
tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0);
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 2, "got %d\n", r);
ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)hpsp[1], (LPARAM)hpsp[2]);
ok(ret == TRUE, "got %d\n", ret);
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
/* add property sheet page that can't be created */
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 1, (LPARAM)hpsp[3]);
ok(ret == TRUE, "got %d\n", ret);
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 4, "got %d\n", r);
/* select page that can't be created */
ret = SendMessageA(hdlg, PSM_SETCURSEL, 1, 0);
ok(ret == TRUE, "got %d\n", ret);
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
/* test PSP_PREMATURE flag with incorrect property sheet page */
ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)hpsp[4]);
ok(ret == FALSE, "got %d\n", ret);
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
ok(r == 3, "got %d\n", r);
DestroyPropertySheetPage(hpsp[4]);
DestroyWindow(hdlg);
}
START_TEST(propsheet)
{
test_title();
@ -891,4 +985,5 @@ START_TEST(propsheet)
test_custom_default_button();
test_messages();
test_PSM_ADDPAGE();
test_PSM_INSERTPAGE();
}

View file

@ -346,6 +346,7 @@ static void test_status_control(void)
r = SendMessageA(hWndStatus, SB_SETTEXTA, 0, (LPARAM)chstr);
expect(TRUE,r);
r = SendMessageA(hWndStatus, SB_GETTEXTA, 0, (LPARAM)charArray);
ok(r == strlen(charArray), "got %d\n", r);
/* substitution with single space */
if (ch > 0x00 && ch < 0x20 && ch != '\t')
chstr[5] = ' ';

View file

@ -1536,7 +1536,6 @@ static void test_sizes(void)
/* Single non-BTNS_AUTOSIZE button with string with TBSTYLE_EX_MIXEDBUTTONS set. */
rebuild_toolbar(&hToolbar);
SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0);
ok(SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons4[1]) == 1, "TB_ADDBUTTONSA failed\n");
ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(40, 20)) == 1, "TB_SETBUTTONSIZE failed\n");
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 );
@ -1545,7 +1544,6 @@ static void test_sizes(void)
/* Single non-BTNS_AUTOSIZE, BTNS_SHOWTEXT button with string with TBSTYLE_EX_MIXEDBUTTONS set. */
rebuild_toolbar(&hToolbar);
SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0);
ok(SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons4[2]) == 1, "TB_ADDBUTTONSA failed\n");
ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(40, 20)) == 1, "TB_SETBUTTONSIZE failed\n");
SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 );

View file

@ -905,6 +905,13 @@ static void test_get_set_item(void)
expect(TRUE, ret);
ok(tviRoot.state == TVIS_FOCUSED, "got state 0x%0x\n", tviRoot.state);
/* invalid item pointer, nt4 crashes here but later versions just return 0 */
tviRoot.hItem = (HTREEITEM)0xdeadbeef;
tviRoot.mask = TVIF_STATE;
tviRoot.state = 0;
ret = SendMessageA(hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
expect(FALSE, ret);
DestroyWindow(hTree);
DestroyWindow(hTree2);
}

View file

@ -26,6 +26,10 @@
#define ARCH "x86"
#elif defined __x86_64__
#define ARCH "amd64"
#elif defined __arm__
#define ARCH "arm"
#elif defined __aarch64__
#define ARCH "arm64"
#else
#define ARCH "none"
#endif