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
75935f94
Commit
75935f94
authored
Mar 05, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add a test for creating surfaces with an explicit pitch.
parent
76ab86ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
404 additions
and
0 deletions
+404
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+99
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+99
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+103
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+103
-0
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
75935f94
...
...
@@ -4552,6 +4552,104 @@ cleanup:
if
(
window2
)
DestroyWindow
(
window2
);
}
static
void
test_create_surface_pitch
(
void
)
{
IDirectDrawSurface
*
surface
;
DDSURFACEDESC
surface_desc
;
IDirectDraw
*
ddraw
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
void
*
mem
;
static
const
struct
{
DWORD
placement
;
DWORD
flags_in
;
DWORD
pitch_in
;
HRESULT
hr
;
DWORD
flags_out
;
DWORD
pitch_out
;
}
test_data
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x100
,
DDERR_INVALIDCAPS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
,
0
,
DDERR_INVALIDPARAMS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x100
,
DDERR_INVALIDPARAMS
,
0
,
0
},
};
DWORD
flags_mask
=
DDSD_PITCH
|
DDSD_LPSURFACE
;
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
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
((
64
*
4
)
+
4
)
*
64
);
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
|
test_data
[
i
].
flags_in
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
test_data
[
i
].
placement
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U1
(
surface_desc
).
lPitch
=
test_data
[
i
].
pitch_in
;
surface_desc
.
lpSurface
=
mem
;
surface_desc
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
surface_desc
.
ddpfPixelFormat
);
surface_desc
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
surface_desc
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
surface_desc
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
surface_desc
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
hr
==
test_data
[
i
].
hr
||
(
test_data
[
i
].
placement
==
DDSCAPS_VIDEOMEMORY
&&
hr
==
DDERR_NODIRECTDRAWHW
),
"Test %u: Got unexpected hr %#x, expected %#x.
\n
"
,
i
,
hr
,
test_data
[
i
].
hr
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
surface
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Test %u: Failed to get surface desc, hr %#x.
\n
"
,
i
,
hr
);
ok
((
surface_desc
.
dwFlags
&
flags_mask
)
==
test_data
[
i
].
flags_out
,
"Test %u: Got unexpected flags %#x, expected %#x.
\n
"
,
i
,
surface_desc
.
dwFlags
&
flags_mask
,
test_data
[
i
].
flags_out
);
ok
(
U1
(
surface_desc
).
lPitch
==
test_data
[
i
].
pitch_out
,
"Test %u: Got unexpected pitch %u, expected %u.
\n
"
,
i
,
U1
(
surface_desc
).
lPitch
,
test_data
[
i
].
pitch_out
);
IDirectDrawSurface_Release
(
surface
);
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
refcount
=
IDirectDraw_Release
(
ddraw
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw1
)
{
test_coop_level_create_device_window
();
...
...
@@ -4586,4 +4684,5 @@ START_TEST(ddraw1)
test_primary_palette
();
test_surface_attachment
();
test_pixel_format
();
test_create_surface_pitch
();
}
dlls/ddraw/tests/ddraw2.c
View file @
75935f94
...
...
@@ -5657,6 +5657,104 @@ cleanup:
if
(
window2
)
DestroyWindow
(
window2
);
}
static
void
test_create_surface_pitch
(
void
)
{
IDirectDrawSurface
*
surface
;
DDSURFACEDESC
surface_desc
;
IDirectDraw2
*
ddraw
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
void
*
mem
;
static
const
struct
{
DWORD
placement
;
DWORD
flags_in
;
DWORD
pitch_in
;
HRESULT
hr
;
DWORD
flags_out
;
DWORD
pitch_out
;
}
test_data
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x100
,
DDERR_INVALIDCAPS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
,
0
,
DDERR_INVALIDPARAMS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x100
,
DDERR_INVALIDPARAMS
,
0
,
0
},
};
DWORD
flags_mask
=
DDSD_PITCH
|
DDSD_LPSURFACE
;
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
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
((
64
*
4
)
+
4
)
*
64
);
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
|
test_data
[
i
].
flags_in
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
test_data
[
i
].
placement
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U1
(
surface_desc
).
lPitch
=
test_data
[
i
].
pitch_in
;
surface_desc
.
lpSurface
=
mem
;
surface_desc
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
surface_desc
.
ddpfPixelFormat
);
surface_desc
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
surface_desc
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
surface_desc
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
surface_desc
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
surface_desc
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
hr
==
test_data
[
i
].
hr
||
(
test_data
[
i
].
placement
==
DDSCAPS_VIDEOMEMORY
&&
hr
==
DDERR_NODIRECTDRAWHW
),
"Test %u: Got unexpected hr %#x, expected %#x.
\n
"
,
i
,
hr
,
test_data
[
i
].
hr
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface_GetSurfaceDesc
(
surface
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Test %u: Failed to get surface desc, hr %#x.
\n
"
,
i
,
hr
);
ok
((
surface_desc
.
dwFlags
&
flags_mask
)
==
test_data
[
i
].
flags_out
,
"Test %u: Got unexpected flags %#x, expected %#x.
\n
"
,
i
,
surface_desc
.
dwFlags
&
flags_mask
,
test_data
[
i
].
flags_out
);
ok
(
U1
(
surface_desc
).
lPitch
==
test_data
[
i
].
pitch_out
,
"Test %u: Got unexpected pitch %u, expected %u.
\n
"
,
i
,
U1
(
surface_desc
).
lPitch
,
test_data
[
i
].
pitch_out
);
IDirectDrawSurface_Release
(
surface
);
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
refcount
=
IDirectDraw2_Release
(
ddraw
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw2
)
{
test_coop_level_create_device_window
();
...
...
@@ -5697,4 +5795,5 @@ START_TEST(ddraw2)
test_primary_palette
();
test_surface_attachment
();
test_pixel_format
();
test_create_surface_pitch
();
}
dlls/ddraw/tests/ddraw4.c
View file @
75935f94
...
...
@@ -6377,6 +6377,108 @@ cleanup:
if
(
window2
)
DestroyWindow
(
window2
);
}
static
void
test_create_surface_pitch
(
void
)
{
IDirectDrawSurface4
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw4
*
ddraw
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
void
*
mem
;
static
const
struct
{
DWORD
placement
;
DWORD
flags_in
;
DWORD
pitch_in
;
HRESULT
hr
;
DWORD
flags_out
;
DWORD
pitch_out
;
}
test_data
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x100
,
DDERR_INVALIDCAPS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
,
0
,
DDERR_INVALIDPARAMS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x104
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x102
,
DDERR_INVALIDPARAMS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x0fc
,
DDERR_INVALIDPARAMS
,
0
,
0
},
};
DWORD
flags_mask
=
DDSD_PITCH
|
DDSD_LPSURFACE
;
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
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
((
64
*
4
)
+
4
)
*
64
);
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
|
test_data
[
i
].
flags_in
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
test_data
[
i
].
placement
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U1
(
surface_desc
).
lPitch
=
test_data
[
i
].
pitch_in
;
surface_desc
.
lpSurface
=
mem
;
U4
(
surface_desc
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
surface_desc
).
ddpfPixelFormat
);
U4
(
surface_desc
).
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
hr
==
test_data
[
i
].
hr
||
(
test_data
[
i
].
placement
==
DDSCAPS_VIDEOMEMORY
&&
hr
==
DDERR_NODIRECTDRAWHW
),
"Test %u: Got unexpected hr %#x, expected %#x.
\n
"
,
i
,
hr
,
test_data
[
i
].
hr
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface4_GetSurfaceDesc
(
surface
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Test %u: Failed to get surface desc, hr %#x.
\n
"
,
i
,
hr
);
ok
((
surface_desc
.
dwFlags
&
flags_mask
)
==
test_data
[
i
].
flags_out
,
"Test %u: Got unexpected flags %#x, expected %#x.
\n
"
,
i
,
surface_desc
.
dwFlags
&
flags_mask
,
test_data
[
i
].
flags_out
);
ok
(
U1
(
surface_desc
).
lPitch
==
test_data
[
i
].
pitch_out
,
"Test %u: Got unexpected pitch %u, expected %u.
\n
"
,
i
,
U1
(
surface_desc
).
lPitch
,
test_data
[
i
].
pitch_out
);
IDirectDrawSurface4_Release
(
surface
);
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
refcount
=
IDirectDraw4_Release
(
ddraw
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
...
...
@@ -6423,4 +6525,5 @@ START_TEST(ddraw4)
test_surface_attachment
();
test_private_data
();
test_pixel_format
();
test_create_surface_pitch
();
}
dlls/ddraw/tests/ddraw7.c
View file @
75935f94
...
...
@@ -6231,6 +6231,108 @@ cleanup:
if
(
window2
)
DestroyWindow
(
window2
);
}
static
void
test_create_surface_pitch
(
void
)
{
IDirectDrawSurface7
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw7
*
ddraw
;
unsigned
int
i
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
void
*
mem
;
static
const
struct
{
DWORD
placement
;
DWORD
flags_in
;
DWORD
pitch_in
;
HRESULT
hr
;
DWORD
flags_out
;
DWORD
pitch_out
;
}
test_data
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_VIDEOMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x100
,
DDERR_INVALIDCAPS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
0
,
0
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_PITCH
,
0x0fc
,
DD_OK
,
DDSD_PITCH
,
0x100
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
,
0
,
DDERR_INVALIDPARAMS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x104
,
DD_OK
,
DDSD_PITCH
,
0x104
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x102
,
DDERR_INVALIDPARAMS
,
0
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSD_LPSURFACE
|
DDSD_PITCH
,
0x0fc
,
DDERR_INVALIDPARAMS
,
0
,
0
},
};
DWORD
flags_mask
=
DDSD_PITCH
|
DDSD_LPSURFACE
;
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
);
hr
=
IDirectDraw_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
mem
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
((
64
*
4
)
+
4
)
*
64
);
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
|
test_data
[
i
].
flags_in
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
test_data
[
i
].
placement
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
U1
(
surface_desc
).
lPitch
=
test_data
[
i
].
pitch_in
;
surface_desc
.
lpSurface
=
mem
;
U4
(
surface_desc
).
ddpfPixelFormat
.
dwSize
=
sizeof
(
U4
(
surface_desc
).
ddpfPixelFormat
);
U4
(
surface_desc
).
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
U4
(
surface_desc
).
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
hr
==
test_data
[
i
].
hr
||
(
test_data
[
i
].
placement
==
DDSCAPS_VIDEOMEMORY
&&
hr
==
DDERR_NODIRECTDRAWHW
),
"Test %u: Got unexpected hr %#x, expected %#x.
\n
"
,
i
,
hr
,
test_data
[
i
].
hr
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
hr
=
IDirectDrawSurface7_GetSurfaceDesc
(
surface
,
&
surface_desc
);
ok
(
SUCCEEDED
(
hr
),
"Test %u: Failed to get surface desc, hr %#x.
\n
"
,
i
,
hr
);
ok
((
surface_desc
.
dwFlags
&
flags_mask
)
==
test_data
[
i
].
flags_out
,
"Test %u: Got unexpected flags %#x, expected %#x.
\n
"
,
i
,
surface_desc
.
dwFlags
&
flags_mask
,
test_data
[
i
].
flags_out
);
ok
(
U1
(
surface_desc
).
lPitch
==
test_data
[
i
].
pitch_out
,
"Test %u: Got unexpected pitch %u, expected %u.
\n
"
,
i
,
U1
(
surface_desc
).
lPitch
,
test_data
[
i
].
pitch_out
);
IDirectDrawSurface7_Release
(
surface
);
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
refcount
=
IDirectDraw7_Release
(
ddraw
);
ok
(
!
refcount
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -6285,4 +6387,5 @@ START_TEST(ddraw7)
test_surface_attachment
();
test_private_data
();
test_pixel_format
();
test_create_surface_pitch
();
}
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