From 398e64941472273e9a0b3d39410c6843f19efd51 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 6 Sep 2010 23:26:39 +0400 Subject: [PATCH] msxml3/tests: Basic test for ::setAttributeNode(). --- dlls/msxml3/element.c | 4 +++ dlls/msxml3/tests/domdoc.c | 53 +++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 0e8559acba..e65da626f5 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -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; } diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 06532d6717..4317c520b8 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -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(); } -- 2.32.0.93.g670b81a890