Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
26bae6d6
Commit
26bae6d6
authored
Jun 09, 2015
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for calling EmptyClipboard from a different thread.
parent
da07fe99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
clipboard.c
dlls/user32/tests/clipboard.c
+33
-0
No files found.
dlls/user32/tests/clipboard.c
View file @
26bae6d6
...
...
@@ -34,6 +34,14 @@ static DWORD WINAPI open_clipboard_thread(LPVOID arg)
return
0
;
}
static
DWORD
WINAPI
empty_clipboard_thread
(
LPVOID
arg
)
{
SetLastError
(
0xdeadbeef
);
ok
(
!
EmptyClipboard
(),
"EmptyClipboard succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_CLIPBOARD_NOT_OPEN
,
"wrong error %u
\n
"
,
GetLastError
());
return
0
;
}
static
void
test_ClipboardOwner
(
void
)
{
HANDLE
thread
;
...
...
@@ -73,6 +81,11 @@ static void test_ClipboardOwner(void)
dwret
=
WaitForSingleObject
(
thread
,
1000
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
CloseHandle
(
thread
);
thread
=
CreateThread
(
NULL
,
0
,
empty_clipboard_thread
,
0
,
0
,
NULL
);
ok
(
thread
!=
NULL
,
"CreateThread failed with error %d
\n
"
,
GetLastError
());
dwret
=
WaitForSingleObject
(
thread
,
1000
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
CloseHandle
(
thread
);
ok
(
!
CloseClipboard
(),
"CloseClipboard should fail if clipboard wasn't open
\n
"
);
ok
(
OpenClipboard
(
hWnd1
),
"OpenClipboard failed
\n
"
);
...
...
@@ -303,6 +316,7 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
{
static
UINT
wm_drawclipboard
;
static
UINT
wm_clipboardupdate
;
static
UINT
wm_destroyclipboard
;
LRESULT
ret
;
switch
(
msg
)
{
...
...
@@ -317,6 +331,10 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
else
if
(
next_wnd
)
SendMessageA
(
next_wnd
,
msg
,
wp
,
lp
);
break
;
case
WM_DESTROYCLIPBOARD
:
wm_destroyclipboard
++
;
ok
(
GetClipboardOwner
()
==
hwnd
,
"WM_DESTROYCLIPBOARD owner %p
\n
"
,
GetClipboardOwner
()
);
break
;
case
WM_CLIPBOARDUPDATE
:
wm_clipboardupdate
++
;
break
;
...
...
@@ -332,6 +350,10 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
ret
=
wm_clipboardupdate
;
wm_clipboardupdate
=
0
;
return
ret
;
case
WM_USER
+
3
:
ret
=
wm_destroyclipboard
;
wm_destroyclipboard
=
0
;
return
ret
;
}
return
DefWindowProcA
(
hwnd
,
msg
,
wp
,
lp
);
...
...
@@ -393,6 +415,8 @@ static DWORD WINAPI clipboard_thread(void *param)
ok
(
!
count
,
"WM_DRAWCLIPBOARD received
\n
"
);
count
=
SendMessageA
(
win
,
WM_USER
+
2
,
0
,
0
);
ok
(
!
count
,
"WM_CLIPBOARDUPDATE received
\n
"
);
count
=
SendMessageA
(
win
,
WM_USER
+
3
,
0
,
0
);
ok
(
!
count
,
"WM_DESTROYCLIPBOARD received
\n
"
);
r
=
EmptyClipboard
();
ok
(
r
,
"EmptyClipboard failed: %d
\n
"
,
GetLastError
());
...
...
@@ -407,6 +431,8 @@ static DWORD WINAPI clipboard_thread(void *param)
ok
(
!
count
,
"WM_DRAWCLIPBOARD received
\n
"
);
count
=
SendMessageA
(
win
,
WM_USER
+
2
,
0
,
0
);
ok
(
!
count
,
"WM_CLIPBOARDUPDATE received
\n
"
);
count
=
SendMessageA
(
win
,
WM_USER
+
3
,
0
,
0
);
ok
(
count
,
"WM_DESTROYCLIPBOARD not received
\n
"
);
handle
=
SetClipboardData
(
CF_TEXT
,
create_text
()
);
ok
(
handle
!=
0
,
"SetClipboardData failed: %d
\n
"
,
GetLastError
());
...
...
@@ -518,6 +544,13 @@ static DWORD WINAPI clipboard_thread(void *param)
count
=
SendMessageA
(
win
,
WM_USER
+
2
,
0
,
0
);
ok
(
!
count
,
"WM_CLIPBOARDUPDATE received
\n
"
);
r
=
OpenClipboard
(
0
);
ok
(
r
,
"OpenClipboard failed: %d
\n
"
,
GetLastError
());
r
=
EmptyClipboard
();
ok
(
r
,
"EmptyClipboard failed: %d
\n
"
,
GetLastError
());
r
=
CloseClipboard
();
ok
(
r
,
"CloseClipboard failed: %d
\n
"
,
GetLastError
());
r
=
PostMessageA
(
win
,
WM_USER
,
0
,
0
);
ok
(
r
,
"PostMessage failed: %d
\n
"
,
GetLastError
());
return
0
;
...
...
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