wine/dlls/msxml3 tests/domdoc.c node.c

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 2 13:55:30 CST 2005


ChangeSet ID:	21050
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/02 13:55:30

Modified files:
	dlls/msxml3/tests: domdoc.c 
	dlls/msxml3    : node.c 

Log message:
	Stefan Huehner <stefan at huehner.org>
	Extend get_nodeName add testcases for it.

Patch: http://cvs.winehq.org/patch.py?id=21050

Old revision  New revision  Changes     Path
 1.3           1.4           +30 -2      wine/dlls/msxml3/tests/domdoc.c
 1.10          1.11          +6 -0       wine/dlls/msxml3/node.c

Index: wine/dlls/msxml3/tests/domdoc.c
diff -u -p wine/dlls/msxml3/tests/domdoc.c:1.3 wine/dlls/msxml3/tests/domdoc.c:1.4
--- wine/dlls/msxml3/tests/domdoc.c:1.3	2 Nov 2005 19:55:30 -0000
+++ wine/dlls/msxml3/tests/domdoc.c	2 Nov 2005 19:55:30 -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");
Index: wine/dlls/msxml3/node.c
diff -u -p wine/dlls/msxml3/node.c:1.10 wine/dlls/msxml3/node.c:1.11
--- wine/dlls/msxml3/node.c:1.10	2 Nov 2005 19:55:30 -0000
+++ wine/dlls/msxml3/node.c	2 Nov 2005 19:55:30 -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;



More information about the wine-cvs mailing list