From dc9208a0c535e62e99036b5960f032b14dddf021 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sun, 5 Jan 2014 23:56:39 +0100 Subject: [PATCH] dmusic/tests: Add some DirectMusicCollection tests. --- dlls/dmusic/tests/dmusic.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 3e67c564408..4291d716090 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -320,6 +320,46 @@ static void test_COM_dmcoll(void) while (IDirectMusicCollection_Release(dmc)); } +static void test_dmcoll(void) +{ + IDirectMusicCollection *dmc; + IDirectMusicObject *dmo; + DMUS_OBJECTDESC desc; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_DirectMusicCollection, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicCollection, (void**)&dmc); + ok(hr == S_OK, "DirectMusicCollection create failed: %08x, expected S_OK\n", hr); + + /* IDirectMusicObject */ + hr = IDirectMusicCollection_QueryInterface(dmc, &IID_IDirectMusicObject, (void**)&dmo); + ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr); + hr = IDirectMusicObject_GetDescriptor(dmo, NULL); + ok(hr == E_POINTER, "IDirectMusicObject_GetDescriptor: expected E_POINTER, got %08x\n", hr); + hr = IDirectMusicObject_SetDescriptor(dmo, NULL); + ok(hr == E_POINTER, "IDirectMusicObject_SetDescriptor: expected E_POINTER, got %08x\n", hr); + ZeroMemory(&desc, sizeof(desc)); + hr = IDirectMusicObject_GetDescriptor(dmo, &desc); + ok(hr == S_OK, "IDirectMusicObject_GetDescriptor failed: %08x\n", hr); + ok(desc.dwValidData == DMUS_OBJ_CLASS, + "Fresh object has more valid data (%08x) than DMUS_OBJ_CLASS\n", desc.dwValidData); + /* DMUS_OBJ_CLASS is immutable */ + desc.dwValidData = DMUS_OBJ_CLASS; + hr = IDirectMusicObject_SetDescriptor(dmo, &desc); + ok(hr == S_FALSE , "IDirectMusicObject_SetDescriptor failed: %08x\n", hr); + ok(!desc.dwValidData, "dwValidData wasn't cleared: %08x\n", desc.dwValidData); + desc.dwValidData = DMUS_OBJ_CLASS; + desc.guidClass = CLSID_DirectMusicSegment; + hr = IDirectMusicObject_SetDescriptor(dmo, &desc); + ok(hr == S_FALSE && !desc.dwValidData, "IDirectMusicObject_SetDescriptor failed: %08x\n", hr); + hr = IDirectMusicObject_GetDescriptor(dmo, &desc); + ok(hr == S_OK, "IDirectMusicObject_GetDescriptor failed: %08x\n", hr); + ok(IsEqualGUID(&desc.guidClass, &CLSID_DirectMusicCollection), + "guidClass changed, should be CLSID_DirectMusicCollection\n"); + + while (IDirectMusicCollection_Release(dmc)); +} + static BOOL missing_dmusic(void) { IDirectMusic8 *dm; @@ -348,6 +388,7 @@ START_TEST(dmusic) test_COM_dmcoll(); test_dmusic(); test_dmbuffer(); + test_dmcoll(); CoUninitialize(); }