ReactOS 0.4.16-dev-1946-g52006dd
schema.c File Reference
#include <stdio.h>
#include <assert.h>
#include "initguid.h"
#include "windows.h"
#include "ole2.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "dispex.h"
#include "cguid.h"
#include "wine/test.h"
Include dependency graph for schema.c:

Go to the source code of this file.

Classes

struct  xdr_datatypes
 

Macros

#define COBJMACROS
 
#define _expect64(expr, str, base, TYPE, CONV)
 
#define expect_int64(expr, x, base)   _expect64(expr, #x, base, LONG64, strtoll)
 
#define expect_uint64(expr, x, base)   _expect64(expr, #x, base, ULONG64, strtoull)
 
#define _create(cls)   cls, #cls
 
#define create_document(iid)   _create_object(&_create(CLSID_DOMDocument), iid, __LINE__)
 
#define create_document_version(v, iid)   _create_object(&_create(CLSID_DOMDocument ## v), iid, __LINE__)
 
#define create_cache(iid)   _create_object(&_create(CLSID_XMLSchemaCache), iid, __LINE__)
 
#define create_cache_version(v, iid)   _create_object(&_create(CLSID_XMLSchemaCache ## v), iid, __LINE__)
 

Functions

static ULONG get_refcount (void *iface)
 
static BSTR _bstr_ (const WCHAR *str)
 
static void free_bstrs (void)
 
static VARIANT _variantdoc_ (void *doc)
 
static void_create_object (const GUID *clsid, const char *name, const IID *iid, int line)
 
static void test_schema_refs (void)
 
static void test_collection_refs (void)
 
static void test_length (void)
 
static void test_collection_content (void)
 
static void test_XDR_schemas (void)
 
static void test_XDR_datatypes (void)
 
static void test_obj_dispex (IUnknown *obj)
 
static void test_dispex (void)
 
 START_TEST (schema)
 

Variables

static const WCHAR xdr_schema1_uri [] = L"x-schema:test1.xdr"
 
static const WCHAR xdr_schema1_xml []
 
static const WCHAR xdr_schema2_uri [] = L"x-schema:test2.xdr"
 
static const WCHAR xdr_schema2_xml []
 
static const WCHAR xdr_schema3_uri [] = L"x-schema:test3.xdr"
 
static const WCHAR xdr_schema3_xml []
 
static const WCHAR xsd_schema1_uri [] = L"x-schema:test1.xsd"
 
static const WCHAR szDatatypeXDR []
 
static const WCHAR szDatatypeXML []
 
static const WCHAR szOpenSeqXDR []
 
static const WCHAR szOpenSeqXML1 [] = L"<test><x/><x/><y/><z/><z/></test>"
 
static const WCHAR szOpenSeqXML2 [] = L"<test><x/><x/><y/><z/><z/><w/></test>"
 
static const WCHAR szOpenSeqXML3 [] = L"<test><w/><x/><x/><y/><z/><z/></test>"
 
static const WCHAR szOpenSeqXML4 [] = L"<test><x/><x/><y/><z/><z/><v/></test>"
 
static BSTR alloced_bstrs [256]
 
static int alloced_bstrs_count
 
static const xdr_datatypes xdr_datatypes_data []
 

Macro Definition Documentation

◆ _create

#define _create (   cls)    cls, #cls

Definition at line 414 of file schema.c.

◆ _expect64

#define _expect64 (   expr,
  str,
  base,
  TYPE,
  CONV 
)
Value:
{ \
TYPE v1 = expr; \
TYPE v2 = CONV(str, NULL, base); \
ok(v1 == v2, #expr "returned %s, expected %s\n", \
}
#define NULL
Definition: types.h:112
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
TYPE
Definition: eventcreate.c:652
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
const WCHAR * str
Definition: query.h:86

Definition at line 366 of file schema.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file schema.c.

◆ create_cache

#define create_cache (   iid)    _create_object(&_create(CLSID_XMLSchemaCache), iid, __LINE__)

Definition at line 420 of file schema.c.

◆ create_cache_version

#define create_cache_version (   v,
  iid 
)    _create_object(&_create(CLSID_XMLSchemaCache ## v), iid, __LINE__)

Definition at line 422 of file schema.c.

◆ create_document

#define create_document (   iid)    _create_object(&_create(CLSID_DOMDocument), iid, __LINE__)

Definition at line 416 of file schema.c.

◆ create_document_version

#define create_document_version (   v,
  iid 
)    _create_object(&_create(CLSID_DOMDocument ## v), iid, __LINE__)

Definition at line 418 of file schema.c.

◆ expect_int64

#define expect_int64 (   expr,
  x,
  base 
)    _expect64(expr, #x, base, LONG64, strtoll)

Definition at line 373 of file schema.c.

◆ expect_uint64

#define expect_uint64 (   expr,
  x,
  base 
)    _expect64(expr, #x, base, ULONG64, strtoull)

Definition at line 374 of file schema.c.

Function Documentation

◆ _bstr_()

static BSTR _bstr_ ( const WCHAR str)
static

Definition at line 379 of file schema.c.

380{
384}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define assert(x)
Definition: debug.h:53
static BSTR alloced_bstrs[256]
Definition: schema.c:376
static int alloced_bstrs_count
Definition: schema.c:377
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

Referenced by test_collection_content(), test_collection_refs(), test_length(), test_XDR_datatypes(), and test_XDR_schemas().

◆ _create_object()

static void * _create_object ( const GUID clsid,
const char name,
const IID iid,
int  line 
)
static

Definition at line 402 of file schema.c.

403{
404 void *obj = NULL;
405 HRESULT hr;
406
407 hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &obj);
408 if (hr != S_OK)
409 win_skip_(__FILE__,line)("failed to create %s instance: hr %#lx.\n", name, hr);
410
411 return obj;
412}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:52
#define win_skip_(file, line)
Definition: minitest.h:61
const CLSID * clsid
Definition: msctf.cpp:50
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:49
Definition: name.c:39

◆ _variantdoc_()

static VARIANT _variantdoc_ ( void doc)
static

Definition at line 394 of file schema.c.

395{
396 VARIANT v;
397 V_VT(&v) = VT_DISPATCH;
398 V_DISPATCH(&v) = (IDispatch*)doc;
399 return v;
400}
@ VT_DISPATCH
Definition: compat.h:2304
const GLdouble * v
Definition: gl.h:2040
#define V_VT(A)
Definition: oleauto.h:211
#define V_DISPATCH(A)
Definition: oleauto.h:239

Referenced by test_collection_content(), test_collection_refs(), test_length(), and test_schema_refs().

◆ free_bstrs()

static void free_bstrs ( void  )
static

Definition at line 386 of file schema.c.

387{
388 int i;
389 for (i = 0; i < alloced_bstrs_count; i++)
392}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by test_collection_content(), test_collection_refs(), test_length(), test_XDR_datatypes(), and test_XDR_schemas().

◆ get_refcount()

static ULONG get_refcount ( void iface)
static

Definition at line 360 of file schema.c.

361{
362 IUnknown_AddRef((IUnknown *)iface);
363 return IUnknown_Release((IUnknown *)iface);
364}

Referenced by test_collection_refs(), and test_schema_refs().

◆ START_TEST()

START_TEST ( schema  )

Definition at line 1553 of file schema.c.

1554{
1555 HRESULT r;
1556
1557 r = CoInitialize( NULL );
1558 ok( r == S_OK, "failed to init com\n");
1559
1562 test_length();
1566 test_dispex();
1567
1569}
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void test_XDR_schemas(void)
Definition: schema.c:1044
static void test_collection_refs(void)
Definition: schema.c:633
static void test_XDR_datatypes(void)
Definition: schema.c:1244
static void test_length(void)
Definition: schema.c:826
static void test_schema_refs(void)
Definition: schema.c:424
static void test_collection_content(void)
Definition: schema.c:938
static void test_dispex(void)
Definition: schema.c:1515

◆ test_collection_content()

static void test_collection_content ( void  )
static

Definition at line 938 of file schema.c.

939{
940 IXMLDOMDocument2 *schema1, *schema2, *schema3;
941 BSTR content[5] = {NULL, NULL, NULL, NULL, NULL};
942 IXMLDOMSchemaCollection *cache1;
944 LONG length;
945 HRESULT hr;
946 BSTR bstr;
947 int i, j;
948
949 schema1 = create_document_version(30, &IID_IXMLDOMDocument2);
950 schema2 = create_document_version(30, &IID_IXMLDOMDocument2);
951 schema3 = create_document_version(30, &IID_IXMLDOMDocument2);
952
953 cache1 = create_cache_version(30, &IID_IXMLDOMSchemaCollection);
954
955 if (!schema1 || !schema2 || !schema3 || !cache1)
956 {
957 if (schema1) IXMLDOMDocument2_Release(schema1);
958 if (schema2) IXMLDOMDocument2_Release(schema2);
959 if (schema3) IXMLDOMDocument2_Release(schema3);
960
961 if (cache1) IXMLDOMSchemaCollection_Release(cache1);
962
963 return;
964 }
965
966 hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
967 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
968 ok(b == VARIANT_TRUE, "failed to load XML\n");
969
970 hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
971 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
972 ok(b == VARIANT_TRUE, "failed to load XML\n");
973
974 hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b);
975 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
976 ok(b == VARIANT_TRUE, "failed to load XML\n");
977
978 hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
979 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
980 hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
981 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
982 hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
983 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
984
985 length = -1;
986 hr = IXMLDOMSchemaCollection_get_length(cache1, &length);
987 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
988 ok(length == 3, "Unexpected length %ld.\n", length);
989
990 IXMLDOMDocument2_Release(schema1);
991 IXMLDOMDocument2_Release(schema2);
992 IXMLDOMDocument2_Release(schema3);
993
994 bstr = (void*)0xdeadbeef;
995 /* error if index is out of range */
996 hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 3, &bstr);
997 ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
998 ok(bstr == (void*)0xdeadbeef, "got %p\n", bstr);
999 /* error if return pointer is NULL */
1000 hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 0, NULL);
1001 ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
1002 /* pointer is checked first */
1003 hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, 3, NULL);
1004 ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
1005
1006 schema1 = NULL;
1007 /* no error if ns uri does not exist */
1008 hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xsd_schema1_uri), (IXMLDOMNode**)&schema1);
1009 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1010 ok(!schema1, "expected NULL\n");
1011 /* a NULL bstr corresponds to no-uri ns */
1012 hr = IXMLDOMSchemaCollection_get(cache1, NULL, (IXMLDOMNode**)&schema1);
1013 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1014 ok(!schema1, "expected NULL\n");
1015 /* error if return pointer is NULL */
1016 hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), NULL);
1017 ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
1018
1019 for (i = 0; i < 3; ++i)
1020 {
1021 bstr = NULL;
1022 hr = IXMLDOMSchemaCollection_get_namespaceURI(cache1, i, &bstr);
1023 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1024 ok(bstr != NULL && *bstr, "expected non-empty string\n");
1025 content[i] = bstr;
1026
1027#ifdef __REACTOS__
1028 if (bstr == NULL) continue;
1029#endif
1030 for (j = 0; j < i; ++j)
1031 ok(wcscmp(content[j], bstr), "got duplicate entry\n");
1032 }
1033
1034 for (i = 0; i < 3; ++i)
1035 {
1037 content[i] = NULL;
1038 }
1039
1040 IXMLDOMSchemaCollection_Release(cache1);
1041 free_bstrs();
1042}
#define E_FAIL
Definition: ddrawi.h:102
content
Definition: atl_ax.c:994
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define b
Definition: ke_i.h:79
static const WCHAR xdr_schema1_xml[]
Definition: schema.c:38
static const WCHAR xdr_schema2_uri[]
Definition: schema.c:55
#define create_document_version(v, iid)
Definition: schema.c:418
static const WCHAR xdr_schema2_xml[]
Definition: schema.c:56
static const WCHAR xdr_schema3_xml[]
Definition: schema.c:72
static void free_bstrs(void)
Definition: schema.c:386
static const WCHAR xdr_schema3_uri[]
Definition: schema.c:71
static BSTR _bstr_(const WCHAR *str)
Definition: schema.c:379
#define create_cache_version(v, iid)
Definition: schema.c:422
static const WCHAR xdr_schema1_uri[]
Definition: schema.c:37
static VARIANT _variantdoc_(void *doc)
Definition: schema.c:394
static const WCHAR xsd_schema1_uri[]
Definition: schema.c:87
long LONG
Definition: pedump.c:60
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define E_POINTER
Definition: winerror.h:3480

Referenced by START_TEST().

◆ test_collection_refs()

static void test_collection_refs ( void  )
static

Definition at line 633 of file schema.c.

634{
635 IXMLDOMDocument2 *schema1, *schema2, *schema3;
636 IXMLDOMSchemaCollection *cache1, *cache2, *cache3;
637 LONG refcount, length;
639 HRESULT hr;
640
641 schema1 = create_document(&IID_IXMLDOMDocument2);
642 ok(schema1 != NULL, "Failed to create a document.\n");
643
644 cache1 = create_cache(&IID_IXMLDOMSchemaCollection);
645 ok(cache1 != NULL, "Failed to create schema collection.\n");
646
647 if (!schema1 || !cache1)
648 {
649 if (schema1)
650 IXMLDOMDocument2_Release(schema1);
651 if (cache1)
652 IXMLDOMSchemaCollection_Release(cache1);
653 return;
654 }
655
656 schema2 = create_document(&IID_IXMLDOMDocument2);
657 schema3 = create_document(&IID_IXMLDOMDocument2);
658
659 cache2 = create_cache(&IID_IXMLDOMSchemaCollection);
660 cache3 = create_cache(&IID_IXMLDOMSchemaCollection);
661
662 hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
663 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
664 ok(b == VARIANT_TRUE, "failed to load XML\n");
665
666 hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
667 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
668 ok(b == VARIANT_TRUE, "failed to load XML\n");
669
670 hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b);
671 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
672 ok(b == VARIANT_TRUE, "failed to load XML\n");
673
674 hr = IXMLDOMSchemaCollection_add(cache1, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
675 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
676 hr = IXMLDOMSchemaCollection_add(cache2, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
677 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
678 hr = IXMLDOMSchemaCollection_add(cache3, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
679 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
680
681 refcount = IXMLDOMDocument2_Release(schema1);
682 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
683 refcount = IXMLDOMDocument2_Release(schema2);
684 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
685 refcount = IXMLDOMDocument2_Release(schema3);
686 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
687 schema1 = NULL;
688 schema2 = NULL;
689 schema3 = NULL;
690
691 /* releasing the original doc does not affect the schema cache */
692 hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1);
693 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
694 hr = IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2);
695 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
696 hr = IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3);
697 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
698
699 /* we get a read-only domdoc interface, created just for us */
700 if (schema1)
701 {
702 refcount = get_refcount(schema1);
703 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
704 }
705
706 if (schema2)
707 {
708 refcount = get_refcount(schema2);
709 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
710 }
711
712 if (schema3)
713 {
714 refcount = get_refcount(schema3);
715 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
716 }
717
718 hr = IXMLDOMSchemaCollection_addCollection(cache1, NULL);
719 ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
720 hr = IXMLDOMSchemaCollection_addCollection(cache2, cache1);
721 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
722 hr = IXMLDOMSchemaCollection_addCollection(cache3, cache2);
723 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
724
725 length = -1;
726 hr = IXMLDOMSchemaCollection_get_length(cache1, &length);
727 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
728 ok(length == 1, "Unexpected length %ld.\n", length);
729
730 length = -1;
731 hr = IXMLDOMSchemaCollection_get_length(cache2, &length);
732 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
733 ok(length == 2, "Unexpected length %ld.\n", length);
734
735 length = -1;
736 hr = IXMLDOMSchemaCollection_get_length(cache3, &length);
737 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
738 ok(length == 3, "Unexpected length %ld.\n", length);
739
740 /* merging collections does not affect the ref count */
741 refcount = get_refcount(cache1);
742 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
743 refcount = get_refcount(cache2);
744 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
745 refcount = get_refcount(cache3);
746 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
747
748 /* nor does it affect the domdoc instances */
749 if (schema1)
750 {
751 refcount = IXMLDOMDocument2_Release(schema1);
752 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
753 }
754
755 if (schema2)
756 {
757 refcount = IXMLDOMDocument2_Release(schema2);
758 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
759 }
760
761 if (schema3)
762 {
763 refcount = IXMLDOMDocument2_Release(schema3);
764 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
765 }
766
767 schema1 = NULL;
768 schema2 = NULL;
769 schema3 = NULL;
770
771 /* releasing the domdoc instances doesn't change the cache */
772 hr = IXMLDOMSchemaCollection_get(cache1, _bstr_(xdr_schema1_uri), (IXMLDOMNode**)&schema1);
773 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
774 hr = IXMLDOMSchemaCollection_get(cache2, _bstr_(xdr_schema2_uri), (IXMLDOMNode**)&schema2);
775 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
776 hr = IXMLDOMSchemaCollection_get(cache3, _bstr_(xdr_schema3_uri), (IXMLDOMNode**)&schema3);
777 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
778
779 /* we can just get them again */
780 if (schema1)
781 {
782 refcount = get_refcount(schema1);
783 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
784 }
785
786 if (schema2)
787 {
788 refcount = get_refcount(schema2);
789 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
790 }
791
792 if (schema3)
793 {
794 refcount = get_refcount(schema3);
795 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
796 }
797
798 /* releasing the caches does not affect the domdoc instances */
799 refcount = IXMLDOMSchemaCollection_Release(cache1);
800 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
801 refcount = IXMLDOMSchemaCollection_Release(cache2);
802 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
803 refcount = IXMLDOMSchemaCollection_Release(cache3);
804 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
805
806 /* they're just for us */
807 if (schema1)
808 {
809 refcount = IXMLDOMDocument2_Release(schema1);
810 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
811 }
812 if (schema2)
813 {
814 refcount = IXMLDOMDocument2_Release(schema2);
815 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
816 }
817 if (schema3)
818 {
819 refcount = IXMLDOMDocument2_Release(schema3);
820 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
821 }
822
823 free_bstrs();
824}
#define create_cache(iid)
Definition: schema.c:420
static ULONG get_refcount(void *iface)
Definition: schema.c:360
#define create_document(iid)
Definition: schema.c:416

Referenced by START_TEST().

◆ test_dispex()

static void test_dispex ( void  )
static

Definition at line 1515 of file schema.c.

1516{
1517 IXMLDOMSchemaCollection *cache;
1518 IDispatchEx *dispex;
1519 IUnknown *unk;
1520 HRESULT hr;
1521 DISPPARAMS dispparams;
1522 VARIANT arg, ret;
1523
1524 cache = create_cache(&IID_IXMLDOMSchemaCollection);
1525 if (!cache) return;
1526
1527 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IUnknown, (void**)&unk);
1528 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1529 test_obj_dispex(unk);
1530 IUnknown_Release(unk);
1531
1532 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatchEx, (void**)&dispex);
1533 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1534
1535 V_VT(&arg) = VT_I4;
1536 V_I4(&arg) = 0;
1537 dispparams.cArgs = 1;
1538 dispparams.cNamedArgs = 0;
1539 dispparams.rgdispidNamedArgs = NULL;
1540 dispparams.rgvarg = &arg;
1541
1542 V_VT(&ret) = VT_EMPTY;
1543 V_DISPATCH(&ret) = (void*)0x1;
1544 hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL);
1545 ok(hr == DISP_E_MEMBERNOTFOUND, "Unexpected hr %#lx.\n", hr);
1546 ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret));
1547 ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret));
1548
1549 IDispatchEx_Release(dispex);
1550 IXMLDOMSchemaCollection_Release(cache);
1551}
const GUID IID_IUnknown
@ VT_I4
Definition: compat.h:2298
@ VT_EMPTY
Definition: compat.h:2295
return ret
Definition: mutex.c:146
static void test_obj_dispex(IUnknown *obj)
Definition: schema.c:1463
struct stdole::DISPPARAMS DISPPARAMS
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_I4(A)
Definition: oleauto.h:247
#define IID_NULL
Definition: guiddef.h:98
Definition: cache.c:49
void * arg
Definition: msvc.h:10
#define DISP_E_MEMBERNOTFOUND
Definition: winerror.h:3615

Referenced by START_TEST().

◆ test_length()

static void test_length ( void  )
static

Definition at line 826 of file schema.c.

827{
828 IXMLDOMDocument2 *schema1, *schema2, *schema3;
829 IXMLDOMSchemaCollection *cache;
831 HRESULT hr;
832 VARIANT v;
833 LONG length;
834
835 schema1 = create_document(&IID_IXMLDOMDocument2);
836 schema2 = create_document(&IID_IXMLDOMDocument2);
837 schema3 = create_document(&IID_IXMLDOMDocument2);
838
839 cache = create_cache(&IID_IXMLDOMSchemaCollection);
840
841 if (!schema1 || !schema2 || !schema3 || !cache)
842 {
843 if (schema1) IXMLDOMDocument2_Release(schema1);
844 if (schema2) IXMLDOMDocument2_Release(schema2);
845 if (schema3) IXMLDOMDocument2_Release(schema3);
846
847 if (cache) IXMLDOMSchemaCollection_Release(cache);
848
849 return;
850 }
851
852 VariantInit(&v);
853
854 hr = IXMLDOMDocument2_loadXML(schema1, _bstr_(xdr_schema1_xml), &b);
855 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
856 ok(b == VARIANT_TRUE, "failed to load XML\n");
857
858 hr = IXMLDOMDocument2_loadXML(schema2, _bstr_(xdr_schema2_xml), &b);
859 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
860 ok(b == VARIANT_TRUE, "failed to load XML\n");
861
862 hr = IXMLDOMDocument2_loadXML(schema3, _bstr_(xdr_schema3_xml), &b);
863 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
864 ok(b == VARIANT_TRUE, "failed to load XML\n");
865
866 hr = IXMLDOMSchemaCollection_get_length(cache, NULL);
867 ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
868
869 /* MSDN lies; removing a nonexistent entry produces no error */
870 hr = IXMLDOMSchemaCollection_remove(cache, NULL);
871 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
872 hr = IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema1_uri));
873 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
874
875 length = -1;
876 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
877 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
878 ok(length == 0, "Unexpected length %ld.\n", length);
879
880 hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema1_uri), _variantdoc_(schema1));
881 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
882
883 length = -1;
884 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
885 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
886 ok(length == 1, "Unexpected length %ld.\n", length);
887
888 hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema2_uri), _variantdoc_(schema2));
889 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
890
891 length = -1;
892 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
893 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
894 ok(length == 2, "Unexpected length %ld.\n", length);
895
896 hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema3_uri), _variantdoc_(schema3));
897 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
898
899 length = -1;
900 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
901 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
902 ok(length == 3, "Unexpected length %ld.\n", length);
903
904 /* adding with VT_NULL is the same as removing */
905 V_VT(&v) = VT_NULL;
906 hr = IXMLDOMSchemaCollection_add(cache, _bstr_(xdr_schema1_uri), v);
907 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
908
909 length = -1;
910 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
911 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
912 ok(length == 2, "Unexpected length %ld.\n", length);
913
914 hr = IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema2_uri));
915 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
916
917 length = -1;
918 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
919 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
920 ok(length == 1, "Unexpected length %ld.\n", length);
921
922 hr = IXMLDOMSchemaCollection_remove(cache, _bstr_(xdr_schema3_uri));
923 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
924
925 length = -1;
926 hr = IXMLDOMSchemaCollection_get_length(cache, &length);
927 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
928 ok(length == 0, "Unexpected length %ld.\n", length);
929
930 IXMLDOMDocument2_Release(schema1);
931 IXMLDOMDocument2_Release(schema2);
932 IXMLDOMDocument2_Release(schema3);
933 IXMLDOMSchemaCollection_Release(cache);
934
935 free_bstrs();
936}
@ VT_NULL
Definition: compat.h:2296
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568

Referenced by START_TEST().

◆ test_obj_dispex()

static void test_obj_dispex ( IUnknown obj)
static

Definition at line 1463 of file schema.c.

1464{
1466 IDispatchEx *dispex;
1467 IUnknown *unk;
1468 DWORD props;
1469 UINT ticnt;
1470 HRESULT hr;
1471 BSTR name;
1472
1473 hr = IUnknown_QueryInterface(obj, &IID_IDispatchEx, (void**)&dispex);
1474 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1475 if (FAILED(hr)) return;
1476
1477 ticnt = 0;
1478 hr = IDispatchEx_GetTypeInfoCount(dispex, &ticnt);
1479 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1480 ok(ticnt == 1, "ticnt=%u\n", ticnt);
1481
1482 name = SysAllocString(L"*");
1483 hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive);
1484 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1486
1487 hr = IDispatchEx_DeleteMemberByDispID(dispex, dispid);
1488 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1489
1490 props = 0;
1491 hr = IDispatchEx_GetMemberProperties(dispex, dispid, grfdexPropCanAll, &props);
1492 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1493 ok(props == 0, "expected 0 got %ld\n", props);
1494
1495 hr = IDispatchEx_GetMemberName(dispex, dispid, &name);
1496 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1498
1499 hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid);
1500 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1501
1502 unk = (IUnknown*)0xdeadbeef;
1503 hr = IDispatchEx_GetNameSpaceParent(dispex, &unk);
1504 ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
1505 ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk);
1506
1507 name = SysAllocString(L"testprop");
1508 hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid);
1509 ok(hr == DISP_E_UNKNOWNNAME, "Unexpected hr %#lx.\n", hr);
1511
1512 IDispatchEx_Release(dispex);
1513}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define DISPID_XMLDOM_SCHEMACOLLECTION_ADD
Definition: msxml2did.h:292
#define DISPID_SAX_XMLREADER_GETFEATURE
Definition: msxml2did.h:342
unsigned int UINT
Definition: ndis.h:50
static const WCHAR props[]
Definition: wbemdisp.c:288
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:3618

Referenced by test_dispex().

◆ test_schema_refs()

static void test_schema_refs ( void  )
static

Definition at line 424 of file schema.c.

425{
426 static const WCHAR xdr_schema_xml[] =
427 L"<Schema xmlns=\"urn:schemas-microsoft-com:xml-data\"\nxmlns:dt=\"urn:schemas-microsoft-com:datatypes\">\n</Schema>\n";
428 IXMLDOMDocument2 *doc;
430 IXMLDOMSchemaCollection *cache;
431 LONG len, refcount;
432 VARIANT v;
434 BSTR str;
435 HRESULT hr;
436
437 doc = create_document(&IID_IXMLDOMDocument2);
438 if (!doc)
439 return;
440
441 cache = create_cache(&IID_IXMLDOMSchemaCollection);
442 if(!cache)
443 {
444 IXMLDOMDocument2_Release(doc);
445 return;
446 }
447
448 VariantInit(&v);
449 str = SysAllocString(xdr_schema_xml);
450 hr = IXMLDOMDocument2_loadXML(doc, str, &b);
451 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
452 ok(b == VARIANT_TRUE, "b %04x\n", b);
454
455 node = (void*)0xdeadbeef;
456 hr = IXMLDOMSchemaCollection_get(cache, NULL, &node);
457 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
458 ok(node == NULL, "%p\n", node);
459
460 /* NULL uri pointer, still adds a document */
461 hr = IXMLDOMSchemaCollection_add(cache, NULL, _variantdoc_(doc));
462 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
463 len = -1;
464 hr = IXMLDOMSchemaCollection_get_length(cache, &len);
465 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
466 ok(len == 1, "Unexpected length %ld.\n", len);
467 /* read back - empty valid BSTR */
468 str = NULL;
469 hr = IXMLDOMSchemaCollection_get_namespaceURI(cache, 0, &str);
470 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
471 ok(str && *str == 0, "got %p\n", str);
473
474 node = NULL;
475 hr = IXMLDOMSchemaCollection_get(cache, NULL, &node);
476 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
477 ok(node != NULL, "%p\n", node);
478#ifdef __REACTOS__
479 if (node != NULL)
480#endif
481 IXMLDOMNode_Release(node);
482
483 node = NULL;
484 str = SysAllocString(L"");
485 hr = IXMLDOMSchemaCollection_get(cache, str, &node);
486 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
487 ok(node != NULL, "%p\n", node);
488#ifdef __REACTOS__
489 if (node != NULL)
490#endif
491 IXMLDOMNode_Release(node);
493
494 /* remove with NULL uri */
495 hr = IXMLDOMSchemaCollection_remove(cache, NULL);
496 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
497 len = -1;
498 hr = IXMLDOMSchemaCollection_get_length(cache, &len);
499 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
500 ok(len == 0, "Unexpected length %ld.\n", len);
501
502 /* same, but with VT_UNKNOWN type */
503 V_VT(&v) = VT_UNKNOWN;
504 V_UNKNOWN(&v) = (IUnknown*)doc;
505 hr = IXMLDOMSchemaCollection_add(cache, NULL, v);
506 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
507
508 len = -1;
509 hr = IXMLDOMSchemaCollection_get_length(cache, &len);
510 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
511 ok(len == 1, "Unexpected length %ld.\n", len);
512
513 hr = IXMLDOMSchemaCollection_remove(cache, NULL);
514 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
515 len = -1;
516 hr = IXMLDOMSchemaCollection_get_length(cache, &len);
517 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
518 ok(len == 0, "Unexpected length %ld.\n", len);
519
520 str = SysAllocString(L"x-schema:test.xml");
521 hr = IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc));
522 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
523
524 /* IXMLDOMSchemaCollection_add doesn't add a ref on doc */
525 refcount = get_refcount(doc);
526 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
527
529
530 V_VT(&v) = VT_INT;
531 hr = IXMLDOMDocument2_get_schemas(doc, &v);
532 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
533 ok(V_VT(&v) == VT_NULL, "vt %x\n", V_VT(&v));
534
535 refcount = IXMLDOMSchemaCollection_AddRef(cache);
536 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
537 V_VT(&v) = VT_DISPATCH;
539
540 /* check that putref_schemas takes a ref */
541 hr = IXMLDOMDocument2_putref_schemas(doc, v);
542 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
543 refcount = get_refcount(cache);
544 ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
545
546 VariantClear(&v); /* refs now 2 */
547
548 V_VT(&v) = VT_INT;
549 /* check that get_schemas adds a ref */
550 hr = IXMLDOMDocument2_get_schemas(doc, &v);
551 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
552 ok(V_VT(&v) == VT_DISPATCH, "vt %x\n", V_VT(&v));
553 refcount = get_refcount(cache);
554 ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
555
556 /* get_schemas doesn't release a ref if passed VT_DISPATCH - ie it doesn't call VariantClear() */
557 hr = IXMLDOMDocument2_get_schemas(doc, &v);
558 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
559 ok(V_VT(&v) == VT_DISPATCH, "vt %x\n", V_VT(&v));
560 refcount = get_refcount(cache);
561 ok(refcount == 4, "Unexpected refcount %ld.\n", refcount);
562
563 /* release the two refs returned by get_schemas */
564 refcount = IXMLDOMSchemaCollection_Release(cache);
565 ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
566 refcount = IXMLDOMSchemaCollection_Release(cache);
567 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
568
569 /* check that taking another ref on the document doesn't change the schema's ref count */
570 refcount = IXMLDOMDocument2_AddRef(doc);
571 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
572 refcount = get_refcount(cache);
573 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
574 refcount = IXMLDOMDocument2_Release(doc);
575 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
576
577 /* call putref_schema with some odd variants */
578 V_VT(&v) = VT_INT;
579 hr = IXMLDOMDocument2_putref_schemas(doc, v);
580 ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
581 refcount = get_refcount(cache);
582 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
583
584 /* calling with VT_EMPTY releases the schema */
585 V_VT(&v) = VT_EMPTY;
586 hr = IXMLDOMDocument2_putref_schemas(doc, v);
587 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
588 refcount = get_refcount(cache);
589 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
590
591 /* try setting with VT_UNKNOWN */
592 refcount = IXMLDOMSchemaCollection_AddRef(cache);
593 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
594 V_VT(&v) = VT_UNKNOWN;
596 hr = IXMLDOMDocument2_putref_schemas(doc, v);
597 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
598 refcount = get_refcount(cache);
599 ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
600
601 VariantClear(&v); /* refs now 2 */
602
603 /* calling with VT_NULL releases the schema */
604 V_VT(&v) = VT_NULL;
605 hr = IXMLDOMDocument2_putref_schemas(doc, v);
606 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
607 refcount = get_refcount(cache);
608 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
609
610 /* refs now 1 */
611 /* set again */
612 refcount = IXMLDOMSchemaCollection_AddRef(cache);
613 ok(refcount == 2, "Unexpected refcount %ld.\n", refcount);
614 V_VT(&v) = VT_UNKNOWN;
616 hr = IXMLDOMDocument2_putref_schemas(doc, v);
617 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
618 refcount = get_refcount(cache);
619 ok(refcount == 3, "Unexpected refcount %ld.\n", refcount);
620
621 VariantClear(&v); /* refs now 2 */
622
623 /* release the final ref on the doc which should release its ref on the schema */
624 refcount = IXMLDOMDocument2_Release(doc);
625 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
626
627 refcount = get_refcount(cache);
628 ok(refcount == 1, "Unexpected refcount %ld.\n", refcount);
629 refcount = IXMLDOMSchemaCollection_Release(cache);
630 ok(!refcount, "Unexpected refcount %ld.\n", refcount);
631}
@ VT_INT
Definition: compat.h:2316
@ VT_UNKNOWN
Definition: compat.h:2308
GLenum GLsizei len
Definition: glext.h:6722
#define V_UNKNOWN(A)
Definition: oleauto.h:281
Definition: dlist.c:348
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define S_FALSE
Definition: winerror.h:3451
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_XDR_datatypes()

static void test_XDR_datatypes ( void  )
static

Definition at line 1244 of file schema.c.

1245{
1246 IXMLDOMDocument2 *doc, *schema, *doc2;
1247 IXMLDOMSchemaCollection* cache;
1248 const xdr_datatypes *ptr;
1251 HRESULT hr;
1252 VARIANT v;
1253 BSTR bstr;
1254 LONG l;
1255
1256 VariantInit(&v);
1257
1258 doc = create_document(&IID_IXMLDOMDocument2);
1259 doc2 = create_document(&IID_IXMLDOMDocument2);
1260 schema = create_document(&IID_IXMLDOMDocument2);
1261 cache = create_cache(&IID_IXMLDOMSchemaCollection);
1262
1263 if (!doc || !doc2 || !schema || !cache)
1264 {
1265 if (doc) IXMLDOMDocument2_Release(doc);
1266 if (doc2) IXMLDOMDocument2_Release(doc2);
1267 if (schema) IXMLDOMDocument2_Release(schema);
1268 if (cache) IXMLDOMSchemaCollection_Release(cache);
1269 return;
1270 }
1271
1272 hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szDatatypeXML), &b);
1273 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1274 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1275
1276 hr = IXMLDOMDocument2_loadXML(doc2, _bstr_(szDatatypeXML), &b);
1277 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1278 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1279
1280 hr = IXMLDOMDocument2_loadXML(schema, _bstr_(szDatatypeXDR), &b);
1281 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1282 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1283
1284 err = NULL;
1285 hr = IXMLDOMDocument2_validate(doc, &err);
1286 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1287 ok(err != NULL, "domdoc_validate() should always set err\n");
1288 hr = IXMLDOMParseError_get_errorCode(err, &l);
1289 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1290 ok(l == E_XML_NODTD, "Unexpected error code %#lx.\n", l);
1291 IXMLDOMParseError_Release(err);
1292
1293 err = NULL;
1294 hr = IXMLDOMDocument2_validate(doc2, &err);
1295 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1296 ok(err != NULL, "domdoc_validate() should always set err\n");
1297 hr = IXMLDOMParseError_get_errorCode(err, &l);
1298 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1299 ok(l == E_XML_NODTD, "Unexpected error code %#lx.\n", l);
1300 IXMLDOMParseError_Release(err);
1301
1302 /* now load the schema */
1303 V_VT(&v) = VT_DISPATCH;
1304 V_DISPATCH(&v) = NULL;
1305 hr = IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1306 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1307 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1308 hr = IXMLDOMSchemaCollection_add(cache, _bstr_(L"urn:x-schema:datatype-test-xdr"), v);
1309 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1310 VariantClear(&v);
1311
1312 /* associate the cache to the doc */
1313 V_VT(&v) = VT_DISPATCH;
1314 V_DISPATCH(&v) = NULL;
1315 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1316 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1317 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1318 hr = IXMLDOMDocument2_putref_schemas(doc2, v);
1319 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1320 VariantClear(&v);
1321
1322 /* validate the doc */
1323 err = NULL;
1324 l = 0;
1325 bstr = NULL;
1326 hr = IXMLDOMDocument2_validate(doc2, &err);
1327 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1328 ok(err != NULL, "domdoc_validate() should always set err\n");
1329 hr = IXMLDOMParseError_get_errorCode(err, &l);
1330 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1331 hr = IXMLDOMParseError_get_reason(err, &bstr);
1332 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1333 ok(l == 0, "Unexpected value %lx : %s\n", l, wine_dbgstr_w(bstr));
1334 SysFreeString(bstr);
1335 IXMLDOMParseError_Release(err);
1336
1338 while (ptr->query)
1339 {
1341 VARIANT type;
1342
1343 /* check data types without the schema */
1344 hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_(ptr->query), &node);
1345 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1346 ok(node != NULL, "expected node\n");
1347
1348 V_VT(&type) = VT_EMPTY;
1349 V_BSTR(&type) = (void*)-1;
1350 hr = IXMLDOMNode_get_dataType(node, &type);
1351 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1352 ok(V_VT(&type) == VT_NULL, "got type %i\n", V_VT(&type));
1353 /* when returning VT_NULL, the pointer is set to NULL */
1354 ok(V_BSTR(&type) == NULL, "got %p\n", V_BSTR(&type));
1355
1357 hr = IXMLDOMNode_get_nodeTypedValue(node, &type);
1358 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1359 ok(V_VT(&type) == VT_BSTR, "got variant type %i\n", V_VT(&v));
1361 IXMLDOMNode_Release(node);
1362
1363 /* check the data with schema */
1364 node = NULL;
1365 hr = IXMLDOMDocument2_selectSingleNode(doc2, _bstr_(ptr->query), &node);
1366 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1367 ok(node != NULL, "expected node\n");
1368
1369 V_VT(&type) = VT_EMPTY;
1370 hr = IXMLDOMNode_get_dataType(node, &type);
1371 if (ptr->typename)
1372 {
1373 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1374 ok(V_VT(&type) == VT_BSTR, "got type %i\n", V_VT(&type));
1375 ok(!lstrcmpW(V_BSTR(&type), _bstr_(ptr->typename)), "got %s\n", wine_dbgstr_w(V_BSTR(&type)));
1376 }
1377 else
1378 {
1379 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1380 ok(V_VT(&type) == VT_NULL, "%s: got type %i\n", wine_dbgstr_w(ptr->query), V_VT(&type));
1381 }
1383
1384 VariantClear(&v);
1385 hr = IXMLDOMNode_get_nodeTypedValue(node, &v);
1386 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1387
1388 todo_wine_if(ptr->todo)
1389 ok(V_VT(&v) == ptr->type_schema, "%s: got variant type %i\n", wine_dbgstr_w(ptr->query), V_VT(&v));
1390
1391 switch (ptr->type_schema)
1392 {
1393 case VT_BOOL:
1394 ok(V_BOOL(&v) == VARIANT_TRUE, "got %x\n", V_BOOL(&v));
1395 break;
1396 case VT_I1:
1397 ok(V_I1(&v) == 42, "got %i\n", V_I1(&v));
1398 break;
1399 case VT_I2:
1400 ok(V_I2(&v) == 420, "got %i\n", V_I2(&v));
1401 break;
1402 case VT_I4:
1403 if (!wcscmp(ptr->typename, L"int"))
1404 ok(V_I4(&v) == 42, "got %ld\n", V_I4(&v));
1405 else if (!wcscmp(ptr->typename, L"char"))
1406 todo_wine
1407 ok(V_I4(&v) == 'u', "got %lx\n", V_I4(&v));
1408 else
1409 ok(V_I4(&v) == -420000000, "got %ld\n", V_I4(&v));
1410 break;
1411 case VT_I8:
1412 expect_int64(V_I8(&v), -4200000000, 10);
1413 break;
1414 case VT_R4:
1415 ok(V_R4(&v) == (float)3.14159265, "got %f\n", V_R4(&v));
1416 break;
1417 case VT_R8:
1418 if (!wcscmp(ptr->typename, L"float"))
1419#ifdef __REACTOS__ // crash due to printf bug, will be fixed with import of wine's msvcrt
1420 ok(V_R8(&v) == 3.14159, "got 0x%llx\n", *(unsigned long long*)&V_R8(&v));
1421#else
1422 ok(V_R8(&v) == 3.14159, "got %f\n", V_R8(&v));
1423#endif
1424 else
1425 todo_wine
1426#ifdef __REACTOS__ // crash due to printf bug, will be fixed with import of wine's msvcrt
1427 ok(V_R8(&v) == 3.14159265358979323846, "got 0x%llx\n", *(unsigned long long*)&V_R8(&v));
1428#else
1429 ok(V_R8(&v) == 3.14159265358979323846, "got %.20f\n", V_R8(&v));
1430#endif
1431 break;
1432 case VT_UI1:
1433 ok(V_UI1(&v) == 0xFF, "got %02x\n", V_UI1(&v));
1434 break;
1435 case VT_UI2:
1436 ok(V_UI2(&v) == 0xFFFF, "got %04x\n", V_UI2(&v));
1437 break;
1438 case VT_UI4:
1439 ok(V_UI4(&v) == 0xFFFFFFFF, "got %#lx\n", V_UI4(&v));
1440 break;
1441 case VT_UI8:
1442 expect_uint64(V_UI8(&v), 0xFFFFFFFFFFFFFFFF, 16);
1443 break;
1444 default:
1445 ;
1446 }
1447
1448 VariantClear(&v);
1449
1450 IXMLDOMNode_Release(node);
1451
1452 ptr++;
1453 }
1454
1455 IXMLDOMDocument2_Release(schema);
1456 IXMLDOMDocument2_Release(doc);
1457 IXMLDOMDocument2_Release(doc2);
1458 IXMLDOMSchemaCollection_Release(cache);
1459
1460 free_bstrs();
1461}
r l[0]
Definition: byte_order.h:168
@ VT_UI8
Definition: compat.h:2315
@ VT_BSTR
Definition: compat.h:2303
@ VT_R4
Definition: compat.h:2299
@ VT_UI2
Definition: compat.h:2312
@ VT_R8
Definition: compat.h:2300
@ VT_I8
Definition: compat.h:2314
@ VT_I1
Definition: compat.h:2310
@ VT_BOOL
Definition: compat.h:2306
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UI1
Definition: compat.h:2311
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
switch(r->id)
Definition: btrfs.c:3046
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
#define wine_dbgstr_w
Definition: kernel32.h:34
const WCHAR * schema
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR szDatatypeXML[]
Definition: schema.c:165
static const WCHAR szDatatypeXDR[]
Definition: schema.c:89
static const xdr_datatypes xdr_datatypes_data[]
Definition: schema.c:1212
#define expect_int64(expr, x, base)
Definition: schema.c:373
#define expect_uint64(expr, x, base)
Definition: schema.c:374
#define V_UI1(A)
Definition: oleauto.h:266
#define V_I8(A)
Definition: oleauto.h:249
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_UI2(A)
Definition: oleauto.h:268
#define V_I1(A)
Definition: oleauto.h:243
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_R4(A)
Definition: oleauto.h:260
#define V_UI4(A)
Definition: oleauto.h:270
#define V_R8(A)
Definition: oleauto.h:262
#define V_UI8(A)
Definition: oleauto.h:272
#define V_I2(A)
Definition: oleauto.h:245
const GUID IID_IDispatch
#define err(...)

Referenced by START_TEST().

◆ test_XDR_schemas()

static void test_XDR_schemas ( void  )
static

Definition at line 1044 of file schema.c.

1045{
1046 IXMLDOMDocument2 *doc, *schema;
1047 IXMLDOMSchemaCollection* cache;
1050 HRESULT hr;
1051 VARIANT v;
1052 BSTR bstr;
1053
1054 doc = create_document(&IID_IXMLDOMDocument2);
1055 schema = create_document(&IID_IXMLDOMDocument2);
1056 cache = create_cache(&IID_IXMLDOMSchemaCollection);
1057
1058 if (!doc || !schema || !cache)
1059 {
1060 if (doc) IXMLDOMDocument2_Release(doc);
1061 if (schema) IXMLDOMDocument2_Release(schema);
1062 if (cache) IXMLDOMSchemaCollection_Release(cache);
1063
1064 return;
1065 }
1066
1067 VariantInit(&v);
1068
1069 hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML1), &b);
1070 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1071 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1072
1073 hr = IXMLDOMDocument2_loadXML(schema, _bstr_(szOpenSeqXDR), &b);
1074 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1075 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1076
1077 /* load the schema */
1078 V_VT(&v) = VT_DISPATCH;
1079 V_DISPATCH(&v) = NULL;
1080 hr = IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1081 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1082 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1083 hr = IXMLDOMSchemaCollection_add(cache, _bstr_(L""), v);
1084 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1085 VariantClear(&v);
1086
1087 /* associate the cache to the doc */
1088 V_VT(&v) = VT_DISPATCH;
1089 V_DISPATCH(&v) = NULL;
1090 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1091 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1092 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1093 hr = IXMLDOMDocument2_putref_schemas(doc, v);
1094 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1095 VariantClear(&v);
1096
1097 /* validate the doc
1098 * only declared elements in the declared order
1099 * this is fine */
1100 err = NULL;
1101 bstr = NULL;
1102 hr = IXMLDOMDocument2_validate(doc, &err);
1103 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1104 ok(err != NULL, "domdoc_validate() should always set err\n");
1105 hr = IXMLDOMParseError_get_reason(err, &bstr);
1106 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1107 ok(IXMLDOMParseError_get_reason(err, &bstr) == S_FALSE, "got error: %s\n", wine_dbgstr_w(bstr));
1108 SysFreeString(bstr);
1109 IXMLDOMParseError_Release(err);
1110
1111 /* load the next doc */
1112 IXMLDOMDocument2_Release(doc);
1113 doc = create_document(&IID_IXMLDOMDocument2);
1114 hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML2), &b);
1115 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1116 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1117
1118 /* associate the cache to the doc */
1119 V_VT(&v) = VT_DISPATCH;
1120 V_DISPATCH(&v) = NULL;
1121 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1122 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1123 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1124 hr = IXMLDOMDocument2_putref_schemas(doc, v);
1125 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1126 VariantClear(&v);
1127
1128 /* validate the doc
1129 * declared elements in the declared order, with an extra declared element at the end
1130 * this is fine */
1131 err = NULL;
1132 bstr = NULL;
1133 hr = IXMLDOMDocument2_validate(doc, &err);
1134 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1135 ok(err != NULL, "domdoc_validate() should always set err\n");
1136 hr = IXMLDOMParseError_get_reason(err, &bstr);
1137 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1138 ok(IXMLDOMParseError_get_reason(err, &bstr) == S_FALSE, "got error: %s\n", wine_dbgstr_w(bstr));
1139 SysFreeString(bstr);
1140 IXMLDOMParseError_Release(err);
1141
1142 /* load the next doc */
1143 IXMLDOMDocument2_Release(doc);
1144 doc = create_document(&IID_IXMLDOMDocument2);
1145 hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML3), &b);
1146 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1147 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1148
1149 /* associate the cache to the doc */
1150 V_VT(&v) = VT_DISPATCH;
1151 V_DISPATCH(&v) = NULL;
1152 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1153 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1154 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1155 hr = IXMLDOMDocument2_putref_schemas(doc, v);
1156 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1157 VariantClear(&v);
1158
1159 /* validate the doc
1160 * fails, extra elements are only allowed at the end */
1161 err = NULL;
1162 bstr = NULL;
1163 hr = IXMLDOMDocument2_validate(doc, &err);
1164 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1165 ok(err != NULL, "domdoc_validate() should always set err\n");
1166 todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr));
1167 SysFreeString(bstr);
1168 IXMLDOMParseError_Release(err);
1169
1170 /* load the next doc */
1171 IXMLDOMDocument2_Release(doc);
1172 doc = create_document(&IID_IXMLDOMDocument2);
1173 hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szOpenSeqXML4), &b);
1174 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1175 ok(b == VARIANT_TRUE, "failed to load XML string\n");
1176
1177 /* associate the cache to the doc */
1178 V_VT(&v) = VT_DISPATCH;
1179 V_DISPATCH(&v) = NULL;
1180 hr = IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v));
1181 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1182 ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n");
1183 hr = IXMLDOMDocument2_putref_schemas(doc, v);
1184 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1185 VariantClear(&v);
1186
1187 /* validate the doc
1188 * fails, undeclared elements are not allowed */
1189 err = NULL;
1190 bstr = NULL;
1191 hr = IXMLDOMDocument2_validate(doc, &err);
1192 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1193 ok(err != NULL, "domdoc_validate() should always set err\n");
1194 todo_wine ok(IXMLDOMParseError_get_reason(err, &bstr) == S_OK, "got error: %s\n", wine_dbgstr_w(bstr));
1195 SysFreeString(bstr);
1196 IXMLDOMParseError_Release(err);
1197
1198 IXMLDOMDocument2_Release(doc);
1199 IXMLDOMDocument2_Release(schema);
1200 IXMLDOMSchemaCollection_Release(cache);
1201
1202 free_bstrs();
1203}
static const WCHAR szOpenSeqXDR[]
Definition: schema.c:338
static const WCHAR szOpenSeqXML1[]
Definition: schema.c:355
static const WCHAR szOpenSeqXML4[]
Definition: schema.c:358
static const WCHAR szOpenSeqXML2[]
Definition: schema.c:356
static const WCHAR szOpenSeqXML3[]
Definition: schema.c:357

Referenced by START_TEST().

Variable Documentation

◆ alloced_bstrs

BSTR alloced_bstrs[256]
static

Definition at line 376 of file schema.c.

Referenced by _bstr_(), and free_bstrs().

◆ alloced_bstrs_count

int alloced_bstrs_count
static

Definition at line 377 of file schema.c.

Referenced by _bstr_(), and free_bstrs().

◆ szDatatypeXDR

const WCHAR szDatatypeXDR[]
static

Definition at line 89 of file schema.c.

Referenced by test_XDR_datatypes().

◆ szDatatypeXML

const WCHAR szDatatypeXML[]
static

Definition at line 165 of file schema.c.

Referenced by test_XDR_datatypes().

◆ szOpenSeqXDR

const WCHAR szOpenSeqXDR[]
static
Initial value:
=
L"<Schema xmlns='urn:schemas-microsoft-com:xml-data'>\n"
" <ElementType name='w' content='empty' model='closed'/>\n"
" <ElementType name='x' content='empty' model='closed'/>\n"
" <ElementType name='y' content='empty' model='closed'/>\n"
" <ElementType name='z' content='empty' model='closed'/>\n"
" <ElementType name='test' content='eltOnly' model='open' order='seq'>\n"
" <element type='x'/>\n"
" <group order='seq'>\n"
" <element type='x'/>\n"
" <element type='y'/>\n"
" <element type='z'/>\n"
" </group>\n"
" <element type='z'/>\n"
" </ElementType>\n"
"</Schema>"

Definition at line 338 of file schema.c.

Referenced by test_XDR_schemas().

◆ szOpenSeqXML1

const WCHAR szOpenSeqXML1[] = L"<test><x/><x/><y/><z/><z/></test>"
static

Definition at line 355 of file schema.c.

Referenced by test_XDR_schemas().

◆ szOpenSeqXML2

const WCHAR szOpenSeqXML2[] = L"<test><x/><x/><y/><z/><z/><w/></test>"
static

Definition at line 356 of file schema.c.

Referenced by test_XDR_schemas().

◆ szOpenSeqXML3

const WCHAR szOpenSeqXML3[] = L"<test><w/><x/><x/><y/><z/><z/></test>"
static

Definition at line 357 of file schema.c.

Referenced by test_XDR_schemas().

◆ szOpenSeqXML4

const WCHAR szOpenSeqXML4[] = L"<test><x/><x/><y/><z/><z/><v/></test>"
static

Definition at line 358 of file schema.c.

Referenced by test_XDR_schemas().

◆ xdr_datatypes_data

const xdr_datatypes xdr_datatypes_data[]
static

Definition at line 1212 of file schema.c.

Referenced by test_XDR_datatypes().

◆ xdr_schema1_uri

const WCHAR xdr_schema1_uri[] = L"x-schema:test1.xdr"
static

Definition at line 37 of file schema.c.

Referenced by test_collection_content(), test_collection_refs(), and test_length().

◆ xdr_schema1_xml

const WCHAR xdr_schema1_xml[]
static
Initial value:
=
L"<?xml version='1.0'?>"
"<Schema xmlns='urn:schemas-microsoft-com:xml-data'"
" xmlns:dt='urn:schemas-microsoft-com:datatypes'"
" name='test1.xdr'>"
" <ElementType name='x' dt:type='boolean'/>"
" <ElementType name='y'>"
" <datatype dt:type='int'/>"
" </ElementType>"
" <ElementType name='z'/>"
" <ElementType name='root' content='eltOnly' model='open' order='seq'>"
" <element type='x'/>"
" <element type='y'/>"
" <element type='z'/>"
" </ElementType>"
"</Schema>"

Definition at line 38 of file schema.c.

Referenced by test_collection_content(), test_collection_refs(), and test_length().

◆ xdr_schema2_uri

const WCHAR xdr_schema2_uri[] = L"x-schema:test2.xdr"
static

Definition at line 55 of file schema.c.

Referenced by test_collection_content(), test_collection_refs(), and test_length().

◆ xdr_schema2_xml

const WCHAR xdr_schema2_xml[]
static
Initial value:
=
L"<?xml version='1.0'?>"
"<Schema xmlns='urn:schemas-microsoft-com:xml-data'"
" xmlns:dt='urn:schemas-microsoft-com:datatypes'"
" name='test2.xdr'>"
" <ElementType name='x' dt:type='bin.base64'/>"
" <ElementType name='y' dt:type='uuid'/>"
" <ElementType name='z'/>"
" <ElementType name='root' content='eltOnly' model='closed' order='one'>"
" <element type='x'/>"
" <element type='y'/>"
" <element type='z'/>"
" </ElementType>"
"</Schema>"

Definition at line 56 of file schema.c.

Referenced by test_collection_content(), test_collection_refs(), and test_length().

◆ xdr_schema3_uri

const WCHAR xdr_schema3_uri[] = L"x-schema:test3.xdr"
static

Definition at line 71 of file schema.c.

Referenced by test_collection_content(), test_collection_refs(), and test_length().

◆ xdr_schema3_xml

const WCHAR xdr_schema3_xml[]
static
Initial value:
=
L"<?xml version='1.0'?>"
"<Schema xmlns='urn:schemas-microsoft-com:xml-data'"
" xmlns:dt='urn:schemas-microsoft-com:datatypes'"
" name='test3.xdr'>"
" <ElementType name='root' content='textOnly' model='open'>"
" <AttributeType name='x' dt:type='int'/>"
" <AttributeType name='y' dt:type='enumeration' dt:values='a b c'/>"
" <AttributeType name='z' dt:type='uuid'/>"
" <attribute type='x'/>"
" <attribute type='y'/>"
" <attribute type='z'/>"
" </ElementType>"
"</Schema>"

Definition at line 72 of file schema.c.

Referenced by test_collection_content(), test_collection_refs(), and test_length().

◆ xsd_schema1_uri

const WCHAR xsd_schema1_uri[] = L"x-schema:test1.xsd"
static

Definition at line 87 of file schema.c.

Referenced by test_collection_content().