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
7983d997
Commit
7983d997
authored
Apr 07, 2014
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxgi/tests: Add private data tests.
parent
24187d53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
143 additions
and
0 deletions
+143
-0
device.c
dlls/dxgi/tests/device.c
+143
-0
No files found.
dlls/dxgi/tests/device.c
View file @
7983d997
...
...
@@ -23,6 +23,12 @@
static
HRESULT
(
WINAPI
*
pCreateDXGIFactory1
)(
REFIID
iid
,
void
**
factory
);
static
ULONG
get_refcount
(
IUnknown
*
iface
)
{
IUnknown_AddRef
(
iface
);
return
IUnknown_Release
(
iface
);
}
static
IDXGIDevice
*
create_device
(
void
)
{
IDXGIDevice
*
dxgi_device
;
...
...
@@ -578,6 +584,142 @@ static void test_create_factory(void)
IUnknown_Release
(
iface
);
}
static
void
test_private_data
(
void
)
{
ULONG
refcount
,
expected_refcount
;
IDXGIDevice
*
device
;
HRESULT
hr
;
IDXGIDevice
*
test_object
;
IUnknown
*
ptr
;
static
const
DWORD
data
[]
=
{
1
,
2
,
3
,
4
};
UINT
size
;
static
const
GUID
dxgi_private_data_test_guid
=
{
0xfdb37466
,
0x428f
,
0x4edf
,
{
0xa3
,
0x7f
,
0x9b
,
0x1d
,
0xf4
,
0x88
,
0xc5
,
0xfc
}
};
static
const
GUID
dxgi_private_data_test_guid2
=
{
0x2e5afac2
,
0x87b5
,
0x4c10
,
{
0x9b
,
0x4b
,
0x89
,
0xd7
,
0xd1
,
0x12
,
0xe7
,
0x2b
}
};
if
(
!
(
device
=
create_device
()))
{
skip
(
"Failed to create device, skipping tests.
\n
"
);
return
;
}
test_object
=
create_device
();
/* SetPrivateData with a pointer of NULL has the purpose of FreePrivateData in previous
* d3d versions. A successful clear returns S_OK. A redundant clear S_FALSE. Setting a
* NULL interface is not considered a clear but as setting an interface pointer that
* happens to be NULL. */
hr
=
IDXGIDevice_SetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
0
,
NULL
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDXGIDevice_SetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
~
0U
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDXGIDevice_SetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
~
0U
,
NULL
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
size
=
sizeof
(
ptr
)
*
2
;
ptr
=
(
IUnknown
*
)
0xdeadbeef
;
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
&
size
,
&
ptr
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
!
ptr
,
"Got unexpected pointer %p.
\n
"
,
ptr
);
todo_wine
ok
(
size
==
sizeof
(
IUnknown
*
),
"Got unexpected size %u.
\n
"
,
size
);
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
(
IUnknown
*
)
test_object
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
expected_refcount
=
refcount
+
1
;
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
todo_wine
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
(
IUnknown
*
)
test_object
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
todo_wine
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
expected_refcount
--
;
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
(
IUnknown
*
)
test_object
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
size
=
sizeof
(
data
);
hr
=
IDXGIDevice_SetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
size
,
data
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
hr
=
IDXGIDevice_SetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
42
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDXGIDevice_SetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
42
,
NULL
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDXGIDevice_SetPrivateDataInterface
(
device
,
&
dxgi_private_data_test_guid
,
(
IUnknown
*
)
test_object
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
expected_refcount
++
;
size
=
2
*
sizeof
(
ptr
);
ptr
=
NULL
;
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
&
size
,
&
ptr
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
==
sizeof
(
test_object
),
"Got unexpected size %u.
\n
"
,
size
);
expected_refcount
++
;
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
todo_wine
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
if
(
ptr
)
IUnknown_Release
(
ptr
);
expected_refcount
--
;
ptr
=
(
IUnknown
*
)
0xdeadbeef
;
size
=
1
;
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
&
size
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
==
sizeof
(
device
),
"Got unexpected size %u.
\n
"
,
size
);
size
=
2
*
sizeof
(
ptr
);
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
&
size
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
==
sizeof
(
device
),
"Got unexpected size %u.
\n
"
,
size
);
refcount
=
get_refcount
((
IUnknown
*
)
test_object
);
todo_wine
ok
(
refcount
==
expected_refcount
,
"Got unexpected refcount %u, expected %u.
\n
"
,
refcount
,
expected_refcount
);
size
=
1
;
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
&
size
,
&
ptr
);
todo_wine
ok
(
hr
==
DXGI_ERROR_MORE_DATA
,
"Got unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
==
sizeof
(
device
),
"Got unexpected size %u.
\n
"
,
size
);
ok
(
ptr
==
(
IUnknown
*
)
0xdeadbeef
,
"Got unexpected pointer %p.
\n
"
,
ptr
);
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid2
,
NULL
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#x.
\n
"
,
hr
);
size
=
0xdeadbabe
;
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid2
,
&
size
,
&
ptr
);
todo_wine
ok
(
hr
==
DXGI_ERROR_NOT_FOUND
,
"Got unexpected hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
size
==
0
,
"Got unexpected size %u.
\n
"
,
size
);
ok
(
ptr
==
(
IUnknown
*
)
0xdeadbeef
,
"Got unexpected pointer %p.
\n
"
,
ptr
);
hr
=
IDXGIDevice_GetPrivateData
(
device
,
&
dxgi_private_data_test_guid
,
NULL
,
&
ptr
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
ptr
==
(
IUnknown
*
)
0xdeadbeef
,
"Got unexpected pointer %p.
\n
"
,
ptr
);
refcount
=
IDXGIDevice_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
refcount
=
IDXGIDevice_Release
(
test_object
);
ok
(
!
refcount
,
"Test object has %u references left.
\n
"
,
refcount
);
}
START_TEST
(
device
)
{
pCreateDXGIFactory1
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"dxgi.dll"
),
"CreateDXGIFactory1"
);
...
...
@@ -589,4 +731,5 @@ START_TEST(device)
test_output
();
test_createswapchain
();
test_create_factory
();
test_private_data
();
}
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