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
e00cc024
Commit
e00cc024
authored
Jan 09, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add some color key tests for complex surfaces.
parent
bddb0433
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
547 additions
and
0 deletions
+547
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+141
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+141
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+140
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+125
-0
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
e00cc024
...
...
@@ -1519,6 +1519,146 @@ static void test_ck_default(void)
DestroyWindow
(
window
);
}
static
void
test_ck_complex
(
void
)
{
IDirectDrawSurface
*
surface
,
*
mipmap
,
*
tmp
;
DDSCAPS
caps
=
{
DDSCAPS_COMPLEX
};
DDSURFACEDESC
surface_desc
;
IDirect3DDevice
*
device
;
DDCOLORKEY
color_key
;
IDirectDraw
*
ddraw
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
return
;
}
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
ddraw
,
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
IDirectDraw2_Release
(
ddraw
);
return
;
}
IDirect3DDevice_Release
(
device
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_COMPLEX
|
DDSCAPS_MIPMAP
;
surface_desc
.
dwWidth
=
128
;
surface_desc
.
dwHeight
=
128
;
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
mipmap
=
surface
;
IDirectDrawSurface_AddRef
(
mipmap
);
for
(
i
=
0
;
i
<
7
;
++
i
)
{
hr
=
IDirectDrawSurface_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, i %u, hr %#x.
\n
"
,
i
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x000000ff
;
color_key
.
dwColorSpaceHighValue
=
0x000000ff
;
hr
=
IDirectDrawSurface_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x, i %u.
\n
"
,
hr
,
i
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x, i %u.
\n
"
,
hr
,
i
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x000000ff
,
"Got unexpected value 0x%08x, i %u.
\n
"
,
color_key
.
dwColorSpaceLowValue
,
i
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x000000ff
,
"Got unexpected value 0x%08x, i %u.
\n
"
,
color_key
.
dwColorSpaceHighValue
,
i
);
IDirectDrawSurface_Release
(
mipmap
);
mipmap
=
tmp
;
}
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
mipmap
);
refcount
=
IDirectDrawSurface_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_BACKBUFFERCOUNT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_COMPLEX
|
DDSCAPS_FLIP
;
surface_desc
.
dwBackBufferCount
=
1
;
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface_GetAttachedSurface
(
surface
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
IDirectDrawSurface_Release
(
tmp
);
refcount
=
IDirectDrawSurface_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
refcount
=
IDirectDraw_Release
(
ddraw
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
struct
qi_test
{
REFIID
iid
;
...
...
@@ -4021,6 +4161,7 @@ START_TEST(ddraw1)
test_zenable
();
test_ck_rgba
();
test_ck_default
();
test_ck_complex
();
test_surface_qi
();
test_device_qi
();
test_wndproc
();
...
...
dlls/ddraw/tests/ddraw2.c
View file @
e00cc024
...
...
@@ -1716,6 +1716,146 @@ static void test_ck_default(void)
DestroyWindow
(
window
);
}
static
void
test_ck_complex
(
void
)
{
IDirectDrawSurface
*
surface
,
*
mipmap
,
*
tmp
;
DDSCAPS
caps
=
{
DDSCAPS_COMPLEX
};
DDSURFACEDESC
surface_desc
;
IDirect3DDevice2
*
device
;
DDCOLORKEY
color_key
;
IDirectDraw2
*
ddraw
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create a ddraw object, skipping test.
\n
"
);
return
;
}
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
ddraw
,
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
IDirectDraw2_Release
(
ddraw
);
return
;
}
IDirect3DDevice2_Release
(
device
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_COMPLEX
|
DDSCAPS_MIPMAP
;
surface_desc
.
dwWidth
=
128
;
surface_desc
.
dwHeight
=
128
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
mipmap
=
surface
;
IDirectDrawSurface_AddRef
(
mipmap
);
for
(
i
=
0
;
i
<
7
;
++
i
)
{
hr
=
IDirectDrawSurface_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, i %u, hr %#x.
\n
"
,
i
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x000000ff
;
color_key
.
dwColorSpaceHighValue
=
0x000000ff
;
hr
=
IDirectDrawSurface_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x, i %u.
\n
"
,
hr
,
i
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x, i %u.
\n
"
,
hr
,
i
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x000000ff
,
"Got unexpected value 0x%08x, i %u.
\n
"
,
color_key
.
dwColorSpaceLowValue
,
i
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x000000ff
,
"Got unexpected value 0x%08x, i %u.
\n
"
,
color_key
.
dwColorSpaceHighValue
,
i
);
IDirectDrawSurface_Release
(
mipmap
);
mipmap
=
tmp
;
}
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
mipmap
);
refcount
=
IDirectDrawSurface_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_BACKBUFFERCOUNT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_COMPLEX
|
DDSCAPS_FLIP
;
surface_desc
.
dwBackBufferCount
=
1
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface_GetAttachedSurface
(
surface
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
IDirectDrawSurface_Release
(
tmp
);
refcount
=
IDirectDrawSurface_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
refcount
=
IDirectDraw2_Release
(
ddraw
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
struct
qi_test
{
REFIID
iid
;
...
...
@@ -5120,6 +5260,7 @@ START_TEST(ddraw2)
test_zenable
();
test_ck_rgba
();
test_ck_default
();
test_ck_complex
();
test_surface_qi
();
test_device_qi
();
test_wndproc
();
...
...
dlls/ddraw/tests/ddraw4.c
View file @
e00cc024
...
...
@@ -1848,6 +1848,145 @@ static void test_ck_default(void)
DestroyWindow
(
window
);
}
static
void
test_ck_complex
(
void
)
{
IDirectDrawSurface4
*
surface
,
*
mipmap
,
*
tmp
;
DDSCAPS2
caps
=
{
DDSCAPS_COMPLEX
,
0
,
0
,
0
};
DDSURFACEDESC2
surface_desc
;
IDirect3DDevice3
*
device
;
DDCOLORKEY
color_key
;
IDirectDraw4
*
ddraw
;
IDirect3D3
*
d3d
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice3_GetDirect3D
(
device
,
&
d3d
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3D3_QueryInterface
(
d3d
,
&
IID_IDirectDraw4
,
(
void
**
)
&
ddraw
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get ddraw interface, hr %#x.
\n
"
,
hr
);
IDirect3D3_Release
(
d3d
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_COMPLEX
|
DDSCAPS_MIPMAP
;
surface_desc
.
dwWidth
=
128
;
surface_desc
.
dwHeight
=
128
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface4_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface4_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
mipmap
=
surface
;
IDirectDrawSurface_AddRef
(
mipmap
);
for
(
i
=
0
;
i
<
7
;
++
i
)
{
hr
=
IDirectDrawSurface4_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, i %u, hr %#x.
\n
"
,
i
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x000000ff
;
color_key
.
dwColorSpaceHighValue
=
0x000000ff
;
hr
=
IDirectDrawSurface4_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x, i %u.
\n
"
,
hr
,
i
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface4_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x, i %u.
\n
"
,
hr
,
i
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x000000ff
,
"Got unexpected value 0x%08x, i %u.
\n
"
,
color_key
.
dwColorSpaceLowValue
,
i
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x000000ff
,
"Got unexpected value 0x%08x, i %u.
\n
"
,
color_key
.
dwColorSpaceHighValue
,
i
);
IDirectDrawSurface_Release
(
mipmap
);
mipmap
=
tmp
;
}
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface4_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface4_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
mipmap
);
refcount
=
IDirectDrawSurface4_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_BACKBUFFERCOUNT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_COMPLEX
|
DDSCAPS_FLIP
;
surface_desc
.
dwBackBufferCount
=
1
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface4_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface4_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface4_GetAttachedSurface
(
surface
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface4_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface4_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
IDirectDrawSurface_Release
(
tmp
);
refcount
=
IDirectDrawSurface4_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
IDirectDraw4_Release
(
ddraw
);
refcount
=
IDirect3DDevice3_Release
(
device
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
struct
qi_test
{
REFIID
iid
;
...
...
@@ -5718,6 +5857,7 @@ START_TEST(ddraw4)
test_zenable
();
test_ck_rgba
();
test_ck_default
();
test_ck_complex
();
test_surface_qi
();
test_device_qi
();
test_wndproc
();
...
...
dlls/ddraw/tests/ddraw7.c
View file @
e00cc024
...
...
@@ -1588,6 +1588,130 @@ static void test_ck_default(void)
DestroyWindow
(
window
);
}
static
void
test_ck_complex
(
void
)
{
IDirectDrawSurface7
*
surface
,
*
mipmap
,
*
tmp
;
DDSCAPS2
caps
=
{
DDSCAPS_COMPLEX
,
0
,
0
,
0
};
DDSURFACEDESC2
surface_desc
;
IDirect3DDevice7
*
device
;
DDCOLORKEY
color_key
;
IDirectDraw7
*
ddraw
;
IDirect3D7
*
d3d
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice7_GetDirect3D
(
device
,
&
d3d
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3D7_QueryInterface
(
d3d
,
&
IID_IDirectDraw7
,
(
void
**
)
&
ddraw
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get ddraw interface, hr %#x.
\n
"
,
hr
);
IDirect3D7_Release
(
d3d
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_COMPLEX
|
DDSCAPS_MIPMAP
;
surface_desc
.
dwWidth
=
128
;
surface_desc
.
dwHeight
=
128
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface7_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface7_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
mipmap
=
surface
;
IDirectDrawSurface_AddRef
(
mipmap
);
for
(
i
=
0
;
i
<
7
;
++
i
)
{
hr
=
IDirectDrawSurface7_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, i %u, hr %#x.
\n
"
,
i
,
hr
);
hr
=
IDirectDrawSurface7_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x000000ff
;
color_key
.
dwColorSpaceHighValue
=
0x000000ff
;
hr
=
IDirectDrawSurface7_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOTONMIPMAPSUBLEVEL
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
IDirectDrawSurface_Release
(
mipmap
);
mipmap
=
tmp
;
}
hr
=
IDirectDrawSurface7_GetAttachedSurface
(
mipmap
,
&
caps
,
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
mipmap
);
refcount
=
IDirectDrawSurface7_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_BACKBUFFERCOUNT
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_COMPLEX
|
DDSCAPS_FLIP
;
surface_desc
.
dwBackBufferCount
=
1
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface7_SetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface7_GetColorKey
(
surface
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
hr
=
IDirectDrawSurface7_GetAttachedSurface
(
surface
,
&
caps
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get attached surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x, i %u.
\n
"
,
hr
,
i
);
color_key
.
dwColorSpaceLowValue
=
0x0000ff00
;
color_key
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface7_SetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
memset
(
&
color_key
,
0
,
sizeof
(
color_key
));
hr
=
IDirectDrawSurface7_GetColorKey
(
tmp
,
DDCKEY_SRCBLT
,
&
color_key
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get color key, hr %#x.
\n
"
,
hr
);
ok
(
color_key
.
dwColorSpaceLowValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceLowValue
);
ok
(
color_key
.
dwColorSpaceHighValue
==
0x0000ff00
,
"Got unexpected value 0x%08x.
\n
"
,
color_key
.
dwColorSpaceHighValue
);
IDirectDrawSurface_Release
(
tmp
);
refcount
=
IDirectDrawSurface7_Release
(
surface
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
IDirectDraw7_Release
(
ddraw
);
refcount
=
IDirect3DDevice7_Release
(
device
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
struct
qi_test
{
REFIID
iid
;
...
...
@@ -5619,6 +5743,7 @@ START_TEST(ddraw7)
test_zenable
();
test_ck_rgba
();
test_ck_default
();
test_ck_complex
();
test_surface_qi
();
test_device_qi
();
test_wndproc
();
...
...
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