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
5a656dea
Commit
5a656dea
authored
Dec 11, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Test user memory and getdc interaction.
Some Windows Media Player 9 visualization plugins used ddraw in this way to get a dc for their custom memory allocations.
parent
9b67b1b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
188 additions
and
0 deletions
+188
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+66
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+61
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+61
-0
No files found.
dlls/ddraw/tests/ddraw2.c
View file @
5a656dea
...
...
@@ -4862,6 +4862,71 @@ done:
DestroyWindow
(
window
);
}
static
void
test_user_memory_getdc
(
void
)
{
IDirectDraw2
*
ddraw
;
HWND
window
;
HRESULT
hr
;
DDSURFACEDESC
ddsd
;
IDirectDrawSurface
*
surface
;
IDirectDrawSurface3
*
surface3
;
DWORD
data
[
16
][
16
];
ULONG
ref
;
HDC
dc
;
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
=
IDirectDraw2_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
16
;
ddsd
.
dwHeight
=
16
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_SYSTEMMEMORY
;
hr
=
IDirectDraw2_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirectDrawSurface3
,
(
void
**
)
&
surface3
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get IDirectDrawSurface3 interface, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
surface
);
memset
(
data
,
0xaa
,
sizeof
(
data
));
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface3_SetSurfaceDesc
(
surface3
,
&
ddsd
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set surface desc, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface3_GetDC
(
surface3
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get DC, hr %#x.
\n
"
,
hr
);
BitBlt
(
dc
,
0
,
0
,
16
,
8
,
NULL
,
0
,
0
,
WHITENESS
);
BitBlt
(
dc
,
0
,
8
,
16
,
8
,
NULL
,
0
,
0
,
BLACKNESS
);
hr
=
IDirectDrawSurface3_ReleaseDC
(
surface3
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to release DC, hr %#x.
\n
"
,
hr
);
ok
(
data
[
0
][
0
]
==
0xffffffff
,
"Expected color 0xffffffff, got %#x.
\n
"
,
data
[
0
][
0
]);
ok
(
data
[
15
][
15
]
==
0x00000000
,
"Expected color 0x00000000, got %#x.
\n
"
,
data
[
15
][
15
]);
IDirectDrawSurface3_Release
(
surface3
);
ref
=
IDirectDraw2_Release
(
ddraw
);
ok
(
ref
==
0
,
"Ddraw object not properly released, refcount %u.
\n
"
,
ref
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw2
)
{
test_coop_level_create_device_window
();
...
...
@@ -4896,4 +4961,5 @@ START_TEST(ddraw2)
test_surface_discard
();
test_flip
();
test_set_surface_desc
();
test_user_memory_getdc
();
}
dlls/ddraw/tests/ddraw4.c
View file @
5a656dea
...
...
@@ -5464,6 +5464,66 @@ done:
DestroyWindow
(
window
);
}
static
void
test_user_memory_getdc
(
void
)
{
IDirectDraw4
*
ddraw
;
HWND
window
;
HRESULT
hr
;
DDSURFACEDESC2
ddsd
;
IDirectDrawSurface4
*
surface
;
DWORD
data
[
16
][
16
];
ULONG
ref
;
HDC
dc
;
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
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
16
;
ddsd
.
dwHeight
=
16
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_SYSTEMMEMORY
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
memset
(
data
,
0xaa
,
sizeof
(
data
));
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface4_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set surface desc, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_GetDC
(
surface
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get DC, hr %#x.
\n
"
,
hr
);
BitBlt
(
dc
,
0
,
0
,
16
,
8
,
NULL
,
0
,
0
,
WHITENESS
);
BitBlt
(
dc
,
0
,
8
,
16
,
8
,
NULL
,
0
,
0
,
BLACKNESS
);
hr
=
IDirectDrawSurface4_ReleaseDC
(
surface
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to release DC, hr %#x.
\n
"
,
hr
);
ok
(
data
[
0
][
0
]
==
0xffffffff
,
"Expected color 0xffffffff, got %#x.
\n
"
,
data
[
0
][
0
]);
ok
(
data
[
15
][
15
]
==
0x00000000
,
"Expected color 0x00000000, got %#x.
\n
"
,
data
[
15
][
15
]);
IDirectDrawSurface4_Release
(
surface
);
ref
=
IDirectDraw4_Release
(
ddraw
);
ok
(
ref
==
0
,
"Ddraw object not properly released, refcount %u.
\n
"
,
ref
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
...
...
@@ -5503,4 +5563,5 @@ START_TEST(ddraw4)
test_surface_discard
();
test_flip
();
test_set_surface_desc
();
test_user_memory_getdc
();
}
dlls/ddraw/tests/ddraw7.c
View file @
5a656dea
...
...
@@ -5352,6 +5352,66 @@ done:
DestroyWindow
(
window
);
}
static
void
test_user_memory_getdc
(
void
)
{
IDirectDraw7
*
ddraw
;
HWND
window
;
HRESULT
hr
;
DDSURFACEDESC2
ddsd
;
IDirectDrawSurface7
*
surface
;
DWORD
data
[
16
][
16
];
ULONG
ref
;
HDC
dc
;
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
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
window
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
16
;
ddsd
.
dwHeight
=
16
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_SYSTEMMEMORY
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
memset
(
data
,
0xaa
,
sizeof
(
data
));
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface7_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set surface desc, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_GetDC
(
surface
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get DC, hr %#x.
\n
"
,
hr
);
BitBlt
(
dc
,
0
,
0
,
16
,
8
,
NULL
,
0
,
0
,
WHITENESS
);
BitBlt
(
dc
,
0
,
8
,
16
,
8
,
NULL
,
0
,
0
,
BLACKNESS
);
hr
=
IDirectDrawSurface7_ReleaseDC
(
surface
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to release DC, hr %#x.
\n
"
,
hr
);
ok
(
data
[
0
][
0
]
==
0xffffffff
,
"Expected color 0xffffffff, got %#x.
\n
"
,
data
[
0
][
0
]);
ok
(
data
[
15
][
15
]
==
0x00000000
,
"Expected color 0x00000000, got %#x.
\n
"
,
data
[
15
][
15
]);
IDirectDrawSurface7_Release
(
surface
);
ref
=
IDirectDraw7_Release
(
ddraw
);
ok
(
ref
==
0
,
"Ddraw object not properly released, refcount %u.
\n
"
,
ref
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -5399,4 +5459,5 @@ START_TEST(ddraw7)
test_surface_discard
();
test_flip
();
test_set_surface_desc
();
test_user_memory_getdc
();
}
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