Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
37d7d6f8
Commit
37d7d6f8
authored
Jun 02, 2015
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Jun 02, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/tests: Add tests for DragQueryFile.
parent
4c31892e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
0 deletions
+117
-0
shellole.c
dlls/shell32/tests/shellole.c
+117
-0
No files found.
dlls/shell32/tests/shellole.c
View file @
37d7d6f8
...
...
@@ -25,6 +25,7 @@
#include "winbase.h"
#include "shlobj.h"
#include "shellapi.h"
#include "initguid.h"
DEFINE_GUID
(
FMTID_Test
,
0x12345678
,
0x1234
,
0x1234
,
0x12
,
0x12
,
0x12
,
0x12
,
0x12
,
0x12
,
0x12
,
0x12
);
...
...
@@ -742,10 +743,126 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void)
IMoniker_Release
(
mon
);
}
#define DROPTEST_FILENAME "c:\\wintest.bin"
struct
DragParam
{
HWND
hwnd
;
HANDLE
ready
;
};
static
LRESULT
WINAPI
drop_window_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
)
{
switch
(
msg
)
{
case
WM_DROPFILES
:
{
HDROP
hDrop
=
(
HDROP
)
wparam
;
char
filename
[
MAX_PATH
]
=
"dummy"
;
UINT
num
;
num
=
DragQueryFileA
(
hDrop
,
0xffffffff
,
NULL
,
0
);
ok
(
num
==
1
,
"expected 1, got %u
\n
"
,
num
);
num
=
DragQueryFileA
(
hDrop
,
0xffffffff
,
(
char
*
)
0xdeadbeef
,
0xffffffff
);
todo_wine
ok
(
num
==
1
,
"expected 1, got %u
\n
"
,
num
);
num
=
DragQueryFileA
(
hDrop
,
0
,
filename
,
sizeof
(
filename
));
ok
(
num
==
strlen
(
DROPTEST_FILENAME
),
"got %u
\n
"
,
num
);
ok
(
!
strcmp
(
filename
,
DROPTEST_FILENAME
),
"got %s
\n
"
,
filename
);
DragFinish
(
hDrop
);
return
0
;
}
}
return
DefWindowProcA
(
hwnd
,
msg
,
wparam
,
lparam
);
}
static
DWORD
WINAPI
drop_window_therad
(
void
*
arg
)
{
struct
DragParam
*
param
=
arg
;
WNDCLASSA
cls
;
WINDOWINFO
info
;
BOOL
r
;
MSG
msg
;
memset
(
&
cls
,
0
,
sizeof
(
cls
));
cls
.
lpfnWndProc
=
drop_window_proc
;
cls
.
hInstance
=
GetModuleHandleA
(
NULL
);
cls
.
lpszClassName
=
"drop test"
;
RegisterClassA
(
&
cls
);
param
->
hwnd
=
CreateWindowA
(
"drop test"
,
NULL
,
0
,
0
,
0
,
0
,
0
,
NULL
,
0
,
NULL
,
0
);
ok
(
param
->
hwnd
!=
NULL
,
"CreateWindow failed: %d
\n
"
,
GetLastError
());
memset
(
&
info
,
0
,
sizeof
(
info
));
info
.
cbSize
=
sizeof
(
info
);
r
=
GetWindowInfo
(
param
->
hwnd
,
&
info
);
ok
(
r
,
"got %d
\n
"
,
r
);
ok
(
!
(
info
.
dwExStyle
&
WS_EX_ACCEPTFILES
),
"got %08x
\n
"
,
info
.
dwExStyle
);
DragAcceptFiles
(
param
->
hwnd
,
TRUE
);
memset
(
&
info
,
0
,
sizeof
(
info
));
info
.
cbSize
=
sizeof
(
info
);
r
=
GetWindowInfo
(
param
->
hwnd
,
&
info
);
ok
(
r
,
"got %d
\n
"
,
r
);
ok
((
info
.
dwExStyle
&
WS_EX_ACCEPTFILES
),
"got %08x
\n
"
,
info
.
dwExStyle
);
SetEvent
(
param
->
ready
);
while
((
r
=
GetMessageA
(
&
msg
,
NULL
,
0
,
0
))
!=
0
)
{
if
(
r
==
(
BOOL
)
-
1
)
{
ok
(
0
,
"unexpected return value, got %d
\n
"
,
r
);
break
;
}
DispatchMessageA
(
&
msg
);
}
DestroyWindow
(
param
->
hwnd
);
UnregisterClassA
(
"drop test"
,
GetModuleHandleA
(
NULL
));
return
0
;
}
static
void
test_DragQueryFile
(
void
)
{
struct
DragParam
param
;
HANDLE
hThread
;
DWORD
rc
;
HGLOBAL
hDrop
;
DROPFILES
*
pDrop
;
int
ret
;
BOOL
r
;
param
.
ready
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
param
.
ready
!=
NULL
,
"can't create event
\n
"
);
hThread
=
CreateThread
(
NULL
,
0
,
drop_window_therad
,
&
param
,
0
,
NULL
);
rc
=
WaitForSingleObject
(
param
.
ready
,
5000
);
ok
(
rc
==
WAIT_OBJECT_0
,
"got %u
\n
"
,
rc
);
hDrop
=
GlobalAlloc
(
GHND
,
sizeof
(
DROPFILES
)
+
(
strlen
(
DROPTEST_FILENAME
)
+
2
)
*
sizeof
(
WCHAR
));
pDrop
=
GlobalLock
(
hDrop
);
pDrop
->
pFiles
=
sizeof
(
DROPFILES
);
ret
=
MultiByteToWideChar
(
CP_ACP
,
0
,
DROPTEST_FILENAME
,
-
1
,
(
LPWSTR
)(
pDrop
+
1
),
strlen
(
DROPTEST_FILENAME
)
+
1
);
ok
(
ret
>
0
,
"got %d
\n
"
,
ret
);
pDrop
->
fWide
=
TRUE
;
GlobalUnlock
(
hDrop
);
r
=
PostMessageA
(
param
.
hwnd
,
WM_DROPFILES
,
(
WPARAM
)
hDrop
,
0
);
ok
(
r
,
"got %d
\n
"
,
r
);
r
=
PostMessageA
(
param
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
r
,
"got %d
\n
"
,
r
);
rc
=
WaitForSingleObject
(
hThread
,
5000
);
ok
(
rc
==
WAIT_OBJECT_0
,
"got %d
\n
"
,
rc
);
CloseHandle
(
param
.
ready
);
CloseHandle
(
hThread
);
}
#undef DROPTEST_FILENAME
START_TEST
(
shellole
)
{
init
();
test_SHPropStg_functions
();
test_SHCreateQueryCancelAutoPlayMoniker
();
test_DragQueryFile
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment