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 --- dlls/dmime/performance.c | 23 +++++++++++++---------- dlls/dmime/tests/performance.c | 28 +++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index f535fe888f..8b38e12eb2 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -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, diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c index 825faabc9c..cec89ca80a 100644 --- a/dlls/dmime/tests/performance.c +++ b/dlls/dmime/tests/performance.c @@ -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(); }
Signed-off-by: Michael Stefaniuc mstefani@winehq.org
On 3/17/20 6:25 AM, Alistair Leslie-Hughes wrote:
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
dlls/dmime/performance.c | 23 +++++++++++++---------- dlls/dmime/tests/performance.c | 28 +++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index f535fe888f..8b38e12eb2 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -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, diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c index 825faabc9c..cec89ca80a 100644 --- a/dlls/dmime/tests/performance.c +++ b/dlls/dmime/tests/performance.c @@ -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();
}