msxml3/tests: Basic test for ::setAttributeNode().

This commit is contained in:
Nikolay Sivov 2010-09-06 23:26:39 +04:00 committed by Alexandre Julliard
parent 97e78d9a0e
commit 398e649414
2 changed files with 56 additions and 1 deletions

View File

@ -661,7 +661,11 @@ static HRESULT WINAPI domelem_setAttributeNode(
IXMLDOMAttribute** attributeNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
FIXME("(%p)->(%p %p)\n", This, domAttribute, attributeNode);
if(!domAttribute) return E_INVALIDARG;
return E_NOTIMPL;
}

View File

@ -5932,6 +5932,57 @@ static void test_get_ownerDocument(void)
free_bstrs();
}
static void test_setAttributeNode(void)
{
IXMLDOMDocument *doc;
IXMLDOMElement *elem;
IXMLDOMAttribute *attr, *attr2, *ret_attr;
VARIANT_BOOL b;
HRESULT hr;
BSTR str;
doc = create_document(&IID_IXMLDOMDocument);
if (!doc) return;
str = SysAllocString( szComplete4 );
hr = IXMLDOMDocument2_loadXML( doc, str, &b );
ok( hr == S_OK, "loadXML failed\n");
ok( b == VARIANT_TRUE, "failed to load XML string\n");
SysFreeString( str );
hr = IXMLDOMDocument_get_documentElement(doc, &elem);
ok( hr == S_OK, "got 0x%08x\n", hr);
ret_attr = (void*)0xdeadbeef;
hr = IXMLDOMElement_setAttributeNode(elem, NULL, &ret_attr);
ok( hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok( ret_attr == (void*)0xdeadbeef, "got %p\n", ret_attr);
hr = IXMLDOMDocument_createAttribute(doc, _bstr_("attr"), &attr);
ok( hr == S_OK, "got 0x%08x\n", hr);
ret_attr = (void*)0xdeadbeef;
hr = IXMLDOMElement_setAttributeNode(elem, attr, &ret_attr);
todo_wine ok( hr == S_OK, "got 0x%08x\n", hr);
todo_wine ok( ret_attr == NULL, "got %p\n", ret_attr);
attr2 = NULL;
hr = IXMLDOMElement_getAttributeNode(elem, _bstr_("attr"), &attr2);
todo_wine ok( hr == S_OK, "got 0x%08x\n", hr);
if (attr2) IXMLDOMAttribute_Release(attr2);
/* try to add it another time */
ret_attr = (void*)0xdeadbeef;
hr = IXMLDOMElement_setAttributeNode(elem, attr, &ret_attr);
todo_wine ok( hr == E_FAIL, "got 0x%08x\n", hr);
ok( ret_attr == (void*)0xdeadbeef, "got %p\n", ret_attr);
IXMLDOMAttribute_Release(attr);
IXMLDOMElement_Release(elem);
IXMLDOMDocument_Release(doc);
free_bstrs();
}
START_TEST(domdoc)
{
IXMLDOMDocument *doc;
@ -5951,7 +6002,6 @@ START_TEST(domdoc)
return;
}
IXMLDOMDocument_Release(doc);
test_domdoc();
@ -5985,6 +6035,7 @@ START_TEST(domdoc)
test_getQualifiedItem();
test_removeQualifiedItem();
test_get_ownerDocument();
test_setAttributeNode();
CoUninitialize();
}