webservices: Implement WsSetWriterPosition.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-06-21 14:04:48 +02:00 committed by Alexandre Julliard
parent 600e2e53c8
commit 511c21d309
3 changed files with 66 additions and 1 deletions

View File

@ -1532,6 +1532,53 @@ static void test_WsGetWriterPosition(void)
WsFreeHeap( heap );
}
static void test_WsSetWriterPosition(void)
{
WS_HEAP *heap;
WS_XML_WRITER *writer;
WS_XML_BUFFER *buf1, *buf2;
WS_XML_NODE_POSITION pos;
HRESULT hr;
hr = WsCreateHeap( 1 << 16, 0, NULL, 0, &heap, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsSetWriterPosition( NULL, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateWriter( NULL, 0, &writer, NULL ) ;
ok( hr == S_OK, "got %08x\n", hr );
hr = WsCreateXmlBuffer( heap, NULL, 0, &buf1, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsSetOutputToBuffer( writer, buf1, NULL, 0, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsSetWriterPosition( writer, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
pos.buffer = pos.node = NULL;
hr = WsGetWriterPosition( writer, &pos, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( pos.buffer == buf1, "wrong buffer\n" );
ok( pos.node != NULL, "node not set\n" );
hr = WsSetWriterPosition( writer, &pos, NULL );
ok( hr == S_OK, "got %08x\n", hr );
/* different buffer */
hr = WsCreateXmlBuffer( heap, NULL, 0, &buf2, NULL );
ok( hr == S_OK, "got %08x\n", hr );
pos.buffer = buf2;
hr = WsSetWriterPosition( writer, &pos, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
WsFreeWriter( writer );
WsFreeHeap( heap );
}
START_TEST(writer)
{
test_WsCreateWriter();
@ -1552,4 +1599,5 @@ START_TEST(writer)
test_complex_struct_type();
test_WsMoveWriter();
test_WsGetWriterPosition();
test_WsSetWriterPosition();
}

View File

@ -157,7 +157,7 @@
@ stdcall WsSetOutput(ptr ptr ptr ptr long ptr)
@ stdcall WsSetOutputToBuffer(ptr ptr ptr long ptr)
@ stub WsSetReaderPosition
@ stub WsSetWriterPosition
@ stdcall WsSetWriterPosition(ptr ptr ptr)
@ stub WsShutdownSessionChannel
@ stub WsSkipNode
@ stub WsStartReaderCanonicalization

View File

@ -1819,3 +1819,20 @@ HRESULT WINAPI WsGetWriterPosition( WS_XML_WRITER *handle, WS_XML_NODE_POSITION
pos->node = writer->current;
return S_OK;
}
/**************************************************************************
* WsSetWriterPosition [webservices.@]
*/
HRESULT WINAPI WsSetWriterPosition( WS_XML_WRITER *handle, const WS_XML_NODE_POSITION *pos, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
TRACE( "%p %p %p\n", handle, pos, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!writer || !pos || (struct xmlbuf *)pos->buffer != writer->output_buf) return E_INVALIDARG;
if (!writer->output_type) return WS_E_INVALID_OPERATION;
writer->current = pos->node;
return S_OK;
}