dmime: IDirectMusicPerformance8 GetGraph return DMUS_E_NOT_FOUND if graph not set.

Just ensure the pointer and return value are correct from GetGraph.  I plan
to extend these tests at a later date.  The tests also show that IDirectMusicPerformance8
has a internal IDirectMusicGraph implementation, returned via QueryInterface.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2020-03-17 05:25:25 +00:00 committed by Alexandre Julliard
parent 4badb89c5f
commit b075088ec5
2 changed files with 40 additions and 11 deletions

View File

@ -549,18 +549,21 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_FreePMsg(IDirectMusicPerforma
} }
static HRESULT WINAPI IDirectMusicPerformance8Impl_GetGraph(IDirectMusicPerformance8 *iface, static HRESULT WINAPI IDirectMusicPerformance8Impl_GetGraph(IDirectMusicPerformance8 *iface,
IDirectMusicGraph **ppGraph) IDirectMusicGraph **graph)
{ {
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface); IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
FIXME("(%p, %p): to check\n", This, ppGraph); TRACE("(%p, %p)\n", This, graph);
if (NULL != This->pToolGraph) {
*ppGraph = This->pToolGraph; if (!graph)
IDirectMusicGraph_AddRef(*ppGraph); return E_POINTER;
} else {
return E_FAIL; *graph = This->pToolGraph;
} if (This->pToolGraph) {
return S_OK; IDirectMusicGraph_AddRef(*graph);
}
return *graph ? S_OK : DMUS_E_NOT_FOUND;
} }
static HRESULT WINAPI IDirectMusicPerformance8Impl_SetGraph(IDirectMusicPerformance8 *iface, static HRESULT WINAPI IDirectMusicPerformance8Impl_SetGraph(IDirectMusicPerformance8 *iface,

View File

@ -345,7 +345,7 @@ static void test_pchannel(void)
unsigned int i; unsigned int i;
HRESULT hr; HRESULT hr;
create_performance(&perf, NULL, NULL, FALSE); create_performance(&perf, NULL, NULL, TRUE);
hr = IDirectMusicPerformance8_Init(perf, NULL, NULL, NULL); hr = IDirectMusicPerformance8_Init(perf, NULL, NULL, NULL);
ok(hr == S_OK, "Init failed: %08x\n", hr); ok(hr == S_OK, "Init failed: %08x\n", hr);
hr = IDirectMusicPerformance8_PChannelInfo(perf, 0, &port, NULL, NULL); hr = IDirectMusicPerformance8_PChannelInfo(perf, 0, &port, NULL, NULL);
@ -610,6 +610,31 @@ static void test_notification_type(void)
IDirectMusicPerformance8_Release(perf); IDirectMusicPerformance8_Release(perf);
} }
static void test_performance_graph(void)
{
HRESULT hr;
IDirectMusicPerformance8 *perf;
IDirectMusicGraph *graph = NULL, *graph2;
create_performance(&perf, NULL, NULL, FALSE);
hr = IDirectMusicPerformance8_Init(perf, NULL, NULL, NULL);
ok(hr == S_OK, "Init failed: %08x\n", hr);
hr = IDirectMusicPerformance8_GetGraph(perf, NULL);
ok(hr == E_POINTER, "Failed: %08x\n", hr);
hr = IDirectMusicPerformance8_GetGraph(perf, &graph2);
ok(hr == DMUS_E_NOT_FOUND, "Failed: %08x\n", hr);
ok(graph2 == NULL, "unexpected pointer.\n");
hr = IDirectMusicPerformance8_QueryInterface(perf, &IID_IDirectMusicGraph, (void**)&graph);
todo_wine ok(hr == S_OK, "Failed: %08x\n", hr);
if (graph)
IDirectMusicGraph_Release(graph);
destroy_performance(perf, NULL, NULL);
}
START_TEST( performance ) START_TEST( performance )
{ {
HRESULT hr; HRESULT hr;
@ -630,6 +655,7 @@ START_TEST( performance )
test_createport(); test_createport();
test_pchannel(); test_pchannel();
test_notification_type(); test_notification_type();
test_performance_graph();
CoUninitialize(); CoUninitialize();
} }