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
ed6461f9
Commit
ed6461f9
authored
Jan 26, 2012
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add a test for SetCooperativeLevel() on a window that belongs to another thread.
parent
348c655b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
336 additions
and
0 deletions
+336
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+84
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+84
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+84
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+84
-0
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
ed6461f9
...
...
@@ -19,6 +19,14 @@
#include "wine/test.h"
#include "d3d.h"
struct
create_window_thread_param
{
HWND
window
;
HANDLE
window_created
;
HANDLE
destroy_window
;
HANDLE
thread
;
};
static
BOOL
compare_color
(
D3DCOLOR
c1
,
D3DCOLOR
c2
,
BYTE
max_diff
)
{
if
(
abs
((
c1
&
0xff
)
-
(
c2
&
0xff
))
>
max_diff
)
return
FALSE
;
...
...
@@ -31,6 +39,61 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
return
TRUE
;
}
static
DWORD
WINAPI
create_window_thread_proc
(
void
*
param
)
{
struct
create_window_thread_param
*
p
=
param
;
DWORD
res
;
BOOL
ret
;
p
->
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ret
=
SetEvent
(
p
->
window_created
);
ok
(
ret
,
"SetEvent failed, last error %#x.
\n
"
,
GetLastError
());
for
(;;)
{
MSG
msg
;
while
(
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
res
=
WaitForSingleObject
(
p
->
destroy_window
,
100
);
if
(
res
==
WAIT_OBJECT_0
)
break
;
if
(
res
!=
WAIT_TIMEOUT
)
{
ok
(
0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
break
;
}
}
DestroyWindow
(
p
->
window
);
return
0
;
}
static
void
create_window_thread
(
struct
create_window_thread_param
*
p
)
{
DWORD
res
,
tid
;
p
->
window_created
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
window_created
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
destroy_window
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
destroy_window
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
thread
=
CreateThread
(
NULL
,
0
,
create_window_thread_proc
,
p
,
0
,
&
tid
);
ok
(
!!
p
->
thread
,
"Failed to create thread, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
p
->
window_created
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
}
static
void
destroy_window_thread
(
struct
create_window_thread_param
*
p
)
{
SetEvent
(
p
->
destroy_window
);
WaitForSingleObject
(
p
->
thread
,
INFINITE
);
CloseHandle
(
p
->
destroy_window
);
CloseHandle
(
p
->
window_created
);
CloseHandle
(
p
->
thread
);
}
static
D3DCOLOR
get_surface_color
(
IDirectDrawSurface
*
surface
,
UINT
x
,
UINT
y
)
{
RECT
rect
=
{
x
,
y
,
x
+
1
,
y
+
1
};
...
...
@@ -730,10 +793,31 @@ cleanup:
DestroyWindow
(
window
);
}
static
void
test_coop_level_threaded
(
void
)
{
struct
create_window_thread_param
p
;
IDirectDraw
*
ddraw
;
HRESULT
hr
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
return
;
}
create_window_thread
(
&
p
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
p
.
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
IDirectDraw_Release
(
ddraw
);
destroy_window_thread
(
&
p
);
}
START_TEST
(
ddraw1
)
{
test_coop_level_create_device_window
();
test_clipper_blt
();
test_coop_level_d3d_state
();
test_surface_interface_mismatch
();
test_coop_level_threaded
();
}
dlls/ddraw/tests/ddraw2.c
View file @
ed6461f9
...
...
@@ -19,6 +19,14 @@
#include "wine/test.h"
#include "d3d.h"
struct
create_window_thread_param
{
HWND
window
;
HANDLE
window_created
;
HANDLE
destroy_window
;
HANDLE
thread
;
};
static
BOOL
compare_color
(
D3DCOLOR
c1
,
D3DCOLOR
c2
,
BYTE
max_diff
)
{
if
(
abs
((
c1
&
0xff
)
-
(
c2
&
0xff
))
>
max_diff
)
return
FALSE
;
...
...
@@ -31,6 +39,61 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
return
TRUE
;
}
static
DWORD
WINAPI
create_window_thread_proc
(
void
*
param
)
{
struct
create_window_thread_param
*
p
=
param
;
DWORD
res
;
BOOL
ret
;
p
->
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ret
=
SetEvent
(
p
->
window_created
);
ok
(
ret
,
"SetEvent failed, last error %#x.
\n
"
,
GetLastError
());
for
(;;)
{
MSG
msg
;
while
(
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
res
=
WaitForSingleObject
(
p
->
destroy_window
,
100
);
if
(
res
==
WAIT_OBJECT_0
)
break
;
if
(
res
!=
WAIT_TIMEOUT
)
{
ok
(
0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
break
;
}
}
DestroyWindow
(
p
->
window
);
return
0
;
}
static
void
create_window_thread
(
struct
create_window_thread_param
*
p
)
{
DWORD
res
,
tid
;
p
->
window_created
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
window_created
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
destroy_window
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
destroy_window
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
thread
=
CreateThread
(
NULL
,
0
,
create_window_thread_proc
,
p
,
0
,
&
tid
);
ok
(
!!
p
->
thread
,
"Failed to create thread, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
p
->
window_created
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
}
static
void
destroy_window_thread
(
struct
create_window_thread_param
*
p
)
{
SetEvent
(
p
->
destroy_window
);
WaitForSingleObject
(
p
->
thread
,
INFINITE
);
CloseHandle
(
p
->
destroy_window
);
CloseHandle
(
p
->
window_created
);
CloseHandle
(
p
->
thread
);
}
static
D3DCOLOR
get_surface_color
(
IDirectDrawSurface
*
surface
,
UINT
x
,
UINT
y
)
{
RECT
rect
=
{
x
,
y
,
x
+
1
,
y
+
1
};
...
...
@@ -755,10 +818,31 @@ cleanup:
DestroyWindow
(
window
);
}
static
void
test_coop_level_threaded
(
void
)
{
struct
create_window_thread_param
p
;
IDirectDraw2
*
ddraw
;
HRESULT
hr
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
return
;
}
create_window_thread
(
&
p
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
p
.
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
IDirectDraw2_Release
(
ddraw
);
destroy_window_thread
(
&
p
);
}
START_TEST
(
ddraw2
)
{
test_coop_level_create_device_window
();
test_clipper_blt
();
test_coop_level_d3d_state
();
test_surface_interface_mismatch
();
test_coop_level_threaded
();
}
dlls/ddraw/tests/ddraw4.c
View file @
ed6461f9
...
...
@@ -30,6 +30,14 @@ struct vec4
float
x
,
y
,
z
,
w
;
};
struct
create_window_thread_param
{
HWND
window
;
HANDLE
window_created
;
HANDLE
destroy_window
;
HANDLE
thread
;
};
static
BOOL
compare_float
(
float
f
,
float
g
,
unsigned
int
ulps
)
{
int
x
=
*
(
int
*
)
&
f
;
...
...
@@ -66,6 +74,61 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
return
TRUE
;
}
static
DWORD
WINAPI
create_window_thread_proc
(
void
*
param
)
{
struct
create_window_thread_param
*
p
=
param
;
DWORD
res
;
BOOL
ret
;
p
->
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ret
=
SetEvent
(
p
->
window_created
);
ok
(
ret
,
"SetEvent failed, last error %#x.
\n
"
,
GetLastError
());
for
(;;)
{
MSG
msg
;
while
(
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
res
=
WaitForSingleObject
(
p
->
destroy_window
,
100
);
if
(
res
==
WAIT_OBJECT_0
)
break
;
if
(
res
!=
WAIT_TIMEOUT
)
{
ok
(
0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
break
;
}
}
DestroyWindow
(
p
->
window
);
return
0
;
}
static
void
create_window_thread
(
struct
create_window_thread_param
*
p
)
{
DWORD
res
,
tid
;
p
->
window_created
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
window_created
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
destroy_window
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
destroy_window
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
thread
=
CreateThread
(
NULL
,
0
,
create_window_thread_proc
,
p
,
0
,
&
tid
);
ok
(
!!
p
->
thread
,
"Failed to create thread, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
p
->
window_created
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
}
static
void
destroy_window_thread
(
struct
create_window_thread_param
*
p
)
{
SetEvent
(
p
->
destroy_window
);
WaitForSingleObject
(
p
->
thread
,
INFINITE
);
CloseHandle
(
p
->
destroy_window
);
CloseHandle
(
p
->
window_created
);
CloseHandle
(
p
->
thread
);
}
static
D3DCOLOR
get_surface_color
(
IDirectDrawSurface4
*
surface
,
UINT
x
,
UINT
y
)
{
RECT
rect
=
{
x
,
y
,
x
+
1
,
y
+
1
};
...
...
@@ -921,6 +984,26 @@ cleanup:
DestroyWindow
(
window
);
}
static
void
test_coop_level_threaded
(
void
)
{
struct
create_window_thread_param
p
;
IDirectDraw4
*
ddraw
;
HRESULT
hr
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
return
;
}
create_window_thread
(
&
p
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
p
.
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
IDirectDraw4_Release
(
ddraw
);
destroy_window_thread
(
&
p
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
...
...
@@ -928,4 +1011,5 @@ START_TEST(ddraw4)
test_clipper_blt
();
test_coop_level_d3d_state
();
test_surface_interface_mismatch
();
test_coop_level_threaded
();
}
dlls/ddraw/tests/ddraw7.c
View file @
ed6461f9
...
...
@@ -33,6 +33,14 @@ struct vec4
float
x
,
y
,
z
,
w
;
};
struct
create_window_thread_param
{
HWND
window
;
HANDLE
window_created
;
HANDLE
destroy_window
;
HANDLE
thread
;
};
static
BOOL
compare_float
(
float
f
,
float
g
,
unsigned
int
ulps
)
{
int
x
=
*
(
int
*
)
&
f
;
...
...
@@ -76,6 +84,61 @@ static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
return
TRUE
;
}
static
DWORD
WINAPI
create_window_thread_proc
(
void
*
param
)
{
struct
create_window_thread_param
*
p
=
param
;
DWORD
res
;
BOOL
ret
;
p
->
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ret
=
SetEvent
(
p
->
window_created
);
ok
(
ret
,
"SetEvent failed, last error %#x.
\n
"
,
GetLastError
());
for
(;;)
{
MSG
msg
;
while
(
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
res
=
WaitForSingleObject
(
p
->
destroy_window
,
100
);
if
(
res
==
WAIT_OBJECT_0
)
break
;
if
(
res
!=
WAIT_TIMEOUT
)
{
ok
(
0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
break
;
}
}
DestroyWindow
(
p
->
window
);
return
0
;
}
static
void
create_window_thread
(
struct
create_window_thread_param
*
p
)
{
DWORD
res
,
tid
;
p
->
window_created
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
window_created
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
destroy_window
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
p
->
destroy_window
,
"CreateEvent failed, last error %#x.
\n
"
,
GetLastError
());
p
->
thread
=
CreateThread
(
NULL
,
0
,
create_window_thread_proc
,
p
,
0
,
&
tid
);
ok
(
!!
p
->
thread
,
"Failed to create thread, last error %#x.
\n
"
,
GetLastError
());
res
=
WaitForSingleObject
(
p
->
window_created
,
INFINITE
);
ok
(
res
==
WAIT_OBJECT_0
,
"Wait failed (%#x), last error %#x.
\n
"
,
res
,
GetLastError
());
}
static
void
destroy_window_thread
(
struct
create_window_thread_param
*
p
)
{
SetEvent
(
p
->
destroy_window
);
WaitForSingleObject
(
p
->
thread
,
INFINITE
);
CloseHandle
(
p
->
destroy_window
);
CloseHandle
(
p
->
window_created
);
CloseHandle
(
p
->
thread
);
}
static
D3DCOLOR
get_surface_color
(
IDirectDrawSurface7
*
surface
,
UINT
x
,
UINT
y
)
{
RECT
rect
=
{
x
,
y
,
x
+
1
,
y
+
1
};
...
...
@@ -861,6 +924,26 @@ cleanup:
DestroyWindow
(
window
);
}
static
void
test_coop_level_threaded
(
void
)
{
struct
create_window_thread_param
p
;
IDirectDraw7
*
ddraw
;
HRESULT
hr
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
return
;
}
create_window_thread
(
&
p
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
p
.
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
IDirectDraw7_Release
(
ddraw
);
destroy_window_thread
(
&
p
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -876,4 +959,5 @@ START_TEST(ddraw7)
test_clipper_blt
();
test_coop_level_d3d_state
();
test_surface_interface_mismatch
();
test_coop_level_threaded
();
}
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