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
a0addfe3
Commit
a0addfe3
authored
Feb 22, 2022
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Feb 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth/tests: Add synth GetFormat tests.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5715d2b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
dmsynth.c
dlls/dmsynth/tests/dmsynth.c
+49
-0
No files found.
dlls/dmsynth/tests/dmsynth.c
View file @
a0addfe3
...
@@ -51,6 +51,30 @@ static ULONG get_refcount(void *iface)
...
@@ -51,6 +51,30 @@ static ULONG get_refcount(void *iface)
return
IUnknown_Release
(
unknown
);
return
IUnknown_Release
(
unknown
);
}
}
static
void
test_synth_getformat
(
IDirectMusicSynth
*
synth
,
DMUS_PORTPARAMS
*
params
,
const
char
*
context
)
{
WAVEFORMATEX
format
;
DWORD
size
;
HRESULT
hr
;
winetest_push_context
(
context
);
size
=
sizeof
(
format
);
hr
=
IDirectMusicSynth_GetFormat
(
synth
,
&
format
,
&
size
);
ok
(
hr
==
S_OK
,
"GetFormat failed: %#lx
\n
"
,
hr
);
ok
(
format
.
wFormatTag
==
WAVE_FORMAT_PCM
,
"wFormatTag: %#x
\n
"
,
format
.
wFormatTag
);
ok
(
format
.
nChannels
==
params
->
dwAudioChannels
,
"nChannels: %d
\n
"
,
format
.
nChannels
);
ok
(
format
.
nSamplesPerSec
==
params
->
dwSampleRate
,
"nSamplesPerSec: %ld
\n
"
,
format
.
nSamplesPerSec
);
ok
(
format
.
wBitsPerSample
==
16
,
"wBitsPerSample: %d
\n
"
,
format
.
wBitsPerSample
);
ok
(
format
.
nBlockAlign
==
params
->
dwAudioChannels
*
format
.
wBitsPerSample
/
8
,
"nBlockAlign: %d
\n
"
,
format
.
nBlockAlign
);
ok
(
format
.
nAvgBytesPerSec
==
params
->
dwSampleRate
*
format
.
nBlockAlign
,
"nAvgBytesPerSec: %ld
\n
"
,
format
.
nAvgBytesPerSec
);
ok
(
format
.
cbSize
==
0
,
"cbSize: %d
\n
"
,
format
.
cbSize
);
winetest_pop_context
();
}
static
void
test_dmsynth
(
void
)
static
void
test_dmsynth
(
void
)
{
{
IDirectMusicSynth
*
dmsynth
=
NULL
;
IDirectMusicSynth
*
dmsynth
=
NULL
;
...
@@ -68,6 +92,8 @@ static void test_dmsynth(void)
...
@@ -68,6 +92,8 @@ static void test_dmsynth(void)
DMUS_PORTPARAMS
params
;
DMUS_PORTPARAMS
params
;
const
DWORD
all_params
=
DMUS_PORTPARAMS_VOICES
|
DMUS_PORTPARAMS_CHANNELGROUPS
|
DMUS_PORTPARAMS_AUDIOCHANNELS
|
const
DWORD
all_params
=
DMUS_PORTPARAMS_VOICES
|
DMUS_PORTPARAMS_CHANNELGROUPS
|
DMUS_PORTPARAMS_AUDIOCHANNELS
|
DMUS_PORTPARAMS_SAMPLERATE
|
DMUS_PORTPARAMS_EFFECTS
|
DMUS_PORTPARAMS_SHARE
|
DMUS_PORTPARAMS_FEATURES
;
DMUS_PORTPARAMS_SAMPLERATE
|
DMUS_PORTPARAMS_EFFECTS
|
DMUS_PORTPARAMS_SHARE
|
DMUS_PORTPARAMS_FEATURES
;
WAVEFORMATEX
format
;
DWORD
size
;
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicSynth
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicSynth
,
(
LPVOID
*
)
&
dmsynth
);
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicSynth
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicSynth
,
(
LPVOID
*
)
&
dmsynth
);
ok
(
hr
==
S_OK
,
"CoCreateInstance returned: %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"CoCreateInstance returned: %#lx
\n
"
,
hr
);
...
@@ -154,6 +180,7 @@ static void test_dmsynth(void)
...
@@ -154,6 +180,7 @@ static void test_dmsynth(void)
ok
(
params
.
dwEffectFlags
==
DMUS_EFFECT_REVERB
,
"params.dwEffectFlags: %#lx
\n
"
,
params
.
dwEffectFlags
);
ok
(
params
.
dwEffectFlags
==
DMUS_EFFECT_REVERB
,
"params.dwEffectFlags: %#lx
\n
"
,
params
.
dwEffectFlags
);
ok
(
params
.
fShare
==
FALSE
,
"fShare: %d
\n
"
,
params
.
fShare
);
ok
(
params
.
fShare
==
FALSE
,
"fShare: %d
\n
"
,
params
.
fShare
);
ok
(
params
.
dwFeatures
==
0
,
"dwFeatures: %#lx
\n
"
,
params
.
dwFeatures
);
ok
(
params
.
dwFeatures
==
0
,
"dwFeatures: %#lx
\n
"
,
params
.
dwFeatures
);
test_synth_getformat
(
dmsynth
,
&
params
,
"defaults"
);
IDirectMusicSynth_Close
(
dmsynth
);
IDirectMusicSynth_Close
(
dmsynth
);
/* Requesting more than supported */
/* Requesting more than supported */
params
.
dwValidParams
=
DMUS_PORTPARAMS_SAMPLERATE
;
params
.
dwValidParams
=
DMUS_PORTPARAMS_SAMPLERATE
;
...
@@ -162,6 +189,7 @@ static void test_dmsynth(void)
...
@@ -162,6 +189,7 @@ static void test_dmsynth(void)
ok
(
hr
==
S_FALSE
,
"Open failed: %#lx
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Open failed: %#lx
\n
"
,
hr
);
ok
(
params
.
dwValidParams
==
all_params
,
"dwValidParams: %#lx
\n
"
,
params
.
dwValidParams
);
ok
(
params
.
dwValidParams
==
all_params
,
"dwValidParams: %#lx
\n
"
,
params
.
dwValidParams
);
ok
(
params
.
dwSampleRate
==
96000
,
"dwSampleRate: %ld
\n
"
,
params
.
dwSampleRate
);
ok
(
params
.
dwSampleRate
==
96000
,
"dwSampleRate: %ld
\n
"
,
params
.
dwSampleRate
);
test_synth_getformat
(
dmsynth
,
&
params
,
"max"
);
IDirectMusicSynth_Close
(
dmsynth
);
IDirectMusicSynth_Close
(
dmsynth
);
/* Minimums */
/* Minimums */
params
.
dwValidParams
=
DMUS_PORTPARAMS_VOICES
|
DMUS_PORTPARAMS_CHANNELGROUPS
|
DMUS_PORTPARAMS_AUDIOCHANNELS
|
params
.
dwValidParams
=
DMUS_PORTPARAMS_VOICES
|
DMUS_PORTPARAMS_CHANNELGROUPS
|
DMUS_PORTPARAMS_AUDIOCHANNELS
|
...
@@ -177,6 +205,7 @@ static void test_dmsynth(void)
...
@@ -177,6 +205,7 @@ static void test_dmsynth(void)
ok
(
params
.
dwChannelGroups
==
1
,
"dwChannelGroups: %ld
\n
"
,
params
.
dwChannelGroups
);
ok
(
params
.
dwChannelGroups
==
1
,
"dwChannelGroups: %ld
\n
"
,
params
.
dwChannelGroups
);
ok
(
params
.
dwAudioChannels
==
1
,
"dwAudioChannels: %ld
\n
"
,
params
.
dwAudioChannels
);
ok
(
params
.
dwAudioChannels
==
1
,
"dwAudioChannels: %ld
\n
"
,
params
.
dwAudioChannels
);
ok
(
params
.
dwSampleRate
==
11025
,
"dwSampleRate: %ld
\n
"
,
params
.
dwSampleRate
);
ok
(
params
.
dwSampleRate
==
11025
,
"dwSampleRate: %ld
\n
"
,
params
.
dwSampleRate
);
test_synth_getformat
(
dmsynth
,
&
params
,
"min"
);
IDirectMusicSynth_Close
(
dmsynth
);
IDirectMusicSynth_Close
(
dmsynth
);
/* Test share and features */
/* Test share and features */
params
.
dwValidParams
=
DMUS_PORTPARAMS_SHARE
|
DMUS_PORTPARAMS_FEATURES
;
params
.
dwValidParams
=
DMUS_PORTPARAMS_SHARE
|
DMUS_PORTPARAMS_FEATURES
;
...
@@ -188,6 +217,7 @@ static void test_dmsynth(void)
...
@@ -188,6 +217,7 @@ static void test_dmsynth(void)
ok
(
params
.
fShare
==
FALSE
,
"fShare: %d
\n
"
,
params
.
fShare
);
ok
(
params
.
fShare
==
FALSE
,
"fShare: %d
\n
"
,
params
.
fShare
);
ok
(
params
.
dwFeatures
==
(
DMUS_PORT_FEATURE_AUDIOPATH
|
DMUS_PORT_FEATURE_STREAMING
),
ok
(
params
.
dwFeatures
==
(
DMUS_PORT_FEATURE_AUDIOPATH
|
DMUS_PORT_FEATURE_STREAMING
),
"dwFeatures: %#lx
\n
"
,
params
.
dwFeatures
);
"dwFeatures: %#lx
\n
"
,
params
.
dwFeatures
);
test_synth_getformat
(
dmsynth
,
&
params
,
"features"
);
IDirectMusicSynth_Close
(
dmsynth
);
IDirectMusicSynth_Close
(
dmsynth
);
/* Synth has no default clock */
/* Synth has no default clock */
...
@@ -226,6 +256,25 @@ static void test_dmsynth(void)
...
@@ -226,6 +256,25 @@ static void test_dmsynth(void)
hr
=
IDirectMusicSynth_GetPortCaps
(
dmsynth
,
&
caps
);
hr
=
IDirectMusicSynth_GetPortCaps
(
dmsynth
,
&
caps
);
ok
(
hr
==
S_OK
,
"GetPortCaps failed: %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"GetPortCaps failed: %#lx
\n
"
,
hr
);
/* GetFormat */
hr
=
IDirectMusicSynth_GetFormat
(
dmsynth
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"GetFormat failed: %#lx
\n
"
,
hr
);
hr
=
IDirectMusicSynth_GetFormat
(
dmsynth
,
NULL
,
&
size
);
ok
(
hr
==
DMUS_E_SYNTHNOTCONFIGURED
,
"GetFormat failed: %#lx
\n
"
,
hr
);
hr
=
IDirectMusicSynth_Open
(
dmsynth
,
NULL
);
ok
(
hr
==
S_OK
,
"Open failed: %#lx
\n
"
,
hr
);
hr
=
IDirectMusicSynth_GetFormat
(
dmsynth
,
NULL
,
&
size
);
ok
(
hr
==
S_OK
,
"GetFormat failed: %#lx
\n
"
,
hr
);
ok
(
size
==
sizeof
(
format
),
"GetFormat size mismatch, got %ld
\n
"
,
size
);
size
=
1
;
hr
=
IDirectMusicSynth_GetFormat
(
dmsynth
,
&
format
,
&
size
);
ok
(
hr
==
S_OK
,
"GetFormat failed: %#lx
\n
"
,
hr
);
ok
(
size
==
sizeof
(
format
),
"GetFormat size mismatch, got %ld
\n
"
,
size
);
size
=
sizeof
(
format
)
+
1
;
hr
=
IDirectMusicSynth_GetFormat
(
dmsynth
,
&
format
,
&
size
);
ok
(
hr
==
S_OK
,
"GetFormat failed: %#lx
\n
"
,
hr
);
ok
(
size
==
sizeof
(
format
),
"GetFormat size mismatch, got %ld
\n
"
,
size
);
if
(
control_synth
)
if
(
control_synth
)
IDirectMusicSynth_Release
(
control_synth
);
IDirectMusicSynth_Release
(
control_synth
);
if
(
control_sink
)
if
(
control_sink
)
...
...
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