shell32/tests: Add DragQueryPoint tests.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ef26257f6f
commit
865fe9cf97
|
@ -745,6 +745,7 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void)
|
||||||
IMoniker_Release(mon);
|
IMoniker_Release(mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WM_EXPECTED_VALUE WM_APP
|
||||||
#define DROPTEST_FILENAME "c:\\wintest.bin"
|
#define DROPTEST_FILENAME "c:\\wintest.bin"
|
||||||
struct DragParam {
|
struct DragParam {
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
@ -753,11 +754,20 @@ struct DragParam {
|
||||||
|
|
||||||
static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
|
static BOOL expected;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
case WM_EXPECTED_VALUE:
|
||||||
|
{
|
||||||
|
expected = lparam;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WM_DROPFILES:
|
case WM_DROPFILES:
|
||||||
{
|
{
|
||||||
HDROP hDrop = (HDROP)wparam;
|
HDROP hDrop = (HDROP)wparam;
|
||||||
char filename[MAX_PATH] = "dummy";
|
char filename[MAX_PATH] = "dummy";
|
||||||
|
POINT pt;
|
||||||
|
BOOL r;
|
||||||
UINT num;
|
UINT num;
|
||||||
num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0);
|
num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0);
|
||||||
ok(num == 1, "expected 1, got %u\n", num);
|
ok(num == 1, "expected 1, got %u\n", num);
|
||||||
|
@ -766,6 +776,10 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||||
num = DragQueryFileA(hDrop, 0, filename, sizeof(filename));
|
num = DragQueryFileA(hDrop, 0, filename, sizeof(filename));
|
||||||
ok(num == strlen(DROPTEST_FILENAME), "got %u\n", num);
|
ok(num == strlen(DROPTEST_FILENAME), "got %u\n", num);
|
||||||
ok(!strcmp(filename, DROPTEST_FILENAME), "got %s\n", filename);
|
ok(!strcmp(filename, DROPTEST_FILENAME), "got %s\n", filename);
|
||||||
|
r = DragQueryPoint(hDrop, &pt);
|
||||||
|
todo_wine ok(r == expected, "expected %d, got %d\n", expected, r);
|
||||||
|
ok(pt.x == 10, "expected 10, got %d\n", pt.x);
|
||||||
|
ok(pt.y == 20, "expected 20, got %d\n", pt.y);
|
||||||
DragFinish(hDrop);
|
DragFinish(hDrop);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -820,7 +834,7 @@ static DWORD WINAPI drop_window_therad(void *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_DragQueryFile(void)
|
static void test_DragQueryFile(BOOL non_client_flag)
|
||||||
{
|
{
|
||||||
struct DragParam param;
|
struct DragParam param;
|
||||||
HANDLE hThread;
|
HANDLE hThread;
|
||||||
|
@ -839,6 +853,9 @@ static void test_DragQueryFile(void)
|
||||||
|
|
||||||
hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (strlen(DROPTEST_FILENAME) + 2) * sizeof(WCHAR));
|
hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (strlen(DROPTEST_FILENAME) + 2) * sizeof(WCHAR));
|
||||||
pDrop = GlobalLock(hDrop);
|
pDrop = GlobalLock(hDrop);
|
||||||
|
pDrop->pt.x = 10;
|
||||||
|
pDrop->pt.y = 20;
|
||||||
|
pDrop->fNC = non_client_flag;
|
||||||
pDrop->pFiles = sizeof(DROPFILES);
|
pDrop->pFiles = sizeof(DROPFILES);
|
||||||
ret = MultiByteToWideChar(CP_ACP, 0, DROPTEST_FILENAME, -1,
|
ret = MultiByteToWideChar(CP_ACP, 0, DROPTEST_FILENAME, -1,
|
||||||
(LPWSTR)(pDrop + 1), strlen(DROPTEST_FILENAME) + 1);
|
(LPWSTR)(pDrop + 1), strlen(DROPTEST_FILENAME) + 1);
|
||||||
|
@ -846,6 +863,9 @@ static void test_DragQueryFile(void)
|
||||||
pDrop->fWide = TRUE;
|
pDrop->fWide = TRUE;
|
||||||
GlobalUnlock(hDrop);
|
GlobalUnlock(hDrop);
|
||||||
|
|
||||||
|
r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, 0, !non_client_flag);
|
||||||
|
ok(r, "got %d\n", r);
|
||||||
|
|
||||||
r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0);
|
r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0);
|
||||||
ok(r, "got %d\n", r);
|
ok(r, "got %d\n", r);
|
||||||
|
|
||||||
|
@ -858,6 +878,7 @@ static void test_DragQueryFile(void)
|
||||||
CloseHandle(param.ready);
|
CloseHandle(param.ready);
|
||||||
CloseHandle(hThread);
|
CloseHandle(hThread);
|
||||||
}
|
}
|
||||||
|
#undef WM_EXPECTED_VALUE
|
||||||
#undef DROPTEST_FILENAME
|
#undef DROPTEST_FILENAME
|
||||||
|
|
||||||
static void test_SHCreateSessionKey(void)
|
static void test_SHCreateSessionKey(void)
|
||||||
|
@ -936,7 +957,8 @@ START_TEST(shellole)
|
||||||
|
|
||||||
test_SHPropStg_functions();
|
test_SHPropStg_functions();
|
||||||
test_SHCreateQueryCancelAutoPlayMoniker();
|
test_SHCreateQueryCancelAutoPlayMoniker();
|
||||||
test_DragQueryFile();
|
test_DragQueryFile(TRUE);
|
||||||
|
test_DragQueryFile(FALSE);
|
||||||
test_SHCreateSessionKey();
|
test_SHCreateSessionKey();
|
||||||
test_dragdrophelper();
|
test_dragdrophelper();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue