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>
feature/deterministic
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,
IDirectMusicGraph **ppGraph)
IDirectMusicGraph **graph)
{
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
FIXME("(%p, %p): to check\n", This, ppGraph);
if (NULL != This->pToolGraph) {
*ppGraph = This->pToolGraph;
IDirectMusicGraph_AddRef(*ppGraph);
} else {
return E_FAIL;
}
return S_OK;
TRACE("(%p, %p)\n", This, graph);
if (!graph)
return E_POINTER;
*graph = This->pToolGraph;
if (This->pToolGraph) {
IDirectMusicGraph_AddRef(*graph);
}
return *graph ? S_OK : DMUS_E_NOT_FOUND;
}
static HRESULT WINAPI IDirectMusicPerformance8Impl_SetGraph(IDirectMusicPerformance8 *iface,

View File

@ -345,7 +345,7 @@ static void test_pchannel(void)
unsigned int i;
HRESULT hr;
create_performance(&perf, NULL, NULL, FALSE);
create_performance(&perf, NULL, NULL, TRUE);
hr = IDirectMusicPerformance8_Init(perf, NULL, NULL, NULL);
ok(hr == S_OK, "Init failed: %08x\n", hr);
hr = IDirectMusicPerformance8_PChannelInfo(perf, 0, &port, NULL, NULL);
@ -610,6 +610,31 @@ static void test_notification_type(void)
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 )
{
HRESULT hr;
@ -630,6 +655,7 @@ START_TEST( performance )
test_createport();
test_pchannel();
test_notification_type();
test_performance_graph();
CoUninitialize();
}