msxml3/tests: Tests for IXMLDOMText::splitText(), stub is extended a bit.

This commit is contained in:
Nikolay Sivov 2010-08-30 01:32:37 +04:00 committed by Alexandre Julliard
parent 92a574b44b
commit a0e7b3b93a
2 changed files with 56 additions and 3 deletions

View File

@ -5614,7 +5614,7 @@ static void test_splitText(void)
IXMLDOMCDATASection *cdata;
IXMLDOMElement *root;
IXMLDOMDocument *doc;
IXMLDOMText *text;
IXMLDOMText *text, *text2;
IXMLDOMNode *node;
VARIANT var;
VARIANT_BOOL success;
@ -5684,6 +5684,46 @@ static void test_splitText(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
IXMLDOMNode_Release(node);
/* split new text node */
hr = IXMLDOMText_get_length(text, &length);
ok(hr == S_OK, "got 0x%08x\n", hr);
node = (void*)0xdeadbeef;
hr = IXMLDOMText_get_nextSibling(text, &node);
ok(hr == S_FALSE, "got 0x%08x\n", hr);
ok(node == 0, "got %p\n", text);
hr = IXMLDOMText_splitText(text, 0, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
text2 = (void*)0xdeadbeef;
/* negative offset */
hr = IXMLDOMText_splitText(text, -1, &text2);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(text2 == (void*)0xdeadbeef, "got %p\n", text2);
text2 = (void*)0xdeadbeef;
/* offset outside data */
hr = IXMLDOMText_splitText(text, length + 1, &text2);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(text2 == 0, "got %p\n", text2);
text2 = (void*)0xdeadbeef;
/* offset outside data */
hr = IXMLDOMText_splitText(text, length, &text2);
ok(hr == S_FALSE, "got 0x%08x\n", hr);
ok(text2 == 0, "got %p\n", text);
text2 = 0;
hr = IXMLDOMText_splitText(text, 4, &text2);
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
if (text2) IXMLDOMText_Release(text2);
node = 0;
hr = IXMLDOMText_get_nextSibling(text, &node);
todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
if (node) IXMLDOMNode_Release(node);
IXMLDOMText_Release(text);
IXMLDOMElement_Release(root);
IXMLDOMCDATASection_Release(cdata);

View File

@ -726,11 +726,24 @@ static HRESULT WINAPI domtext_splitText(
LONG offset, IXMLDOMText **txtNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
FIXME("(%p)->(%d %p)\n", This, offset, txtNode);
LONG length = 0;
TRACE("(%p)->(%d %p)\n", This, offset, txtNode);
if (!txtNode || offset < 0) return E_INVALIDARG;
*txtNode = NULL;
IXMLDOMText_get_length(iface, &length);
if (offset > length) return E_INVALIDARG;
if (offset == length) return S_FALSE;
FIXME("adjacent text nodes are not supported\n");
return E_NOTIMPL;
}
static const struct IXMLDOMTextVtbl domtext_vtbl =
{
domtext_QueryInterface,