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
b235edb0
Commit
b235edb0
authored
Mar 19, 2012
by
Andrew Eikum
Committed by
Alexandre Julliard
Mar 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: Add simple playing test.
parent
5e522a1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
8 deletions
+83
-8
loader.c
dlls/dmloader/tests/loader.c
+83
-8
No files found.
dlls/dmloader/tests/loader.c
View file @
b235edb0
...
@@ -22,34 +22,109 @@
...
@@ -22,34 +22,109 @@
#include "dmusici.h"
#include "dmusici.h"
#include "wine/test.h"
#include "wine/test.h"
static
unsigned
char
mp3file
[]
=
"
\xFF\xFB\x92\x04
"
;
/* MP3 header */
static
unsigned
char
rifffile
[
8
+
4
+
8
+
16
+
8
+
256
]
=
"RIFF
\x24\x01\x00\x00
WAVE"
/* header: 4 ("WAVE") + (8 + 16) (format segment) + (8 + 256) (data segment) = 0x124 */
"fmt
\x10\x00\x00\x00\x01\x00\x20\x00\xAC\x44\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00
"
/* format segment: PCM, 2 chan, 44100 Hz, 16 bits */
"data
\x00\x01\x00\x00
"
;
/* 256 byte data segment (silence) */
static
void
test_release_object
(
void
)
static
void
test_release_object
(
void
)
{
{
HRESULT
hr
;
HRESULT
hr
;
IDirectMusicLoader8
*
loader
=
NULL
;
IDirectMusicLoader8
*
loader
=
NULL
;
hr
=
Co
Initialize
(
NULL
);
hr
=
Co
CreateInstance
(
&
CLSID_DirectMusicLoader
,
NULL
,
CLSCTX_INPROC
,
&
IID_IDirectMusicLoader8
,
(
void
**
)
&
loader
);
if
(
FAILED
(
hr
)
)
if
(
FAILED
(
hr
)
)
{
{
skip
(
"Co
Initializ
e failed.
\n
"
);
skip
(
"Co
CreateInstanc
e failed.
\n
"
);
return
;
return
;
}
}
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicLoader
,
NULL
,
CLSCTX_INPROC
,
&
IID_IDirectMusicLoader8
,
(
void
**
)
&
loader
);
hr
=
IDirectMusicLoader_ReleaseObject
(
loader
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Expected E_POINTER, received %#x
\n
"
,
hr
);
IDirectMusicLoader_Release
(
loader
);
}
static
void
test_simple_playing
(
void
)
{
IDirectMusic
*
music
=
NULL
;
IDirectMusicLoader8
*
loader
;
IDirectMusicPerformance8
*
perf
;
IDirectMusicAudioPath8
*
path
=
NULL
;
IDirectMusicSegment8
*
segment
=
NULL
;
IDirectMusicSegmentState
*
state
=
NULL
;
IDirectSound
*
dsound
=
NULL
;
DMUS_OBJECTDESC
desc
=
{
0
};
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicPerformance
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicPerformance8
,
(
void
**
)
&
perf
);
if
(
FAILED
(
hr
)
)
if
(
FAILED
(
hr
)
)
{
{
skip
(
"CoCreateInstance failed.
\n
"
);
skip
(
"CoCreateInstance failed.
\n
"
);
CoUninitialize
();
return
;
return
;
}
}
hr
=
IDirectMusicLoader_ReleaseObject
(
loader
,
NULL
);
hr
=
CoCreateInstance
(
&
CLSID_DirectMusicLoader
,
NULL
,
ok
(
hr
==
E_POINTER
,
"Expected E_POINTER, received %#x
\n
"
,
hr
);
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusicLoader8
,
(
void
**
)
&
loader
);
ok
(
hr
==
S_OK
,
"Couldn't create Loader %08x
\n
"
,
hr
);
IDirectMusicLoader_Release
(
loader
);
hr
=
IDirectMusicPerformance8_InitAudio
(
perf
,
&
music
,
&
dsound
,
NULL
,
CoUninitialize
();
DMUS_APATH_DYNAMIC_STEREO
,
64
,
DMUS_AUDIOF_ALL
,
NULL
);
ok
(
hr
==
S_OK
,
"InitAudio failed: %08x
\n
"
,
hr
);
ok
(
music
!=
NULL
,
"Didn't get IDirectMusic pointer
\n
"
);
ok
(
dsound
!=
NULL
,
"Didn't get IDirectSound pointer
\n
"
);
hr
=
IDirectMusicPerformance8_CreateStandardAudioPath
(
perf
,
DMUS_APATH_DYNAMIC_STEREO
,
64
,
TRUE
,
&
path
);
ok
(
hr
==
S_OK
,
"CreateStandardAudioPath failed: %08x
\n
"
,
hr
);
ok
(
path
!=
NULL
,
"Didn't get IDirectMusicAudioPath pointer
\n
"
);
desc
.
dwSize
=
sizeof
(
DMUS_OBJECTDESC
);
desc
.
dwValidData
=
DMUS_OBJ_CLASS
|
DMUS_OBJ_MEMORY
;
desc
.
guidClass
=
CLSID_DirectMusicSegment
;
desc
.
pbMemData
=
mp3file
;
desc
.
llMemLength
=
sizeof
(
mp3file
);
hr
=
IDirectMusicLoader8_GetObject
(
loader
,
&
desc
,
&
IID_IDirectMusicSegment8
,
(
void
**
)
&
segment
);
ok
(
hr
==
DMUS_E_UNSUPPORTED_STREAM
,
"GetObject gave wrong error: %08x
\n
"
,
hr
);
ok
(
segment
==
NULL
,
"Didn't get NULL IDirectMusicSegment pointer
\n
"
);
desc
.
pbMemData
=
rifffile
;
desc
.
llMemLength
=
sizeof
(
rifffile
);
hr
=
IDirectMusicLoader8_GetObject
(
loader
,
&
desc
,
&
IID_IDirectMusicSegment8
,
(
void
**
)
&
segment
);
ok
(
hr
==
S_OK
,
"GetObject failed: %08x
\n
"
,
hr
);
ok
(
segment
!=
NULL
,
"Didn't get IDirectMusicSegment pointer
\n
"
);
hr
=
IDirectMusicSegment8_Download
(
segment
,
(
IUnknown
*
)
path
);
ok
(
hr
==
S_OK
,
"Download failed: %08x
\n
"
,
hr
);
hr
=
IDirectMusicSegment8_SetRepeats
(
segment
,
1
);
ok
(
hr
==
S_OK
,
"SetRepeats failed: %08x
\n
"
,
hr
);
hr
=
IDirectMusicPerformance8_PlaySegmentEx
(
perf
,
(
IUnknown
*
)
segment
,
NULL
,
NULL
,
DMUS_SEGF_SECONDARY
,
0
,
&
state
,
NULL
,
(
IUnknown
*
)
path
);
ok
(
hr
==
S_OK
,
"PlaySegmentEx failed: %08x
\n
"
,
hr
);
ok
(
state
!=
NULL
,
"Didn't get IDirectMusicSegmentState pointer
\n
"
);
hr
=
IDirectMusicPerformance8_CloseDown
(
perf
);
ok
(
hr
==
S_OK
,
"CloseDown failed: %08x
\n
"
,
hr
);
IDirectSound_Release
(
dsound
);
IDirectMusicSegmentState_Release
(
state
);
IDirectMusicSegment8_Release
(
segment
);
IDirectMusic_Release
(
music
);
IDirectMusicPerformance8_Release
(
perf
);
IDirectMusicLoader8_Release
(
loader
);
}
}
START_TEST
(
loader
)
START_TEST
(
loader
)
{
{
CoInitialize
(
NULL
);
test_release_object
();
test_release_object
();
test_simple_playing
();
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