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
cfc9e120
Commit
cfc9e120
authored
Jan 31, 2012
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 31, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add an IDirect3DTexture2::Load color key test.
parent
2bd56ac5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+96
-0
No files found.
dlls/ddraw/tests/ddraw4.c
View file @
cfc9e120
...
...
@@ -1214,6 +1214,101 @@ static void test_depth_blit(void)
DestroyWindow
(
window
);
}
static
void
test_texture_load_ckey
(
void
)
{
IDirectDraw4
*
ddraw
;
IDirectDrawSurface4
*
src
;
IDirectDrawSurface4
*
dst
;
IDirect3DTexture2
*
src_tex
;
IDirect3DTexture2
*
dst_tex
;
DDSURFACEDESC2
ddsd
;
HRESULT
hr
;
DDCOLORKEY
ckey
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create ddraw object, skipping test.
\n
"
);
return
;
}
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_HEIGHT
|
DDSD_WIDTH
;
ddsd
.
dwHeight
=
128
;
ddsd
.
dwWidth
=
128
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_SYSTEMMEMORY
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
ddsd
,
&
src
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create source texture, hr %#x.
\n
"
,
hr
);
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
ddsd
,
&
dst
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create destination texture, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_QueryInterface
(
src
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
src_tex
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
E_NOINTERFACE
,
"Failed to get Direct3DTexture2 interface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
/* 64 bit ddraw does not support d3d */
skip
(
"Could not get Direct3DTexture2 interface, skipping texture::Load color keying tests.
\n
"
);
IDirectDrawSurface4_Release
(
dst
);
IDirectDrawSurface4_Release
(
src
);
IDirectDraw4_Release
(
ddraw
);
return
;
}
hr
=
IDirectDrawSurface4_QueryInterface
(
dst
,
&
IID_IDirect3DTexture2
,
(
void
**
)
&
dst_tex
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get Direct3DTexture2 interface, hr %#x.
\n
"
,
hr
);
/* No surface has a color key */
hr
=
IDirect3DTexture2_Load
(
dst_tex
,
src_tex
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
ckey
.
dwColorSpaceLowValue
=
ckey
.
dwColorSpaceHighValue
=
0xdeadbeef
;
hr
=
IDirectDrawSurface4_GetColorKey
(
dst
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
ckey
.
dwColorSpaceLowValue
==
0xdeadbeef
,
"dwColorSpaceLowValue is %#x.
\n
"
,
ckey
.
dwColorSpaceLowValue
);
ok
(
ckey
.
dwColorSpaceHighValue
==
0xdeadbeef
,
"dwColorSpaceHighValue is %#x.
\n
"
,
ckey
.
dwColorSpaceHighValue
);
/* Source surface has a color key */
ckey
.
dwColorSpaceLowValue
=
ckey
.
dwColorSpaceHighValue
=
0x0000ff00
;
hr
=
IDirectDrawSurface4_SetColorKey
(
src
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_Load
(
dst_tex
,
src_tex
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
dst
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
ckey
.
dwColorSpaceLowValue
==
0x0000ff00
,
"dwColorSpaceLowValue is %#x.
\n
"
,
ckey
.
dwColorSpaceLowValue
);
ok
(
ckey
.
dwColorSpaceHighValue
==
0x0000ff00
,
"dwColorSpaceHighValue is %#x.
\n
"
,
ckey
.
dwColorSpaceHighValue
);
/* Both surfaces have a color key: Dest ckey is overwritten */
ckey
.
dwColorSpaceLowValue
=
ckey
.
dwColorSpaceHighValue
=
0x000000ff
;
hr
=
IDirectDrawSurface4_SetColorKey
(
dst
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_Load
(
dst_tex
,
src_tex
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
dst
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
ckey
.
dwColorSpaceLowValue
==
0x0000ff00
,
"dwColorSpaceLowValue is %#x.
\n
"
,
ckey
.
dwColorSpaceLowValue
);
ok
(
ckey
.
dwColorSpaceHighValue
==
0x0000ff00
,
"dwColorSpaceHighValue is %#x.
\n
"
,
ckey
.
dwColorSpaceHighValue
);
/* Only the destination has a color key: It is not deleted */
hr
=
IDirectDrawSurface4_SetColorKey
(
src
,
DDCKEY_SRCBLT
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set color key, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
src
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
hr
==
DDERR_NOCOLORKEY
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DTexture2_Load
(
dst_tex
,
src_tex
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetColorKey
(
dst
,
DDCKEY_SRCBLT
,
&
ckey
);
ok
(
SUCCEEDED
(
hr
),
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
ckey
.
dwColorSpaceLowValue
==
0x0000ff00
,
"dwColorSpaceLowValue is %#x.
\n
"
,
ckey
.
dwColorSpaceLowValue
);
ok
(
ckey
.
dwColorSpaceHighValue
==
0x0000ff00
,
"dwColorSpaceHighValue is %#x.
\n
"
,
ckey
.
dwColorSpaceHighValue
);
IDirect3DTexture2_Release
(
dst_tex
);
IDirect3DTexture2_Release
(
src_tex
);
IDirectDrawSurface4_Release
(
dst
);
IDirectDrawSurface4_Release
(
src
);
IDirectDraw4_Release
(
ddraw
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
...
...
@@ -1223,4 +1318,5 @@ START_TEST(ddraw4)
test_surface_interface_mismatch
();
test_coop_level_threaded
();
test_depth_blit
();
test_texture_load_ckey
();
}
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