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
acf82ff1
Commit
acf82ff1
authored
Feb 02, 2012
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Add some IDirect3DViewport interface tests.
parent
c47677fe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
272 additions
and
0 deletions
+272
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+92
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+89
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+88
-0
refcount.c
dlls/ddraw/tests/refcount.c
+3
-0
No files found.
dlls/ddraw/tests/ddraw1.c
View file @
acf82ff1
...
...
@@ -15,6 +15,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "wine/test.h"
#include "d3d.h"
...
...
@@ -815,6 +816,96 @@ static void test_coop_level_threaded(void)
destroy_window_thread
(
&
p
);
}
static
LONG
get_refcount
(
IUnknown
*
test_iface
)
{
IUnknown_AddRef
(
test_iface
);
return
IUnknown_Release
(
test_iface
);
}
static
void
test_viewport_interfaces
(
void
)
{
IDirectDraw
*
ddraw
;
IDirect3D
*
d3d
;
HRESULT
hr
;
LONG
ref
;
IDirect3DViewport
*
viewport
;
IDirect3DViewport2
*
viewport2
;
IDirect3DViewport3
*
viewport3
;
IDirectDrawGammaControl
*
gamma
;
IUnknown
*
unknown
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create ddraw object, skipping test.
\n
"
);
return
;
}
hr
=
IDirectDraw_QueryInterface
(
ddraw
,
&
IID_IDirect3D
,
(
void
**
)
&
d3d
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
E_NOINTERFACE
,
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Direct3D not available, skipping tests
\n
"
);
IDirectDraw_Release
(
ddraw
);
return
;
}
ref
=
get_refcount
((
IUnknown
*
)
d3d
);
ok
(
ref
==
2
,
"IDirect3D refcount is %d
\n
"
,
ref
);
hr
=
IDirect3D_CreateViewport
(
d3d
,
&
viewport
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create viewport, hr %#x.
\n
"
,
hr
);
ref
=
get_refcount
((
IUnknown
*
)
viewport
);
ok
(
ref
==
1
,
"Initial IDirect3DViewport refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
d3d
);
ok
(
ref
==
2
,
"IDirect3D refcount is %d
\n
"
,
ref
);
/* E_FAIL return values are returned by Winetestbot Windows NT machines. While not supporting
* newer interfaces is legitimate for old ddraw versions, E_FAIL violates Microsoft's rules
* for QueryInterface, hence the broken() */
gamma
=
(
IDirectDrawGammaControl
*
)
0xdeadbeef
;
hr
=
IDirect3DViewport_QueryInterface
(
viewport
,
&
IID_IDirectDrawGammaControl
,
(
void
**
)
&
gamma
);
ok
(
hr
==
E_NOINTERFACE
||
broken
(
hr
==
E_FAIL
),
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
gamma
==
NULL
,
"Interface not set to NULL by failed QI call: %p
\n
"
,
gamma
);
if
(
SUCCEEDED
(
hr
))
IDirectDrawGammaControl_Release
(
gamma
);
/* NULL iid: Segfaults */
hr
=
IDirect3DViewport_QueryInterface
(
viewport
,
&
IID_IDirect3DViewport2
,
(
void
**
)
&
viewport2
);
ok
(
SUCCEEDED
(
hr
)
||
broken
(
hr
==
E_FAIL
),
"Failed to QI IDirect3DViewport2, hr %#x.
\n
"
,
hr
);
if
(
viewport2
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport
);
ok
(
ref
==
2
,
"IDirect3DViewport refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
viewport2
);
ok
(
ref
==
2
,
"IDirect3DViewport2 refcount is %d
\n
"
,
ref
);
IDirect3DViewport2_Release
(
viewport2
);
viewport2
=
NULL
;
}
hr
=
IDirect3DViewport_QueryInterface
(
viewport
,
&
IID_IDirect3DViewport3
,
(
void
**
)
&
viewport3
);
ok
(
SUCCEEDED
(
hr
)
||
broken
(
hr
==
E_FAIL
),
"Failed to QI IDirect3DViewport3, hr %#x.
\n
"
,
hr
);
if
(
viewport3
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport
);
ok
(
ref
==
2
,
"IDirect3DViewport refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
viewport3
);
ok
(
ref
==
2
,
"IDirect3DViewport3 refcount is %d
\n
"
,
ref
);
IDirect3DViewport3_Release
(
viewport3
);
}
hr
=
IDirect3DViewport_QueryInterface
(
viewport
,
&
IID_IUnknown
,
(
void
**
)
&
unknown
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IUnknown, hr %#x.
\n
"
,
hr
);
if
(
unknown
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport
);
ok
(
ref
==
2
,
"IDirect3DViewport refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
(
unknown
);
ok
(
ref
==
2
,
"IUnknown refcount is %d
\n
"
,
ref
);
IUnknown_Release
(
unknown
);
}
IDirect3DViewport_Release
(
viewport
);
IDirect3D_Release
(
d3d
);
IDirectDraw_Release
(
ddraw
);
}
START_TEST
(
ddraw1
)
{
test_coop_level_create_device_window
();
...
...
@@ -822,4 +913,5 @@ START_TEST(ddraw1)
test_coop_level_d3d_state
();
test_surface_interface_mismatch
();
test_coop_level_threaded
();
test_viewport_interfaces
();
}
dlls/ddraw/tests/ddraw2.c
View file @
acf82ff1
...
...
@@ -15,6 +15,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "wine/test.h"
#include "d3d.h"
...
...
@@ -1178,6 +1179,93 @@ done:
if
(
ddraw
)
IDirectDraw2_Release
(
ddraw
);
}
static
LONG
get_refcount
(
IUnknown
*
test_iface
)
{
IUnknown_AddRef
(
test_iface
);
return
IUnknown_Release
(
test_iface
);
}
static
void
test_viewport_interfaces
(
void
)
{
IDirectDraw2
*
ddraw
;
IDirect3D2
*
d3d
;
HRESULT
hr
;
LONG
ref
,
old_d3d_ref
;
IDirect3DViewport
*
viewport
;
IDirect3DViewport2
*
viewport2
;
IDirect3DViewport3
*
viewport3
;
IDirectDrawGammaControl
*
gamma
;
IUnknown
*
unknown
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create ddraw object, skipping test.
\n
"
);
return
;
}
hr
=
IDirectDraw2_QueryInterface
(
ddraw
,
&
IID_IDirect3D2
,
(
void
**
)
&
d3d
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
E_NOINTERFACE
,
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Direct3D not available, skipping tests
\n
"
);
IDirectDraw2_Release
(
ddraw
);
return
;
}
old_d3d_ref
=
get_refcount
((
IUnknown
*
)
d3d
);
hr
=
IDirect3D2_CreateViewport
(
d3d
,
&
viewport2
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create viewport, hr %#x.
\n
"
,
hr
);
ref
=
get_refcount
((
IUnknown
*
)
viewport2
);
ok
(
ref
==
1
,
"Initial IDirect3DViewport2 refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
d3d
);
ok
(
ref
==
old_d3d_ref
,
"IDirect3D2 refcount is %d
\n
"
,
ref
);
gamma
=
(
IDirectDrawGammaControl
*
)
0xdeadbeef
;
hr
=
IDirect3DViewport2_QueryInterface
(
viewport2
,
&
IID_IDirectDrawGammaControl
,
(
void
**
)
&
gamma
);
ok
(
hr
==
E_NOINTERFACE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
gamma
==
NULL
,
"Interface not set to NULL by failed QI call: %p
\n
"
,
gamma
);
if
(
SUCCEEDED
(
hr
))
IDirectDrawGammaControl_Release
(
gamma
);
/* NULL iid: Segfaults */
hr
=
IDirect3DViewport2_QueryInterface
(
viewport2
,
&
IID_IDirect3DViewport
,
(
void
**
)
&
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IDirect3DViewport, hr %#x.
\n
"
,
hr
);
if
(
viewport
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport
);
ok
(
ref
==
2
,
"IDirect3DViewport refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
viewport2
);
ok
(
ref
==
2
,
"IDirect3DViewport2 refcount is %d
\n
"
,
ref
);
IDirect3DViewport_Release
(
viewport
);
viewport
=
NULL
;
}
hr
=
IDirect3DViewport2_QueryInterface
(
viewport2
,
&
IID_IDirect3DViewport3
,
(
void
**
)
&
viewport3
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IDirect3DViewport3, hr %#x.
\n
"
,
hr
);
if
(
viewport3
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport2
);
ok
(
ref
==
2
,
"IDirect3DViewport2 refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
viewport3
);
ok
(
ref
==
2
,
"IDirect3DViewport3 refcount is %d
\n
"
,
ref
);
IDirect3DViewport3_Release
(
viewport3
);
}
hr
=
IDirect3DViewport2_QueryInterface
(
viewport2
,
&
IID_IUnknown
,
(
void
**
)
&
unknown
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IUnknown, hr %#x.
\n
"
,
hr
);
if
(
unknown
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport2
);
ok
(
ref
==
2
,
"IDirect3DViewport2 refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
(
unknown
);
ok
(
ref
==
2
,
"IUnknown refcount is %d
\n
"
,
ref
);
IUnknown_Release
(
unknown
);
}
IDirect3DViewport2_Release
(
viewport2
);
IDirect3D2_Release
(
d3d
);
IDirectDraw2_Release
(
ddraw
);
}
START_TEST
(
ddraw2
)
{
test_coop_level_create_device_window
();
...
...
@@ -1187,4 +1275,5 @@ START_TEST(ddraw2)
test_coop_level_threaded
();
test_depth_blit
();
test_texture_load_ckey
();
test_viewport_interfaces
();
}
dlls/ddraw/tests/ddraw4.c
View file @
acf82ff1
...
...
@@ -15,6 +15,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "wine/test.h"
#include <limits.h>
...
...
@@ -1309,6 +1310,92 @@ static void test_texture_load_ckey(void)
IDirectDraw4_Release
(
ddraw
);
}
static
LONG
get_refcount
(
IUnknown
*
test_iface
)
{
IUnknown_AddRef
(
test_iface
);
return
IUnknown_Release
(
test_iface
);
}
static
void
test_viewport_interfaces
(
void
)
{
IDirectDraw4
*
ddraw
;
IDirect3D3
*
d3d
;
HRESULT
hr
,
old_d3d_ref
;
LONG
ref
;
IDirect3DViewport
*
viewport
;
IDirect3DViewport2
*
viewport2
;
IDirect3DViewport3
*
viewport3
;
IDirectDrawGammaControl
*
gamma
;
IUnknown
*
unknown
;
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create ddraw object, skipping test.
\n
"
);
return
;
}
hr
=
IDirectDraw4_QueryInterface
(
ddraw
,
&
IID_IDirect3D3
,
(
void
**
)
&
d3d
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
E_NOINTERFACE
,
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Direct3D not available, skipping tests
\n
"
);
IDirectDraw4_Release
(
ddraw
);
return
;
}
old_d3d_ref
=
get_refcount
((
IUnknown
*
)
d3d
);
hr
=
IDirect3D3_CreateViewport
(
d3d
,
&
viewport3
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create viewport, hr %#x.
\n
"
,
hr
);
ref
=
get_refcount
((
IUnknown
*
)
viewport3
);
ok
(
ref
==
1
,
"Initial IDirect3DViewport3 refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
d3d
);
ok
(
ref
==
old_d3d_ref
,
"IDirect3D3 refcount is %d
\n
"
,
ref
);
gamma
=
(
IDirectDrawGammaControl
*
)
0xdeadbeef
;
hr
=
IDirect3DViewport2_QueryInterface
(
viewport3
,
&
IID_IDirectDrawGammaControl
,
(
void
**
)
&
gamma
);
ok
(
hr
==
E_NOINTERFACE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
gamma
==
NULL
,
"Interface not set to NULL by failed QI call: %p
\n
"
,
gamma
);
if
(
SUCCEEDED
(
hr
))
IDirectDrawGammaControl_Release
(
gamma
);
/* NULL iid: Segfaults */
hr
=
IDirect3DViewport3_QueryInterface
(
viewport3
,
&
IID_IDirect3DViewport
,
(
void
**
)
&
viewport
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IDirect3DViewport, hr %#x.
\n
"
,
hr
);
if
(
viewport
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport
);
ok
(
ref
==
2
,
"IDirect3DViewport refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
viewport3
);
ok
(
ref
==
2
,
"IDirect3DViewport3 refcount is %d
\n
"
,
ref
);
IDirect3DViewport_Release
(
viewport
);
viewport
=
NULL
;
}
hr
=
IDirect3DViewport3_QueryInterface
(
viewport3
,
&
IID_IDirect3DViewport3
,
(
void
**
)
&
viewport2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IDirect3DViewport3, hr %#x.
\n
"
,
hr
);
if
(
viewport2
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport2
);
ok
(
ref
==
2
,
"IDirect3DViewport2 refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
((
IUnknown
*
)
viewport3
);
ok
(
ref
==
2
,
"IDirect3DViewport3 refcount is %d
\n
"
,
ref
);
IDirect3DViewport3_Release
(
viewport2
);
}
hr
=
IDirect3DViewport3_QueryInterface
(
viewport2
,
&
IID_IUnknown
,
(
void
**
)
&
unknown
);
ok
(
SUCCEEDED
(
hr
),
"Failed to QI IUnknown, hr %#x.
\n
"
,
hr
);
if
(
unknown
)
{
ref
=
get_refcount
((
IUnknown
*
)
viewport3
);
ok
(
ref
==
2
,
"IDirect3DViewport3 refcount is %d
\n
"
,
ref
);
ref
=
get_refcount
(
unknown
);
ok
(
ref
==
2
,
"IUnknown refcount is %d
\n
"
,
ref
);
IUnknown_Release
(
unknown
);
}
IDirect3DViewport3_Release
(
viewport3
);
IDirect3D3_Release
(
d3d
);
IDirectDraw4_Release
(
ddraw
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
...
...
@@ -1319,4 +1406,5 @@ START_TEST(ddraw4)
test_coop_level_threaded
();
test_depth_blit
();
test_texture_load_ckey
();
test_viewport_interfaces
();
}
dlls/ddraw/tests/refcount.c
View file @
acf82ff1
...
...
@@ -356,6 +356,9 @@ static void test_d3d_ifaces(void)
ref
=
getRefcount
(
(
IUnknown
*
)
DDraw1
);
ok
(
ref
==
1
,
"IDirectDraw reference count is %ld
\n
"
,
ref
);
/* FIXME: This test suggests that IDirect3D, IDirect3D2 and IDirect3D3 are linked
* to IDirectDraw. However, they are linked to whatever interface is used to QI the
* first IDirect3D? interface. If DDraw1 is replaced with DDraw4 here the tests break */
hr
=
IDirectDraw_QueryInterface
(
DDraw1
,
&
IID_IDirect3D
,
(
void
**
)
&
D3D1
);
if
(
hr
==
E_NOINTERFACE
)
/* win64 */
{
...
...
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