msxml: extend get_nodeName, add some tests
Stefan Huehner
stefan at huehner.org
Wed Nov 2 05:43:23 CST 2005
Hi,
patch extends node.c:get_nodeName a bit and adds test-cases for the
function.
Regards,
Stefan
Changelog:
- extend get_nodeName add testcases for it
-------------- next part --------------
? 2a28d54af65c42bbe78cc1552697c29e90dd6b6d.diff
? msxml1.diff
? msxml2.diff
? msxml3.diff
Index: node.c
===================================================================
RCS file: /home/wine/wine/dlls/msxml3/node.c,v
retrieving revision 1.10
diff -u -p -r1.10 node.c
--- node.c 2 Nov 2005 10:55:03 -0000 1.10
+++ node.c 2 Nov 2005 11:33:49 -0000
@@ -178,6 +178,9 @@ static HRESULT WINAPI xmlnode_get_nodeNa
TRACE("%p\n", This );
+ if (!name)
+ return E_INVALIDARG;
+
if ( !This->node )
return E_FAIL;
@@ -186,6 +189,9 @@ static HRESULT WINAPI xmlnode_get_nodeNa
case XML_TEXT_NODE:
str = (const xmlChar*) "#text";
break;
+ case XML_DOCUMENT_NODE:
+ str = (const xmlChar*) "#document";
+ break;
default:
str = This->node->name;
break;
Index: tests/domdoc.c
===================================================================
RCS file: /home/wine/wine/dlls/msxml3/tests/domdoc.c,v
retrieving revision 1.3
diff -u -p -r1.3 domdoc.c
--- tests/domdoc.c 26 Oct 2005 10:09:22 -0000 1.3
+++ tests/domdoc.c 2 Nov 2005 11:33:49 -0000
@@ -64,6 +64,9 @@ static const WCHAR szComplete4[] = {
static const WCHAR szNonExistentFile[] = {
'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0
};
+static const WCHAR szDocument[] = {
+ '#', 'd', 'o', 'c', 'u', 'm', 'e', 'n', 't', 0
+};
static const WCHAR szOpen[] = { 'o','p','e','n',0 };
static const WCHAR szdl[] = { 'd','l',0 };
@@ -98,9 +101,9 @@ void test_domdoc( void )
ok( r == S_FALSE, "loadXML failed\n");
ok( b == VARIANT_FALSE, "failed to load XML string\n");
- /* try to laod an document from an non-existent file */
+ /* try to load an document from an non-existent file */
b = VARIANT_TRUE;
- str = SysAllocString ( szNonExistentFile );
+ str = SysAllocString( szNonExistentFile );
VariantInit(&var);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = str;
@@ -151,6 +154,19 @@ void test_domdoc( void )
ok( r == S_OK, "should be no document element\n");
}
+ /* check if nodename is correct */
+ r = IXMLDOMDocument_get_nodeName( doc, NULL );
+ ok ( r == E_INVALIDARG, "get_nodeName (NULL) wrong code");
+
+ /* content doesn't matter here */
+ str = SysAllocString( szNonExistentFile );
+ r = IXMLDOMDocument_get_nodeName( doc, &str );
+ ok ( r == S_OK, "get_nodeName wrong code\n");
+ ok ( str != NULL, "str is null\n");
+ ok( !lstrcmpW( str, szDocument ), "incorrect nodeName\n");
+ SysFreeString( str );
+
+
/* check that there's no document element */
element = NULL;
r = IXMLDOMDocument_get_documentElement( doc, &element );
@@ -279,6 +295,18 @@ void test_domnode( void )
ok( r == S_OK, "get_baseName returned wrong code\n");
ok( lstrcmpW(str,szlc) == 0, "basename was wrong\n");
+ /* check if nodename is correct */
+ r = IXMLDOMElement_get_nodeName( element, NULL );
+ ok ( r == E_INVALIDARG, "get_nodeName (NULL) wrong code");
+
+ /* content doesn't matter here */
+ str = SysAllocString( szNonExistentFile );
+ r = IXMLDOMElement_get_nodeName( element, &str );
+ ok ( r == S_OK, "get_nodeName wrong code\n");
+ ok ( str != NULL, "str is null\n");
+ ok( !lstrcmpW( str, szlc ), "incorrect nodeName\n");
+ SysFreeString( str );
+
r = IXMLDOMElement_get_attributes( element, &map );
ok( r == S_OK, "get_attributes returned wrong code\n");
ok( map != NULL, "should be attributes\n");
More information about the wine-patches
mailing list