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
7aa5e909
Commit
7aa5e909
authored
Mar 17, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/tests: Extend the window proc / focus window tests.
parent
d9381b97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
14 deletions
+89
-14
device.c
dlls/d3d8/tests/device.c
+89
-14
No files found.
dlls/d3d8/tests/device.c
View file @
7aa5e909
...
...
@@ -1494,6 +1494,13 @@ struct
UINT
message
;
}
expect_message
;
struct
wndproc_thread_param
{
HWND
dummy_window
;
HANDLE
window_created
;
HANDLE
test_finished
;
};
static
LRESULT
CALLBACK
test_proc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
)
{
if
(
filter_messages
&&
filter_messages
==
hwnd
)
...
...
@@ -1506,14 +1513,37 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
return
DefWindowProcA
(
hwnd
,
message
,
wparam
,
lparam
);
}
static
DWORD
WINAPI
wndproc_thread
(
void
*
param
)
{
struct
wndproc_thread_param
*
p
=
param
;
DWORD
res
;
BOOL
ret
;
p
->
dummy_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ret
=
SetEvent
(
p
->
window_created
);
ok
(
ret
,
"SetEvent failed, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
p
->
test_finished
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
DestroyWindow
(
p
->
dummy_window
);
return
0
;
}
static
void
test_wndproc
(
void
)
{
HWND
device_window
,
focus_window
,
dummy_window
,
tmp
;
struct
wndproc_thread_param
thread_params
;
HWND
device_window
,
focus_window
,
tmp
;
IDirect3DDevice8
*
device
;
WNDCLASSA
wc
=
{
0
};
IDirect3D8
*
d3d8
;
HANDLE
thread
;
LONG_PTR
proc
;
ULONG
ref
;
DWORD
res
;
if
(
!
(
d3d8
=
pDirect3DCreate8
(
D3D_SDK_VERSION
)))
{
...
...
@@ -1525,12 +1555,20 @@ static void test_wndproc(void)
wc
.
lpszClassName
=
"d3d8_test_wndproc_wc"
;
ok
(
RegisterClassA
(
&
wc
),
"Failed to register window class.
\n
"
);
thread_params
.
window_created
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
thread_params
.
window_created
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
thread_params
.
test_finished
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
thread_params
.
test_finished
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
focus_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
device_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
dummy_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
thread
=
CreateThread
(
NULL
,
0
,
wndproc_thread
,
&
thread_params
,
0
,
NULL
);
ok
(
!!
thread
,
"Failed to create thread, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
thread_params
.
window_created
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
proc
=
GetWindowLongPtrA
(
device_window
,
GWLP_WNDPROC
);
ok
(
proc
==
(
LONG_PTR
)
test_proc
,
"Expected wndproc %#lx, got %#lx.
\n
"
,
...
...
@@ -1539,10 +1577,14 @@ static void test_wndproc(void)
ok
(
proc
==
(
LONG_PTR
)
test_proc
,
"Expected wndproc %#lx, got %#lx.
\n
"
,
(
LONG_PTR
)
test_proc
,
proc
);
trace
(
"device_window %p, focus_window %p, dummy_window %p.
\n
"
,
device_window
,
focus_window
,
dummy_window
);
trace
(
"device_window %p, focus_window %p, dummy_window %p.
\n
"
,
device_window
,
focus_window
,
thread_params
.
dummy_window
);
tmp
=
GetFocus
();
ok
(
tmp
==
dummy_window
,
"Expected focus %p, got %p.
\n
"
,
dummy_window
,
tmp
);
ok
(
tmp
==
device_window
,
"Expected focus %p, got %p.
\n
"
,
device_window
,
tmp
);
tmp
=
GetForegroundWindow
();
ok
(
tmp
==
thread_params
.
dummy_window
,
"Expected foreground window %p, got %p.
\n
"
,
thread_params
.
dummy_window
,
tmp
);
expect_message
.
window
=
focus_window
;
expect_message
.
message
=
WM_SETFOCUS
;
...
...
@@ -1557,7 +1599,10 @@ static void test_wndproc(void)
ok
(
!
expect_message
.
message
,
"Expected message %#x for window %p, but didn't receive it.
\n
"
,
expect_message
.
message
,
expect_message
.
window
);
tmp
=
GetFocus
();
ok
(
tmp
==
focus_window
,
"Expected focus %p, got %p.
\n
"
,
focus_window
,
tmp
);
todo_wine
ok
(
tmp
==
focus_window
,
"Expected focus %p, got %p.
\n
"
,
focus_window
,
tmp
);
tmp
=
GetForegroundWindow
();
todo_wine
ok
(
tmp
==
focus_window
,
"Expected foreground window %p, got %p.
\n
"
,
focus_window
,
tmp
);
SetForegroundWindow
(
focus_window
);
filter_messages
=
focus_window
;
...
...
@@ -1607,7 +1652,13 @@ static void test_wndproc(void)
done:
filter_messages
=
NULL
;
IDirect3D8_Release
(
d3d8
);
DestroyWindow
(
dummy_window
);
SetEvent
(
thread_params
.
test_finished
);
WaitForSingleObject
(
thread
,
INFINITE
);
CloseHandle
(
thread_params
.
test_finished
);
CloseHandle
(
thread_params
.
window_created
);
CloseHandle
(
thread
);
DestroyWindow
(
device_window
);
DestroyWindow
(
focus_window
);
UnregisterClassA
(
"d3d8_test_wndproc_wc"
,
GetModuleHandleA
(
NULL
));
...
...
@@ -1615,12 +1666,15 @@ done:
static
void
test_wndproc_windowed
(
void
)
{
HWND
device_window
,
focus_window
,
dummy_window
,
tmp
;
struct
wndproc_thread_param
thread_params
;
HWND
device_window
,
focus_window
,
tmp
;
IDirect3DDevice8
*
device
;
WNDCLASSA
wc
=
{
0
};
IDirect3D8
*
d3d8
;
HANDLE
thread
;
LONG_PTR
proc
;
ULONG
ref
;
DWORD
res
;
if
(
!
(
d3d8
=
pDirect3DCreate8
(
D3D_SDK_VERSION
)))
{
...
...
@@ -1632,12 +1686,20 @@ static void test_wndproc_windowed(void)
wc
.
lpszClassName
=
"d3d8_test_wndproc_wc"
;
ok
(
RegisterClassA
(
&
wc
),
"Failed to register window class.
\n
"
);
thread_params
.
window_created
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
thread_params
.
window_created
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
thread_params
.
test_finished
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
thread_params
.
test_finished
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
focus_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
device_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
dummy_window
=
CreateWindowA
(
"d3d8_test_wndproc_wc"
,
"d3d8_test"
,
WS_MAXIMIZE
|
WS_VISIBLE
|
WS_CAPTION
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
thread
=
CreateThread
(
NULL
,
0
,
wndproc_thread
,
&
thread_params
,
0
,
NULL
);
ok
(
!!
thread
,
"Failed to create thread, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
thread_params
.
window_created
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
proc
=
GetWindowLongPtrA
(
device_window
,
GWLP_WNDPROC
);
ok
(
proc
==
(
LONG_PTR
)
test_proc
,
"Expected wndproc %#lx, got %#lx.
\n
"
,
...
...
@@ -1646,10 +1708,14 @@ static void test_wndproc_windowed(void)
ok
(
proc
==
(
LONG_PTR
)
test_proc
,
"Expected wndproc %#lx, got %#lx.
\n
"
,
(
LONG_PTR
)
test_proc
,
proc
);
trace
(
"device_window %p, focus_window %p, dummy_window %p.
\n
"
,
device_window
,
focus_window
,
dummy_window
);
trace
(
"device_window %p, focus_window %p, dummy_window %p.
\n
"
,
device_window
,
focus_window
,
thread_params
.
dummy_window
);
tmp
=
GetFocus
();
ok
(
tmp
==
dummy_window
,
"Expected focus %p, got %p.
\n
"
,
dummy_window
,
tmp
);
ok
(
tmp
==
device_window
,
"Expected focus %p, got %p.
\n
"
,
device_window
,
tmp
);
tmp
=
GetForegroundWindow
();
ok
(
tmp
==
thread_params
.
dummy_window
,
"Expected foreground window %p, got %p.
\n
"
,
thread_params
.
dummy_window
,
tmp
);
filter_messages
=
focus_window
;
...
...
@@ -1661,7 +1727,10 @@ static void test_wndproc_windowed(void)
}
tmp
=
GetFocus
();
ok
(
tmp
==
dummy_window
,
"Expected focus %p, got %p.
\n
"
,
dummy_window
,
tmp
);
ok
(
tmp
==
device_window
,
"Expected focus %p, got %p.
\n
"
,
device_window
,
tmp
);
tmp
=
GetForegroundWindow
();
ok
(
tmp
==
thread_params
.
dummy_window
,
"Expected foreground window %p, got %p.
\n
"
,
thread_params
.
dummy_window
,
tmp
);
proc
=
GetWindowLongPtrA
(
device_window
,
GWLP_WNDPROC
);
ok
(
proc
==
(
LONG_PTR
)
test_proc
,
"Expected wndproc %#lx, got %#lx.
\n
"
,
...
...
@@ -1699,7 +1768,13 @@ static void test_wndproc_windowed(void)
done:
filter_messages
=
NULL
;
IDirect3D8_Release
(
d3d8
);
DestroyWindow
(
dummy_window
);
SetEvent
(
thread_params
.
test_finished
);
WaitForSingleObject
(
thread
,
INFINITE
);
CloseHandle
(
thread_params
.
test_finished
);
CloseHandle
(
thread_params
.
window_created
);
CloseHandle
(
thread
);
DestroyWindow
(
device_window
);
DestroyWindow
(
focus_window
);
UnregisterClassA
(
"d3d8_test_wndproc_wc"
,
GetModuleHandleA
(
NULL
));
...
...
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