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
cbb7fd52
Commit
cbb7fd52
authored
Mar 12, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Mar 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/tests: Clean up test_query_interface().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fd2412fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
86 deletions
+106
-86
dsoundrender.c
dlls/quartz/tests/dsoundrender.c
+106
-86
No files found.
dlls/quartz/tests/dsoundrender.c
View file @
cbb7fd52
...
...
@@ -26,104 +26,122 @@
#include "amaudio.h"
#include "wine/test.h"
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
ok(ppv != NULL, "Pointer is NULL\n")
;
#define RELEASE_EXPECT(iface, num) if (iface) { \
hr = IUnknown_Release((IUnknown*)iface); \
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
static
IBaseFilter
*
create_dsound_render
(
void
)
{
IBaseFilter
*
filter
=
NULL
;
HRESULT
hr
=
CoCreateInstance
(
&
CLSID_DSoundRender
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IBaseFilter
,
(
void
**
)
&
filter
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
return
filter
;
}
static
IUnknown
*
pDSRender
=
NULL
;
static
HRESULT
WINAPI
property_bag_QueryInterface
(
IPropertyBag
*
iface
,
REFIID
iid
,
void
**
out
)
{
ok
(
0
,
"Unexpected call (iid %s).
\n
"
,
wine_dbgstr_guid
(
iid
));
return
E_NOINTERFACE
;
}
static
BOOL
create_dsound_renderer
(
void
)
static
ULONG
WINAPI
property_bag_AddRef
(
IPropertyBag
*
iface
)
{
HRESULT
hr
;
ok
(
0
,
"Unexpected call.
\n
"
);
return
2
;
}
hr
=
CoCreateInstance
(
&
CLSID_DSoundRender
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
pDSRender
);
return
(
hr
==
S_OK
&&
pDSRender
!=
NULL
);
static
ULONG
WINAPI
property_bag_Release
(
IPropertyBag
*
iface
)
{
ok
(
0
,
"Unexpected call.
\n
"
);
return
1
;
}
static
void
release_dsound_renderer
(
void
)
static
HRESULT
WINAPI
property_bag_Read
(
IPropertyBag
*
iface
,
const
WCHAR
*
name
,
VARIANT
*
var
,
IErrorLog
*
log
)
{
HRESULT
hr
;
static
const
WCHAR
dsguidW
[]
=
{
'D'
,
'S'
,
'G'
,
'u'
,
'i'
,
'd'
,
0
};
WCHAR
guidstr
[
39
];
ok
(
!
lstrcmpW
(
name
,
dsguidW
),
"Got unexpected name %s.
\n
"
,
wine_dbgstr_w
(
name
));
ok
(
V_VT
(
var
)
==
VT_BSTR
,
"Got unexpected type %u.
\n
"
,
V_VT
(
var
));
StringFromGUID2
(
&
DSDEVID_DefaultPlayback
,
guidstr
,
ARRAY_SIZE
(
guidstr
));
V_BSTR
(
var
)
=
SysAllocString
(
guidstr
);
return
S_OK
;
}
hr
=
IUnknown_Release
(
pDSRender
);
ok
(
hr
==
0
,
"IUnknown_Release failed with %x
\n
"
,
hr
);
static
HRESULT
WINAPI
property_bag_Write
(
IPropertyBag
*
iface
,
const
WCHAR
*
name
,
VARIANT
*
var
)
{
ok
(
0
,
"Unexpected call (name %s).
\n
"
,
wine_dbgstr_w
(
name
));
return
E_FAIL
;
}
static
const
IPropertyBagVtbl
property_bag_vtbl
=
{
property_bag_QueryInterface
,
property_bag_AddRef
,
property_bag_Release
,
property_bag_Read
,
property_bag_Write
,
};
static
void
test_property_bag
(
void
)
{
IPropertyBag
property_bag
=
{
&
property_bag_vtbl
};
IPersistPropertyBag
*
ppb
;
ICreateDevEnum
*
devenum
;
IEnumMoniker
*
enummon
;
IPropertyBag
*
propbag
;
IMoniker
*
mon
;
HRESULT
hr
;
ULONG
ref
;
CoCreateInstance
(
&
CLSID_SystemDeviceEnum
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_ICreateDevEnum
,
(
void
**
)
&
devenum
);
ICreateDevEnum_CreateClassEnumerator
(
devenum
,
&
CLSID_AudioRendererCategory
,
&
enummon
,
0
);
hr
=
CoCreateInstance
(
&
CLSID_DSoundRender
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IPersistPropertyBag
,
(
void
**
)
&
ppb
);
todo_wine
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
while
(
IEnumMoniker_Next
(
enummon
,
1
,
&
mon
,
NULL
)
==
S_OK
)
{
hr
=
CoCreateInstance
(
&
CLSID_DSoundRender
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IPersistPropertyBag
,
(
void
**
)
&
ppb
);
todo_wine
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
break
;
hr
=
IPersistPropertyBag_InitNew
(
ppb
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IMoniker_BindToStorage
(
mon
,
NULL
,
NULL
,
&
IID_IPropertyBag
,
(
void
**
)
&
propbag
);
hr
=
IPersistPropertyBag_Load
(
ppb
,
&
property_bag
,
NULL
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IPersistPropertyBag_InitNew
(
ppb
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ref
=
IPersistPropertyBag_Release
(
ppb
);
ok
(
!
ref
,
"Got unexpected refcount %d.
\n
"
,
ref
);
}
hr
=
IPersistPropertyBag_Load
(
ppb
,
propbag
,
NULL
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
static
void
check_interface_
(
unsigned
int
line
,
void
*
iface_ptr
,
REFIID
iid
,
BOOL
supported
)
{
IUnknown
*
iface
=
iface_ptr
;
HRESULT
hr
,
expected_hr
;
IUnknown
*
unk
;
IPersistPropertyBag_Release
(
ppb
);
IPropertyBag_Release
(
propbag
);
IMoniker_Release
(
mon
);
}
expected_hr
=
supported
?
S_OK
:
E_NOINTERFACE
;
IEnumMoniker_Release
(
enummon
);
ICreateDevEnum_Release
(
devenum
);
hr
=
IUnknown_QueryInterface
(
iface
,
iid
,
(
void
**
)
&
unk
);
ok_
(
__FILE__
,
line
)(
hr
==
expected_hr
,
"Got hr %#x, expected %#x.
\n
"
,
hr
,
expected_hr
);
if
(
SUCCEEDED
(
hr
))
IUnknown_Release
(
unk
);
}
static
void
test_
query_interface
(
void
)
static
void
test_
interfaces
(
void
)
{
HRESULT
hr
;
IBaseFilter
*
pBaseFilter
=
NULL
;
IBasicAudio
*
pBasicAudio
=
NULL
;
IMediaPosition
*
pMediaPosition
=
NULL
;
IMediaSeeking
*
pMediaSeeking
=
NULL
;
IQualityControl
*
pQualityControl
=
NULL
;
IPersistPropertyBag
*
ppb
=
NULL
;
IDirectSound3DBuffer
*
ds3dbuf
=
NULL
;
IReferenceClock
*
clock
=
NULL
;
IAMDirectSound
*
pAMDirectSound
=
NULL
;
QI_SUCCEED
(
pDSRender
,
IID_IBaseFilter
,
pBaseFilter
);
RELEASE_EXPECT
(
pBaseFilter
,
1
);
QI_SUCCEED
(
pDSRender
,
IID_IBasicAudio
,
pBasicAudio
);
RELEASE_EXPECT
(
pBasicAudio
,
1
);
QI_SUCCEED
(
pDSRender
,
IID_IMediaSeeking
,
pMediaSeeking
);
RELEASE_EXPECT
(
pMediaSeeking
,
1
);
QI_SUCCEED
(
pDSRender
,
IID_IReferenceClock
,
clock
);
RELEASE_EXPECT
(
clock
,
1
);
QI_SUCCEED
(
pDSRender
,
IID_IAMDirectSound
,
pAMDirectSound
);
RELEASE_EXPECT
(
pAMDirectSound
,
1
);
todo_wine
{
QI_SUCCEED
(
pDSRender
,
IID_IDirectSound3DBuffer
,
ds3dbuf
);
RELEASE_EXPECT
(
ds3dbuf
,
1
);
QI_SUCCEED
(
pDSRender
,
IID_IPersistPropertyBag
,
ppb
);
RELEASE_EXPECT
(
ppb
,
1
);
}
QI_SUCCEED
(
pDSRender
,
IID_IMediaPosition
,
pMediaPosition
);
RELEASE_EXPECT
(
pMediaPosition
,
1
);
QI_SUCCEED
(
pDSRender
,
IID_IQualityControl
,
pQualityControl
);
RELEASE_EXPECT
(
pQualityControl
,
1
);
IBaseFilter
*
filter
=
create_dsound_render
();
check_interface
(
filter
,
&
IID_IAMDirectSound
,
TRUE
);
check_interface
(
filter
,
&
IID_IBaseFilter
,
TRUE
);
check_interface
(
filter
,
&
IID_IBasicAudio
,
TRUE
);
todo_wine
check_interface
(
filter
,
&
IID_IDirectSound3DBuffer
,
TRUE
);
check_interface
(
filter
,
&
IID_IMediaFilter
,
TRUE
);
check_interface
(
filter
,
&
IID_IMediaPosition
,
TRUE
);
check_interface
(
filter
,
&
IID_IMediaSeeking
,
TRUE
);
check_interface
(
filter
,
&
IID_IPersist
,
TRUE
);
todo_wine
check_interface
(
filter
,
&
IID_IPersistPropertyBag
,
TRUE
);
check_interface
(
filter
,
&
IID_IQualityControl
,
TRUE
);
check_interface
(
filter
,
&
IID_IReferenceClock
,
TRUE
);
check_interface
(
filter
,
&
IID_IUnknown
,
TRUE
);
todo_wine
check_interface
(
filter
,
&
IID_IAMFilterMiscFlags
,
FALSE
);
check_interface
(
filter
,
&
IID_IBasicVideo
,
FALSE
);
check_interface
(
filter
,
&
IID_IKsPropertySet
,
FALSE
);
check_interface
(
filter
,
&
IID_IPin
,
FALSE
);
check_interface
(
filter
,
&
IID_IQualProp
,
FALSE
);
check_interface
(
filter
,
&
IID_IVideoWindow
,
FALSE
);
IBaseFilter_Release
(
filter
);
}
static
void
test_pin
(
IPin
*
pin
)
...
...
@@ -145,19 +163,11 @@ static void test_pin(IPin *pin)
static
void
test_basefilter
(
void
)
{
IEnumPins
*
pin_enum
=
NULL
;
IBaseFilter
*
base
=
NULL
;
IBaseFilter
*
base
=
create_dsound_render
()
;
IPin
*
pins
[
2
];
ULONG
ref
;
HRESULT
hr
;
IUnknown_QueryInterface
(
pDSRender
,
&
IID_IBaseFilter
,
(
void
**
)
&
base
);
if
(
base
==
NULL
)
{
/* test_query_interface handles this case */
skip
(
"No IBaseFilter
\n
"
);
return
;
}
hr
=
IBaseFilter_EnumPins
(
base
,
NULL
);
ok
(
hr
==
E_POINTER
,
"hr = %08x and not E_POINTER
\n
"
,
hr
);
...
...
@@ -192,15 +202,25 @@ static void test_basefilter(void)
START_TEST
(
dsoundrender
)
{
IBaseFilter
*
filter
;
HRESULT
hr
;
CoInitialize
(
NULL
);
if
(
!
create_dsound_renderer
())
hr
=
CoCreateInstance
(
&
CLSID_DSoundRender
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IBaseFilter
,
(
void
**
)
&
filter
);
if
(
hr
==
VFW_E_NO_AUDIO_HARDWARE
)
{
skip
(
"No audio hardware.
\n
"
);
CoUninitialize
();
return
;
}
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IBaseFilter_Release
(
filter
);
test_property_bag
();
test_
query_interface
();
test_
interfaces
();
test_basefilter
();
release_dsound_renderer
();
CoUninitialize
();
}
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