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
77e6d988
Commit
77e6d988
authored
Apr 10, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Rewrite GetDCFormatTest().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2a2554ee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
466 additions
and
240 deletions
+466
-240
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+116
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+116
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+117
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+117
-0
dsurface.c
dlls/ddraw/tests/dsurface.c
+0
-240
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
77e6d988
...
...
@@ -8573,6 +8573,121 @@ static void test_blt(void)
DestroyWindow
(
window
);
}
static
void
test_getdc
(
void
)
{
IDirectDrawSurface
*
surface
;
DDSURFACEDESC
surface_desc
;
IDirectDraw
*
ddraw
;
unsigned
int
i
;
HWND
window
;
HRESULT
hr
;
HDC
dc
;
static
const
struct
{
const
char
*
name
;
DDPIXELFORMAT
format
;
BOOL
getdc_supported
;
HRESULT
alt_result
;
}
test_data
[]
=
{
{
"D3DFMT_A8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0xff000000
}},
TRUE
},
{
"D3DFMT_X8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_R5G6B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x0000f800
},
{
0x000007e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_X1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_A1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00008000
}},
TRUE
},
{
"D3DFMT_A4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x0000f000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_A2R10G10B10"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0xc0000000
},
{
0x3ff00000
},
{
0x000ffc00
},
{
0x000003ff
}},
TRUE
},
{
"D3DFMT_A8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0xff000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_R3G3B2"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
8
},
{
0x000000e0
},
{
0x0000001c
},
{
0x00000003
},
{
0x00000000
}},
FALSE
},
/* GetDC() on a P8 surface fails unless the display mode is 8 bpp.
* This is not implemented in wine yet, so disable the test for now.
* Succeeding P8 GetDC() calls are tested in the ddraw:visual test.
{"D3DFMT_P8", {sizeof(test_data->format), DDPF_PALETTEINDEXED8 | DDPF_RGB, 0, {8 },
{0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}}, FALSE},
*/
{
"D3DFMT_L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_LUMINANCE
,
0
,
{
8
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_A8L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_ALPHAPIXELS
|
DDPF_LUMINANCE
,
0
,
{
16
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x0000ff00
}},
FALSE
},
{
"D3DFMT_DXT1"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'1'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT2"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'2'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT3"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'3'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT4"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'4'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT5"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'5'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
test_data
)
/
sizeof
(
*
test_data
));
++
i
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U4
(
surface_desc
).
ddpfPixelFormat
=
test_data
[
i
].
format
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
if
(
FAILED
(
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
if
(
FAILED
(
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
skip
(
"Failed to create surface for format %s (hr %#x), skipping tests.
\n
"
,
test_data
[
i
].
name
,
hr
);
continue
;
}
}
dc
=
(
void
*
)
0x1234
;
hr
=
IDirectDrawSurface_GetDC
(
surface
,
&
dc
);
if
(
test_data
[
i
].
getdc_supported
)
ok
(
SUCCEEDED
(
hr
)
||
(
test_data
[
i
].
alt_result
&&
hr
==
test_data
[
i
].
alt_result
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
else
ok
(
FAILED
(
hr
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDrawSurface_ReleaseDC
(
surface
,
dc
);
ok
(
hr
==
DD_OK
,
"Failed to release DC for format %s, hr %#x.
\n
"
,
test_data
[
i
].
name
,
hr
);
}
else
{
ok
(
!
dc
,
"Got unexpected dc %p for format %s.
\n
"
,
dc
,
test_data
[
i
].
name
);
}
IDirectDrawSurface_Release
(
surface
);
}
IDirectDraw_Release
(
ddraw
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw1
)
{
IDirectDraw
*
ddraw
;
...
...
@@ -8650,4 +8765,5 @@ START_TEST(ddraw1)
test_offscreen_overlay
();
test_overlay_rect
();
test_blt
();
test_getdc
();
}
dlls/ddraw/tests/ddraw2.c
View file @
77e6d988
...
...
@@ -9680,6 +9680,121 @@ static void test_blt(void)
DestroyWindow
(
window
);
}
static
void
test_getdc
(
void
)
{
IDirectDrawSurface
*
surface
;
DDSURFACEDESC
surface_desc
;
IDirectDraw2
*
ddraw
;
unsigned
int
i
;
HWND
window
;
HRESULT
hr
;
HDC
dc
;
static
const
struct
{
const
char
*
name
;
DDPIXELFORMAT
format
;
BOOL
getdc_supported
;
HRESULT
alt_result
;
}
test_data
[]
=
{
{
"D3DFMT_A8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0xff000000
}},
TRUE
},
{
"D3DFMT_X8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_R5G6B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x0000f800
},
{
0x000007e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_X1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_A1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00008000
}},
TRUE
},
{
"D3DFMT_A4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x0000f000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_A2R10G10B10"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0xc0000000
},
{
0x3ff00000
},
{
0x000ffc00
},
{
0x000003ff
}},
TRUE
},
{
"D3DFMT_A8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0xff000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_R3G3B2"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
8
},
{
0x000000e0
},
{
0x0000001c
},
{
0x00000003
},
{
0x00000000
}},
FALSE
},
/* GetDC() on a P8 surface fails unless the display mode is 8 bpp.
* This is not implemented in wine yet, so disable the test for now.
* Succeeding P8 GetDC() calls are tested in the ddraw:visual test.
{"D3DFMT_P8", {sizeof(test_data->format), DDPF_PALETTEINDEXED8 | DDPF_RGB, 0, {8 },
{0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}}, FALSE},
*/
{
"D3DFMT_L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_LUMINANCE
,
0
,
{
8
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_A8L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_ALPHAPIXELS
|
DDPF_LUMINANCE
,
0
,
{
16
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x0000ff00
}},
FALSE
},
{
"D3DFMT_DXT1"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'1'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT2"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'2'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT3"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'3'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT4"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'4'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT5"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'5'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
hr
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
test_data
)
/
sizeof
(
*
test_data
));
++
i
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U4
(
surface_desc
).
ddpfPixelFormat
=
test_data
[
i
].
format
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
if
(
FAILED
(
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
if
(
FAILED
(
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
skip
(
"Failed to create surface for format %s (hr %#x), skipping tests.
\n
"
,
test_data
[
i
].
name
,
hr
);
continue
;
}
}
dc
=
(
void
*
)
0x1234
;
hr
=
IDirectDrawSurface_GetDC
(
surface
,
&
dc
);
if
(
test_data
[
i
].
getdc_supported
)
ok
(
SUCCEEDED
(
hr
)
||
(
test_data
[
i
].
alt_result
&&
hr
==
test_data
[
i
].
alt_result
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
else
ok
(
FAILED
(
hr
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDrawSurface_ReleaseDC
(
surface
,
dc
);
ok
(
hr
==
DD_OK
,
"Failed to release DC for format %s, hr %#x.
\n
"
,
test_data
[
i
].
name
,
hr
);
}
else
{
ok
(
!
dc
,
"Got unexpected dc %p for format %s.
\n
"
,
dc
,
test_data
[
i
].
name
);
}
IDirectDrawSurface_Release
(
surface
);
}
IDirectDraw2_Release
(
ddraw
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw2
)
{
IDirectDraw2
*
ddraw
;
...
...
@@ -9764,4 +9879,5 @@ START_TEST(ddraw2)
test_offscreen_overlay
();
test_overlay_rect
();
test_blt
();
test_getdc
();
}
dlls/ddraw/tests/ddraw4.c
View file @
77e6d988
...
...
@@ -10956,6 +10956,122 @@ static void test_color_clamping(void)
DestroyWindow
(
window
);
}
static
void
test_getdc
(
void
)
{
IDirectDrawSurface4
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw4
*
ddraw
;
unsigned
int
i
;
HWND
window
;
HRESULT
hr
;
HDC
dc
;
static
const
struct
{
const
char
*
name
;
DDPIXELFORMAT
format
;
BOOL
getdc_supported
;
HRESULT
alt_result
;
}
test_data
[]
=
{
{
"D3DFMT_A8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0xff000000
}},
TRUE
},
{
"D3DFMT_X8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_R5G6B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x0000f800
},
{
0x000007e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_X1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_A1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00008000
}},
TRUE
},
{
"D3DFMT_A4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x0000f000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_A2R10G10B10"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0xc0000000
},
{
0x3ff00000
},
{
0x000ffc00
},
{
0x000003ff
}},
TRUE
},
{
"D3DFMT_A8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0xff000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_R3G3B2"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
8
},
{
0x000000e0
},
{
0x0000001c
},
{
0x00000003
},
{
0x00000000
}},
FALSE
},
/* GetDC() on a P8 surface fails unless the display mode is 8 bpp.
* This is not implemented in wine yet, so disable the test for now.
* Succeeding P8 GetDC() calls are tested in the ddraw:visual test.
{"D3DFMT_P8", {sizeof(test_data->format), DDPF_PALETTEINDEXED8 | DDPF_RGB, 0, {8 },
{0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}}, FALSE},
*/
{
"D3DFMT_L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_LUMINANCE
,
0
,
{
8
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_A8L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_ALPHAPIXELS
|
DDPF_LUMINANCE
,
0
,
{
16
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x0000ff00
}},
FALSE
},
{
"D3DFMT_DXT1"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'1'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT2"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'2'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT3"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'3'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT4"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'4'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT5"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'5'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
test_data
)
/
sizeof
(
*
test_data
));
++
i
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U4
(
surface_desc
).
ddpfPixelFormat
=
test_data
[
i
].
format
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
if
(
FAILED
(
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
surface_desc
.
ddsCaps
.
dwCaps2
=
DDSCAPS2_TEXTUREMANAGE
;
if
(
FAILED
(
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
skip
(
"Failed to create surface for format %s (hr %#x), skipping tests.
\n
"
,
test_data
[
i
].
name
,
hr
);
continue
;
}
}
dc
=
(
void
*
)
0x1234
;
hr
=
IDirectDrawSurface4_GetDC
(
surface
,
&
dc
);
if
(
test_data
[
i
].
getdc_supported
)
ok
(
SUCCEEDED
(
hr
)
||
(
test_data
[
i
].
alt_result
&&
hr
==
test_data
[
i
].
alt_result
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
else
ok
(
FAILED
(
hr
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDrawSurface4_ReleaseDC
(
surface
,
dc
);
ok
(
hr
==
DD_OK
,
"Failed to release DC for format %s, hr %#x.
\n
"
,
test_data
[
i
].
name
,
hr
);
}
else
{
ok
(
!
dc
,
"Got unexpected dc %p for format %s.
\n
"
,
dc
,
test_data
[
i
].
name
);
}
IDirectDrawSurface4_Release
(
surface
);
}
IDirectDraw4_Release
(
ddraw
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw4
)
{
IDirectDraw4
*
ddraw
;
...
...
@@ -11048,4 +11164,5 @@ START_TEST(ddraw4)
test_overlay_rect
();
test_blt
();
test_color_clamping
();
test_getdc
();
}
dlls/ddraw/tests/ddraw7.c
View file @
77e6d988
...
...
@@ -11222,6 +11222,122 @@ static void test_color_clamping(void)
DestroyWindow
(
window
);
}
static
void
test_getdc
(
void
)
{
IDirectDrawSurface7
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw7
*
ddraw
;
unsigned
int
i
;
HWND
window
;
HRESULT
hr
;
HDC
dc
;
static
const
struct
{
const
char
*
name
;
DDPIXELFORMAT
format
;
BOOL
getdc_supported
;
HRESULT
alt_result
;
}
test_data
[]
=
{
{
"D3DFMT_A8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0xff000000
}},
TRUE
},
{
"D3DFMT_X8R8G8B8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_R5G6B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x0000f800
},
{
0x000007e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_X1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00000000
}},
TRUE
},
{
"D3DFMT_A1R5G5B5"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00007c00
},
{
0x000003e0
},
{
0x0000001f
},
{
0x00008000
}},
TRUE
},
{
"D3DFMT_A4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x0000f000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X4R4G4B4"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_A2R10G10B10"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0xc0000000
},
{
0x3ff00000
},
{
0x000ffc00
},
{
0x000003ff
}},
TRUE
},
{
"D3DFMT_A8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0xff000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X8B8G8R8"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_R3G3B2"
,
{
sizeof
(
test_data
->
format
),
DDPF_RGB
,
0
,
{
8
},
{
0x000000e0
},
{
0x0000001c
},
{
0x00000003
},
{
0x00000000
}},
FALSE
},
/* GetDC() on a P8 surface fails unless the display mode is 8 bpp.
* This is not implemented in wine yet, so disable the test for now.
* Succeeding P8 GetDC() calls are tested in the ddraw:visual test.
{"D3DFMT_P8", {sizeof(test_data->format), DDPF_PALETTEINDEXED8 | DDPF_RGB, 0, {8 },
{0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}}, FALSE},
*/
{
"D3DFMT_L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_LUMINANCE
,
0
,
{
8
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_A8L8"
,
{
sizeof
(
test_data
->
format
),
DDPF_ALPHAPIXELS
|
DDPF_LUMINANCE
,
0
,
{
16
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x0000ff00
}},
FALSE
},
{
"D3DFMT_DXT1"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'1'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT2"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'2'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT3"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'3'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT4"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'4'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
{
"D3DFMT_DXT5"
,
{
sizeof
(
test_data
->
format
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'5'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}},
FALSE
},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ddraw
=
create_ddraw
();
ok
(
!!
ddraw
,
"Failed to create a ddraw object.
\n
"
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
test_data
)
/
sizeof
(
*
test_data
));
++
i
)
{
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U4
(
surface_desc
).
ddpfPixelFormat
=
test_data
[
i
].
format
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
if
(
FAILED
(
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
surface_desc
.
ddsCaps
.
dwCaps2
=
DDSCAPS2_TEXTUREMANAGE
;
if
(
FAILED
(
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
)))
{
skip
(
"Failed to create surface for format %s (hr %#x), skipping tests.
\n
"
,
test_data
[
i
].
name
,
hr
);
continue
;
}
}
dc
=
(
void
*
)
0x1234
;
hr
=
IDirectDrawSurface7_GetDC
(
surface
,
&
dc
);
if
(
test_data
[
i
].
getdc_supported
)
ok
(
SUCCEEDED
(
hr
)
||
(
test_data
[
i
].
alt_result
&&
hr
==
test_data
[
i
].
alt_result
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
else
ok
(
FAILED
(
hr
),
"Got unexpected hr %#x for format %s.
\n
"
,
hr
,
test_data
[
i
].
name
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDrawSurface7_ReleaseDC
(
surface
,
dc
);
ok
(
hr
==
DD_OK
,
"Failed to release DC for format %s, hr %#x.
\n
"
,
test_data
[
i
].
name
,
hr
);
}
else
{
ok
(
!
dc
,
"Got unexpected dc %p for format %s.
\n
"
,
dc
,
test_data
[
i
].
name
);
}
IDirectDrawSurface7_Release
(
surface
);
}
IDirectDraw7_Release
(
ddraw
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -11325,4 +11441,5 @@ START_TEST(ddraw7)
test_overlay_rect
();
test_blt
();
test_color_clamping
();
test_getdc
();
}
dlls/ddraw/tests/dsurface.c
View file @
77e6d988
...
...
@@ -2443,245 +2443,6 @@ static void GetDCTest(void)
IDirectDraw7_Release
(
dd7
);
}
static
void
GetDCFormatTest
(
void
)
{
DDSURFACEDESC2
ddsd
;
unsigned
int
i
;
IDirectDrawSurface7
*
surface
;
IDirectDraw7
*
dd7
;
HRESULT
hr
;
HDC
dc
;
struct
{
const
char
*
name
;
DDPIXELFORMAT
fmt
;
BOOL
getdc_capable
;
HRESULT
alt_result
;
}
testdata
[]
=
{
{
"D3DFMT_A8R8G8B8"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0xff000000
}
},
TRUE
},
{
"D3DFMT_X8R8G8B8"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
,
0
,
{
32
},
{
0x00ff0000
},
{
0x0000ff00
},
{
0x000000ff
},
{
0x00000000
}
},
TRUE
},
{
"D3DFMT_X8B8G8R8"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0x00000000
}
},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X8B8G8R8"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0x000000ff
},
{
0x0000ff00
},
{
0x00ff0000
},
{
0xff000000
}
},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_A4R4G4B4"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x0000f000
}
},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_X4R4G4B4"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
,
0
,
{
16
},
{
0x00000f00
},
{
0x000000f0
},
{
0x0000000f
},
{
0x00000000
}
},
TRUE
,
DDERR_CANTCREATEDC
/* Vista+ */
},
{
"D3DFMT_R5G6B5"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
,
0
,
{
16
},
{
0x0000F800
},
{
0x000007E0
},
{
0x0000001F
},
{
0x00000000
}
},
TRUE
},
{
"D3DFMT_A1R5G5B5"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
16
},
{
0x00007C00
},
{
0x000003E0
},
{
0x0000001F
},
{
0x00008000
}
},
TRUE
},
{
"D3DFMT_X1R5G5B5"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
,
0
,
{
16
},
{
0x00007C00
},
{
0x000003E0
},
{
0x0000001F
},
{
0x00000000
}
},
TRUE
},
{
"D3DFMT_R3G3B2"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
,
0
,
{
8
},
{
0x000000E0
},
{
0x0000001C
},
{
0x00000003
},
{
0x00000000
}
},
FALSE
},
{
/* Untested, windows test machine didn't support this format */
"D3DFMT_A2R10G10B10"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_RGB
|
DDPF_ALPHAPIXELS
,
0
,
{
32
},
{
0xC0000000
},
{
0x3FF00000
},
{
0x000FFC00
},
{
0x000003FF
}
},
TRUE
},
/*
* GetDC on a P8 surface fails unless the display mode is 8 bpp. This is not
* implemented in wine yet, so disable the test for now. Succeeding P8 getDC
* calls are tested in the ddraw.visual test.
*
{
"D3DFMT_P8",
{
sizeof(DDPIXELFORMAT), DDPF_PALETTEINDEXED8 | DDPF_RGB, 0,
{8 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
},
FALSE
},
*/
{
"D3DFMT_L8"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_LUMINANCE
,
0
,
{
8
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}
},
FALSE
},
{
"D3DFMT_A8L8"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_ALPHAPIXELS
|
DDPF_LUMINANCE
,
0
,
{
16
},
{
0x000000ff
},
{
0x00000000
},
{
0x00000000
},
{
0x0000ff00
}
},
FALSE
},
{
"D3DFMT_DXT1"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'1'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}
},
FALSE
},
{
"D3DFMT_DXT2"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'2'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}
},
FALSE
},
{
"D3DFMT_DXT3"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'3'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}
},
FALSE
},
{
"D3DFMT_DXT4"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'4'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}
},
FALSE
},
{
"D3DFMT_DXT5"
,
{
sizeof
(
DDPIXELFORMAT
),
DDPF_FOURCC
,
MAKEFOURCC
(
'D'
,
'X'
,
'T'
,
'5'
),
{
0
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
},
{
0x00000000
}
},
FALSE
},
};
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw7
,
(
void
**
)
&
dd7
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface failed, hr = 0x%08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
testdata
)
/
sizeof
(
testdata
[
0
]));
i
++
)
{
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
64
;
ddsd
.
dwHeight
=
64
;
U4
(
ddsd
).
ddpfPixelFormat
=
testdata
[
i
].
fmt
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd
,
&
surface
,
NULL
);
if
(
FAILED
(
hr
))
{
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
ddsd
.
ddsCaps
.
dwCaps2
=
DDSCAPS2_TEXTUREMANAGE
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd
,
&
surface
,
NULL
);
if
(
FAILED
(
hr
))
{
skip
(
"IDirectDraw7_CreateSurface failed, hr = 0x%08x, format %s
\n
"
,
hr
,
testdata
[
i
].
name
);
continue
;
}
}
dc
=
(
void
*
)
0x1234
;
hr
=
IDirectDrawSurface7_GetDC
(
surface
,
&
dc
);
if
(
testdata
[
i
].
getdc_capable
)
{
ok
(
SUCCEEDED
(
hr
)
||
(
testdata
[
i
].
alt_result
&&
hr
==
testdata
[
i
].
alt_result
),
"GetDC on a %s surface failed(0x%08x), expected it to work
\n
"
,
testdata
[
i
].
name
,
hr
);
}
else
{
ok
(
FAILED
(
hr
),
"GetDC on a %s surface succeeded(0x%08x), expected it to fail
\n
"
,
testdata
[
i
].
name
,
hr
);
}
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirectDrawSurface7_ReleaseDC
(
surface
,
dc
);
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface7_ReleaseDC failed, hr = 0x%08x
\n
"
,
hr
);
dc
=
0
;
}
else
{
ok
(
dc
==
NULL
,
"After failed GetDC dc is %p
\n
"
,
dc
);
}
IDirectDrawSurface7_Release
(
surface
);
}
IDirectDraw7_Release
(
dd7
);
}
static
void
BackBufferCreateSurfaceTest
(
void
)
{
DDSURFACEDESC
ddsd
;
...
...
@@ -3675,7 +3436,6 @@ START_TEST(dsurface)
PaletteTest
();
SurfaceCapsTest
();
GetDCTest
();
GetDCFormatTest
();
BackBufferCreateSurfaceTest
();
BackBufferAttachmentFlipTest
();
CreateSurfaceBadCapsSizeTest
();
...
...
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