mirror of
https://github.com/reactos/wine.git
synced 2025-01-31 17:23:53 +00:00
msxml3: Implement IXMLElement::removeChild() with some tests.
This commit is contained in:
parent
5afdfaba86
commit
7f5cedf70a
@ -478,7 +478,7 @@ static void test_xmlelem_children(void)
|
||||
|
||||
/* remove/add child and check what happens with collection */
|
||||
hr = IXMLElement_removeChild(element, child);
|
||||
todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
length = -1;
|
||||
hr = IXMLElementCollection_get_length(collection, &length);
|
||||
@ -522,14 +522,34 @@ static void test_xmlelem_children(void)
|
||||
hr = IXMLElementCollection_item(collection, vIndex, vName, (IDispatch **)&child2);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(child2 != NULL, "Expected not NULL child\n");
|
||||
IXMLElementCollection_Release(collection);
|
||||
|
||||
/* add element->child->child2 structure, then remove child2 from node */
|
||||
V_VT(&vType) = VT_I4;
|
||||
V_I4(&vType) = XMLELEMTYPE_TEXT;
|
||||
V_VT(&vName) = VT_NULL;
|
||||
hr = IXMLDocument_createElement(doc, vType, vName, &child2);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(child2 != NULL, "Expected non-NULL child\n");
|
||||
|
||||
hr = IXMLElement_addChild(child, child2, 0, -1);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
hr = IXMLElement_removeChild(element, child2);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
|
||||
hr = IXMLElement_removeChild(child, child2);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
|
||||
hr = IXMLElement_removeChild(child, NULL);
|
||||
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
|
||||
|
||||
IXMLElement_Release(element);
|
||||
IXMLElement_Release(child);
|
||||
IXMLElementCollection_Release(collection);
|
||||
IXMLElement_Release(child2);
|
||||
IXMLDocument_Release(doc);
|
||||
}
|
||||
|
||||
|
||||
static BOOL test_try_xmldoc(void)
|
||||
{
|
||||
IXMLDocument *doc = NULL;
|
||||
|
@ -412,8 +412,21 @@ static HRESULT WINAPI xmlelem_addChild(IXMLElement *iface, IXMLElement *pChildEl
|
||||
|
||||
static HRESULT WINAPI xmlelem_removeChild(IXMLElement *iface, IXMLElement *pChildElem)
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", iface, pChildElem);
|
||||
return E_NOTIMPL;
|
||||
xmlelem *This = impl_from_IXMLElement(iface);
|
||||
xmlelem *childElem = impl_from_IXMLElement(pChildElem);
|
||||
|
||||
TRACE("(%p, %p)\n", This, childElem);
|
||||
|
||||
if (!pChildElem)
|
||||
return E_INVALIDARG;
|
||||
|
||||
/* only supported for This is childElem parent case */
|
||||
if (This->node != childElem->node->parent)
|
||||
return E_INVALIDARG;
|
||||
|
||||
xmlUnlinkNode(childElem->node);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct IXMLElementVtbl xmlelem_vtbl =
|
||||
|
Loading…
x
Reference in New Issue
Block a user