[MSXML3_WINETEST]
[reactos.git] / rostests / winetests / msxml3 / schema.c
index e9299cd..d9d99e6 100644 (file)
@@ -34,6 +34,7 @@
 #include <winnls.h>
 #include <ole2.h>
 #include <msxml2.h>
+#undef CLSID_DOMDocument
 #include <msxml2did.h>
 #include <dispex.h>
 
@@ -1282,24 +1283,20 @@ static void test_XDR_datatypes(void)
     while (ptr->query)
     {
         IXMLDOMNode* node = NULL;
-        VARIANT type, testv;
+        VARIANT type;
 
         /* check data types without the schema */
-        memset(&testv, -1, sizeof(VARIANT));
-        V_VT(&testv) = VT_NULL;
-        V_BSTR(&testv) = NULL;
-
         hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_(ptr->query), &node);
         EXPECT_HR(hr, S_OK);
         ok(node != NULL, "expected node\n");
 
-        memset(&type, -1, sizeof(VARIANT));
         V_VT(&type) = VT_EMPTY;
+        V_BSTR(&type) = (void*)-1;
         hr = IXMLDOMNode_get_dataType(node, &type);
         EXPECT_HR(hr, S_FALSE);
         ok(V_VT(&type) == VT_NULL, "got type %i\n", V_VT(&type));
         /* when returning VT_NULL, the pointer is set to NULL */
-        ok(!memcmp(&testv, &type, sizeof(VARIANT)), "got %p\n", V_BSTR(&type));
+        ok(V_BSTR(&type) == NULL, "got %p\n", V_BSTR(&type));
 
         VariantClear(&type);
         hr = IXMLDOMNode_get_nodeTypedValue(node, &type);
@@ -1423,6 +1420,7 @@ static void test_validate_on_load(void)
 
 static void test_obj_dispex(IUnknown *obj)
 {
+    static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0};
     static const WCHAR starW[] = {'*',0};
     DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE;
     IDispatchEx *dispex;
@@ -1461,9 +1459,15 @@ static void test_obj_dispex(IUnknown *obj)
     hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid);
     EXPECT_HR(hr, E_NOTIMPL);
 
+    unk = (IUnknown*)0xdeadbeef;
     hr = IDispatchEx_GetNameSpaceParent(dispex, &unk);
     EXPECT_HR(hr, E_NOTIMPL);
-    if (hr == S_OK && unk) IUnknown_Release(unk);
+    ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
+
+    name = SysAllocString(testW);
+    hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid);
+    ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr);
+    SysFreeString(name);
 
     IDispatchEx_Release(dispex);
 }
@@ -1503,8 +1507,14 @@ static void test_dispex(void)
     ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
 
     IDispatchEx_Release(dispex);
-
     IXMLDOMSchemaCollection_Release(cache);
+
+    cache = create_cache_version(60, &IID_IXMLDOMSchemaCollection);
+    if (cache)
+    {
+        test_obj_dispex((IUnknown*)cache);
+        IXMLDOMSchemaCollection_Release(cache);
+    }
 }
 
 static void test_get(void)
@@ -1517,7 +1527,7 @@ static void test_get(void)
     if (!cache) return;
 
     hr = IXMLDOMSchemaCollection2_get(cache, NULL, NULL);
-    EXPECT_HR(hr, E_NOTIMPL);
+    ok(hr == E_NOTIMPL || hr == E_POINTER /* win8 */, "got %08x\n", hr);
 
     hr = IXMLDOMSchemaCollection2_get(cache, _bstr_("uri"), &node);
     EXPECT_HR(hr, E_NOTIMPL);