Commit 98db0c75 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmime: Implement IDirectMusicGraph_StampPMsg.

parent 5d97483f
......@@ -112,7 +112,34 @@ static ULONG WINAPI graph_Release(IDirectMusicGraph *iface)
static HRESULT WINAPI graph_StampPMsg(IDirectMusicGraph *iface, DMUS_PMSG *msg)
{
struct graph *This = impl_from_IDirectMusicGraph(iface);
FIXME("(%p, %p): stub\n", This, msg);
struct tool_entry *entry, *next, *first;
TRACE("(%p, %p)\n", This, msg);
if (!msg) return E_POINTER;
first = LIST_ENTRY(This->tools.next, struct tool_entry, entry);
LIST_FOR_EACH_ENTRY_SAFE(entry, next, &This->tools, struct tool_entry, entry)
if (entry->tool == msg->pTool) break;
if (&entry->entry == &This->tools) next = first;
if (msg->pTool)
{
IDirectMusicTool_Release(msg->pTool);
msg->pTool = NULL;
}
if (&next->entry == &This->tools) return DMUS_S_LAST_TOOL;
if (!msg->pGraph)
{
msg->pGraph = iface;
IDirectMusicGraph_AddRef(msg->pGraph);
}
msg->pTool = next->tool;
IDirectMusicTool_AddRef(msg->pTool);
return S_OK;
}
......
......@@ -746,12 +746,12 @@ static void test_graph(void)
/* Test basic IDirectMusicGraph_StampPMsg usage */
hr = IDirectMusicGraph_StampPMsg(graph, NULL);
todo_wine ok(hr == E_POINTER, "got %#lx\n", hr);
ok(hr == E_POINTER, "got %#lx\n", hr);
memset(&msg, 0, sizeof(msg));
hr = IDirectMusicGraph_StampPMsg(graph, &msg);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == tool1, "got %p\n", msg.pTool);
ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
ok(msg.pTool == tool1, "got %p\n", msg.pTool);
ok(!msg.dwSize, "got %ld\n", msg.dwSize);
ok(!msg.rtTime, "got %I64d\n", msg.rtTime);
......@@ -766,19 +766,19 @@ static void test_graph(void)
hr = IDirectMusicGraph_StampPMsg(graph, &msg);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == tool2, "got %p\n", msg.pTool);
ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
ok(msg.pTool == tool2, "got %p\n", msg.pTool);
hr = IDirectMusicGraph_StampPMsg(graph, &msg);
todo_wine ok(hr == DMUS_S_LAST_TOOL, "got %#lx\n", hr);
todo_wine ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
ok(hr == DMUS_S_LAST_TOOL, "got %#lx\n", hr);
ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
ok(!msg.pTool, "got %p\n", msg.pTool);
hr = IDirectMusicGraph_StampPMsg(graph, &msg);
ok(hr == S_OK, "got %#lx\n", hr);
todo_wine ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == tool1, "got %p\n", msg.pTool);
if (msg.pGraph) IDirectMusicGraph_Release(msg.pGraph);
ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
ok(msg.pTool == tool1, "got %p\n", msg.pTool);
IDirectMusicGraph_Release(msg.pGraph);
msg.pGraph = NULL;
if (msg.pTool) IDirectMusicGraph_Release(msg.pTool);
IDirectMusicGraph_Release(msg.pTool);
msg.pTool = NULL;
......@@ -794,16 +794,16 @@ static void test_graph(void)
hr = IDirectMusicGraph_StampPMsg(graph, &msg);
ok(hr == S_OK, "got %#lx\n", hr);
ok(msg.pGraph == tmp_graph, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == tool2, "got %p\n", msg.pTool);
if (msg.pGraph) IDirectMusicGraph_Release(msg.pGraph);
ok(msg.pTool == tool2, "got %p\n", msg.pTool);
IDirectMusicGraph_Release(msg.pGraph);
msg.pGraph = NULL;
msg.pGraph = graph;
IDirectMusicGraph_AddRef(msg.pGraph);
hr = IDirectMusicGraph_StampPMsg(tmp_graph, &msg);
todo_wine ok(hr == DMUS_S_LAST_TOOL, "got %#lx\n", hr);
ok(hr == DMUS_S_LAST_TOOL, "got %#lx\n", hr);
ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == NULL, "got %p\n", msg.pTool);
ok(msg.pTool == NULL, "got %p\n", msg.pTool);
msg.pTool = tool2;
IDirectMusicTool_AddRef(msg.pTool);
......@@ -814,16 +814,16 @@ static void test_graph(void)
hr = IDirectMusicGraph_StampPMsg(tmp_graph, &msg);
ok(hr == S_OK, "got %#lx\n", hr);
ok(msg.pGraph == graph, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == tool1, "got %p\n", msg.pTool);
if (msg.pGraph) IDirectMusicGraph_Release(msg.pGraph);
ok(msg.pTool == tool1, "got %p\n", msg.pTool);
IDirectMusicGraph_Release(msg.pGraph);
msg.pGraph = NULL;
hr = IDirectMusicGraph_RemoveTool(graph, tool1);
ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicGraph_StampPMsg(tmp_graph, &msg);
todo_wine ok(hr == DMUS_S_LAST_TOOL, "got %#lx\n", hr);
ok(hr == DMUS_S_LAST_TOOL, "got %#lx\n", hr);
ok(msg.pGraph == NULL, "got %p\n", msg.pGraph);
todo_wine ok(msg.pTool == NULL, "got %p\n", msg.pTool);
ok(msg.pTool == NULL, "got %p\n", msg.pTool);
IDirectMusicGraph_Release(tmp_graph);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment