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
c56ba461
Commit
c56ba461
authored
Nov 18, 2014
by
Sebastian Lackner
Committed by
Alexandre Julliard
Nov 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add multi-threaded tests for [Get|Set]WindowText.
parent
d6bdae11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
win.c
dlls/user32/tests/win.c
+70
-0
No files found.
dlls/user32/tests/win.c
View file @
c56ba461
...
@@ -5693,13 +5693,47 @@ static void test_ShowWindow(void)
...
@@ -5693,13 +5693,47 @@ static void test_ShowWindow(void)
ok
(
!
IsWindow
(
hwnd
),
"window should not exist
\n
"
);
ok
(
!
IsWindow
(
hwnd
),
"window should not exist
\n
"
);
}
}
static
DWORD
CALLBACK
gettext_msg_thread
(
LPVOID
arg
)
{
HWND
hwnd
=
arg
;
char
buf
[
32
];
INT
buf_len
;
/* test GetWindowTextA */
num_gettext_msgs
=
0
;
memset
(
buf
,
0
,
sizeof
(
buf
)
);
buf_len
=
GetWindowTextA
(
hwnd
,
buf
,
sizeof
(
buf
)
);
ok
(
buf_len
!=
0
,
"expected a nonempty window text
\n
"
);
ok
(
!
strcmp
(
buf
,
"another_caption"
),
"got wrong window text '%s'
\n
"
,
buf
);
ok
(
num_gettext_msgs
==
1
,
"got %u WM_GETTEXT messages
\n
"
,
num_gettext_msgs
);
return
0
;
}
static
DWORD
CALLBACK
settext_msg_thread
(
LPVOID
arg
)
{
HWND
hwnd
=
arg
;
BOOL
success
;
/* test SetWindowTextA */
num_settext_msgs
=
0
;
success
=
SetWindowTextA
(
hwnd
,
"thread_caption"
);
ok
(
success
,
"SetWindowTextA failed
\n
"
);
ok
(
num_settext_msgs
==
1
,
"got %u WM_SETTEXT messages
\n
"
,
num_settext_msgs
);
return
0
;
}
static
void
test_gettext
(
void
)
static
void
test_gettext
(
void
)
{
{
DWORD
tid
,
num_msgs
;
HANDLE
thread
;
BOOL
success
;
BOOL
success
;
char
buf
[
32
];
char
buf
[
32
];
INT
buf_len
;
INT
buf_len
;
HWND
hwnd
;
HWND
hwnd
;
LRESULT
r
;
LRESULT
r
;
MSG
msg
;
hwnd
=
CreateWindowExA
(
0
,
"MainWindowClass"
,
"caption"
,
WS_POPUP
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
NULL
);
hwnd
=
CreateWindowExA
(
0
,
"MainWindowClass"
,
"caption"
,
WS_POPUP
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
NULL
);
ok
(
hwnd
!=
0
,
"CreateWindowExA error %d
\n
"
,
GetLastError
()
);
ok
(
hwnd
!=
0
,
"CreateWindowExA error %d
\n
"
,
GetLastError
()
);
...
@@ -5746,6 +5780,42 @@ static void test_gettext(void)
...
@@ -5746,6 +5780,42 @@ static void test_gettext(void)
ok
(
!
strcmp
(
buf
,
"another_caption"
),
"got wrong window text '%s'
\n
"
,
buf
);
ok
(
!
strcmp
(
buf
,
"another_caption"
),
"got wrong window text '%s'
\n
"
,
buf
);
ok
(
num_gettext_msgs
==
1
,
"got %u WM_GETTEXT messages
\n
"
,
num_gettext_msgs
);
ok
(
num_gettext_msgs
==
1
,
"got %u WM_GETTEXT messages
\n
"
,
num_gettext_msgs
);
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
|
PM_QS_SENDMESSAGE
))
DispatchMessageA
(
&
msg
);
/* test interthread GetWindowTextA */
num_msgs
=
0
;
thread
=
CreateThread
(
NULL
,
0
,
gettext_msg_thread
,
hwnd
,
0
,
&
tid
);
ok
(
thread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
while
(
MsgWaitForMultipleObjects
(
1
,
&
thread
,
FALSE
,
INFINITE
,
QS_SENDMESSAGE
)
!=
WAIT_OBJECT_0
)
{
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
|
PM_QS_SENDMESSAGE
))
DispatchMessageA
(
&
msg
);
num_msgs
++
;
}
CloseHandle
(
thread
);
ok
(
num_msgs
==
1
,
"got %u wakeups from MsgWaitForMultipleObjects
\n
"
,
num_msgs
);
/* test interthread SetWindowText */
num_msgs
=
0
;
thread
=
CreateThread
(
NULL
,
0
,
settext_msg_thread
,
hwnd
,
0
,
&
tid
);
ok
(
thread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
while
(
MsgWaitForMultipleObjects
(
1
,
&
thread
,
FALSE
,
INFINITE
,
QS_SENDMESSAGE
)
!=
WAIT_OBJECT_0
)
{
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
|
PM_QS_SENDMESSAGE
))
DispatchMessageA
(
&
msg
);
num_msgs
++
;
}
CloseHandle
(
thread
);
ok
(
num_msgs
==
1
,
"got %u wakeups from MsgWaitForMultipleObjects
\n
"
,
num_msgs
);
num_gettext_msgs
=
0
;
memset
(
buf
,
0
,
sizeof
(
buf
)
);
buf_len
=
GetWindowTextA
(
hwnd
,
buf
,
sizeof
(
buf
)
);
ok
(
buf_len
!=
0
,
"expected a nonempty window text
\n
"
);
ok
(
!
strcmp
(
buf
,
"thread_caption"
),
"got wrong window text '%s'
\n
"
,
buf
);
ok
(
num_gettext_msgs
==
1
,
"got %u WM_GETTEXT messages
\n
"
,
num_gettext_msgs
);
/* seems to crash on every modern Windows version */
/* seems to crash on every modern Windows version */
if
(
0
)
if
(
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