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
f221298e
Commit
f221298e
authored
May 04, 2017
by
Michael Stefaniuc
Committed by
Alexandre Julliard
May 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime/tests: Add more InitAudio() tests.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a3065778
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
8 deletions
+118
-8
Makefile.in
dlls/dmime/tests/Makefile.in
+1
-1
performance.c
dlls/dmime/tests/performance.c
+117
-7
No files found.
dlls/dmime/tests/Makefile.in
View file @
f221298e
TESTDLL
=
dmime.dll
TESTDLL
=
dmime.dll
IMPORTS
=
user32 ole32
IMPORTS
=
user32 ole32
dsound
C_SRCS
=
\
C_SRCS
=
\
dmime.c
\
dmime.c
\
...
...
dlls/dmime/tests/performance.c
View file @
f221298e
...
@@ -31,13 +31,59 @@
...
@@ -31,13 +31,59 @@
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
DEFINE_GUID
(
GUID_Bunk
,
0xFFFFFFFF
,
0xFFFF
,
0xFFFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
);
DEFINE_GUID
(
GUID_Bunk
,
0xFFFFFFFF
,
0xFFFF
,
0xFFFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
);
static
void
create_performance
(
IDirectMusicPerformance8
**
performance
,
IDirectMusic
**
dmusic
,
IDirectSound
**
dsound
,
BOOL
set_cooplevel
)
{
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicPerformance
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicPerformance8
,
(
void
**
)
performance
);
ok
(
hr
==
S_OK
,
"DirectMusicPerformance create failed: %08x
\n
"
,
hr
);
if
(
dmusic
)
{
hr
=
CoCreateInstance
(
&
CLSID_DirectMusic
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusic8
,
(
void
**
)
dmusic
);
ok
(
hr
==
S_OK
,
"DirectMusic create failed: %08x
\n
"
,
hr
);
}
if
(
dsound
)
{
hr
=
DirectSoundCreate8
(
NULL
,
(
IDirectSound8
**
)
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"DirectSoundCreate failed: %08x
\n
"
,
hr
);
if
(
set_cooplevel
)
{
hr
=
IDirectSound_SetCooperativeLevel
(
*
dsound
,
GetForegroundWindow
(),
DSSCL_PRIORITY
);
ok
(
hr
==
S_OK
,
"SetCooperativeLevel failed: %08x
\n
"
,
hr
);
}
}
}
static
void
destroy_performance
(
IDirectMusicPerformance8
*
performance
,
IDirectMusic
*
dmusic
,
IDirectSound
*
dsound
)
{
HRESULT
hr
;
hr
=
IDirectMusicPerformance8_CloseDown
(
performance
);
ok
(
hr
==
S_OK
,
"CloseDown failed: %08x
\n
"
,
hr
);
IDirectMusicPerformance8_Release
(
performance
);
if
(
dmusic
)
IDirectMusic_Release
(
dmusic
);
if
(
dsound
)
IDirectSound_Release
(
dsound
);
}
static
ULONG
get_refcount
(
void
*
iface
)
{
IUnknown
*
unknown
=
iface
;
IUnknown_AddRef
(
unknown
);
return
IUnknown_Release
(
unknown
);
}
static
HRESULT
test_InitAudio
(
void
)
static
HRESULT
test_InitAudio
(
void
)
{
{
IDirectMusicPerformance8
*
performance
;
IDirectMusicPerformance8
*
performance
;
IDirectMusic
*
dmusic
;
IDirectSound
*
dsound
;
IDirectSound
*
dsound
;
IDirectMusicPort
*
port
;
IDirectMusicPort
*
port
;
IDirectMusicAudioPath
*
path
;
IDirectMusicAudioPath
*
path
;
HRESULT
hr
;
HRESULT
hr
;
ULONG
ref
;
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicPerformance
,
NULL
,
CLSCTX_INPROC_SERVER
,
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicPerformance
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicPerformance8
,
(
void
**
)
&
performance
);
&
IID_IDirectMusicPerformance8
,
(
void
**
)
&
performance
);
...
@@ -70,17 +116,81 @@ static HRESULT test_InitAudio(void)
...
@@ -70,17 +116,81 @@ static HRESULT test_InitAudio(void)
IDirectMusicPerformance8_Release
(
performance
);
IDirectMusicPerformance8_Release
(
performance
);
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicPerformance
,
NULL
,
CLSCTX_INPROC_SERVER
,
/* Auto generated dmusic and dsound */
&
IID_IDirectMusicPerformance8
,
(
void
**
)
&
performance
);
create_performance
(
&
performance
,
NULL
,
NULL
,
FALSE
);
ok
(
hr
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hr
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
NULL
,
NULL
,
NULL
,
0
,
64
,
0
,
NULL
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
NULL
,
NULL
,
NULL
,
0
,
64
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
destroy_performance
(
performance
,
NULL
,
NULL
);
/* dsound without SetCooperativeLevel() */
create_performance
(
&
performance
,
NULL
,
&
dsound
,
FALSE
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
NULL
,
&
dsound
,
NULL
,
0
,
0
,
0
,
NULL
);
todo_wine
ok
(
hr
==
DSERR_PRIOLEVELNEEDED
,
"InitAudio failed: %08x
\n
"
,
hr
);
destroy_performance
(
performance
,
NULL
,
dsound
);
/* Using the wrong CLSID_DirectSound */
create_performance
(
&
performance
,
NULL
,
NULL
,
FALSE
);
hr
=
DirectSoundCreate
(
NULL
,
&
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"DirectSoundCreate failed: %08x
\n
"
,
hr
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
NULL
,
&
dsound
,
NULL
,
0
,
0
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_NOINTERFACE
,
"InitAudio failed: %08x
\n
"
,
hr
);
destroy_performance
(
performance
,
NULL
,
dsound
);
/* Init() works with just a CLSID_DirectSound */
create_performance
(
&
performance
,
NULL
,
NULL
,
FALSE
);
hr
=
DirectSoundCreate
(
NULL
,
&
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"DirectSoundCreate failed: %08x
\n
"
,
hr
);
hr
=
IDirectSound_SetCooperativeLevel
(
dsound
,
GetForegroundWindow
(),
DSSCL_PRIORITY
);
ok
(
hr
==
S_OK
,
"SetCooperativeLevel failed: %08x
\n
"
,
hr
);
hr
=
IDirectMusicPerformance8_Init
(
performance
,
NULL
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"Init failed: %08x
\n
"
,
hr
);
destroy_performance
(
performance
,
NULL
,
dsound
);
hr
=
IDirectMusicPerformance8_CloseDown
(
performance
);
/* Init() followed by InitAudio() */
ok
(
hr
==
S_OK
,
"CloseDown failed: %08x
\n
"
,
hr
);
create_performance
(
&
performance
,
NULL
,
&
dsound
,
TRUE
);
hr
=
IDirectMusicPerformance8_Init
(
performance
,
NULL
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"Init failed: %08x
\n
"
,
hr
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
NULL
,
&
dsound
,
NULL
,
0
,
0
,
0
,
NULL
);
ok
(
hr
==
DMUS_E_ALREADY_INITED
,
"InitAudio failed: %08x
\n
"
,
hr
);
destroy_performance
(
performance
,
NULL
,
dsound
);
IDirectMusicPerformance8_Release
(
performance
);
/* Provided dmusic and dsound */
create_performance
(
&
performance
,
&
dmusic
,
&
dsound
,
TRUE
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
&
dmusic
,
&
dsound
,
NULL
,
0
,
64
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ref
=
get_refcount
(
dmusic
);
ok
(
ref
==
2
,
"dmusic ref count got %d expected 2
\n
"
,
ref
);
destroy_performance
(
performance
,
dmusic
,
dsound
);
/* Provided dmusic initialized with SetDirectSound */
create_performance
(
&
performance
,
&
dmusic
,
&
dsound
,
TRUE
);
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
&
dmusic
,
NULL
,
NULL
,
0
,
64
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
ref
=
get_refcount
(
dmusic
);
ok
(
ref
==
2
,
"dmusic ref count got %d expected 2
\n
"
,
ref
);
destroy_performance
(
performance
,
dmusic
,
dsound
);
/* Provided dmusic and dsound, dmusic initialized with SetDirectSound */
create_performance
(
&
performance
,
&
dmusic
,
&
dsound
,
TRUE
);
IDirectMusic_SetDirectSound
(
dmusic
,
dsound
,
NULL
);
ok
(
hr
==
S_OK
,
"SetDirectSound failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
2
,
"dsound ref count got %d expected 2
\n
"
,
ref
);
hr
=
IDirectMusicPerformance8_InitAudio
(
performance
,
&
dmusic
,
&
dsound
,
NULL
,
0
,
64
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ref
=
get_refcount
(
dsound
);
todo_wine
ok
(
ref
==
3
,
"dsound ref count got %d expected 3
\n
"
,
ref
);
ref
=
get_refcount
(
dmusic
);
ok
(
ref
==
2
,
"dmusic ref count got %d expected 2
\n
"
,
ref
);
destroy_performance
(
performance
,
dmusic
,
dsound
);
return
S_OK
;
return
S_OK
;
}
}
...
...
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