dmime/tests: Add an invalid stream test.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-03-15 00:09:33 +01:00 committed by Alexandre Julliard
parent 83c078b0ab
commit a783d2a397
1 changed files with 14 additions and 0 deletions

View File

@ -723,6 +723,7 @@ static void test_parsedescriptor(void)
};
FOURCC empty[] = {FOURCC_RIFF, ~0, 0};
FOURCC inam[] = {FOURCC_RIFF, ~0, FOURCC_LIST, ~0, mmioFOURCC('I','N','A','M'), 0, 0};
FOURCC noriff[] = {mmioFOURCC('J','U','N','K'), 0};
#define X(class) &CLSID_ ## class, #class
#define Y(form) form, #form
const struct {
@ -808,6 +809,19 @@ static void test_parsedescriptor(void)
ok(!desc.dwValidData, "Got valid data %#x, expected 0\n", desc.dwValidData);
IStream_Release(stream);
/* Not a RIFF stream */
stream = gen_riff_stream(noriff);
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
hr = IDirectMusicObject_ParseDescriptor(dmo, stream, &desc);
if (forms[i].needs_size)
ok(hr == DMUS_E_CHUNKNOTFOUND,
"ParseDescriptor failed: %08x, expected DMUS_E_CHUNKNOTFOUND\n", hr);
else
ok(hr == E_FAIL, "ParseDescriptor failed: %08x, expected E_FAIL\n", hr);
ok(!desc.dwValidData, "Got valid data %#x, expected 0\n", desc.dwValidData);
IStream_Release(stream);
/* All desc chunks */
alldesc[1] = forms[i].form;
stream = gen_riff_stream(alldesc);