>From 9355dbe934929763d3829950943e425e60071d42 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Mon, 9 Jan 2012 00:21:53 +0300
Subject: [PATCH 12/13] Some put_dataType() tests for nodes without typed data

---
 dlls/msxml3/cdata.c        |    4 +-
 dlls/msxml3/comment.c      |    2 +-
 dlls/msxml3/docfrag.c      |    2 +-
 dlls/msxml3/entityref.c    |    2 +-
 dlls/msxml3/pi.c           |    2 +-
 dlls/msxml3/tests/domdoc.c |   77 ++++++++++++++++++++++++++++----------------
 6 files changed, 55 insertions(+), 34 deletions(-)

diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c
index 0058314..c6d1f8c 100644
--- a/dlls/msxml3/cdata.c
+++ b/dlls/msxml3/cdata.c
@@ -42,7 +42,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
 
 #ifdef HAVE_LIBXML2
 
-typedef struct _domcdata
+typedef struct
 {
     xmlnode node;
     IXMLDOMCDATASection IXMLDOMCDATASection_iface;
@@ -436,7 +436,7 @@ static HRESULT WINAPI domcdata_put_dataType(
 {
     domcdata *This = impl_from_IXMLDOMCDATASection( iface );
 
-    FIXME("(%p)->(%s)\n", This, debugstr_w(p));
+    TRACE("(%p)->(%s)\n", This, debugstr_w(p));
 
     if(!p)
         return E_INVALIDARG;
diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index 5663632..f1f94c6 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -435,7 +435,7 @@ static HRESULT WINAPI domcomment_put_dataType(
 {
     domcomment *This = impl_from_IXMLDOMComment( iface );
 
-    FIXME("(%p)->(%s)\n", This, debugstr_w(p));
+    TRACE("(%p)->(%s)\n", This, debugstr_w(p));
 
     if(!p)
         return E_INVALIDARG;
diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c
index 435712c..cedd258 100644
--- a/dlls/msxml3/docfrag.c
+++ b/dlls/msxml3/docfrag.c
@@ -433,7 +433,7 @@ static HRESULT WINAPI domfrag_put_dataType(
 {
     domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
 
-    FIXME("(%p)->(%s)\n", This, debugstr_w(p));
+    TRACE("(%p)->(%s)\n", This, debugstr_w(p));
 
     if(!p)
         return E_INVALIDARG;
diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c
index b6b0ae4..313fc2e 100644
--- a/dlls/msxml3/entityref.c
+++ b/dlls/msxml3/entityref.c
@@ -428,7 +428,7 @@ static HRESULT WINAPI entityref_put_dataType(
 {
     entityref *This = impl_from_IXMLDOMEntityReference( iface );
 
-    FIXME("(%p)->(%s)\n", This, debugstr_w(p));
+    TRACE("(%p)->(%s)\n", This, debugstr_w(p));
 
     if(!p)
         return E_INVALIDARG;
diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c
index 23027a1..332d97c 100644
--- a/dlls/msxml3/pi.c
+++ b/dlls/msxml3/pi.c
@@ -506,7 +506,7 @@ static HRESULT WINAPI dom_pi_put_dataType(
 {
     dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
 
-    FIXME("(%p)->(%s)\n", This, debugstr_w(p));
+    TRACE("(%p)->(%s)\n", This, debugstr_w(p));
 
     if(!p)
         return E_INVALIDARG;
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index d737d7f..5ed8715 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -6777,10 +6777,26 @@ static put_datatype_t put_datatype_data[] = {
     { NULL }
 };
 
-static void test_nodeTypeTests( void )
+typedef struct {
+    DOMNodeType type;
+    HRESULT hr;
+} put_datatype_notype_t;
+
+static put_datatype_notype_t put_dt_notype[] = {
+    { NODE_PROCESSING_INSTRUCTION, E_FAIL },
+    { NODE_DOCUMENT_FRAGMENT,      E_FAIL },
+    { NODE_ENTITY_REFERENCE,       E_FAIL },
+    { NODE_CDATA_SECTION,          E_FAIL },
+    { NODE_COMMENT,                E_FAIL },
+    { NODE_INVALID }
+};
+
+static void test_put_dataType( void )
 {
+    const put_datatype_notype_t *ptr2 = put_dt_notype;
     const put_datatype_t *ptr = put_datatype_data;
     IXMLDOMElement *root, *element;
+    BSTR nameW, type1W, type2W;
     IXMLDOMDocument *doc;
     HRESULT hr;
 
@@ -6831,6 +6847,38 @@ static void test_nodeTypeTests( void )
 
     IXMLDOMElement_Release(element);
 
+    /* try to set type for node without a type */
+    nameW  = _bstr_("testname");
+    type1W = _bstr_("string");
+    type2W = _bstr_("number");
+    while (ptr2->type != NODE_INVALID)
+    {
+        IXMLDOMNode *node;
+        VARIANT type;
+
+        V_VT(&type) = VT_I2;
+        V_I2(&type) = ptr2->type;
+
+        hr = IXMLDOMDocument_createNode(doc, type, nameW, NULL, &node);
+        EXPECT_HR(hr, S_OK);
+        if(hr == S_OK)
+        {
+            hr = IXMLDOMElement_appendChild(root, node, NULL);
+            EXPECT_HR(hr, S_OK);
+
+            hr = IXMLDOMNode_put_dataType(node, NULL);
+            EXPECT_HR(hr, E_INVALIDARG);
+
+            hr = IXMLDOMNode_put_dataType(node, type1W);
+            ok(hr == ptr2->hr, "failed for type %d, 0x%08x\n", ptr2->type, ptr->hr);
+            hr = IXMLDOMNode_put_dataType(node, type2W);
+            ok(hr == ptr2->hr, "failed for type %d, 0x%08x\n", ptr2->type, ptr->hr);
+
+            IXMLDOMNode_Release(node);
+        }
+        ptr2++;
+    }
+
     IXMLDOMElement_Release(root);
     IXMLDOMDocument_Release(doc);
     free_bstrs();
@@ -8490,32 +8538,6 @@ static void test_setAttributeNode(void)
     free_bstrs();
 }
 
-static void test_put_dataType(void)
-{
-    IXMLDOMCDATASection *cdata;
-    IXMLDOMDocument *doc;
-    VARIANT_BOOL b;
-    HRESULT hr;
-
-    doc = create_document(&IID_IXMLDOMDocument);
-    if (!doc) return;
-
-    hr = IXMLDOMDocument_loadXML( doc, _bstr_(complete4A), &b );
-    ok( hr == S_OK, "loadXML failed\n");
-    ok( b == VARIANT_TRUE, "failed to load XML string\n");
-
-    hr = IXMLDOMDocument_createCDATASection(doc, _bstr_("test"), &cdata);
-    ok( hr == S_OK, "got 0x%08x\n", hr);
-    hr = IXMLDOMCDATASection_put_dataType(cdata, _bstr_("number"));
-    ok( hr == E_FAIL, "got 0x%08x\n", hr);
-    hr = IXMLDOMCDATASection_put_dataType(cdata, _bstr_("string"));
-    ok( hr == E_FAIL, "got 0x%08x\n", hr);
-    IXMLDOMCDATASection_Release(cdata);
-
-    IXMLDOMDocument_Release(doc);
-    free_bstrs();
-}
-
 static void test_createNode(void)
 {
     IXMLDOMDocument *doc;
@@ -11062,7 +11084,6 @@ START_TEST(domdoc)
     test_XSLPattern();
     test_cloneNode();
     test_xmlTypes();
-    test_nodeTypeTests();
     test_save();
     test_testTransforms();
     test_namespaces();
-- 
1.5.6.5


