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
e808fb19
Commit
e808fb19
authored
Feb 25, 2015
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Feb 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm/tests: Add tests for PlaySound().
parent
ea018550
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
wave.c
dlls/winmm/tests/wave.c
+88
-0
No files found.
dlls/winmm/tests/wave.c
View file @
e808fb19
...
...
@@ -1599,10 +1599,98 @@ static void test_fragmentsize(void)
CloseHandle
(
hevent
);
}
static
void
create_wav_file
(
char
*
temp_file
)
{
WAVEFORMATEX
format
;
HMMIO
h
;
MMCKINFO
riff_chunk
,
chunk
;
MMRESULT
rc
;
LONG
written
;
DWORD
length
;
char
*
buffer
;
format
.
wFormatTag
=
WAVE_FORMAT_PCM
;
format
.
cbSize
=
0
;
format
.
nChannels
=
1
;
format
.
wBitsPerSample
=
8
;
format
.
nSamplesPerSec
=
8000
;
format
.
nBlockAlign
=
format
.
nChannels
*
format
.
wBitsPerSample
/
8
;
format
.
nAvgBytesPerSec
=
format
.
nSamplesPerSec
*
format
.
nBlockAlign
;
h
=
mmioOpenA
(
temp_file
,
NULL
,
MMIO_ALLOCBUF
|
MMIO_WRITE
|
MMIO_CREATE
);
ok
(
h
!=
NULL
,
"Can't open temp_file
\n
"
);
riff_chunk
.
fccType
=
mmioFOURCC
(
'W'
,
'A'
,
'V'
,
'E'
);
rc
=
mmioCreateChunk
(
h
,
&
riff_chunk
,
MMIO_CREATERIFF
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioCreateChunk failed, got %u
\n
"
,
rc
);
chunk
.
ckid
=
mmioFOURCC
(
'f'
,
'm'
,
't'
,
' '
);
rc
=
mmioCreateChunk
(
h
,
&
chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioCreateChunk failed, got %u
\n
"
,
rc
);
written
=
mmioWrite
(
h
,
(
char
*
)
&
format
,
sizeof
(
format
));
ok
(
written
==
sizeof
(
format
),
"mmioWrite failed, got %d
\n
"
,
written
);
rc
=
mmioAscend
(
h
,
&
chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioAscend failed, got %d
\n
"
,
rc
);
chunk
.
ckid
=
mmioFOURCC
(
'd'
,
'a'
,
't'
,
'a'
);
rc
=
mmioCreateChunk
(
h
,
&
chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioCreateChunk failed, got %u
\n
"
,
rc
);
buffer
=
wave_generate_silence
(
&
format
,
.
1
,
&
length
);
written
=
mmioWrite
(
h
,
buffer
,
length
);
ok
(
written
==
length
,
"mmioWrite failed, got %d
\n
"
,
written
);
rc
=
mmioAscend
(
h
,
&
chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioAscend failed, got %d
\n
"
,
rc
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
rc
=
mmioAscend
(
h
,
&
riff_chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioAscend failed, got %d
\n
"
,
rc
);
rc
=
mmioClose
(
h
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioClose failed, got %u
\n
"
,
rc
);
}
static
void
test_PlaySound
(
void
)
{
BOOL
br
;
char
test_file
[
MAX_PATH
],
temp
[
MAX_PATH
],
*
exts
;
if
(
waveOutGetNumDevs
()
==
0
)
{
skip
(
"No output devices available
\n
"
);
return
;
}
GetTempPathA
(
sizeof
(
test_file
),
test_file
);
strcat
(
test_file
,
"mysound.wav"
);
create_wav_file
(
test_file
);
br
=
PlaySoundA
(
test_file
,
NULL
,
SND_FILENAME
|
SND_NODEFAULT
);
ok
(
br
,
"PlaySound failed, got %d
\n
"
,
br
);
/* SND_ALIAS fallbacks to SND_FILENAME */
br
=
PlaySoundA
(
test_file
,
NULL
,
SND_ALIAS
|
SND_NODEFAULT
);
ok
(
br
,
"PlaySound failed, got %d
\n
"
,
br
);
strcpy
(
temp
,
test_file
);
exts
=
strrchr
(
temp
,
'.'
);
/* no extensions */
*
exts
=
'\0'
;
br
=
PlaySoundA
(
temp
,
NULL
,
SND_FILENAME
|
SND_NODEFAULT
);
todo_wine
ok
(
br
,
"PlaySound failed, got %d
\n
"
,
br
);
/* ends with a dot */
strcpy
(
exts
,
"."
);
br
=
PlaySoundA
(
temp
,
NULL
,
SND_FILENAME
|
SND_NODEFAULT
);
ok
(
!
br
||
broken
(
br
),
"PlaySound succeeded, got %d
\n
"
,
br
);
DeleteFileA
(
test_file
);
}
START_TEST
(
wave
)
{
test_multiple_waveopens
();
wave_out_tests
();
test_sndPlaySound
();
test_fragmentsize
();
test_PlaySound
();
}
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