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
5c05b141
Commit
5c05b141
authored
Aug 03, 2010
by
Oldřich Jedlička
Committed by
Alexandre Julliard
Aug 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: New attachment/flipping tests for back buffers.
parent
109cb9fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
0 deletions
+118
-0
dsurface.c
dlls/ddraw/tests/dsurface.c
+118
-0
No files found.
dlls/ddraw/tests/dsurface.c
View file @
5c05b141
...
...
@@ -3452,6 +3452,123 @@ static void BackBufferCreateSurfaceTest(void)
IDirectDraw7_Release
(
dd7
);
}
static
void
BackBufferAttachmentFlipTest
(
void
)
{
HRESULT
hr
;
IDirectDrawSurface
*
surface1
,
*
surface2
,
*
surface3
,
*
surface4
;
DDSURFACEDESC
ddsd
;
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
/* Perform attachment tests on a back-buffer */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_BACKBUFFER
;
ddsd
.
dwWidth
=
GetSystemMetrics
(
SM_CXSCREEN
);
ddsd
.
dwHeight
=
GetSystemMetrics
(
SM_CYSCREEN
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
surface2
,
NULL
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"CreateSurface returned: %x
\n
"
,
hr
);
if
(
surface2
!=
NULL
)
{
/* Try a single primary and a two back buffers */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_PRIMARYSURFACE
;
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
surface1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned: %x
\n
"
,
hr
);
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_BACKBUFFER
;
ddsd
.
dwWidth
=
GetSystemMetrics
(
SM_CXSCREEN
);
ddsd
.
dwHeight
=
GetSystemMetrics
(
SM_CYSCREEN
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
surface3
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned: %x
\n
"
,
hr
);
/* This one has a different size */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_BACKBUFFER
;
ddsd
.
dwWidth
=
128
;
ddsd
.
dwHeight
=
128
;
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd
,
&
surface4
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned: %x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface1
,
surface2
);
todo_wine
ok
(
hr
==
DD_OK
||
broken
(
hr
==
DDERR_CANNOTATTACHSURFACE
),
"Attaching a back buffer to a front buffer returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* Try flipping the surfaces */
hr
=
IDirectDrawSurface_Flip
(
surface1
,
NULL
,
DDFLIP_WAIT
);
todo_wine
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Flip
(
surface2
,
NULL
,
DDFLIP_WAIT
);
todo_wine
ok
(
hr
==
DDERR_NOTFLIPPABLE
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
/* Try the reverse without detaching first */
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface2
,
surface1
);
ok
(
hr
==
DDERR_SURFACEALREADYATTACHED
,
"Attaching an attached surface to its attachee returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface failed with %08x
\n
"
,
hr
);
}
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface2
,
surface1
);
todo_wine
ok
(
hr
==
DD_OK
||
broken
(
hr
==
DDERR_CANNOTATTACHSURFACE
),
"Attaching a front buffer to a back buffer returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* Try flipping the surfaces */
hr
=
IDirectDrawSurface_Flip
(
surface1
,
NULL
,
DDFLIP_WAIT
);
todo_wine
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Flip
(
surface2
,
NULL
,
DDFLIP_WAIT
);
todo_wine
ok
(
hr
==
DDERR_NOTFLIPPABLE
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
/* Try to detach reversed */
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface1
,
0
,
surface2
);
ok
(
hr
==
DDERR_CANNOTDETACHSURFACE
,
"DeleteAttachedSurface returned %08x
\n
"
,
hr
);
/* Now the proper detach */
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface2
,
0
,
surface1
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface failed with %08x
\n
"
,
hr
);
}
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface2
,
surface3
);
todo_wine
ok
(
hr
==
DD_OK
||
broken
(
hr
==
DDERR_CANNOTATTACHSURFACE
),
"Attaching a back buffer to another back buffer returned %08x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
{
/* Try flipping the surfaces */
hr
=
IDirectDrawSurface_Flip
(
surface3
,
NULL
,
DDFLIP_WAIT
);
todo_wine
ok
(
hr
==
DD_OK
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Flip
(
surface2
,
NULL
,
DDFLIP_WAIT
);
todo_wine
ok
(
hr
==
DDERR_NOTFLIPPABLE
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Flip
(
surface1
,
NULL
,
DDFLIP_WAIT
);
ok
(
hr
==
DDERR_NOTFLIPPABLE
,
"IDirectDrawSurface_Flip returned 0x%08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_DeleteAttachedSurface
(
surface2
,
0
,
surface3
);
ok
(
hr
==
DD_OK
,
"DeleteAttachedSurface failed with %08x
\n
"
,
hr
);
}
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface1
,
surface4
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Attaching a back buffer to a front buffer of different size returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface_AddAttachedSurface
(
surface4
,
surface1
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Attaching a front buffer to a back buffer of different size returned %08x
\n
"
,
hr
);
IDirectDrawSurface_Release
(
surface4
);
IDirectDrawSurface_Release
(
surface3
);
IDirectDrawSurface_Release
(
surface2
);
IDirectDrawSurface_Release
(
surface1
);
}
hr
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
DestroyWindow
(
window
);
}
START_TEST
(
dsurface
)
{
HRESULT
ret
;
...
...
@@ -3506,5 +3623,6 @@ START_TEST(dsurface)
GetDCTest
();
GetDCFormatTest
();
BackBufferCreateSurfaceTest
();
BackBufferAttachmentFlipTest
();
ReleaseDirectDraw
();
}
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