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
654d53fa
Commit
654d53fa
authored
Dec 21, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add some tests for DDSCL_CREATEDEVICEWINDOW.
parent
fe4e2bf6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
489 additions
and
7 deletions
+489
-7
Makefile.in
dlls/ddraw/tests/Makefile.in
+2
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+130
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+137
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+112
-5
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+108
-2
No files found.
dlls/ddraw/tests/Makefile.in
View file @
654d53fa
...
...
@@ -3,6 +3,8 @@ IMPORTS = ddraw user32 gdi32 ole32
C_SRCS
=
\
d3d.c
\
ddraw1.c
\
ddraw2.c
\
ddraw4.c
\
ddraw7.c
\
ddrawmodes.c
\
...
...
dlls/ddraw/tests/ddraw1.c
0 → 100644
View file @
654d53fa
/*
* Copyright 2011 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/test.h"
#include "d3d.h"
static
IDirectDraw
*
create_ddraw
(
void
)
{
IDirectDraw
*
ddraw
;
if
(
FAILED
(
DirectDrawCreate
(
NULL
,
&
ddraw
,
NULL
)))
return
NULL
;
return
ddraw
;
}
static
void
test_coop_level_create_device_window
(
void
)
{
HWND
focus_window
,
device_window
;
IDirectDraw
*
ddraw
;
HRESULT
hr
;
focus_window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
||
broken
(
hr
==
DDERR_INVALIDPARAMS
),
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
/* Windows versions before 98 / NT5 don't support DDSCL_CREATEDEVICEWINDOW. */
if
(
broken
(
hr
==
DDERR_INVALIDPARAMS
))
{
win_skip
(
"DDSCL_CREATEDEVICEWINDOW not supported, skipping test.
\n
"
);
IDirectDraw_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOHWND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
IDirectDraw_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
}
START_TEST
(
ddraw1
)
{
test_coop_level_create_device_window
();
}
dlls/ddraw/tests/ddraw2.c
0 → 100644
View file @
654d53fa
/*
* Copyright 2011 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/test.h"
#include "d3d.h"
static
IDirectDraw2
*
create_ddraw
(
void
)
{
IDirectDraw2
*
ddraw2
;
IDirectDraw
*
ddraw1
;
HRESULT
hr
;
if
(
FAILED
(
DirectDrawCreate
(
NULL
,
&
ddraw1
,
NULL
)))
return
NULL
;
hr
=
IDirectDraw_QueryInterface
(
ddraw1
,
&
IID_IDirectDraw2
,
(
void
**
)
&
ddraw2
);
IDirectDraw_Release
(
ddraw1
);
if
(
FAILED
(
hr
))
return
NULL
;
return
ddraw2
;
}
static
void
test_coop_level_create_device_window
(
void
)
{
HWND
focus_window
,
device_window
;
IDirectDraw2
*
ddraw
;
HRESULT
hr
;
focus_window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
||
broken
(
hr
==
DDERR_INVALIDPARAMS
),
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
/* Windows versions before 98 / NT5 don't support DDSCL_CREATEDEVICEWINDOW. */
if
(
broken
(
hr
==
DDERR_INVALIDPARAMS
))
{
win_skip
(
"DDSCL_CREATEDEVICEWINDOW not supported, skipping test.
\n
"
);
IDirectDraw2_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOHWND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
IDirectDraw2_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
}
START_TEST
(
ddraw2
)
{
test_coop_level_create_device_window
();
}
dlls/ddraw/tests/ddraw4.c
View file @
654d53fa
...
...
@@ -54,14 +54,10 @@ static BOOL compare_vec4(struct vec4 *vec, float x, float y, float z, float w, u
&&
compare_float
(
vec
->
w
,
w
,
ulps
);
}
static
IDirect
3DDevice3
*
create_device
(
HWND
window
,
DWORD
coop_level
)
static
IDirect
Draw4
*
create_ddraw
(
void
)
{
IDirect3DDevice3
*
device
=
NULL
;
IDirectDrawSurface4
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw4
*
ddraw4
;
IDirectDraw
*
ddraw1
;
IDirect3D3
*
d3d3
;
HRESULT
hr
;
if
(
FAILED
(
DirectDrawCreate
(
NULL
,
&
ddraw1
,
NULL
)))
...
...
@@ -72,6 +68,21 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level)
if
(
FAILED
(
hr
))
return
NULL
;
return
ddraw4
;
}
static
IDirect3DDevice3
*
create_device
(
HWND
window
,
DWORD
coop_level
)
{
IDirect3DDevice3
*
device
=
NULL
;
IDirectDrawSurface4
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw4
*
ddraw4
;
IDirect3D3
*
d3d3
;
HRESULT
hr
;
if
(
!
(
ddraw4
=
create_ddraw
()))
return
NULL
;
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw4
,
window
,
coop_level
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
...
...
@@ -321,7 +332,103 @@ static void test_process_vertices(void)
DestroyWindow
(
window
);
}
static
void
test_coop_level_create_device_window
(
void
)
{
HWND
focus_window
,
device_window
;
IDirectDraw4
*
ddraw
;
HRESULT
hr
;
focus_window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
||
broken
(
hr
==
DDERR_INVALIDPARAMS
),
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
/* Windows versions before 98 / NT5 don't support DDSCL_CREATEDEVICEWINDOW. */
if
(
broken
(
hr
==
DDERR_INVALIDPARAMS
))
{
win_skip
(
"DDSCL_CREATEDEVICEWINDOW not supported, skipping test.
\n
"
);
IDirectDraw4_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOHWND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
IDirectDraw4_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
test_coop_level_create_device_window
();
}
dlls/ddraw/tests/ddraw7.c
View file @
654d53fa
...
...
@@ -64,6 +64,16 @@ static BOOL compare_vec4(struct vec4 *vec, float x, float y, float z, float w, u
&&
compare_float
(
vec
->
w
,
w
,
ulps
);
}
static
IDirectDraw7
*
create_ddraw
(
void
)
{
IDirectDraw7
*
ddraw
;
if
(
FAILED
(
pDirectDrawCreateEx
(
NULL
,
(
void
**
)
&
ddraw
,
&
IID_IDirectDraw7
,
NULL
)))
return
NULL
;
return
ddraw
;
}
static
IDirect3DDevice7
*
create_device
(
HWND
window
,
DWORD
coop_level
)
{
IDirect3DDevice7
*
device
=
NULL
;
...
...
@@ -73,7 +83,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
IDirect3D7
*
d3d7
;
HRESULT
hr
;
if
(
FAILED
(
pDirectDrawCreateEx
(
NULL
,
(
void
**
)
&
ddraw
,
&
IID_IDirectDraw7
,
NULL
)))
if
(
!
(
ddraw
=
create_ddraw
(
)))
return
NULL
;
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
window
,
coop_level
);
...
...
@@ -158,7 +168,7 @@ static void test_process_vertices(void)
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a
3D device
, skipping test.
\n
"
);
skip
(
"Failed to create a
ddraw object
, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
...
...
@@ -315,6 +325,101 @@ static void test_process_vertices(void)
DestroyWindow
(
window
);
}
static
void
test_coop_level_create_device_window
(
void
)
{
HWND
focus_window
,
device_window
;
IDirectDraw7
*
ddraw
;
HRESULT
hr
;
focus_window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_NORMAL
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
||
broken
(
hr
==
DDERR_INVALIDPARAMS
),
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
/* Windows versions before 98 / NT5 don't support DDSCL_CREATEDEVICEWINDOW. */
if
(
broken
(
hr
==
DDERR_INVALIDPARAMS
))
{
win_skip
(
"DDSCL_CREATEDEVICEWINDOW not supported, skipping test.
\n
"
);
IDirectDraw7_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
return
;
}
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOHWND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
|
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DDERR_NOFOCUSWINDOW
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
focus_window
,
DDSCL_SETFOCUSWINDOW
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
ok
(
!
device_window
,
"Unexpected device window found.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_CREATEDEVICEWINDOW
|
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
todo_wine
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
device_window
=
FindWindowA
(
"DirectDrawDeviceWnd"
,
"DirectDrawDeviceWnd"
);
todo_wine
ok
(
!!
device_window
,
"Device window not found.
\n
"
);
IDirectDraw7_Release
(
ddraw
);
DestroyWindow
(
focus_window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -326,4 +431,5 @@ START_TEST(ddraw7)
}
test_process_vertices
();
test_coop_level_create_device_window
();
}
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