Commit 2a1576c0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/tests: Add some tests for node management.

parent b4c5dd49
...@@ -28,29 +28,159 @@ ...@@ -28,29 +28,159 @@
#include "initguid.h" #include "initguid.h"
#include "mfapi.h" #include "mfapi.h"
#include "mferror.h"
#include "mfidl.h" #include "mfidl.h"
#include "wine/test.h" #include "wine/test.h"
static void test_topology(void) static void test_topology(void)
{ {
IMFTopologyNode *node, *node2;
IMFTopology *topology; IMFTopology *topology;
IMFTopologyNode *node; WORD count;
HRESULT hr; HRESULT hr;
TOPOID id;
hr = MFCreateTopology(NULL); hr = MFCreateTopology(NULL);
ok(hr == E_POINTER, "got %#x\n", hr); ok(hr == E_POINTER, "got %#x\n", hr);
hr = MFCreateTopology(&topology); hr = MFCreateTopology(&topology);
ok(hr == S_OK, "got %#x\n", hr); ok(hr == S_OK, "got %#x\n", hr);
IMFTopology_Release(topology);
hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, NULL); hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node); hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node);
ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
hr = MFCreateTopologyNode(MF_TOPOLOGY_TEE_NODE, &node2);
ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
hr = IMFTopologyNode_GetTopoNodeID(node, &id);
todo_wine
ok(hr == S_OK, "Failed to get node id, hr %#x.\n", hr);
hr = IMFTopologyNode_SetTopoNodeID(node2, id);
todo_wine
ok(hr == S_OK, "Failed to set node id, hr %#x.\n", hr);
count = 1;
hr = IMFTopology_GetNodeCount(topology, &count);
todo_wine {
ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
ok(count == 0, "Unexpected node count %u.\n", count);
}
/* Same id, different nodes. */
hr = IMFTopology_AddNode(topology, node);
todo_wine
ok(hr == S_OK, "Failed to add a node, hr %#x.\n", hr);
count = 0;
hr = IMFTopology_GetNodeCount(topology, &count);
todo_wine {
ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
ok(count == 1, "Unexpected node count %u.\n", count);
}
hr = IMFTopology_AddNode(topology, node2);
todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
IMFTopologyNode_Release(node2);
hr = IMFTopology_GetNodeByID(topology, id, &node2);
todo_wine {
ok(hr == S_OK, "Failed to get a node, hr %#x.\n", hr);
ok(node2 == node, "Unexpected node.\n");
}
if (SUCCEEDED(hr))
IMFTopologyNode_Release(node2);
/* Change node id, add it again. */
hr = IMFTopologyNode_SetTopoNodeID(node, ++id);
todo_wine
ok(hr == S_OK, "Failed to set node id, hr %#x.\n", hr);
hr = IMFTopology_GetNodeByID(topology, id, &node2);
todo_wine {
ok(hr == S_OK, "Failed to get a node, hr %#x.\n", hr);
ok(node2 == node, "Unexpected node.\n");
}
if (SUCCEEDED(hr))
IMFTopologyNode_Release(node2);
hr = IMFTopology_GetNodeByID(topology, id + 1, &node2);
todo_wine
ok(hr == MF_E_NOT_FOUND, "Unexpected hr %#x.\n", hr);
hr = IMFTopology_AddNode(topology, node);
todo_wine
ok(hr == E_INVALIDARG, "Failed to add a node, hr %#x.\n", hr);
hr = IMFTopology_GetNode(topology, 0, &node2);
todo_wine {
ok(hr == S_OK, "Failed to get a node, hr %#x.\n", hr);
ok(node2 == node, "Unexpected node.\n");
}
if (SUCCEEDED(hr))
IMFTopologyNode_Release(node2);
hr = IMFTopology_GetNode(topology, 1, &node2);
todo_wine
ok(hr == MF_E_INVALIDINDEX, "Failed to get a node, hr %#x.\n", hr);
hr = IMFTopology_GetNode(topology, -2, &node2);
todo_wine
ok(hr == MF_E_INVALIDINDEX, "Failed to get a node, hr %#x.\n", hr);
hr = MFCreateTopologyNode(MF_TOPOLOGY_TEE_NODE, &node2);
ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
hr = IMFTopology_AddNode(topology, node2);
todo_wine
ok(hr == S_OK, "Failed to add a node, hr %#x.\n", hr);
IMFTopologyNode_Release(node2);
count = 0;
hr = IMFTopology_GetNodeCount(topology, &count);
todo_wine {
ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
ok(count == 2, "Unexpected node count %u.\n", count);
}
/* Remove with detached node, existing id. */
hr = MFCreateTopologyNode(MF_TOPOLOGY_TEE_NODE, &node2);
ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
hr = IMFTopologyNode_SetTopoNodeID(node2, id);
todo_wine
ok(hr == S_OK, "Failed to set node id, hr %#x.\n", hr);
hr = IMFTopology_RemoveNode(topology, node2);
todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
IMFTopologyNode_Release(node2);
hr = IMFTopology_RemoveNode(topology, node);
todo_wine
ok(hr == S_OK, "Failed to remove a node, hr %#x.\n", hr);
count = 0;
hr = IMFTopology_GetNodeCount(topology, &count);
todo_wine {
ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
ok(count == 1, "Unexpected node count %u.\n", count);
}
hr = IMFTopology_Clear(topology);
todo_wine
ok(hr == S_OK, "Failed to clear topology, hr %#x.\n", hr);
count = 1;
hr = IMFTopology_GetNodeCount(topology, &count);
todo_wine {
ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
ok(count == 0, "Unexpected node count %u.\n", count);
}
hr = IMFTopology_Clear(topology);
todo_wine
ok(hr == S_OK, "Failed to clear topology, hr %#x.\n", hr);
IMFTopologyNode_Release(node); IMFTopologyNode_Release(node);
IMFTopology_Release(topology);
} }
static HRESULT WINAPI test_getservice_QI(IMFGetService *iface, REFIID riid, void **obj) static HRESULT WINAPI test_getservice_QI(IMFGetService *iface, REFIID riid, void **obj)
......
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