From fbc08085da8b5512204aae1c0a56909fea72be89 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 10 Feb 2016 15:02:08 +0100 Subject: [PATCH] webservices/tests: Add tests. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/webservices/tests/reader.c | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c index 555226d92d8..4416a846ec5 100644 --- a/dlls/webservices/tests/reader.c +++ b/dlls/webservices/tests/reader.c @@ -1702,6 +1702,63 @@ static void test_WsMoveReader(void) ok( hr == S_OK, "got %08x\n", hr ); ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", elem->node.nodeType ); + hr = WsMoveReader( reader, WS_MOVE_TO_ROOT_ELEMENT, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + elem = (WS_XML_ELEMENT_NODE *)node; + ok( elem->node.nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", elem->node.nodeType ); + ok( elem->localName->length == 1, "got %u\n", elem->localName->length ); + ok( !memcmp( elem->localName->bytes, "a", 1 ), "wrong data\n" ); + + hr = WsMoveReader( reader, WS_MOVE_TO_CHILD_ELEMENT, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + elem = (WS_XML_ELEMENT_NODE *)node; + ok( elem->node.nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", elem->node.nodeType ); + ok( elem->localName->length == 1, "got %u\n", elem->localName->length ); + ok( !memcmp( elem->localName->bytes, "b", 1 ), "wrong data\n" ); + + hr = WsMoveReader( reader, WS_MOVE_TO_END_ELEMENT, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( node->nodeType == WS_XML_NODE_TYPE_END_ELEMENT, "got %u\n", elem->node.nodeType ); + + hr = WsMoveReader( reader, WS_MOVE_TO_PARENT_ELEMENT, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + elem = (WS_XML_ELEMENT_NODE *)node; + ok( elem->node.nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", elem->node.nodeType ); + ok( elem->localName->length == 1, "got %u\n", elem->localName->length ); + ok( !memcmp( elem->localName->bytes, "b", 1 ), "wrong data\n" ); + + hr = WsMoveReader( reader, WS_MOVE_TO_PARENT_ELEMENT, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + elem = (WS_XML_ELEMENT_NODE *)node; + ok( elem->node.nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", elem->node.nodeType ); + ok( elem->localName->length == 1, "got %u\n", elem->localName->length ); + ok( !memcmp( elem->localName->bytes, "a", 1 ), "wrong data\n" ); + + hr = WsMoveReader( reader, WS_MOVE_TO_PARENT_ELEMENT, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsGetReaderNode( reader, &node, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( node->nodeType == WS_XML_NODE_TYPE_BOF, "got %u\n", elem->node.nodeType ); + + hr = WsMoveReader( reader, WS_MOVE_TO_PARENT_ELEMENT, NULL, NULL ); + ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr ); + WsFreeReader( reader ); WsFreeWriter( writer ); WsFreeHeap( heap );