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
e477e3e3
Commit
e477e3e3
authored
Aug 10, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth/tests: Import and use a check_interface helper.
parent
40dcb595
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
41 deletions
+31
-41
dmsynth.c
dlls/dmsynth/tests/dmsynth.c
+31
-41
No files found.
dlls/dmsynth/tests/dmsynth.c
View file @
e477e3e3
...
...
@@ -51,6 +51,27 @@ static ULONG get_refcount(void *iface)
return
IUnknown_Release
(
unknown
);
}
#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
)
{
ULONG
expect_ref
=
get_refcount
(
iface_ptr
);
IUnknown
*
iface
=
iface_ptr
;
HRESULT
hr
,
expected
;
IUnknown
*
unk
;
expected
=
supported
?
S_OK
:
E_NOINTERFACE
;
hr
=
IUnknown_QueryInterface
(
iface
,
iid
,
(
void
**
)
&
unk
);
ok_
(
__FILE__
,
line
)(
hr
==
expected
,
"got hr %#lx, expected %#lx.
\n
"
,
hr
,
expected
);
if
(
SUCCEEDED
(
hr
))
{
LONG
ref
=
get_refcount
(
unk
);
ok_
(
__FILE__
,
line
)(
ref
==
expect_ref
+
1
,
"got %ld
\n
"
,
ref
);
IUnknown_Release
(
unk
);
ref
=
get_refcount
(
iface_ptr
);
ok_
(
__FILE__
,
line
)(
ref
==
expect_ref
,
"got %ld
\n
"
,
ref
);
}
}
static
void
test_synth_getformat
(
IDirectMusicSynth
*
synth
,
DMUS_PORTPARAMS
*
params
,
const
char
*
context
)
{
WAVEFORMATEX
format
;
...
...
@@ -317,9 +338,6 @@ static void test_dmsynth(void)
static
void
test_COM
(
void
)
{
IDirectMusicSynth8
*
dms8
=
(
IDirectMusicSynth8
*
)
0xdeadbeef
;
IKsControl
*
iksc
;
IUnknown
*
unk
;
ULONG
refcount
;
HRESULT
hr
;
/* COM aggregation */
...
...
@@ -334,40 +352,23 @@ static void test_COM(void)
&
IID_IDirectMusicObject
,
(
void
**
)
&
dms8
);
ok
(
hr
==
E_NOINTERFACE
,
"DirectMusicSynth create failed: %#lx, expected E_NOINTERFACE
\n
"
,
hr
);
/* Same refcount for all DirectMusicSynth interfaces */
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicSynth
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicSynth8
,
(
void
**
)
&
dms8
);
ok
(
hr
==
S_OK
,
"DirectMusicSynth create failed: %#lx, expected S_OK
\n
"
,
hr
);
refcount
=
IDirectMusicSynth8_AddRef
(
dms8
);
ok
(
refcount
==
2
,
"refcount == %lu, expected 2
\n
"
,
refcount
);
hr
=
IDirectMusicSynth8_QueryInterface
(
dms8
,
&
IID_IKsControl
,
(
void
**
)
&
iksc
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IKsControl failed: %#lx
\n
"
,
hr
);
refcount
=
IKsControl_AddRef
(
iksc
);
ok
(
refcount
==
4
,
"refcount == %lu, expected 4
\n
"
,
refcount
);
IKsControl_Release
(
iksc
);
hr
=
IDirectMusicSynth8_QueryInterface
(
dms8
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IUnknown failed: %#lx
\n
"
,
hr
);
refcount
=
IUnknown_AddRef
(
unk
);
ok
(
refcount
==
5
,
"refcount == %lu, expected 5
\n
"
,
refcount
);
IUnknown_Release
(
unk
);
check_interface
(
dms8
,
&
IID_IUnknown
,
TRUE
);
check_interface
(
dms8
,
&
IID_IKsControl
,
TRUE
);
/* Unsupported interfaces */
hr
=
IDirectMusicSynth8_QueryInterface
(
dms8
,
&
IID_IDirectMusicSynthSink
,
(
void
**
)
&
unk
);
ok
(
hr
==
E_NOINTERFACE
,
"QueryInterface for IID_IDirectMusicSynthSink failed: %#lx
\n
"
,
hr
);
hr
=
IDirectMusicSynth8_QueryInterface
(
dms8
,
&
IID_IReferenceClock
,
(
void
**
)
&
unk
);
ok
(
hr
==
E_NOINTERFACE
,
"QueryInterface for IID_IReferenceClock failed: %#lx
\n
"
,
hr
);
check_interface
(
dms8
,
&
IID_IDirectMusicSynthSink
,
FALSE
);
check_interface
(
dms8
,
&
IID_IReferenceClock
,
FALSE
);
while
(
IDirectMusicSynth8_Release
(
dms8
)
);
IDirectMusicSynth8_Release
(
dms8
);
}
static
void
test_COM_synthsink
(
void
)
{
IDirectMusicSynthSink
*
dmss
=
(
IDirectMusicSynthSink
*
)
0xdeadbeef
;
IKsControl
*
iksc
;
IUnknown
*
unk
;
ULONG
refcount
;
HRESULT
hr
;
/* COM aggregation */
...
...
@@ -386,27 +387,16 @@ static void test_COM_synthsink(void)
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicSynthSink
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicSynthSink
,
(
void
**
)
&
dmss
);
ok
(
hr
==
S_OK
,
"DirectMusicSynthSink create failed: %#lx, expected S_OK
\n
"
,
hr
);
refcount
=
IDirectMusicSynthSink_AddRef
(
dmss
);
ok
(
refcount
==
2
,
"refcount == %lu, expected 2
\n
"
,
refcount
);
hr
=
IDirectMusicSynthSink_QueryInterface
(
dmss
,
&
IID_IKsControl
,
(
void
**
)
&
iksc
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IKsControl failed: %#lx
\n
"
,
hr
);
refcount
=
IKsControl_AddRef
(
iksc
);
ok
(
refcount
==
4
,
"refcount == %lu, expected 4
\n
"
,
refcount
);
IKsControl_Release
(
iksc
);
hr
=
IDirectMusicSynthSink_QueryInterface
(
dmss
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"QueryInterface for IID_IUnknown failed: %#lx
\n
"
,
hr
);
refcount
=
IUnknown_AddRef
(
unk
);
ok
(
refcount
==
5
,
"refcount == %lu, expected 5
\n
"
,
refcount
);
IUnknown_Release
(
unk
);
check_interface
(
dmss
,
&
IID_IUnknown
,
TRUE
);
check_interface
(
dmss
,
&
IID_IKsControl
,
TRUE
);
/* Unsupported interfaces */
hr
=
IDirectMusicSynthSink_QueryInterface
(
dmss
,
&
IID_IReferenceClock
,
(
void
**
)
&
unk
);
ok
(
hr
==
E_NOINTERFACE
,
"QueryInterface for IID_IReferenceClock failed: %#lx
\n
"
,
hr
);
check_interface
(
dmss
,
&
IID_IReferenceClock
,
FALSE
);
while
(
IDirectMusicSynthSink_Release
(
dmss
)
);
IDirectMusicSynthSink_Release
(
dmss
);
}
START_TEST
(
dmsynth
)
{
CoInitializeEx
(
NULL
,
COINIT_MULTITHREADED
);
...
...
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