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
e28a5fa3
Commit
e28a5fa3
authored
Feb 10, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Rewrite GetDCTest().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
04586f63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
124 deletions
+154
-124
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+77
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+77
-0
dsurface.c
dlls/ddraw/tests/dsurface.c
+0
-124
No files found.
dlls/ddraw/tests/ddraw4.c
View file @
e28a5fa3
...
...
@@ -12772,6 +12772,82 @@ static void test_surface_desc_size(void)
ok
(
!
refcount
,
"DirectDraw has %u references left.
\n
"
,
refcount
);
}
static
void
test_get_surface_from_dc
(
void
)
{
IDirectDrawSurface
*
surface1
,
*
tmp
;
IDirectDrawSurface4
*
surface
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw4
*
ddraw
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
HDC
dc
;
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
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_QueryInterface
(
surface
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
surface1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to query IDirectDrawSurface interface, hr %#x.
\n
"
,
hr
);
refcount
=
get_refcount
((
IUnknown
*
)
surface1
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
surface
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
hr
=
IDirectDrawSurface4_GetDC
(
surface
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get DC, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDraw4_GetSurfaceFromDC
(
ddraw
,
dc
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDraw4_GetSurfaceFromDC
(
ddraw
,
dc
,
(
IDirectDrawSurface4
**
)
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
tmp
==
surface1
,
"Got unexpected surface %p, expected %p.
\n
"
,
tmp
,
surface1
);
refcount
=
get_refcount
((
IUnknown
*
)
surface1
);
ok
(
refcount
==
2
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
surface
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
hr
=
IDirectDrawSurface4_ReleaseDC
(
surface
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"ReleaseDC failed, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
tmp
);
dc
=
CreateCompatibleDC
(
NULL
);
ok
(
!!
dc
,
"CreateCompatibleDC failed.
\n
"
);
tmp
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectDraw4_GetSurfaceFromDC
(
ddraw
,
dc
,
(
IDirectDrawSurface4
**
)
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
tmp
,
"Got unexpected surface %p.
\n
"
,
tmp
);
ok
(
DeleteDC
(
dc
),
"DeleteDC failed.
\n
"
);
tmp
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectDraw4_GetSurfaceFromDC
(
ddraw
,
NULL
,
(
IDirectDrawSurface4
**
)
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
tmp
,
"Got unexpected surface %p.
\n
"
,
tmp
);
IDirectDrawSurface4_Release
(
surface
);
IDirectDrawSurface_Release
(
surface1
);
IDirectDraw4_Release
(
ddraw
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw4
)
{
IDirectDraw4
*
ddraw
;
...
...
@@ -12874,4 +12950,5 @@ START_TEST(ddraw4)
test_transform_vertices
();
test_display_mode_surface_pixel_format
();
test_surface_desc_size
();
test_get_surface_from_dc
();
}
dlls/ddraw/tests/ddraw7.c
View file @
e28a5fa3
...
...
@@ -12445,6 +12445,82 @@ static void test_surface_desc_size(void)
ok
(
!
refcount
,
"DirectDraw has %u references left.
\n
"
,
refcount
);
}
static
void
test_get_surface_from_dc
(
void
)
{
IDirectDrawSurface7
*
surface
,
*
tmp
;
IDirectDrawSurface
*
surface1
;
DDSURFACEDESC2
surface_desc
;
IDirectDraw7
*
ddraw
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
HDC
dc
;
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
);
memset
(
&
surface_desc
,
0
,
sizeof
(
surface_desc
));
surface_desc
.
dwSize
=
sizeof
(
surface_desc
);
surface_desc
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
surface_desc
.
dwWidth
=
64
;
surface_desc
.
dwHeight
=
64
;
surface_desc
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
surface_desc
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_QueryInterface
(
surface
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
surface1
);
ok
(
SUCCEEDED
(
hr
),
"Failed to query IDirectDrawSurface interface, hr %#x.
\n
"
,
hr
);
refcount
=
get_refcount
((
IUnknown
*
)
surface1
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
surface
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
hr
=
IDirectDrawSurface7_GetDC
(
surface
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get DC, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDraw7_GetSurfaceFromDC
(
ddraw
,
dc
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDraw7_GetSurfaceFromDC
(
ddraw
,
dc
,
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
tmp
==
surface
,
"Got unexpected surface %p, expected %p.
\n
"
,
tmp
,
surface
);
refcount
=
get_refcount
((
IUnknown
*
)
surface1
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
surface
);
ok
(
refcount
==
2
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
hr
=
IDirectDrawSurface7_ReleaseDC
(
surface
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"ReleaseDC failed, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
tmp
);
dc
=
CreateCompatibleDC
(
NULL
);
ok
(
!!
dc
,
"CreateCompatibleDC failed.
\n
"
);
tmp
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectDraw7_GetSurfaceFromDC
(
ddraw
,
dc
,
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
tmp
,
"Got unexpected surface %p.
\n
"
,
tmp
);
ok
(
DeleteDC
(
dc
),
"DeleteDC failed.
\n
"
);
tmp
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectDraw7_GetSurfaceFromDC
(
ddraw
,
NULL
,
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
tmp
,
"Got unexpected surface %p.
\n
"
,
tmp
);
IDirectDrawSurface7_Release
(
surface
);
IDirectDrawSurface_Release
(
surface1
);
IDirectDraw7_Release
(
ddraw
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -12557,4 +12633,5 @@ START_TEST(ddraw7)
test_edge_antialiasing_blending
();
test_display_mode_surface_pixel_format
();
test_surface_desc_size
();
test_get_surface_from_dc
();
}
dlls/ddraw/tests/dsurface.c
View file @
e28a5fa3
...
...
@@ -2163,129 +2163,6 @@ static BOOL can_create_primary_surface(void)
return
TRUE
;
}
static
void
GetDCTest
(
void
)
{
DDSURFACEDESC
ddsd
;
DDSURFACEDESC2
ddsd2
;
IDirectDrawSurface
*
surf
;
IDirectDrawSurface4
*
surf4
;
IDirectDrawSurface7
*
surf7
;
IDirectDrawSurface
*
tmp
;
IDirectDrawSurface7
*
tmp7
;
HRESULT
hr
;
IDirectDraw4
*
dd4
;
IDirectDraw7
*
dd7
;
HDC
dc
;
ULONG
ref
;
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
dwWidth
=
64
;
ddsd
.
dwHeight
=
64
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
memset
(
&
ddsd2
,
0
,
sizeof
(
ddsd2
));
ddsd2
.
dwSize
=
sizeof
(
ddsd2
);
ddsd2
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd2
.
dwWidth
=
64
;
ddsd2
.
dwHeight
=
64
;
ddsd2
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
;
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw4
,
(
void
**
)
&
dd4
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface failed: 0x%08x
\n
"
,
hr
);
surf
=
NULL
;
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
&
ddsd2
,
&
surf4
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw4_CreateSurface failed: 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_QueryInterface
(
surf4
,
&
IID_IDirectDrawSurface
,
(
void
**
)
&
surf
);
ok
(
SUCCEEDED
(
hr
),
"QueryInterface failed, hr %#x.
\n
"
,
hr
);
ref
=
getRefcount
((
IUnknown
*
)
surf
);
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
ref
=
getRefcount
((
IUnknown
*
)
surf4
);
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
hr
=
IDirectDrawSurface4_GetDC
(
surf4
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"GetDC failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDraw4_GetSurfaceFromDC
(
dd4
,
dc
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Expected hr E_INVALIDARG, got %#x.
\n
"
,
hr
);
hr
=
IDirectDraw4_GetSurfaceFromDC
(
dd4
,
dc
,
(
IDirectDrawSurface4
**
)
&
tmp
);
ok
(
SUCCEEDED
(
hr
),
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
tmp
==
surf
,
"Expected surface %p, got %p.
\n\n
"
,
surf
,
tmp
);
ref
=
getRefcount
((
IUnknown
*
)
surf
);
ok
(
ref
==
2
,
"Refcount is %u, expected 2
\n
"
,
ref
);
ref
=
getRefcount
((
IUnknown
*
)
tmp
);
ok
(
ref
==
2
,
"Refcount is %u, expected 2
\n
"
,
ref
);
ref
=
getRefcount
((
IUnknown
*
)
surf4
);
ok
(
ref
==
1
,
"Refcount is %u, expected 1
\n
"
,
ref
);
hr
=
IDirectDrawSurface4_ReleaseDC
(
surf4
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"ReleaseDC failed, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
tmp
);
dc
=
CreateCompatibleDC
(
NULL
);
ok
(
!!
dc
,
"CreateCompatibleDC failed.
\n
"
);
tmp
=
(
IDirectDrawSurface
*
)
0xdeadbeef
;
hr
=
IDirectDraw4_GetSurfaceFromDC
(
dd4
,
dc
,
(
IDirectDrawSurface4
**
)
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
!
tmp
,
"Expected surface NULL, got %p.
\n
"
,
tmp
);
ok
(
DeleteDC
(
dc
),
"DeleteDC failed.
\n
"
);
tmp
=
(
IDirectDrawSurface
*
)
0xdeadbeef
;
hr
=
IDirectDraw4_GetSurfaceFromDC
(
dd4
,
NULL
,
(
IDirectDrawSurface4
**
)
&
tmp
);
ok
(
hr
==
DDERR_NOTFOUND
,
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
!
tmp
,
"Expected surface NULL, got %p.
\n
"
,
tmp
);
IDirectDrawSurface4_Release
(
surf4
);
IDirectDrawSurface_Release
(
surf
);
IDirectDraw4_Release
(
dd4
);
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw7
,
(
void
**
)
&
dd7
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface failed: 0x%08x
\n
"
,
hr
);
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2
,
&
surf7
,
NULL
);
ok
(
hr
==
DD_OK
,
"IDirectDraw7_CreateSurface failed: 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_GetDC
(
surf7
,
&
dc
);
ok
(
SUCCEEDED
(
hr
),
"GetDC failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDraw7_GetSurfaceFromDC
(
dd7
,
dc
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Expected hr E_INVALIDARG, got %#x.
\n
"
,
hr
);
hr
=
IDirectDraw7_GetSurfaceFromDC
(
dd7
,
dc
,
&
tmp7
);
ok
(
SUCCEEDED
(
hr
),
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
tmp7
==
surf7
,
"Expected surface %p, got %p.
\n\n
"
,
surf7
,
tmp7
);
IDirectDrawSurface7_Release
(
tmp7
);
hr
=
IDirectDrawSurface7_ReleaseDC
(
surf7
,
dc
);
ok
(
SUCCEEDED
(
hr
),
"ReleaseDC failed, hr %#x.
\n
"
,
hr
);
dc
=
CreateCompatibleDC
(
NULL
);
ok
(
!!
dc
,
"CreateCompatibleDC failed.
\n
"
);
tmp7
=
(
IDirectDrawSurface7
*
)
0xdeadbeef
;
hr
=
IDirectDraw7_GetSurfaceFromDC
(
dd7
,
dc
,
&
tmp7
);
ok
(
hr
==
DDERR_NOTFOUND
,
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
!
tmp7
,
"Expected surface NULL, got %p.
\n
"
,
tmp7
);
ok
(
DeleteDC
(
dc
),
"DeleteDC failed.
\n
"
);
tmp7
=
(
IDirectDrawSurface7
*
)
0xdeadbeef
;
hr
=
IDirectDraw7_GetSurfaceFromDC
(
dd7
,
NULL
,
(
IDirectDrawSurface7
**
)
&
tmp7
);
ok
(
hr
==
DDERR_NOTFOUND
,
"GetSurfaceFromDC failed, hr %#x.
\n
"
,
hr
);
ok
(
!
tmp7
,
"Expected surface NULL, got %p.
\n
"
,
tmp7
);
IDirectDrawSurface7_Release
(
surf7
);
IDirectDraw7_Release
(
dd7
);
}
static
void
BackBufferCreateSurfaceTest
(
void
)
{
DDSURFACEDESC
ddsd
;
...
...
@@ -3277,7 +3154,6 @@ START_TEST(dsurface)
BltParamTest
();
PaletteTest
();
SurfaceCapsTest
();
GetDCTest
();
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