ReactOS 0.4.15-dev-8093-g3285f69
reader.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "initguid.h"
#include "ole2.h"
#include "xmllite.h"
#include "wine/test.h"
#include "wine/heap.h"
Include dependency graph for reader.c:

Go to the source code of this file.

Classes

struct  input_iids_t
 
struct  _testinput
 
struct  test_entry
 
struct  nodes_test
 
struct  test_entry_empty
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define TEST_READER_POSITION(reader, line, pos)    test_reader_pos(reader, line, pos, ~0u, ~0u, __LINE__)
 
#define TEST_READER_POSITION2(reader, line, pos, line_broken, pos_broken)    test_reader_pos(reader, line, pos, line_broken, pos_broken, __LINE__)
 
#define ok_iids(got, exp, brk, todo)   ok_iids_(got, exp, brk, todo, __LINE__)
 
#define set_input_string(a, b)   _set_input_string(__LINE__,a,b);
 
#define read_node(a, b)   _read_node(__LINE__,a,b)
 
#define next_attribute(a)   _next_attribute(__LINE__,a)
 
#define move_to_element(a)   _move_to_element(__LINE__,a)
 
#define TEST_READER_STATE(reader, state)   test_read_state(reader, state, state, __LINE__)
 
#define TEST_READER_STATE2(reader, state, brk)   test_read_state(reader, state, brk, __LINE__)
 
#define reader_value(a, b)   _reader_value(__LINE__,a,b)
 
#define reader_name(a, b)   _reader_name(__LINE__,a,b)
 
#define reader_prefix(a, b)   _reader_prefix(__LINE__,a,b)
 
#define reader_namespace(a, b)   _reader_namespace(__LINE__,a,b)
 
#define reader_qname(a, b)   _reader_qname(a,b,__LINE__)
 
#define read_value_char(a, b)   _read_value_char(a,b,__LINE__)
 
#define TEST_DEPTH(reader, depth)   test_reader_depth(reader, depth, ~0u, __LINE__)
 
#define TEST_DEPTH2(reader, depth, brk)   test_reader_depth(reader, depth, brk, __LINE__)
 

Typedefs

typedef struct input_iids_t input_iids_t
 
typedef struct _testinput testinput
 

Functions

 DEFINE_GUID (IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda)
 
static WCHARa2w (const char *str)
 
static void free_str (WCHAR *str)
 
static int strcmp_wa (const WCHAR *str1, const char *stra)
 
static IStreamcreate_stream_on_data (const void *data, unsigned int size)
 
static void test_reader_pos (IXmlReader *reader, UINT line, UINT pos, UINT line_broken, UINT pos_broken, int _line_)
 
static void ok_iids_ (const input_iids_t *iids, const IID **expected, const IID **exp_broken, BOOL todo, int line)
 
static const charstate_to_str (XmlReadState state)
 
static const chartype_to_str (XmlNodeType type)
 
static void _set_input_string (unsigned line, IXmlReader *reader, const char *xml)
 
static void _read_node (unsigned line, IXmlReader *reader, XmlNodeType expected_type)
 
static void _next_attribute (unsigned line, IXmlReader *reader)
 
static void _move_to_element (unsigned line, IXmlReader *reader)
 
static void test_read_state (IXmlReader *reader, XmlReadState expected, XmlReadState exp_broken, int line)
 
static const WCHAR_reader_value (unsigned line, IXmlReader *reader, const char *expect)
 
static const WCHAR_reader_name (unsigned line, IXmlReader *reader, const char *expect)
 
static const WCHAR_reader_prefix (unsigned line, IXmlReader *reader, const char *expect)
 
static const WCHAR_reader_namespace (unsigned line, IXmlReader *reader, const char *expect)
 
static const WCHAR_reader_qname (IXmlReader *reader, const char *expect, unsigned line)
 
static void _read_value_char (IXmlReader *reader, WCHAR expected_char, unsigned line)
 
static testinputimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI testinput_QueryInterface (IUnknown *iface, REFIID riid, void **ppvObj)
 
static ULONG WINAPI testinput_AddRef (IUnknown *iface)
 
static ULONG WINAPI testinput_Release (IUnknown *iface)
 
static HRESULT testinput_createinstance (void **ppObj)
 
static HRESULT WINAPI teststream_QueryInterface (ISequentialStream *iface, REFIID riid, void **obj)
 
static ULONG WINAPI teststream_AddRef (ISequentialStream *iface)
 
static ULONG WINAPI teststream_Release (ISequentialStream *iface)
 
static HRESULT WINAPI teststream_Read (ISequentialStream *iface, void *pv, ULONG cb, ULONG *pread)
 
static HRESULT WINAPI teststream_Write (ISequentialStream *iface, const void *pv, ULONG cb, ULONG *written)
 
static HRESULT WINAPI resolver_QI (IXmlResolver *iface, REFIID riid, void **obj)
 
static ULONG WINAPI resolver_AddRef (IXmlResolver *iface)
 
static ULONG WINAPI resolver_Release (IXmlResolver *iface)
 
static HRESULT WINAPI resolver_ResolveUri (IXmlResolver *iface, const WCHAR *base_uri, const WCHAR *public_id, const WCHAR *system_id, IUnknown **input)
 
static void test_reader_create (void)
 
static void test_readerinput (void)
 
static void test_reader_state (void)
 
static void test_reader_depth (IXmlReader *reader, UINT depth, UINT brk, int line)
 
static void test_read_xmldeclaration (void)
 
static void test_read_comment (void)
 
static void test_read_pi (void)
 
static void test_read_full (void)
 
static void test_read_public_dtd (void)
 
static void test_read_system_dtd (void)
 
static void test_read_element (void)
 
static void test_read_pending (void)
 
static void test_readvaluechunk (void)
 
static void test_read_cdata (void)
 
static void test_read_text (void)
 
static void test_isemptyelement (void)
 
static void test_read_attribute (void)
 
static void test_reader_properties (void)
 
static void test_prefix (void)
 
static void test_namespaceuri (void)
 
static void test_read_charref (void)
 
static void test_encoding_detection (void)
 
static void test_eof_state (IXmlReader *reader, BOOL eof)
 
static void test_endoffile (void)
 
static void test_max_element_depth (void)
 
static void test_reader_position (void)
 
static void test_string_pointers (void)
 
static void test_attribute_by_name (void)
 
 START_TEST (reader)
 

Variables

static const char xmldecl_full [] = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
 
static const char xmldecl_short [] = "<?xml version=\"1.0\"?><RegistrationInfo/>"
 
static const IIDsetinput_full []
 
static const IIDsetinput_full_old []
 
static const IIDsetinput_readerinput []
 
static const IIDempty_seq []
 
static input_iids_t input_iids
 
static const struct IUnknownVtbl testinput_vtbl
 
static int stream_readcall
 
static const ISequentialStreamVtbl teststreamvtbl
 
static const IXmlResolverVtbl resolvervtbl
 
static IXmlResolver testresolver = { &resolvervtbl }
 
static struct test_entry comment_tests []
 
static struct test_entry pi_tests []
 
static const char misc_test_xml []
 
static struct nodes_test misc_test
 
static const char test_public_dtd []
 
static const char test_system_dtd []
 
static struct test_entry element_tests []
 
static ISequentialStream teststream = { &teststreamvtbl }
 
static struct test_entry cdata_tests []
 
static struct test_entry text_tests []
 
static struct test_entry_empty empty_element_tests []
 
static struct test_entry attributes_tests []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file reader.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 22 of file reader.c.

◆ move_to_element

#define move_to_element (   a)    _move_to_element(__LINE__,a)

Definition at line 260 of file reader.c.

◆ next_attribute

#define next_attribute (   a)    _next_attribute(__LINE__,a)

Definition at line 252 of file reader.c.

◆ ok_iids

#define ok_iids (   got,
  exp,
  brk,
  todo 
)    ok_iids_(got, exp, brk, todo, __LINE__)

Definition at line 155 of file reader.c.

◆ read_node

#define read_node (   a,
  b 
)    _read_node(__LINE__,a,b)

Definition at line 238 of file reader.c.

◆ read_value_char

#define read_value_char (   a,
  b 
)    _read_value_char(a,b,__LINE__)

Definition at line 359 of file reader.c.

◆ reader_name

#define reader_name (   a,
  b 
)    _reader_name(__LINE__,a,b)

Definition at line 303 of file reader.c.

◆ reader_namespace

#define reader_namespace (   a,
  b 
)    _reader_namespace(__LINE__,a,b)

Definition at line 331 of file reader.c.

◆ reader_prefix

#define reader_prefix (   a,
  b 
)    _reader_prefix(__LINE__,a,b)

Definition at line 317 of file reader.c.

◆ reader_qname

#define reader_qname (   a,
  b 
)    _reader_qname(a,b,__LINE__)

Definition at line 345 of file reader.c.

◆ reader_value

#define reader_value (   a,
  b 
)    _reader_value(__LINE__,a,b)

Definition at line 289 of file reader.c.

◆ set_input_string

#define set_input_string (   a,
  b 
)    _set_input_string(__LINE__,a,b);

Definition at line 224 of file reader.c.

◆ TEST_DEPTH

#define TEST_DEPTH (   reader,
  depth 
)    test_reader_depth(reader, depth, ~0u, __LINE__)

Definition at line 854 of file reader.c.

◆ TEST_DEPTH2

#define TEST_DEPTH2 (   reader,
  depth,
  brk 
)    test_reader_depth(reader, depth, brk, __LINE__)

Definition at line 855 of file reader.c.

◆ TEST_READER_POSITION

#define TEST_READER_POSITION (   reader,
  line,
  pos 
)     test_reader_pos(reader, line, pos, ~0u, ~0u, __LINE__)

Definition at line 100 of file reader.c.

◆ TEST_READER_POSITION2

#define TEST_READER_POSITION2 (   reader,
  line,
  pos,
  line_broken,
  pos_broken 
)     test_reader_pos(reader, line, pos, line_broken, pos_broken, __LINE__)

Definition at line 102 of file reader.c.

◆ TEST_READER_STATE

#define TEST_READER_STATE (   reader,
  state 
)    test_read_state(reader, state, state, __LINE__)

Definition at line 286 of file reader.c.

◆ TEST_READER_STATE2

#define TEST_READER_STATE2 (   reader,
  state,
  brk 
)    test_read_state(reader, state, brk, __LINE__)

Definition at line 287 of file reader.c.

Typedef Documentation

◆ input_iids_t

◆ testinput

Function Documentation

◆ _move_to_element()

static void _move_to_element ( unsigned  line,
IXmlReader reader 
)
static

Definition at line 261 of file reader.c.

262{
263 HRESULT hr;
264 hr = IXmlReader_MoveToElement(reader);
265 ok_(__FILE__,line)(hr == S_OK, "MoveToElement failed: %08x\n", hr);
266}
#define ok_(x1, x2)
Definition: atltest.h:61
#define S_OK
Definition: intsafe.h:52
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:49
Definition: reader.h:84

◆ _next_attribute()

static void _next_attribute ( unsigned  line,
IXmlReader reader 
)
static

Definition at line 253 of file reader.c.

254{
255 HRESULT hr;
256 hr = IXmlReader_MoveToNextAttribute(reader);
257 ok_(__FILE__,line)(hr == S_OK, "MoveToNextAttribute returned %08x\n", hr);
258}

◆ _read_node()

static void _read_node ( unsigned  line,
IXmlReader reader,
XmlNodeType  expected_type 
)
static

Definition at line 239 of file reader.c.

240{
242 HRESULT hr;
243
244 hr = IXmlReader_Read(reader, &type);
245 if (expected_type == XmlNodeType_None)
246 ok_(__FILE__,line)(hr == S_FALSE, "Read returned %08x, expected S_FALSE\n", hr);
247 else
248 ok_(__FILE__,line)(hr == S_OK, "Read returned %08x\n", hr);
249 ok_(__FILE__,line)(type == expected_type, "read type %d, expected %d\n", type, expected_type);
250}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define S_FALSE
Definition: winerror.h:2357
XmlNodeType
Definition: xmllite.idl:23
@ XmlNodeType_None
Definition: xmllite.idl:24

◆ _read_value_char()

static void _read_value_char ( IXmlReader reader,
WCHAR  expected_char,
unsigned  line 
)
static

Definition at line 360 of file reader.c.

361{
362 WCHAR c = 0xffff;
363 UINT count = 0;
364 HRESULT hr;
365
366 hr = IXmlReader_ReadValueChunk(reader, &c, 1, &count);
367 ok_(__FILE__,line)(hr == S_OK, "got %08x\n", hr);
368 ok_(__FILE__,line)(count == 1, "got %u\n", c);
369 ok_(__FILE__,line)(c == expected_char, "got %x\n", c);
370}
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
unsigned int UINT
Definition: ndis.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ _reader_name()

static const WCHAR * _reader_name ( unsigned  line,
IXmlReader reader,
const char expect 
)
static

Definition at line 304 of file reader.c.

305{
306 const WCHAR *str = (void*)0xdeadbeef;
307 ULONG len = 0xdeadbeef;
308 HRESULT hr;
309
310 hr = IXmlReader_GetLocalName(reader, &str, &len);
311 ok_(__FILE__,line)(hr == S_OK, "GetLocalName returned %08x\n", hr);
312 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
313 ok_(__FILE__,line)(!strcmp_wa(str, expect), "name = %s\n", wine_dbgstr_w(str));
314 return str;
315}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define lstrlenW
Definition: compat.h:750
GLenum GLsizei len
Definition: glext.h:6722
#define wine_dbgstr_w
Definition: kernel32.h:34
static int strcmp_wa(const WCHAR *str1, const char *stra)
Definition: reader.c:50
const WCHAR * str
uint32_t ULONG
Definition: typedefs.h:59

◆ _reader_namespace()

static const WCHAR * _reader_namespace ( unsigned  line,
IXmlReader reader,
const char expect 
)
static

Definition at line 332 of file reader.c.

333{
334 const WCHAR *str = (void*)0xdeadbeef;
335 ULONG len = 0xdeadbeef;
336 HRESULT hr;
337
338 hr = IXmlReader_GetNamespaceUri(reader, &str, &len);
339 ok_(__FILE__,line)(hr == S_OK, "GetNamespaceUri returned %08x\n", hr);
340 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
341 ok_(__FILE__,line)(!strcmp_wa(str, expect), "namespace = %s\n", wine_dbgstr_w(str));
342 return str;
343}

◆ _reader_prefix()

static const WCHAR * _reader_prefix ( unsigned  line,
IXmlReader reader,
const char expect 
)
static

Definition at line 318 of file reader.c.

319{
320 const WCHAR *str = (void*)0xdeadbeef;
321 ULONG len = 0xdeadbeef;
322 HRESULT hr;
323
324 hr = IXmlReader_GetPrefix(reader, &str, &len);
325 ok_(__FILE__,line)(hr == S_OK, "GetPrefix returned %08x\n", hr);
326 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
327 ok_(__FILE__,line)(!strcmp_wa(str, expect), "prefix = %s\n", wine_dbgstr_w(str));
328 return str;
329}

◆ _reader_qname()

static const WCHAR * _reader_qname ( IXmlReader reader,
const char expect,
unsigned  line 
)
static

Definition at line 346 of file reader.c.

347{
348 const WCHAR *str = (void*)0xdeadbeef;
349 ULONG len = 0xdeadbeef;
350 HRESULT hr;
351
352 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
353 ok_(__FILE__,line)(hr == S_OK, "GetQualifiedName returned %08x\n", hr);
354 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
355 ok_(__FILE__,line)(!strcmp_wa(str, expect), "name = %s\n", wine_dbgstr_w(str));
356 return str;
357}

◆ _reader_value()

static const WCHAR * _reader_value ( unsigned  line,
IXmlReader reader,
const char expect 
)
static

Definition at line 290 of file reader.c.

291{
292 const WCHAR *str = (void*)0xdeadbeef;
293 ULONG len = 0xdeadbeef;
294 HRESULT hr;
295
296 hr = IXmlReader_GetValue(reader, &str, &len);
297 ok_(__FILE__,line)(hr == S_OK, "GetValue returned %08x\n", hr);
298 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
299 ok_(__FILE__,line)(!strcmp_wa(str, expect), "value = %s\n", wine_dbgstr_w(str));
300 return str;
301}

◆ _set_input_string()

static void _set_input_string ( unsigned  line,
IXmlReader reader,
const char xml 
)
static

Definition at line 225 of file reader.c.

226{
228 HRESULT hr;
229
231
232 hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
233 ok_(__FILE__,line)(hr == S_OK, "got %08x\n", hr);
234
235 IStream_Release(stream);
236}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static IStream * create_stream_on_data(const void *data, unsigned int size)
Definition: reader.c:61
Definition: parse.h:23

◆ a2w()

static WCHAR * a2w ( const char str)
static

Definition at line 37 of file reader.c.

38{
39 int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
40 WCHAR *ret = heap_alloc(len * sizeof(WCHAR));
42 return ret;
43}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
int ret

Referenced by strcmp_wa(), test_read_attribute(), test_read_element(), and test_read_pi().

◆ create_stream_on_data()

static IStream * create_stream_on_data ( const void data,
unsigned int  size 
)
static

Definition at line 61 of file reader.c.

62{
64 HGLOBAL hglobal;
65 void *ptr;
66 HRESULT hr;
67
68 hglobal = GlobalAlloc(GHND, size);
69 ptr = GlobalLock(hglobal);
70
72
73 hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
74 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
75 ok(stream != NULL, "Expected non-NULL stream\n");
76
77 GlobalUnlock(hglobal);
78
79 return stream;
80}
#define ok(value,...)
Definition: atltest.h:57
#define TRUE
Definition: types.h:120
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
#define GHND
Definition: winbase.h:297

Referenced by _set_input_string(), test_encoding_detection(), and test_read_xmldeclaration().

◆ DEFINE_GUID()

DEFINE_GUID ( IID_IXmlReaderInput  ,
0x0b3ccc9b  ,
0x9214  ,
0x428b  ,
0xa2  ,
0xae  ,
0xef  ,
0x3a  ,
0xa8  ,
0x71  ,
0xaf  ,
0xda   
)

◆ free_str()

static void free_str ( WCHAR str)
static

Definition at line 45 of file reader.c.

46{
48}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76

Referenced by strcmp_wa(), test_read_attribute(), test_read_element(), and test_read_pi().

◆ impl_from_IUnknown()

static testinput * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 378 of file reader.c.

379{
380 return CONTAINING_RECORD(iface, testinput, IUnknown_iface);
381}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by testinput_AddRef(), and testinput_Release().

◆ ok_iids_()

static void ok_iids_ ( const input_iids_t iids,
const IID **  expected,
const IID **  exp_broken,
BOOL  todo,
int  line 
)
static

Definition at line 138 of file reader.c.

139{
140 int i = 0, size = 0;
141
142 while (expected[i++]) size++;
143
145 ok_(__FILE__, line)(iids->count == size, "Sequence size mismatch (%d), got (%d)\n", size, iids->count);
146
147 if (iids->count != size) return;
148
149 for (i = 0; i < size; i++) {
150 ok_(__FILE__, line)(IsEqualGUID(&iids->iids[i], expected[i]) ||
151 (exp_broken ? broken(IsEqualGUID(&iids->iids[i], exp_broken[i])) : FALSE),
152 "Wrong IID(%d), got %s\n", i, wine_dbgstr_guid(&iids->iids[i]));
153 }
154}
#define broken(x)
Definition: _sntprintf.h:21
#define FALSE
Definition: types.h:117
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
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2063
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
IID iids[10]
Definition: reader.c:106
int count
Definition: reader.c:107

◆ resolver_AddRef()

static ULONG WINAPI resolver_AddRef ( IXmlResolver iface)
static

Definition at line 508 of file reader.c.

509{
510 return 2;
511}

◆ resolver_QI()

static HRESULT WINAPI resolver_QI ( IXmlResolver iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 493 of file reader.c.

494{
495 ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
496
497 if (IsEqualIID(riid, &IID_IXmlResolver) || IsEqualIID(riid, &IID_IUnknown))
498 {
499 *obj = iface;
500 IXmlResolver_AddRef(iface);
501 return S_OK;
502 }
503
504 *obj = NULL;
505 return E_NOINTERFACE;
506}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ resolver_Release()

static ULONG WINAPI resolver_Release ( IXmlResolver iface)
static

Definition at line 513 of file reader.c.

514{
515 return 1;
516}

◆ resolver_ResolveUri()

static HRESULT WINAPI resolver_ResolveUri ( IXmlResolver iface,
const WCHAR base_uri,
const WCHAR public_id,
const WCHAR system_id,
IUnknown **  input 
)
static

Definition at line 518 of file reader.c.

520{
521 ok(0, "unexpected call\n");
522 return E_NOTIMPL;
523}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ START_TEST()

START_TEST ( reader  )

Definition at line 2661 of file reader.c.

2662{
2669 test_read_pi();
2680 test_prefix();
2689}
static void test_read_element(void)
Definition: reader.c:1405
static void test_readerinput(void)
Definition: reader.c:640
static void test_prefix(void)
Definition: reader.c:1972
static void test_read_public_dtd(void)
Definition: reader.c:1275
static void test_reader_state(void)
Definition: reader.c:798
static void test_namespaceuri(void)
Definition: reader.c:2028
static void test_read_charref(void)
Definition: reader.c:2120
static void test_endoffile(void)
Definition: reader.c:2227
static void test_read_full(void)
Definition: reader.c:1250
static void test_encoding_detection(void)
Definition: reader.c:2157
static void test_string_pointers(void)
Definition: reader.c:2457
static void test_attribute_by_name(void)
Definition: reader.c:2577
static void test_read_system_dtd(void)
Definition: reader.c:1338
static void test_isemptyelement(void)
Definition: reader.c:1833
static void test_reader_position(void)
Definition: reader.c:2391
static void test_read_cdata(void)
Definition: reader.c:1688
static void test_reader_properties(void)
Definition: reader.c:1944
static void test_read_pi(void)
Definition: reader.c:1152
static void test_reader_create(void)
Definition: reader.c:535
static void test_read_pending(void)
Definition: reader.c:1565
static void test_read_text(void)
Definition: reader.c:1761
static void test_max_element_depth(void)
Definition: reader.c:2288
static void test_read_comment(void)
Definition: reader.c:1062
static void test_read_xmldeclaration(void)
Definition: reader.c:857
static void test_read_attribute(void)
Definition: reader.c:1887
static void test_readvaluechunk(void)
Definition: reader.c:1601

◆ state_to_str()

static const char * state_to_str ( XmlReadState  state)
static

Definition at line 157 of file reader.c.

158{
159 static const char* state_names[] = {
160 "XmlReadState_Initial",
161 "XmlReadState_Interactive",
162 "XmlReadState_Error",
163 "XmlReadState_EndOfFile",
164 "XmlReadState_Closed"
165 };
166
167 static const char unknown[] = "unknown";
168
169 switch (state)
170 {
176 return state_names[state];
177 default:
178 return unknown;
179 }
180}
static int state
Definition: maze.c:121
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
@ XmlReadState_Closed
Definition: xmllite.idl:103
@ XmlReadState_Error
Definition: xmllite.idl:101
@ XmlReadState_EndOfFile
Definition: xmllite.idl:102
@ XmlReadState_Initial
Definition: xmllite.idl:99
@ XmlReadState_Interactive
Definition: xmllite.idl:100

Referenced by test_read_state().

◆ strcmp_wa()

static int strcmp_wa ( const WCHAR str1,
const char stra 
)
static

Definition at line 50 of file reader.c.

51{
52 WCHAR *str2 = a2w(stra);
53 int r = lstrcmpW(str1, str2);
54 free_str(str2);
55 return r;
56}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static WCHAR * a2w(const char *str)
Definition: reader.c:37
static void free_str(WCHAR *str)
Definition: reader.c:45

Referenced by _reader_name(), _reader_namespace(), _reader_prefix(), _reader_qname(), _reader_value(), and test_readvaluechunk().

◆ test_attribute_by_name()

static void test_attribute_by_name ( void  )
static

Definition at line 2577 of file reader.c.

2578{
2579 static const char *xml = "<a><elem xmlns=\"myns\" a=\"value a\" b=\"value b\" xmlns:ns=\"ns uri\" "
2580 "ns:c=\"value c\" c=\"value c2\"/></a>";
2581 static const WCHAR xmlns_uriW[] = {'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/',
2582 '2','0','0','0','/','x','m','l','n','s','/',0};
2583 static const WCHAR nsuriW[] = {'n','s',' ','u','r','i',0};
2584 static const WCHAR xmlnsW[] = {'x','m','l','n','s',0};
2585 static const WCHAR mynsW[] = {'m','y','n','s',0};
2586 static const WCHAR nsW[] = {'n','s',0};
2587 static const WCHAR emptyW[] = {0};
2588 static const WCHAR aW[] = {'a',0};
2589 static const WCHAR bW[] = {'b',0};
2590 static const WCHAR cW[] = {'c',0};
2592 HRESULT hr;
2593
2594 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2595 ok(hr == S_OK, "Failed to create reader, hr %#x.\n", hr);
2596
2598
2599 hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL);
2600 ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* WinXP */, "Unexpected hr %#x.\n", hr);
2601
2602 hr = IXmlReader_MoveToAttributeByName(reader, emptyW, NULL);
2603 ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
2604
2606
2607 hr = IXmlReader_MoveToAttributeByName(reader, emptyW, NULL);
2608 ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
2609
2611
2612 hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL);
2613 ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
2614
2615 hr = IXmlReader_MoveToAttributeByName(reader, NULL, xmlns_uriW);
2616 ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
2617
2618 hr = IXmlReader_MoveToAttributeByName(reader, emptyW, xmlns_uriW);
2619 ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
2620
2621 hr = IXmlReader_MoveToAttributeByName(reader, xmlnsW, NULL);
2622 ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
2623
2624 hr = IXmlReader_MoveToAttributeByName(reader, xmlnsW, xmlns_uriW);
2625 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2626 reader_value(reader, "myns");
2627
2628 hr = IXmlReader_MoveToAttributeByName(reader, aW, NULL);
2629 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2630 reader_value(reader, "value a");
2631
2632 hr = IXmlReader_MoveToAttributeByName(reader, bW, NULL);
2633 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2634 reader_value(reader, "value b");
2635
2636 hr = IXmlReader_MoveToAttributeByName(reader, aW, mynsW);
2637 ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
2638
2639 hr = IXmlReader_MoveToAttributeByName(reader, nsW, NULL);
2640 ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
2641
2642 hr = IXmlReader_MoveToAttributeByName(reader, nsW, xmlns_uriW);
2643 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2644 reader_value(reader, "ns uri");
2645
2646 hr = IXmlReader_MoveToAttributeByName(reader, bW, emptyW);
2647 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2648 reader_value(reader, "value b");
2649
2650 hr = IXmlReader_MoveToAttributeByName(reader, cW, NULL);
2651 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2652 reader_value(reader, "value c2");
2653
2654 hr = IXmlReader_MoveToAttributeByName(reader, cW, nsuriW);
2655 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
2656 reader_value(reader, "value c");
2657
2658 IXmlReader_Release(reader);
2659}
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
static WCHAR xmlnsW[]
Definition: reader.c:228
static WCHAR emptyW[]
Definition: reader.c:226
static const WCHAR aW[]
Definition: htmlelem.c:21
#define reader_value(a, b)
Definition: reader.c:289
#define set_input_string(a, b)
Definition: reader.c:224
#define read_node(a, b)
Definition: reader.c:238
@ XmlNodeType_Element
Definition: xmllite.idl:25

Referenced by START_TEST().

◆ test_encoding_detection()

static void test_encoding_detection ( void  )
static

Definition at line 2157 of file reader.c.

2158{
2159 static const struct encoding_testW
2160 {
2161 WCHAR text[16];
2162 }
2163 encoding_testsW[] =
2164 {
2165 { { '<','?','p','i',' ','?','>',0 } },
2166 { { '<','!','-','-',' ','c','-','-','>',0 } },
2167 { { 0xfeff,'<','a','/','>',0 } },
2168 { { '<','a','/','>',0 } },
2169 };
2170 static const char *encoding_testsA[] =
2171 {
2172 "<?pi ?>",
2173 "<!-- comment -->",
2174 "\xef\xbb\xbf<a/>", /* UTF-8 BOM */
2175 "<a/>",
2176 };
2179 IStream *stream;
2180 unsigned int i;
2181 HRESULT hr;
2182
2183 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2184 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2185
2186 /* there's no way to query detected encoding back, so just verify that document is browsable */
2187
2188 for (i = 0; i < ARRAY_SIZE(encoding_testsA); i++)
2189 {
2190 set_input_string(reader, encoding_testsA[i]);
2191
2193 hr = IXmlReader_Read(reader, &type);
2194 ok(hr == S_OK, "got %08x\n", hr);
2195 ok(type != XmlNodeType_None, "Unexpected node type %d\n", type);
2196 }
2197
2198 for (i = 0; i < ARRAY_SIZE(encoding_testsW); i++)
2199 {
2200 stream = create_stream_on_data(encoding_testsW[i].text, lstrlenW(encoding_testsW[i].text) * sizeof(WCHAR));
2201
2202 hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
2203 ok(hr == S_OK, "got %08x\n", hr);
2204
2206 hr = IXmlReader_Read(reader, &type);
2207 ok(hr == S_OK, "%u: got %08x\n", i, hr);
2208 ok(type != XmlNodeType_None, "%u: unexpected node type %d\n", i, type);
2209
2210 IStream_Release(stream);
2211 }
2212
2213 IXmlReader_Release(reader);
2214}
#define ARRAY_SIZE(A)
Definition: main.h:33
const WCHAR * text
Definition: package.c:1799

Referenced by START_TEST().

◆ test_endoffile()

static void test_endoffile ( void  )
static

Definition at line 2227 of file reader.c.

2228{
2231 HRESULT hr;
2232
2233 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2234 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2235
2237
2238 set_input_string(reader, "<a/>");
2239
2241
2243 hr = IXmlReader_Read(reader, &type);
2244 ok(hr == S_OK, "got %#x\n", hr);
2245 ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
2246
2248
2250 hr = IXmlReader_Read(reader, &type);
2251 ok(hr == S_FALSE, "got %#x\n", hr);
2252 ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
2253
2255
2256 hr = IXmlReader_SetInput(reader, NULL);
2257 ok(hr == S_OK, "got %08x\n", hr);
2258
2260
2261 IXmlReader_Release(reader);
2262
2263 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2264 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2265
2266 set_input_string(reader, "<a/>text");
2267
2269 hr = IXmlReader_Read(reader, &type);
2270 ok(hr == S_OK, "got %#x\n", hr);
2271 ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
2272
2274
2276 hr = IXmlReader_Read(reader, &type);
2277 ok(hr == WC_E_SYNTAX, "got %#x\n", hr);
2278 ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
2279
2281
2282 hr = IXmlReader_SetInput(reader, NULL);
2283 ok(hr == S_OK, "got %08x\n", hr);
2284
2285 IXmlReader_Release(reader);
2286}
static void test_eof_state(IXmlReader *reader, BOOL eof)
Definition: reader.c:2216
@ WC_E_SYNTAX
Definition: xmllite.idl:158

Referenced by START_TEST().

◆ test_eof_state()

static void test_eof_state ( IXmlReader reader,
BOOL  eof 
)
static

Definition at line 2216 of file reader.c.

2217{
2219 HRESULT hr;
2220
2221 ok(IXmlReader_IsEOF(reader) == eof, "Unexpected IsEOF() result\n");
2222 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
2223 ok(hr == S_OK, "GetProperty() failed, %#x\n", hr);
2224 ok((state == XmlReadState_EndOfFile) == eof, "Unexpected EndOfFile state %ld\n", state);
2225}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
@ XmlReaderProperty_ReadState
Definition: xmllite.idl:131

Referenced by test_endoffile().

◆ test_isemptyelement()

static void test_isemptyelement ( void  )
static

Definition at line 1833 of file reader.c.

1834{
1837 HRESULT hr;
1838
1839 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1840 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1841
1842 while (test->xml)
1843 {
1845 BOOL ret;
1846
1848
1850 hr = IXmlReader_Read(reader, &type);
1851 ok(hr == S_OK, "got 0x%08x\n", hr);
1852 ok(type == XmlNodeType_Element, "got %d\n", type);
1853
1854 ret = IXmlReader_IsEmptyElement(reader);
1855 ok(ret == test->empty, "got %d, expected %d. xml=%s\n", ret, test->empty, test->xml);
1856
1857 test++;
1858 }
1859
1860 IXmlReader_Release(reader);
1861}
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct test_entry_empty empty_element_tests[]
Definition: reader.c:1827
#define test
Definition: rosglue.h:37
Definition: reader.c:1822

Referenced by START_TEST().

◆ test_max_element_depth()

static void test_max_element_depth ( void  )
static

Definition at line 2288 of file reader.c.

2289{
2290 static const char *xml =
2291 "<a>"
2292 "<b attrb=\"_b\">"
2293 "<c>"
2294 "<d></d>"
2295 "</c>"
2296 "</b>"
2297 "</a>";
2298 XmlNodeType nodetype;
2299 unsigned int count;
2301 HRESULT hr;
2302
2303 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2304 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2305
2307
2308 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
2309 ok(hr == S_OK, "got %08x\n", hr);
2310
2311 TEST_DEPTH(reader, 0);
2312
2313 hr = IXmlReader_Read(reader, NULL);
2314 ok(hr == S_OK, "got %08x\n", hr);
2315
2316 TEST_DEPTH(reader, 0);
2317
2318 hr = IXmlReader_Read(reader, NULL);
2319 ok(hr == S_OK, "got %08x\n", hr);
2320
2321 TEST_DEPTH(reader, 1);
2323
2324 hr = IXmlReader_Read(reader, NULL);
2325 ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2326
2327 TEST_DEPTH2(reader, 0, 2);
2329
2330 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 10);
2331 ok(hr == S_OK, "got %08x\n", hr);
2332
2333 hr = IXmlReader_Read(reader, NULL);
2334 ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2335
2336 TEST_DEPTH2(reader, 0, 2);
2338
2339 /* test if stepping into attributes enforces depth limit too */
2341
2342 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
2343 ok(hr == S_OK, "got %08x\n", hr);
2344
2345 TEST_DEPTH(reader, 0);
2346
2347 hr = IXmlReader_Read(reader, NULL);
2348 ok(hr == S_OK, "got %08x\n", hr);
2349
2350 TEST_DEPTH(reader, 0);
2351
2352 hr = IXmlReader_Read(reader, NULL);
2353 ok(hr == S_OK, "got %08x\n", hr);
2354
2355 TEST_DEPTH(reader, 1);
2356
2357 hr = IXmlReader_MoveToFirstAttribute(reader);
2358 ok(hr == S_OK, "got %08x\n", hr);
2359
2360 TEST_DEPTH(reader, 2);
2362
2363 nodetype = 123;
2364 hr = IXmlReader_Read(reader, &nodetype);
2365 ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2366 ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
2367
2368 nodetype = 123;
2369 hr = IXmlReader_Read(reader, &nodetype);
2370 ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2371 ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
2372
2373 TEST_DEPTH2(reader, 0, 2);
2375
2376 /* set max depth to 0, this disables depth limit */
2378
2379 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
2380 ok(hr == S_OK, "got %08x\n", hr);
2381
2382 count = 0;
2383 while (IXmlReader_Read(reader, NULL) == S_OK)
2384 count++;
2385 ok(count == 8, "Unexpected node number %u\n", count);
2387
2388 IXmlReader_Release(reader);
2389}
#define TEST_READER_STATE(reader, state)
Definition: reader.c:286
#define TEST_DEPTH2(reader, depth, brk)
Definition: reader.c:855
#define TEST_DEPTH(reader, depth)
Definition: reader.c:854
@ SC_E_MAXELEMENTDEPTH
Definition: xmllite.idl:206
@ XmlReaderProperty_MaxElementDepth
Definition: xmllite.idl:132

Referenced by START_TEST().

◆ test_namespaceuri()

static void test_namespaceuri ( void  )
static

Definition at line 2028 of file reader.c.

2029{
2030 struct uri_test
2031 {
2032 const char *xml;
2033 const char *uri[5];
2034 } uri_tests[] =
2035 {
2036 { "<a xmlns=\"defns a\"><b xmlns=\"defns b\"><c xmlns=\"defns c\"/></b></a>",
2037 { "defns a", "defns b", "defns c", "defns b", "defns a" }},
2038 { "<r:a xmlns=\"defns a\" xmlns:r=\"ns r\"/>",
2039 { "ns r" }},
2040 { "<r:a xmlns=\"defns a\" xmlns:r=\"ns r\"><b/></r:a>",
2041 { "ns r", "defns a", "ns r" }},
2042 { "<a xmlns=\"defns a\" xmlns:r=\"ns r\"><r:b/></a>",
2043 { "defns a", "ns r", "defns a" }},
2044 { "<a><b><c/></b></a>",
2045 { "", "", "", "", "" }},
2046 { "<a>text</a>",
2047 { "", "", "" }},
2048 { "<a>\r\n</a>",
2049 { "", "", "" }},
2050 { "<a><![CDATA[data]]></a>",
2051 { "", "", "" }},
2052 { "<?xml version=\"1.0\" ?><a/>",
2053 { "", "" }},
2054 { "<a><?pi ?></a>",
2055 { "", "", "" }},
2056 { "<a><!-- comment --></a>",
2057 { "", "", "" }},
2058 };
2061 unsigned int i;
2062 HRESULT hr;
2063
2064 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
2065 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2066
2067 for (i = 0; i < ARRAY_SIZE(uri_tests); i++) {
2068 unsigned int j = 0;
2069
2071
2072 type = ~0u;
2073 while (IXmlReader_Read(reader, &type) == S_OK) {
2074 const WCHAR *local, *qname;
2075 UINT length, length2;
2076
2084 type == XmlNodeType_XmlDeclaration, "Unexpected node type %d.\n", type);
2085
2086 local = NULL;
2087 length = 0;
2088 hr = IXmlReader_GetLocalName(reader, &local, &length);
2089 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2090 ok(local != NULL, "Unexpected NULL local name pointer\n");
2091
2092 qname = NULL;
2093 length2 = 0;
2094 hr = IXmlReader_GetQualifiedName(reader, &qname, &length2);
2095 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2096 ok(qname != NULL, "Unexpected NULL qualified name pointer\n");
2097
2098 if (type == XmlNodeType_Element ||
2102 {
2103 ok(*local != 0, "Unexpected empty local name\n");
2104 ok(length > 0, "Unexpected local name length\n");
2105
2106 ok(*qname != 0, "Unexpected empty qualified name\n");
2107 ok(length2 > 0, "Unexpected qualified name length\n");
2108 }
2109
2111
2112 j++;
2113 }
2114 ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
2115 }
2116
2117 IXmlReader_Release(reader);
2118}
#define local
Definition: zutil.h:30
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 * u
Definition: glfuncs.h:240
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
const char * uri
Definition: sec_mgr.c:1588
static const uri_properties uri_tests[]
Definition: uri.c:140
#define reader_namespace(a, b)
Definition: reader.c:331
@ XmlNodeType_Whitespace
Definition: xmllite.idl:32
@ XmlNodeType_EndElement
Definition: xmllite.idl:33
@ XmlNodeType_ProcessingInstruction
Definition: xmllite.idl:29
@ XmlNodeType_CDATA
Definition: xmllite.idl:28
@ XmlNodeType_XmlDeclaration
Definition: xmllite.idl:34
@ XmlNodeType_Comment
Definition: xmllite.idl:30
@ XmlNodeType_Text
Definition: xmllite.idl:27

Referenced by START_TEST().

◆ test_prefix()

static void test_prefix ( void  )
static

Definition at line 1972 of file reader.c.

1973{
1974 static const struct
1975 {
1976 const char *xml;
1977 const char *prefix1;
1978 const char *prefix2;
1979 const char *prefix3;
1980 } prefix_tests[] =
1981 {
1982 { "<b xmlns=\"defns\" xml:a=\"a ns\"/>", "", "", "xml" },
1983 { "<c:b xmlns:c=\"c ns\" xml:a=\"a ns\"/>", "c", "xmlns", "xml" },
1984 };
1986 unsigned int i;
1987 HRESULT hr;
1988
1989 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1990 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1991
1992 for (i = 0; i < ARRAY_SIZE(prefix_tests); i++) {
1994
1995 set_input_string(reader, prefix_tests[i].xml);
1996
1997 hr = IXmlReader_Read(reader, &type);
1998 ok(hr == S_OK, "Read() failed, %#x\n", hr);
1999 ok(type == XmlNodeType_Element, "Unexpected node type %d.\n", type);
2000
2001 reader_prefix(reader, prefix_tests[i].prefix1);
2002
2003 hr = IXmlReader_MoveToFirstAttribute(reader);
2004 ok(hr == S_OK, "MoveToFirstAttribute() failed, %#x.\n", hr);
2005
2006 hr = IXmlReader_GetNodeType(reader, &type);
2007 ok(hr == S_OK, "GetNodeType() failed, %#x.\n", hr);
2008 ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
2009
2010 reader_prefix(reader, prefix_tests[i].prefix2);
2011
2013
2014 hr = IXmlReader_GetNodeType(reader, &type);
2015 ok(hr == S_OK, "GetNodeType() failed, %#x.\n", hr);
2016 ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
2017
2018 reader_prefix(reader, prefix_tests[i].prefix3);
2019
2020 /* back to the element, check prefix */
2022 reader_prefix(reader, prefix_tests[i].prefix1);
2023 }
2024
2025 IXmlReader_Release(reader);
2026}
#define reader_prefix(a, b)
Definition: reader.c:317
#define move_to_element(a)
Definition: reader.c:260
#define next_attribute(a)
Definition: reader.c:252
@ XmlNodeType_Attribute
Definition: xmllite.idl:26

Referenced by START_TEST().

◆ test_read_attribute()

static void test_read_attribute ( void  )
static

Definition at line 1887 of file reader.c.

1888{
1891 HRESULT hr;
1892
1893 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1894 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1895
1896 while (test->xml)
1897 {
1899
1901
1902 hr = IXmlReader_Read(reader, NULL);
1903
1904 if (test->hr_broken)
1905 ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1906 else
1907 ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1908 if (hr == S_OK)
1909 {
1910 const WCHAR *str;
1911 WCHAR *str_exp;
1912 UINT len;
1913
1915 hr = IXmlReader_GetNodeType(reader, &type);
1916 ok(hr == S_OK, "Failed to get node type, %#x\n", hr);
1917
1918 ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
1919
1920 hr = IXmlReader_MoveToFirstAttribute(reader);
1921 ok(hr == S_OK, "got 0x%08x\n", hr);
1922
1924
1925 len = 1;
1926 str = NULL;
1927 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1928 ok(hr == S_OK, "got 0x%08x\n", hr);
1929 ok(len == strlen(test->name), "got %u\n", len);
1930 str_exp = a2w(test->name);
1931 ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
1932 free_str(str_exp);
1933
1934 /* value */
1936 }
1937
1938 test++;
1939 }
1940
1941 IXmlReader_Release(reader);
1942}
#define reader_name(a, b)
Definition: reader.c:303
static struct test_entry attributes_tests[]
Definition: reader.c:1863
char * value
Definition: compiler.c:67
char * name
Definition: compiler.c:66

Referenced by START_TEST().

◆ test_read_cdata()

static void test_read_cdata ( void  )
static

Definition at line 1688 of file reader.c.

1689{
1690 struct test_entry *test = cdata_tests;
1692 HRESULT hr;
1693
1694 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1695 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1696
1697 while (test->xml)
1698 {
1700
1702
1704 hr = IXmlReader_Read(reader, &type);
1705
1706 /* read one more to get to CDATA */
1708 {
1710 hr = IXmlReader_Read(reader, &type);
1711 }
1712
1713 if (test->hr_broken)
1714 ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1715 else
1716 ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1717 if (hr == S_OK)
1718 {
1719 const WCHAR *str;
1720 UINT len;
1721
1722 ok(type == XmlNodeType_CDATA, "got %d for %s\n", type, test->xml);
1723
1724 reader_name(reader, "");
1725
1726 str = NULL;
1727 hr = IXmlReader_GetLocalName(reader, &str, NULL);
1728 ok(hr == S_OK, "got 0x%08x\n", hr);
1729 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1730
1731 len = 1;
1732 str = NULL;
1733 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1734 ok(hr == S_OK, "got 0x%08x\n", hr);
1735 ok(len == 0, "got %u\n", len);
1736 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1737
1738 str = NULL;
1739 hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1740 ok(hr == S_OK, "got 0x%08x\n", hr);
1741 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1742
1743 /* value */
1745 }
1746
1747 test++;
1748 }
1749
1750 IXmlReader_Release(reader);
1751}
static struct test_entry cdata_tests[]
Definition: reader.c:1679

Referenced by START_TEST().

◆ test_read_charref()

static void test_read_charref ( void  )
static

Definition at line 2120 of file reader.c.

2121{
2122 static const char testA[] = "<a b=\"c\">&#x1f3;&#x103;&gt;</a>";
2123 static const WCHAR chardataW[] = {0x01f3,0x0103,'>',0};
2124 const WCHAR *value;
2127 HRESULT hr;
2128
2129 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2130 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2131
2133
2134 hr = IXmlReader_Read(reader, &type);
2135 ok(hr == S_OK, "got %08x\n", hr);
2136 ok(type == XmlNodeType_Element, "Unexpected node type %d\n", type);
2137
2138 hr = IXmlReader_Read(reader, &type);
2139 ok(hr == S_OK, "got %08x\n", hr);
2140 ok(type == XmlNodeType_Text, "Unexpected node type %d\n", type);
2141
2142 hr = IXmlReader_GetValue(reader, &value, NULL);
2143 ok(hr == S_OK, "got %08x\n", hr);
2144 ok(!lstrcmpW(value, chardataW), "Text value : %s\n", wine_dbgstr_w(value));
2145
2146 hr = IXmlReader_Read(reader, &type);
2147 ok(hr == S_OK, "got %08x\n", hr);
2148 ok(type == XmlNodeType_EndElement, "Unexpected node type %d\n", type);
2149
2150 hr = IXmlReader_Read(reader, &type);
2151 ok(hr == S_FALSE, "got %08x\n", hr);
2152 ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
2153
2154 IXmlReader_Release(reader);
2155}
static const CHAR testA[]
Definition: run.c:171
Definition: pdh_main.c:94

Referenced by START_TEST().

◆ test_read_comment()

static void test_read_comment ( void  )
static

Definition at line 1062 of file reader.c.

1063{
1064 static const char *teststr = "<a>text<!-- comment --></a>";
1065 struct test_entry *test = comment_tests;
1066 static const XmlNodeType types[] =
1067 {
1072 };
1073 unsigned int i = 0;
1076 HRESULT hr;
1077
1078 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1079 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1080
1081 set_input_string(reader, teststr);
1082
1083 while (IXmlReader_Read(reader, &type) == S_OK)
1084 {
1085 const WCHAR *value;
1086
1087 ok(type == types[i], "%d: unexpected node type %d\n", i, type);
1088
1090 {
1091 hr = IXmlReader_GetValue(reader, &value, NULL);
1092 ok(hr == S_OK, "got %08x\n", hr);
1093 ok(*value != 0, "Expected node value\n");
1094 }
1095 i++;
1096 }
1097
1098 while (test->xml)
1099 {
1101
1103 hr = IXmlReader_Read(reader, &type);
1104 if (test->hr_broken)
1105 ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1106 else
1107 ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1108 if (hr == S_OK)
1109 {
1110 const WCHAR *str;
1111
1112 ok(type == XmlNodeType_Comment, "got %d for %s\n", type, test->xml);
1113
1114 reader_name(reader, "");
1115
1116 str = NULL;
1117 hr = IXmlReader_GetLocalName(reader, &str, NULL);
1118 ok(hr == S_OK, "got 0x%08x\n", hr);
1119 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1120
1121 reader_qname(reader, "");
1122
1123 str = NULL;
1124 hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1125 ok(hr == S_OK, "got 0x%08x\n", hr);
1126 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1127
1128 /* value */
1130 }
1131
1132 test++;
1133 }
1134
1135 IXmlReader_Release(reader);
1136}
#define reader_qname(a, b)
Definition: reader.c:345
static struct test_entry comment_tests[]
Definition: reader.c:1054
const char * value
Definition: reader.c:1048
Definition: cmds.c:130

Referenced by START_TEST().

◆ test_read_element()

static void test_read_element ( void  )
static

Definition at line 1405 of file reader.c.

1406{
1407 struct test_entry *test = element_tests;
1408 static const char stag[] =
1409 "<a attr1=\"_a\">"
1410 "<b attr2=\"_b\">"
1411 "text"
1412 "<c attr3=\"_c\"/>"
1413 "<d attr4=\"_d\"></d>"
1414 "</b>"
1415 "</a>";
1416 static const UINT depths[] = { 0, 1, 2, 2, 2, 3, 2, 1 };
1419 unsigned int i;
1420 UINT depth;
1421 HRESULT hr;
1422
1423 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1424 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1425
1426 while (test->xml)
1427 {
1429
1431 hr = IXmlReader_Read(reader, &type);
1432 if (test->hr_broken)
1433 ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1434 else
1436 ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1437 if (hr == S_OK)
1438 {
1439 const WCHAR *str;
1440 WCHAR *str_exp;
1441 UINT len;
1442
1443 ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
1444
1445 len = 0;
1446 str = NULL;
1447 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1448 ok(hr == S_OK, "got 0x%08x\n", hr);
1449 ok(len == strlen(test->name), "got %u\n", len);
1450 str_exp = a2w(test->name);
1451 ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
1452 free_str(str_exp);
1453
1454 /* value */
1455 reader_value(reader, "");
1456 }
1457
1458 test++;
1459 }
1460
1461 /* test reader depth increment */
1462 set_input_string(reader, stag);
1463
1464 i = 0;
1465 while (IXmlReader_Read(reader, &type) == S_OK)
1466 {
1467 UINT count;
1468
1470 type == XmlNodeType_Text, "Unexpected node type %d\n", type);
1471
1472 depth = 123;
1473 hr = IXmlReader_GetDepth(reader, &depth);
1474 ok(hr == S_OK, "got %08x\n", hr);
1475 ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
1476
1478 {
1479 const WCHAR *prefix;
1480
1481 prefix = NULL;
1482 hr = IXmlReader_GetPrefix(reader, &prefix, NULL);
1483 ok(hr == S_OK, "got %08x\n", hr);
1484 ok(prefix != NULL, "got %p\n", prefix);
1485
1486 if (!*prefix)
1487 {
1488 const WCHAR *local, *qname;
1489
1490 local = NULL;
1491 hr = IXmlReader_GetLocalName(reader, &local, NULL);
1492 ok(hr == S_OK, "got %08x\n", hr);
1493 ok(local != NULL, "got %p\n", local);
1494
1495 qname = NULL;
1496 hr = IXmlReader_GetQualifiedName(reader, &qname, NULL);
1497 ok(hr == S_OK, "got %08x\n", hr);
1498 ok(qname != NULL, "got %p\n", qname);
1499
1500 ok(local == qname, "expected same pointer\n");
1501 }
1502 }
1503
1505 {
1506 count = 1;
1507 hr = IXmlReader_GetAttributeCount(reader, &count);
1508 ok(hr == S_OK, "got %08x\n", hr);
1509 ok(count == 0, "got %u\n", count);
1510 }
1511
1513 {
1514 count = 0;
1515 hr = IXmlReader_GetAttributeCount(reader, &count);
1516 ok(hr == S_OK, "got %08x\n", hr);
1517
1518 /* moving to attributes increases depth */
1519 if (count)
1520 {
1521 const WCHAR *value;
1522
1523 reader_value(reader, "");
1524
1525 hr = IXmlReader_MoveToFirstAttribute(reader);
1526 ok(hr == S_OK, "got %08x\n", hr);
1527
1528 hr = IXmlReader_GetValue(reader, &value, NULL);
1529 ok(*value != 0, "Unexpected value %s\n", wine_dbgstr_w(value));
1530
1531 depth = 123;
1532 hr = IXmlReader_GetDepth(reader, &depth);
1533 ok(hr == S_OK, "got %08x\n", hr);
1534 ok(depth == depths[i] + 1, "%u: got depth %u, expected %u\n", i, depth, depths[i] + 1);
1535
1537 reader_value(reader, "");
1538
1539 depth = 123;
1540 hr = IXmlReader_GetDepth(reader, &depth);
1541 ok(hr == S_OK, "got %08x\n", hr);
1542 ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
1543 }
1544 }
1545
1546 i++;
1547 }
1548
1549 /* start/end tag mismatch */
1550 set_input_string(reader, "<a></b>");
1551
1553
1555 hr = IXmlReader_Read(reader, &type);
1556 ok(hr == WC_E_ELEMENTMATCH, "got %08x\n", hr);
1557 ok(type == XmlNodeType_None, "got %d\n", type);
1559
1560 IXmlReader_Release(reader);
1561}
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static struct test_entry element_tests[]
Definition: reader.c:1390
@ NC_E_UNDECLAREDPREFIX
Definition: xmllite.idl:199
@ WC_E_ELEMENTMATCH
Definition: xmllite.idl:172

Referenced by START_TEST().

◆ test_read_full()

static void test_read_full ( void  )
static

Definition at line 1250 of file reader.c.

1251{
1252 struct nodes_test *test = &misc_test;
1254 HRESULT hr;
1255 int i;
1256
1257 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1258 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1259
1261
1262 i = 0;
1263 do
1264 {
1265 read_node(reader, test->nodes[i].type);
1266 reader_value(reader, test->nodes[i].value);
1267 } while(test->nodes[i++].type != XmlNodeType_None);
1268
1269 IXmlReader_Release(reader);
1270}
static struct nodes_test misc_test
Definition: reader.c:1228

Referenced by START_TEST().

◆ test_read_pending()

static void test_read_pending ( void  )
static

Definition at line 1565 of file reader.c.

1566{
1568 const WCHAR *value;
1570 HRESULT hr;
1571 int c;
1572
1573 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1574 ok(hr == S_OK, "S_OK, got 0x%08x\n", hr);
1575
1576 hr = IXmlReader_SetInput(reader, (IUnknown*)&teststream);
1577 ok(hr == S_OK, "got 0x%08x\n", hr);
1578
1579 /* first read call returns incomplete node, second attempt fails with E_PENDING */
1580 stream_readcall = 0;
1582 hr = IXmlReader_Read(reader, &type);
1583 ok(hr == S_OK || broken(hr == E_PENDING), "got 0x%08x\n", hr);
1584 /* newer versions are happy when it's enough data to detect node type,
1585 older versions keep reading until it fails to read more */
1587 ok(stream_readcall == 1 || broken(stream_readcall > 1), "got %d\n", stream_readcall);
1588 ok(type == XmlNodeType_Comment || broken(type == XmlNodeType_None), "got %d\n", type);
1589
1590 /* newer versions' GetValue() makes an attempt to read more */
1592 value = (void*)0xdeadbeef;
1593 hr = IXmlReader_GetValue(reader, &value, NULL);
1594 ok(hr == E_PENDING, "got 0x%08x\n", hr);
1595 ok(value == NULL || broken(value == (void*)0xdeadbeef) /* Win8 sets it to NULL */, "got %p\n", value);
1596 ok(c < stream_readcall || broken(c == stream_readcall), "got %d, expected %d\n", stream_readcall, c+1);
1597
1598 IXmlReader_Release(reader);
1599}
#define E_PENDING
Definition: dinput.h:172
#define todo_wine
Definition: custom.c:79
static ISequentialStream teststream
Definition: reader.c:1563
static int stream_readcall
Definition: reader.c:461

Referenced by START_TEST().

◆ test_read_pi()

static void test_read_pi ( void  )
static

Definition at line 1152 of file reader.c.

1153{
1154 struct test_entry *test = pi_tests;
1156 HRESULT hr;
1157
1158 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1159 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1160
1161 while (test->xml)
1162 {
1164
1166
1168 hr = IXmlReader_Read(reader, &type);
1169 if (test->hr_broken)
1170 ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1171 else
1172 ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1173 if (hr == S_OK)
1174 {
1175 const WCHAR *str;
1176 WCHAR *str_exp;
1177 UINT len;
1178
1179 ok(type == XmlNodeType_ProcessingInstruction, "got %d for %s\n", type, test->xml);
1180
1182
1183 len = 0;
1184 str = NULL;
1185 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1186 ok(hr == S_OK, "got 0x%08x\n", hr);
1187 ok(len == strlen(test->name), "got %u\n", len);
1188 str_exp = a2w(test->name);
1189 ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
1190 free_str(str_exp);
1191
1192 /* value */
1194 }
1195
1196 test++;
1197 }
1198
1199 IXmlReader_Release(reader);
1200}
static struct test_entry pi_tests[]
Definition: reader.c:1138

Referenced by START_TEST().

◆ test_read_public_dtd()

static void test_read_public_dtd ( void  )
static

Definition at line 1275 of file reader.c.

1276{
1277 static const WCHAR dtdnameW[] = {'t','e','s','t','d','t','d',0};
1279 const WCHAR *str;
1281 UINT len, count;
1282 HRESULT hr;
1283
1284 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1285 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1286
1288 ok(hr == S_OK, "got 0x%8x\n", hr);
1289
1291
1293
1294 count = 0;
1295 hr = IXmlReader_GetAttributeCount(reader, &count);
1296 ok(hr == S_OK, "got %08x\n", hr);
1297 ok(count == 2, "got %d\n", count);
1298
1299 hr = IXmlReader_MoveToFirstAttribute(reader);
1300 ok(hr == S_OK, "got %08x\n", hr);
1301
1303 hr = IXmlReader_GetNodeType(reader, &type);
1304 ok(hr == S_OK, "got %08x\n", hr);
1305 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1306
1307 reader_name(reader, "PUBLIC");
1308 reader_value(reader, "pubid");
1309
1311
1313 hr = IXmlReader_GetNodeType(reader, &type);
1314 ok(hr == S_OK, "got %08x\n", hr);
1315 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1316
1317 reader_name(reader, "SYSTEM");
1318 reader_value(reader, "externalid uri");
1319
1321 reader_name(reader, "testdtd");
1322
1323 len = 0;
1324 str = NULL;
1325 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1326 ok(hr == S_OK, "got 0x%08x\n", hr);
1327todo_wine {
1328 ok(len == lstrlenW(dtdnameW), "got %u\n", len);
1329 ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str));
1330}
1331 IXmlReader_Release(reader);
1332}
static const char test_public_dtd[]
Definition: reader.c:1272
@ DtdProcessing_Parse
Definition: xmllite.idl:119
@ XmlReaderProperty_DtdProcessing
Definition: xmllite.idl:130
@ XmlNodeType_DocumentType
Definition: xmllite.idl:31

Referenced by START_TEST().

◆ test_read_state()

static void test_read_state ( IXmlReader reader,
XmlReadState  expected,
XmlReadState  exp_broken,
int  line 
)
static

Definition at line 268 of file reader.c.

270{
271 BOOL broken_state;
273
274 state = -1; /* invalid state value */
275 IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
276
277 if (exp_broken == expected)
278 broken_state = FALSE;
279 else
280 broken_state = broken(exp_broken == state);
281
282 ok_(__FILE__, line)(state == expected || broken_state, "Expected (%s), got (%s)\n",
284}
static const char * state_to_str(XmlReadState state)
Definition: reader.c:157

◆ test_read_system_dtd()

static void test_read_system_dtd ( void  )
static

Definition at line 1338 of file reader.c.

1339{
1340 static const WCHAR dtdnameW[] = {'t','e','s','t','d','t','d',0};
1342 const WCHAR *str;
1344 UINT len, count;
1345 HRESULT hr;
1346
1347 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1348 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1349
1351 ok(hr == S_OK, "got 0x%8x\n", hr);
1352
1354
1356
1357 count = 0;
1358 hr = IXmlReader_GetAttributeCount(reader, &count);
1359 ok(hr == S_OK, "got %08x\n", hr);
1360 ok(count == 1, "got %d\n", count);
1361
1362 hr = IXmlReader_MoveToFirstAttribute(reader);
1363 ok(hr == S_OK, "got %08x\n", hr);
1364
1366 hr = IXmlReader_GetNodeType(reader, &type);
1367 ok(hr == S_OK, "got %08x\n", hr);
1368 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1369
1370 reader_name(reader, "SYSTEM");
1371 reader_value(reader, "externalid uri");
1372
1374 reader_name(reader, "testdtd");
1375
1376 len = 0;
1377 str = NULL;
1378 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1379 ok(hr == S_OK, "got 0x%08x\n", hr);
1380todo_wine {
1381 ok(len == lstrlenW(dtdnameW), "got %u\n", len);
1382 ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str));
1383}
1384
1386
1387 IXmlReader_Release(reader);
1388}
static const char test_system_dtd[]
Definition: reader.c:1334

Referenced by START_TEST().

◆ test_read_text()

static void test_read_text ( void  )
static

Definition at line 1761 of file reader.c.

1762{
1763 struct test_entry *test = text_tests;
1765 HRESULT hr;
1766
1767 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1768 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1769
1770 while (test->xml)
1771 {
1773
1775
1777 hr = IXmlReader_Read(reader, &type);
1778
1779 /* read one more to get to text node */
1781 {
1783 hr = IXmlReader_Read(reader, &type);
1784 }
1785 ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1786 if (hr == S_OK)
1787 {
1788 const WCHAR *str;
1789 UINT len;
1790
1791 ok(type == XmlNodeType_Text, "got %d for %s\n", type, test->xml);
1792
1793 reader_name(reader, "");
1794
1795 str = NULL;
1796 hr = IXmlReader_GetLocalName(reader, &str, NULL);
1797 ok(hr == S_OK, "got 0x%08x\n", hr);
1798 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1799
1800 len = 1;
1801 str = NULL;
1802 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1803 ok(hr == S_OK, "got 0x%08x\n", hr);
1804 ok(len == 0, "got %u\n", len);
1805 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1806
1807 str = NULL;
1808 hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1809 ok(hr == S_OK, "got 0x%08x\n", hr);
1810 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1811
1812 /* value */
1814 }
1815
1816 test++;
1817 }
1818
1819 IXmlReader_Release(reader);
1820}
static struct test_entry text_tests[]
Definition: reader.c:1753

Referenced by START_TEST().

◆ test_read_xmldeclaration()

static void test_read_xmldeclaration ( void  )
static

Definition at line 857 of file reader.c.

858{
859 static const struct
860 {
861 WCHAR name[12];
862 WCHAR val[12];
863 } name_val[] =
864 {
865 { {'v','e','r','s','i','o','n',0}, {'1','.','0',0} },
866 { {'e','n','c','o','d','i','n','g',0}, {'U','T','F','-','8',0} },
867 { {'s','t','a','n','d','a','l','o','n','e',0}, {'y','e','s',0} }
868 };
871 HRESULT hr;
873 UINT count = 0, len, i;
874 BOOL ret;
875 const WCHAR *val;
876
877 hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
878 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
879
881
882 hr = IXmlReader_SetInput(reader, (IUnknown*)stream);
883 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
884
885 hr = IXmlReader_GetAttributeCount(reader, &count);
886 ok(hr == S_OK, "got %08x\n", hr);
887 ok(count == 0, "got %d\n", count);
888
889 /* try to move without attributes */
890 hr = IXmlReader_MoveToElement(reader);
891 ok(hr == S_FALSE, "got %08x\n", hr);
892
893 hr = IXmlReader_MoveToNextAttribute(reader);
894 ok(hr == S_FALSE, "got %08x\n", hr);
895
896 hr = IXmlReader_MoveToFirstAttribute(reader);
897 ok(hr == S_FALSE, "got %08x\n", hr);
898
900
902
903 /* new version 1.2.x and 1.3.x properly update position for <?xml ?> */
904 TEST_READER_POSITION2(reader, 1, 3, ~0u, 55);
905
906 TEST_DEPTH(reader, 0);
908
909 reader_value(reader, "");
910
911 /* check attributes */
913
914 TEST_DEPTH(reader, 1);
915
917 hr = IXmlReader_GetNodeType(reader, &type);
918 ok(hr == S_OK, "got %08x\n", hr);
919 ok(type == XmlNodeType_Attribute, "got %d\n", type);
920
921 TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
922
923 /* try to move from last attribute */
926 hr = IXmlReader_MoveToNextAttribute(reader);
927 ok(hr == S_FALSE, "got %08x\n", hr);
928
930 hr = IXmlReader_GetNodeType(reader, &type);
931 ok(hr == S_OK, "got %08x\n", hr);
932 ok(type == XmlNodeType_Attribute, "got %d\n", type);
933
934 hr = IXmlReader_MoveToFirstAttribute(reader);
935 ok(hr == S_OK, "got %08x\n", hr);
936 TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
937
938 hr = IXmlReader_GetAttributeCount(reader, NULL);
939 ok(hr == E_INVALIDARG, "got %08x\n", hr);
940
941 hr = IXmlReader_GetAttributeCount(reader, &count);
942 ok(hr == S_OK, "got %08x\n", hr);
943 ok(count == 3, "Expected 3, got %d\n", count);
944
945 for (i = 0; i < count; i++)
946 {
947 len = 0;
948 hr = IXmlReader_GetLocalName(reader, &val, &len);
949 ok(hr == S_OK, "got %08x\n", hr);
950 ok(len == lstrlenW(name_val[i].name), "expected %u, got %u\n", lstrlenW(name_val[i].name), len);
951 ok(!lstrcmpW(name_val[i].name, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].name), wine_dbgstr_w(val));
952
953 len = 0;
954 hr = IXmlReader_GetValue(reader, &val, &len);
955 ok(hr == S_OK, "got %08x\n", hr);
956 ok(len == lstrlenW(name_val[i].val), "expected %u, got %u\n", lstrlenW(name_val[i].val), len);
957 ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val));
958
959 hr = IXmlReader_MoveToNextAttribute(reader);
960 ok(hr == ((i < count - 1) ? S_OK : S_FALSE), "got %08x\n", hr);
961 }
962
963 TEST_DEPTH(reader, 1);
964
966 TEST_READER_POSITION2(reader, 1, 3, ~0u, 55);
967
969 hr = IXmlReader_GetNodeType(reader, &type);
970 ok(hr == S_OK, "got %08x\n", hr);
971 ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type);
972
974 hr = IXmlReader_Read(reader, &type);
975 /* newer versions return syntax error here cause document is incomplete,
976 it makes more sense than invalid char error */
977todo_wine {
978 ok(hr == WC_E_SYNTAX || broken(hr == WC_E_XMLCHARACTER), "got 0x%08x\n", hr);
979 ok(type == XmlNodeType_None, "got %d\n", type);
980}
981 IStream_Release(stream);
982
983 /* test short variant */
985
986 hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
987 ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
988
990 TEST_READER_POSITION2(reader, 1, 3, ~0u, 21);
992
993 hr = IXmlReader_GetAttributeCount(reader, &count);
994 ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
995 ok(count == 1, "expected 1, got %d\n", count);
996
997 ret = IXmlReader_IsEmptyElement(reader);
998 ok(!ret, "element should not be empty\n");
999
1000 reader_value(reader, "");
1001 reader_name(reader, "xml");
1002
1003 reader_qname(reader, "xml");
1004
1005 /* check attributes */
1007
1008 type = -1;
1009 hr = IXmlReader_GetNodeType(reader, &type);
1010 ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
1011 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1012 TEST_READER_POSITION2(reader, 1, 7, ~0u, 21);
1013
1014 /* try to move from last attribute */
1015 hr = IXmlReader_MoveToNextAttribute(reader);
1016 ok(hr == S_FALSE, "expected S_FALSE, got %08x\n", hr);
1017
1019 TEST_READER_POSITION2(reader, 1, 23, ~0u, 40);
1021
1022 hr = IXmlReader_GetAttributeCount(reader, &count);
1023 ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
1024 ok(count == 0, "expected 0, got %d\n", count);
1025
1026 ret = IXmlReader_IsEmptyElement(reader);
1027 ok(ret, "element should be empty\n");
1028
1029 reader_value(reader, "");
1030 reader_name(reader, "RegistrationInfo");
1031
1032 type = -1;
1033 hr = IXmlReader_Read(reader, &type);
1035 ok(hr == WC_E_SYNTAX || hr == WC_E_XMLCHARACTER /* XP */, "expected WC_E_SYNTAX, got %08x\n", hr);
1036 ok(type == XmlNodeType_None, "expected XmlNodeType_None, got %s\n", type_to_str(type));
1040
1041 IStream_Release(stream);
1042 IXmlReader_Release(reader);
1043}
GLuint GLfloat * val
Definition: glext.h:7180
static const char xmldecl_full[]
Definition: reader.c:58
#define TEST_READER_POSITION(reader, line, pos)
Definition: reader.c:100
static const char * type_to_str(XmlNodeType type)
Definition: reader.c:182
static const char xmldecl_short[]
Definition: reader.c:59
#define TEST_READER_POSITION2(reader, line, pos, line_broken, pos_broken)
Definition: reader.c:102
Definition: name.c:39
@ WC_E_XMLCHARACTER
Definition: xmllite.idl:156

Referenced by START_TEST().

◆ test_reader_create()

static void test_reader_create ( void  )
static

Definition at line 535 of file reader.c.

536{
537 IXmlResolver *resolver;
538 IUnknown *input, *unk;
540#ifdef __REACTOS__
541 ULONG_PTR dtd;
542#else
543 DtdProcessing dtd;
544#endif
545 XmlNodeType nodetype;
546 HRESULT hr;
547
548 /* crashes native */
549 if (0)
550 {
551 CreateXmlReader(&IID_IXmlReader, NULL, NULL);
552 CreateXmlReader(NULL, (void**)&reader, NULL);
553 }
554
555 hr = CreateXmlReader(&IID_IStream, (void **)&unk, NULL);
556 ok(hr == E_NOINTERFACE, "got %08x\n", hr);
557
558 hr = CreateXmlReader(&IID_IUnknown, (void **)&unk, NULL);
559 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
560 hr = IUnknown_QueryInterface(unk, &IID_IXmlReader, (void **)&reader);
561 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
562 ok(unk == (IUnknown *)reader, "unexpected interface\n");
563 IXmlReader_Release(reader);
564 IUnknown_Release(unk);
565
566 hr = CreateXmlReader(&IID_IUnknown, (void **)&reader, NULL);
567 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
568 IXmlReader_Release(reader);
569
570 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
571 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
572
574
575 nodetype = XmlNodeType_Element;
576 hr = IXmlReader_GetNodeType(reader, &nodetype);
577 ok(hr == S_FALSE, "got %08x\n", hr);
578 ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
579
580 /* crashes on XP, 2k3, works on newer versions */
581 if (0)
582 {
583 hr = IXmlReader_GetNodeType(reader, NULL);
584 ok(hr == E_INVALIDARG, "got %08x\n", hr);
585 }
586
587 resolver = (void*)0xdeadbeef;
588 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
589 ok(hr == S_OK, "got 0x%08x\n", hr);
590 ok(resolver == NULL, "got %p\n", resolver);
591
592 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
593 ok(hr == S_OK, "got 0x%08x\n", hr);
594
595 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR)&testresolver);
596 ok(hr == S_OK, "got 0x%08x\n", hr);
597
598 resolver = NULL;
599 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
600 ok(hr == S_OK, "got 0x%08x\n", hr);
601 ok(resolver == &testresolver, "got %p\n", resolver);
602 IXmlResolver_Release(resolver);
603
604 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
605 ok(hr == S_OK, "got 0x%08x\n", hr);
606
607 dtd = 2;
608 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, (LONG_PTR*)&dtd);
609 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
610 ok(dtd == DtdProcessing_Prohibit, "got %Id\n", dtd);
611
612 dtd = 2;
613 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, dtd);
614 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
615
616 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, -1);
617 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
618
619 /* Null input pointer, releases previous input */
620 hr = IXmlReader_SetInput(reader, NULL);
621 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
622
624
625 /* test input interface selection sequence */
627 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
628
629 if (hr == S_OK)
630 {
631 input_iids.count = 0;
632 hr = IXmlReader_SetInput(reader, input);
633 ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
635 IUnknown_Release(input);
636 }
637 IXmlReader_Release(reader);
638}
GLenum GLenum GLenum input
Definition: glext.h:9031
static const IID * setinput_full_old[]
Definition: reader.c:118
static HRESULT testinput_createinstance(void **ppObj)
Definition: reader.c:424
#define ok_iids(got, exp, brk, todo)
Definition: reader.c:155
#define TEST_READER_STATE2(reader, state, brk)
Definition: reader.c:287
static const IID * setinput_full[]
Definition: reader.c:110
static IXmlResolver testresolver
Definition: reader.c:533
static input_iids_t input_iids
Definition: reader.c:136
uint32_t ULONG_PTR
Definition: typedefs.h:65
DtdProcessing
Definition: xmllite.idl:117
@ DtdProcessing_Prohibit
Definition: xmllite.idl:118
@ XmlReaderProperty_XmlResolver
Definition: xmllite.idl:129

Referenced by START_TEST().

◆ test_reader_depth()

static void test_reader_depth ( IXmlReader reader,
UINT  depth,
UINT  brk,
int  line 
)
static

Definition at line 841 of file reader.c.

842{
844 UINT d = ~0u;
845
846 IXmlReader_GetDepth(reader, &d);
847
848 condition = d == depth;
849 if (brk != ~0u)
850 condition |= broken(d == brk);
851 ok_(__FILE__, line)(condition, "Unexpected nesting depth %u, expected %u\n", d, depth);
852}
GLenum condition
Definition: glext.h:9255
#define d
Definition: ke_i.h:81

◆ test_reader_pos()

static void test_reader_pos ( IXmlReader reader,
UINT  line,
UINT  pos,
UINT  line_broken,
UINT  pos_broken,
int  _line_ 
)
static

Definition at line 82 of file reader.c.

84{
85 UINT l = ~0u, p = ~0u;
86 BOOL broken_state;
87
88 IXmlReader_GetLineNumber(reader, &l);
89 IXmlReader_GetLinePosition(reader, &p);
90
91 if (line_broken == ~0u && pos_broken == ~0u)
92 broken_state = FALSE;
93 else
94 broken_state = broken((line_broken == ~0u ? line : line_broken) == l &&
95 (pos_broken == ~0u ? pos : pos_broken) == p);
96
97 ok_(__FILE__, _line_)((l == line && pos == p) || broken_state,
98 "Expected (%d,%d), got (%d,%d)\n", line, pos, l, p);
99}
r l[0]
Definition: byte_order.h:168
GLfloat GLfloat p
Definition: glext.h:8902

◆ test_reader_position()

static void test_reader_position ( void  )
static

Definition at line 2391 of file reader.c.

2392{
2393 static const char *xml = "<c:a xmlns:c=\"nsdef c\" b=\"attr b\">\n</c:a>";
2396 UINT position;
2397 HRESULT hr;
2398
2399 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2400 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2401
2403
2404 /* position methods with Null args */
2405 hr = IXmlReader_GetLineNumber(reader, NULL);
2406 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
2407
2408 hr = IXmlReader_GetLinePosition(reader, NULL);
2409 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
2410
2411 position = 123;
2412 hr = IXmlReader_GetLinePosition(reader, &position);
2413 ok(hr == S_FALSE, "got %#x\n", hr);
2414 ok(position == 0, "got %u\n", position);
2415
2416 position = 123;
2417 hr = IXmlReader_GetLineNumber(reader, &position);
2418 ok(hr == S_FALSE, "got %#x\n", hr);
2419 ok(position == 0, "got %u\n", position);
2420
2422
2425 hr = IXmlReader_Read(reader, &type);
2426 ok(hr == S_OK, "got %08x\n", hr);
2427 ok(type == XmlNodeType_Element, "got type %d\n", type);
2428 TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
2429
2431 TEST_READER_POSITION2(reader, 1, 6, ~0u, 34);
2432
2434 TEST_READER_POSITION2(reader, 1, 24, ~0u, 34);
2435
2437 TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
2438
2439 hr = IXmlReader_Read(reader, &type);
2440 ok(hr == S_OK, "got %08x\n", hr);
2441 ok(type == XmlNodeType_Whitespace, "got type %d\n", type);
2442 TEST_READER_POSITION2(reader, 1, 35, 2, 6);
2443
2444 hr = IXmlReader_Read(reader, &type);
2445 ok(hr == S_OK, "got %08x\n", hr);
2446 ok(type == XmlNodeType_EndElement, "got type %d\n", type);
2447 TEST_READER_POSITION2(reader, 2, 3, 2, 6);
2448
2449 hr = IXmlReader_SetInput(reader, NULL);
2450 ok(hr == S_OK, "got %08x\n", hr);
2453
2454 IXmlReader_Release(reader);
2455}

Referenced by START_TEST().

◆ test_reader_properties()

static void test_reader_properties ( void  )
static

Definition at line 1944 of file reader.c.

1945{
1948 HRESULT hr;
1949
1950 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1951 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1952
1953 value = 0;
1954 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value);
1955 ok(hr == S_OK, "GetProperty failed: %08x\n", hr);
1956 ok(value == 256, "Unexpected default max depth value %ld\n", value);
1957
1958 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MultiLanguage, 0);
1959 ok(hr == S_OK, "SetProperty failed: %08x\n", hr);
1960
1961 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
1962 ok(hr == S_OK, "SetProperty failed: %08x\n", hr);
1963
1964 value = 256;
1965 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value);
1966 ok(hr == S_OK, "GetProperty failed: %08x\n", hr);
1967 ok(value == 0, "Unexpected max depth value %ld\n", value);
1968
1969 IXmlReader_Release(reader);
1970}
@ XmlReaderProperty_MultiLanguage
Definition: xmllite.idl:126

Referenced by START_TEST().

◆ test_reader_state()

static void test_reader_state ( void  )
static

Definition at line 798 of file reader.c.

799{
800 XmlNodeType nodetype;
802 HRESULT hr;
803
804 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
805 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
806
807 /* invalid arguments */
808 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, NULL);
809 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
810
811 /* attempt to read on closed reader */
813
814if (0)
815{
816 /* newer versions crash here, probably because no input was set */
817 hr = IXmlReader_Read(reader, &nodetype);
818 ok(hr == S_FALSE, "got %08x\n", hr);
819}
820 set_input_string(reader, "xml");
822
823 nodetype = XmlNodeType_Element;
824 hr = IXmlReader_Read(reader, &nodetype);
826 ok(FAILED(hr), "got %08x\n", hr);
827 ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype);
828
831
832 nodetype = XmlNodeType_Element;
833 hr = IXmlReader_Read(reader, &nodetype);
835 ok(FAILED(hr), "got %08x\n", hr);
836 ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype);
837
838 IXmlReader_Release(reader);
839}
#define FAILED(hr)
Definition: intsafe.h:51

Referenced by START_TEST().

◆ test_readerinput()

static void test_readerinput ( void  )
static

Definition at line 640 of file reader.c.

641{
642 IXmlReaderInput *reader_input;
643 IXmlReader *reader, *reader2;
644 IUnknown *obj, *input;
645 IStream *stream, *stream2;
646 XmlNodeType nodetype;
647 HRESULT hr;
648 LONG ref;
649
651 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
653 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
654
656 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
657
658 ref = IStream_AddRef(stream);
659 ok(ref == 2, "Expected 2, got %d\n", ref);
660 IStream_Release(stream);
662 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
663
664 hr = IUnknown_QueryInterface(reader_input, &IID_IStream, (void**)&stream2);
665 ok(hr == E_NOINTERFACE, "Expected S_OK, got %08x\n", hr);
666
667 hr = IUnknown_QueryInterface(reader_input, &IID_ISequentialStream, (void**)&stream2);
668 ok(hr == E_NOINTERFACE, "Expected S_OK, got %08x\n", hr);
669
670 /* IXmlReaderInput grabs a stream reference */
671 ref = IStream_AddRef(stream);
672 ok(ref == 3, "Expected 3, got %d\n", ref);
673 IStream_Release(stream);
674
675 /* try ::SetInput() with valid IXmlReaderInput */
676 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
677 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
678
679 ref = IUnknown_AddRef(reader_input);
680 ok(ref == 2, "Expected 2, got %d\n", ref);
681 IUnknown_Release(reader_input);
682
683 hr = IXmlReader_SetInput(reader, reader_input);
684 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
685
687
688 nodetype = XmlNodeType_Element;
689 hr = IXmlReader_GetNodeType(reader, &nodetype);
690 ok(hr == S_OK, "got %08x\n", hr);
691 ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
692
693 /* IXmlReader grabs a IXmlReaderInput reference */
694 ref = IUnknown_AddRef(reader_input);
695 ok(ref == 3, "Expected 3, got %d\n", ref);
696 IUnknown_Release(reader_input);
697
698 ref = IStream_AddRef(stream);
699 ok(ref == 4, "Expected 4, got %d\n", ref);
700 IStream_Release(stream);
701
702 /* reset input and check state */
703 hr = IXmlReader_SetInput(reader, NULL);
704 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
705
707
708 IXmlReader_Release(reader);
709
710 ref = IStream_AddRef(stream);
711 ok(ref == 3, "Expected 3, got %d\n", ref);
712 IStream_Release(stream);
713
714 ref = IUnknown_AddRef(reader_input);
715 ok(ref == 2, "Expected 2, got %d\n", ref);
716 IUnknown_Release(reader_input);
717
718 /* IID_IXmlReaderInput */
719 /* it returns a kind of private undocumented vtable incompatible with IUnknown,
720 so it's not a COM interface actually.
721 Such query will be used only to check if input is really IXmlReaderInput */
722 obj = (IUnknown*)0xdeadbeef;
723 hr = IUnknown_QueryInterface(reader_input, &IID_IXmlReaderInput, (void**)&obj);
724 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
725 ref = IUnknown_AddRef(reader_input);
726 ok(ref == 3, "Expected 3, got %d\n", ref);
727 IUnknown_Release(reader_input);
728
729 IUnknown_Release(reader_input);
730 IUnknown_Release(reader_input);
731 IStream_Release(stream);
732
733 /* test input interface selection sequence */
734 input = NULL;
736 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
737
738 input_iids.count = 0;
739 ref = IUnknown_AddRef(input);
740 ok(ref == 2, "Expected 2, got %d\n", ref);
741 IUnknown_Release(input);
743 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
745 /* IXmlReaderInput stores stream interface as IUnknown */
746 ref = IUnknown_AddRef(input);
747 ok(ref == 3, "Expected 3, got %d\n", ref);
748 IUnknown_Release(input);
749
750 hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
751 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
752
753 input_iids.count = 0;
754 ref = IUnknown_AddRef(reader_input);
755 ok(ref == 2, "Expected 2, got %d\n", ref);
756 IUnknown_Release(reader_input);
757 ref = IUnknown_AddRef(input);
758 ok(ref == 3, "Expected 3, got %d\n", ref);
759 IUnknown_Release(input);
760 hr = IXmlReader_SetInput(reader, reader_input);
761 ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
763
765
766 ref = IUnknown_AddRef(input);
767 ok(ref == 3, "Expected 3, got %d\n", ref);
768 IUnknown_Release(input);
769
770 ref = IUnknown_AddRef(reader_input);
771 ok(ref == 3 || broken(ref == 2) /* versions 1.0.x and 1.1.x - XP, Vista */,
772 "Expected 3, got %d\n", ref);
773 IUnknown_Release(reader_input);
774 /* repeat another time, no check or caching here */
775 input_iids.count = 0;
776 hr = IXmlReader_SetInput(reader, reader_input);
777 ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
779
780 /* another reader */
781 hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader2, NULL);
782 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
783
784 /* resolving from IXmlReaderInput to IStream/ISequentialStream is done at
785 ::SetInput() level, each time it's called */
786 input_iids.count = 0;
787 hr = IXmlReader_SetInput(reader2, reader_input);
788 ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
790
791 IXmlReader_Release(reader2);
792 IXmlReader_Release(reader);
793
794 IUnknown_Release(reader_input);
795 IUnknown_Release(input);
796}
HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *imalloc, LPCWSTR encoding, BOOL hint, LPCWSTR base_uri, IXmlReaderInput **ppInput)
Definition: reader.c:3696
static const IID * empty_seq[]
Definition: reader.c:132
static const IID * setinput_readerinput[]
Definition: reader.c:126
long LONG
Definition: pedump.c:60
Definition: send.c:48

Referenced by START_TEST().

◆ test_readvaluechunk()

static void test_readvaluechunk ( void  )
static

Definition at line 1601 of file reader.c.

1602{
1605 WCHAR buf[64];
1606 WCHAR b;
1607 HRESULT hr;
1608 UINT c;
1609
1610 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1611 ok(hr == S_OK, "S_OK, got %08x\n", hr);
1612
1613 set_input_string(reader, "<!-- comment1 --><!-- comment2 -->");
1614
1615 hr = IXmlReader_Read(reader, &type);
1616 ok(hr == S_OK, "got %08x\n", hr);
1617 ok(type == XmlNodeType_Comment, "type = %u\n", type);
1618
1619 read_value_char(reader, ' ');
1620 read_value_char(reader, 'c');
1621
1622 /* portion read as chunk is skipped from resulting node value */
1623 reader_value(reader, "omment1 ");
1624
1625 /* once value is returned/allocated it's not possible to read by chunk */
1626 c = 0;
1627 b = 0;
1628 hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
1629 ok(hr == S_FALSE, "got %08x\n", hr);
1630 ok(c == 0, "got %u\n", c);
1631 ok(b == 0, "got %x\n", b);
1632
1633 c = 0xdeadbeef;
1634 hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c);
1635 ok(hr == S_OK, "got %08x\n", hr);
1636 ok(!c, "c = %u\n", c);
1637
1638 reader_value(reader, "omment1 ");
1639
1640 /* read comment2 */
1642
1643 c = 0xdeadbeef;
1644 hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c);
1645 ok(hr == S_OK, "got %08x\n", hr);
1646 ok(!c, "c = %u\n", c);
1647
1648 c = 0xdeadbeef;
1649 memset(buf, 0xcc, sizeof(buf));
1650 hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c);
1651 ok(hr == S_OK, "got %08x\n", hr);
1652 ok(c == 10, "got %u\n", c);
1653 ok(buf[c] == 0xcccc, "buffer overflow\n");
1654 buf[c] = 0;
1655 ok(!strcmp_wa(buf, " comment2 "), "buf = %s\n", wine_dbgstr_w(buf));
1656
1657 c = 0xdeadbeef;
1658 memset(buf, 0xcc, sizeof(buf));
1659 hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c);
1660 ok(hr == S_FALSE, "got %08x\n", hr);
1661 ok(!c, "got %u\n", c);
1662
1663 /* portion read as chunk is skipped from resulting node value */
1664 reader_value(reader, "");
1665
1666 /* once value is returned/allocated it's not possible to read by chunk */
1667 c = 0xdeadbeef;
1668 b = 0xffff;
1669 hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
1670 ok(hr == S_FALSE, "got %08x\n", hr);
1671 ok(c == 0, "got %u\n", c);
1672 ok(b == 0xffff, "got %x\n", b);
1673
1674 reader_value(reader, "");
1675
1676 IXmlReader_Release(reader);
1677}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define b
Definition: ke_i.h:79
#define read_value_char(a, b)
Definition: reader.c:359
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_string_pointers()

static void test_string_pointers ( void  )
static

Definition at line 2457 of file reader.c.

2458{
2459 const WCHAR *ns, *nsq, *empty, *xmlns_ns, *xmlns_name, *name, *p, *q, *xml, *ptr, *value;
2461 HRESULT hr;
2462
2463 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2464 ok(hr == S_OK, "S_OK, got %08x\n", hr);
2465
2466 set_input_string(reader, "<elem xmlns=\"myns\">myns<elem2 /></elem>");
2467
2469 empty = reader_value(reader, "");
2470 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2471 name = reader_name(reader, "elem");
2472 ok(name == reader_qname(reader, "elem"), "name != qname\n");
2473 ns = reader_namespace(reader, "myns");
2474
2476 ptr = reader_value(reader, "myns");
2477 if (ns != ptr)
2478 {
2479 win_skip("attr value is different than namespace pointer, assuming old xmllite\n");
2480 IXmlReader_Release(reader);
2481 return;
2482 }
2483 ok(ns == ptr, "ns != value\n");
2484 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2485 xmlns_ns = reader_namespace(reader, "http://www.w3.org/2000/xmlns/");
2486 xmlns_name = reader_name(reader, "xmlns");
2487 ok(xmlns_name == reader_qname(reader, "xmlns"), "xmlns_name != qname\n");
2488
2490 ok(ns != reader_value(reader, "myns"), "ns == value\n");
2491 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2492 ok(empty == reader_namespace(reader, ""), "empty != namespace\n");
2493 ok(empty == reader_name(reader, ""), "empty != name\n");
2494 ok(empty == reader_qname(reader, ""), "empty != qname\n");
2495
2497 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2498 ok(ns == reader_namespace(reader, "myns"), "empty != namespace\n");
2499
2501 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2502 ok(name == reader_name(reader, "elem"), "empty != name\n");
2503 ok(name == reader_qname(reader, "elem"), "empty != qname\n");
2504 ok(ns == reader_namespace(reader, "myns"), "empty != namespace\n");
2505
2506 set_input_string(reader, "<elem xmlns:p=\"myns\" xmlns:q=\"mynsq\"><p:elem2 q:attr=\"\"></p:elem2></elem>");
2507
2509 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2510 name = reader_name(reader, "elem");
2511 ok(empty == reader_namespace(reader, ""), "empty != namespace\n");
2512
2514 ns = reader_value(reader, "myns");
2515 ok(xmlns_name == reader_prefix(reader, "xmlns"), "xmlns_name != prefix\n");
2516 p = reader_name(reader, "p");
2517 ok(xmlns_ns == reader_namespace(reader, "http://www.w3.org/2000/xmlns/"), "xmlns_ns != namespace\n");
2518
2520 nsq = reader_value(reader, "mynsq");
2521 ok(xmlns_name == reader_prefix(reader, "xmlns"), "xmlns_name != prefix\n");
2522 q = reader_name(reader, "q");
2523 ok(xmlns_ns == reader_namespace(reader, "http://www.w3.org/2000/xmlns/"), "xmlns_ns != namespace\n");
2524
2526 ok(p == reader_prefix(reader, "p"), "p != prefix\n");
2527 ok(ns == reader_namespace(reader, "myns"), "empty != namespace\n");
2528 name = reader_qname(reader, "p:elem2");
2529
2531 ok(empty != reader_value(reader, ""), "empty == value\n");
2532 ok(q == reader_prefix(reader, "q"), "q != prefix\n");
2533 ok(nsq == reader_namespace(reader, "mynsq"), "nsq != namespace\n");
2534
2536 ptr = reader_qname(reader, "p:elem2"); todo_wine ok(name != ptr, "q == qname\n");
2537
2538 set_input_string(reader, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
2539
2541 ok(empty == reader_value(reader, ""), "empty != value\n");
2542 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2543 xml = reader_name(reader, "xml");
2544 ptr = reader_qname(reader, "xml"); todo_wine ok(xml == ptr, "xml != qname\n");
2545 ok(empty == reader_namespace(reader, ""), "empty != namespace\n");
2546
2548 ok(empty == reader_prefix(reader, ""), "empty != prefix\n");
2549 ok(empty == reader_namespace(reader, ""), "empty != namespace\n");
2550
2551 set_input_string(reader, "<elem xmlns:p=\"myns\"><p:elem2 attr=\"\" /></elem>");
2552
2555 read_value_char(reader, 'm');
2556 p = reader_value(reader, "yns");
2557
2559 ns = reader_namespace(reader, "myns");
2560 ok(ns+1 == p, "ns+1 != p\n");
2561
2562 set_input_string(reader, "<elem attr=\"value\"></elem>");
2563
2566 name = reader_name(reader, "attr");
2567 value = reader_value(reader, "value");
2568
2571 ok(name == reader_name(reader, "attr"), "attr pointer changed\n");
2572 ok(value == reader_value(reader, "value"), "value pointer changed\n");
2573
2574 IXmlReader_Release(reader);
2575}
static const WCHAR empty[]
Definition: main.c:47
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define win_skip
Definition: test.h:163
Definition: mxnamespace.c:45

Referenced by START_TEST().

◆ testinput_AddRef()

static ULONG WINAPI testinput_AddRef ( IUnknown iface)
static

Definition at line 399 of file reader.c.

400{
402 return InterlockedIncrement(&This->ref);
403}
#define InterlockedIncrement
Definition: armddk.h:53
static testinput * impl_from_IUnknown(IUnknown *iface)
Definition: reader.c:378

◆ testinput_createinstance()

static HRESULT testinput_createinstance ( void **  ppObj)
static

Definition at line 424 of file reader.c.

425{
427
428 input = heap_alloc(sizeof(*input));
429 if(!input) return E_OUTOFMEMORY;
430
431 input->IUnknown_iface.lpVtbl = &testinput_vtbl;
432 input->ref = 1;
433
434 *ppObj = &input->IUnknown_iface;
435
436 return S_OK;
437}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const struct IUnknownVtbl testinput_vtbl
Definition: reader.c:417

Referenced by test_reader_create(), and test_readerinput().

◆ testinput_QueryInterface()

static HRESULT WINAPI testinput_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppvObj 
)
static

Definition at line 383 of file reader.c.

384{
386 {
387 *ppvObj = iface;
388 IUnknown_AddRef(iface);
389 return S_OK;
390 }
391
393
394 *ppvObj = NULL;
395
396 return E_NOINTERFACE;
397}

◆ testinput_Release()

static ULONG WINAPI testinput_Release ( IUnknown iface)
static

Definition at line 405 of file reader.c.

406{
408 LONG ref;
409
411 if (ref == 0)
413
414 return ref;
415}
#define InterlockedDecrement
Definition: armddk.h:52

◆ teststream_AddRef()

static ULONG WINAPI teststream_AddRef ( ISequentialStream iface)
static

Definition at line 451 of file reader.c.

452{
453 return 2;
454}

◆ teststream_QueryInterface()

static HRESULT WINAPI teststream_QueryInterface ( ISequentialStream iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 439 of file reader.c.

440{
441 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ISequentialStream))
442 {
443 *obj = iface;
444 return S_OK;
445 }
446
447 *obj = NULL;
448 return E_NOINTERFACE;
449}

◆ teststream_Read()

static HRESULT WINAPI teststream_Read ( ISequentialStream iface,
void pv,
ULONG  cb,
ULONG pread 
)
static

Definition at line 463 of file reader.c.

464{
465 static const char xml[] = "<!-- comment -->";
466
467 if (stream_readcall++)
468 {
469 *pread = 0;
470 return E_PENDING;
471 }
472
473 *pread = sizeof(xml) / 2;
474 memcpy(pv, xml, *pread);
475 return S_OK;
476}
ssize_t pread(int fd, void *buf, size_t count, off_t offset)

◆ teststream_Release()

static ULONG WINAPI teststream_Release ( ISequentialStream iface)
static

Definition at line 456 of file reader.c.

457{
458 return 1;
459}

◆ teststream_Write()

static HRESULT WINAPI teststream_Write ( ISequentialStream iface,
const void pv,
ULONG  cb,
ULONG written 
)
static

Definition at line 478 of file reader.c.

479{
480 ok(0, "unexpected call\n");
481 return E_NOTIMPL;
482}

◆ type_to_str()

static const char * type_to_str ( XmlNodeType  type)
static

Definition at line 182 of file reader.c.

183{
184 static const char* type_names[] = {
185 "XmlNodeType_None",
186 "XmlNodeType_Element",
187 "XmlNodeType_Attribute",
188 "XmlNodeType_Text",
189 "XmlNodeType_CDATA",
190 "", "",
191 "XmlNodeType_ProcessingInstruction",
192 "XmlNodeType_Comment",
193 "",
194 "XmlNodeType_DocumentType",
195 "", "",
196 "XmlNodeType_Whitespace",
197 "",
198 "XmlNodeType_EndElement",
199 "",
200 "XmlNodeType_XmlDeclaration"
201 };
202
203 static const char unknown[] = "unknown";
204
205 switch (type)
206 {
207 case XmlNodeType_None:
210 case XmlNodeType_Text:
218 return type_names[type];
219 default:
220 return unknown;
221 }
222}

Referenced by test_read_xmldeclaration().

Variable Documentation

◆ attributes_tests

struct test_entry attributes_tests[]
static
Initial value:
= {
{ "<a attr1=\"attrvalue\"/>", "attr1", "attrvalue", S_OK },
{ "<a attr1=\"a\'\'ttrvalue\"/>", "attr1", "a\'\'ttrvalue", S_OK },
{ "<a attr1=\'a\"ttrvalue\'/>", "attr1", "a\"ttrvalue", S_OK },
{ "<a attr1=\' \'/>", "attr1", " ", S_OK },
{ "<a attr1=\" \"/>", "attr1", " ", S_OK },
{ "<a attr1=\"\r\n \r \n \t\n\r\"/>", "attr1", " ", S_OK },
{ "<a attr1=\" val \"/>", "attr1", " val ", S_OK },
{ "<a attr1=\"\r\n\tval\n\"/>", "attr1", " val ", S_OK },
{ "<a attr1=\"val&#32;\"/>", "attr1", "val ", S_OK },
{ "<a attr1=\"val&#x20;\"/>", "attr1", "val ", S_OK },
{ "<a attr1=\"&lt;&gt;&amp;&apos;&quot;\"/>", "attr1", "<>&\'\"", S_OK },
{ "<a attr1=\"&entname;\"/>", NULL, NULL, WC_E_UNDECLAREDENTITY },
{ "<a attr1=\"val&#xfffe;\"/>", NULL, NULL, WC_E_XMLCHARACTER },
{ "<a attr1=\"val &#a;\"/>", NULL, NULL, WC_E_DIGIT, WC_E_SEMICOLON },
{ "<a attr1=\"val &#12a;\"/>", NULL, NULL, WC_E_SEMICOLON },
{ "<a attr1=\"val &#x12g;\"/>", NULL, NULL, WC_E_SEMICOLON },
{ "<a attr1=\"val &#xg;\"/>", NULL, NULL, WC_E_HEXDIGIT, WC_E_SEMICOLON },
{ "<a attr1=attrvalue/>", NULL, NULL, WC_E_QUOTE },
{ "<a attr1=\"attr<value\"/>", NULL, NULL, WC_E_LESSTHAN },
{ "<a attr1=\"&entname\"/>", NULL, NULL, WC_E_SEMICOLON },
{ NULL }
}
@ WC_E_LESSTHAN
Definition: xmllite.idl:151
@ WC_E_DIGIT
Definition: xmllite.idl:153
@ WC_E_UNDECLAREDENTITY
Definition: xmllite.idl:184
@ WC_E_SEMICOLON
Definition: xmllite.idl:147
@ WC_E_QUOTE
Definition: xmllite.idl:149
@ WC_E_HEXDIGIT
Definition: xmllite.idl:152

Definition at line 1863 of file reader.c.

Referenced by test_read_attribute().

◆ cdata_tests

struct test_entry cdata_tests[]
static
Initial value:
= {
{ "<a><![CDATA[ ]]data ]]></a>", "", " ]]data ", S_OK },
{ "<a><![CDATA[<![CDATA[ data ]]]]></a>", "", "<![CDATA[ data ]]", S_OK },
{ "<a><![CDATA[\n \r\n \n\n ]]></a>", "", "\n \n \n\n ", S_OK, S_OK },
{ "<a><![CDATA[\r \r\r\n \n\n ]]></a>", "", "\n \n\n \n\n ", S_OK, S_OK },
{ "<a><![CDATA[\r\r \n\r \r \n\n ]]></a>", "", "\n\n \n\n \n \n\n ", S_OK },
{ NULL }
}

Definition at line 1679 of file reader.c.

Referenced by test_read_cdata().

◆ comment_tests

struct test_entry comment_tests[]
static
Initial value:
= {
{ "<!-- comment -->", "", " comment ", S_OK },
{ "<!-- - comment-->", "", " - comment", S_OK },
{ "<!-- -- comment-->", NULL, NULL, WC_E_COMMENT, WC_E_GREATERTHAN },
{ "<!-- -- comment--->", NULL, NULL, WC_E_COMMENT, WC_E_GREATERTHAN },
{ NULL }
}
@ WC_E_GREATERTHAN
Definition: xmllite.idl:148
@ WC_E_COMMENT
Definition: xmllite.idl:160

Definition at line 1054 of file reader.c.

Referenced by test_read_comment().

◆ element_tests

struct test_entry element_tests[]
static
Initial value:
= {
{ "<a/>", "a", "", S_OK },
{ "<a />", "a", "", S_OK },
{ "<a:b/>", "a:b", "", NC_E_UNDECLAREDPREFIX },
{ "<:a/>", NULL, NULL, NC_E_QNAMECHARACTER },
{ "< a/>", NULL, NULL, NC_E_QNAMECHARACTER },
{ "<a>", "a", "", S_OK },
{ "<a >", "a", "", S_OK },
{ "<a \r \t\n>", "a", "", S_OK },
{ "</a>", NULL, NULL, NC_E_QNAMECHARACTER },
{ "<a:b:c />", NULL, NULL, NC_E_QNAMECOLON },
{ "<:b:c />", NULL, NULL, NC_E_QNAMECHARACTER },
{ NULL }
}
@ NC_E_QNAMECOLON
Definition: xmllite.idl:196
@ NC_E_QNAMECHARACTER
Definition: xmllite.idl:195

Definition at line 1390 of file reader.c.

Referenced by test_read_element().

◆ empty_element_tests

struct test_entry_empty empty_element_tests[]
static
Initial value:
= {
{ "<a></a>", FALSE },
{ "<a/>", TRUE },
{ NULL }
}

Definition at line 1827 of file reader.c.

Referenced by test_isemptyelement().

◆ empty_seq

const IID* empty_seq[]
static
Initial value:
= {
}

Definition at line 132 of file reader.c.

Referenced by test_readerinput().

◆ input_iids

input_iids_t input_iids
static

Definition at line 136 of file reader.c.

Referenced by test_reader_create(), test_readerinput(), and testinput_QueryInterface().

◆ misc_test

struct nodes_test misc_test
static
Initial value:
= {
{
{XmlNodeType_Comment, " comment1 "},
{XmlNodeType_Comment, " comment2 "},
{XmlNodeType_Comment, " comment3 "},
{XmlNodeType_Whitespace, " \t \n \n"},
{XmlNodeType_Comment, " comment4 "},
{XmlNodeType_Text, "text"},
{XmlNodeType_Comment, " comment "},
{XmlNodeType_Text, "text2"},
}
}
static const char misc_test_xml[]
Definition: reader.c:1210

Definition at line 1228 of file reader.c.

Referenced by test_read_full().

◆ misc_test_xml

const char misc_test_xml[]
static
Initial value:
=
"<!-- comment1 -->"
"<!-- comment2 -->"
"<?pi1 pi1body ?>"
"<!-- comment3 -->"
" \t \r \n"
"<!-- comment4 -->"
"<a>"
"\r\n\t"
"<b/>"
"text"
"<!-- comment -->"
"text2"
"<?pi pibody ?>"
"\r\n"
"</a>"

Definition at line 1210 of file reader.c.

◆ pi_tests

struct test_entry pi_tests[]
static
Initial value:
= {
{ "<?pi?>", "pi", "", S_OK },
{ "<?pi ?>", "pi", "", S_OK },
{ "<?pi ?>", "pi", "", S_OK },
{ "<?pi pi data?>", "pi", "pi data", S_OK },
{ "<?pi pi data ?>", "pi", "pi data ", S_OK },
{ "<?pi data ?>", "pi", "data ", S_OK },
{ "<?:pi ?>", NULL, NULL, WC_E_PI, WC_E_NAMECHARACTER },
{ "<?-pi ?>", NULL, NULL, WC_E_PI, WC_E_NAMECHARACTER },
{ "<?xml-stylesheet ?>", "xml-stylesheet", "", S_OK },
{ NULL }
}
@ WC_E_PI
Definition: xmllite.idl:187
@ WC_E_NAMECHARACTER
Definition: xmllite.idl:157
@ NC_E_NAMECOLON
Definition: xmllite.idl:197

Definition at line 1138 of file reader.c.

Referenced by test_read_pi().

◆ resolvervtbl

const IXmlResolverVtbl resolvervtbl
static
Initial value:
=
{
}
static HRESULT WINAPI resolver_ResolveUri(IXmlResolver *iface, const WCHAR *base_uri, const WCHAR *public_id, const WCHAR *system_id, IUnknown **input)
Definition: reader.c:518
static HRESULT WINAPI resolver_QI(IXmlResolver *iface, REFIID riid, void **obj)
Definition: reader.c:493
static ULONG WINAPI resolver_AddRef(IXmlResolver *iface)
Definition: reader.c:508
static ULONG WINAPI resolver_Release(IXmlResolver *iface)
Definition: reader.c:513

Definition at line 525 of file reader.c.

◆ setinput_full

const IID* setinput_full[]
static
Initial value:
= {
&IID_IXmlReaderInput,
&IID_IStream,
&IID_ISequentialStream,
}

Definition at line 110 of file reader.c.

Referenced by test_reader_create().

◆ setinput_full_old

const IID* setinput_full_old[]
static
Initial value:
= {
&IID_IXmlReaderInput,
&IID_ISequentialStream,
&IID_IStream,
}

Definition at line 118 of file reader.c.

Referenced by test_reader_create().

◆ setinput_readerinput

const IID* setinput_readerinput[]
static
Initial value:
= {
&IID_IStream,
&IID_ISequentialStream,
}

Definition at line 126 of file reader.c.

Referenced by test_readerinput().

◆ stream_readcall

int stream_readcall
static

Definition at line 461 of file reader.c.

Referenced by test_read_pending(), and teststream_Read().

◆ test_public_dtd

const char test_public_dtd[]
static
Initial value:
=
"<!DOCTYPE testdtd PUBLIC \"pubid\" \"externalid uri\" >"

Definition at line 1272 of file reader.c.

Referenced by test_read_public_dtd().

◆ test_system_dtd

const char test_system_dtd[]
static
Initial value:
=
"<!DOCTYPE testdtd SYSTEM \"externalid uri\" >"
"<!-- comment -->"

Definition at line 1334 of file reader.c.

Referenced by test_read_system_dtd().

◆ testinput_vtbl

const struct IUnknownVtbl testinput_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI testinput_AddRef(IUnknown *iface)
Definition: reader.c:399
static HRESULT WINAPI testinput_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObj)
Definition: reader.c:383
static ULONG WINAPI testinput_Release(IUnknown *iface)
Definition: reader.c:405

Definition at line 417 of file reader.c.

Referenced by testinput_createinstance().

◆ testresolver

IXmlResolver testresolver = { &resolvervtbl }
static

Definition at line 533 of file reader.c.

Referenced by test_reader_create().

◆ teststream

ISequentialStream teststream = { &teststreamvtbl }
static

Definition at line 1563 of file reader.c.

Referenced by test_read_pending().

◆ teststreamvtbl

const ISequentialStreamVtbl teststreamvtbl
static
Initial value:
=
{
}
static HRESULT WINAPI teststream_QueryInterface(ISequentialStream *iface, REFIID riid, void **obj)
Definition: reader.c:439
static HRESULT WINAPI teststream_Write(ISequentialStream *iface, const void *pv, ULONG cb, ULONG *written)
Definition: reader.c:478
static ULONG WINAPI teststream_AddRef(ISequentialStream *iface)
Definition: reader.c:451
static ULONG WINAPI teststream_Release(ISequentialStream *iface)
Definition: reader.c:456
static HRESULT WINAPI teststream_Read(ISequentialStream *iface, void *pv, ULONG cb, ULONG *pread)
Definition: reader.c:463

Definition at line 484 of file reader.c.

◆ text_tests

struct test_entry text_tests[]
static
Initial value:
= {
{ "<a>simple text</a>", "", "simple text", S_OK },
{ "<a>text ]]> text</a>", "", "", WC_E_CDSECTEND },
{ "<a>\n \r\n \n\n text</a>", "", "\n \n \n\n text", S_OK, S_OK },
{ "<a>\r \r\r\n \n\n text</a>", "", "\n \n\n \n\n text", S_OK, S_OK },
{ NULL }
}
@ WC_E_CDSECTEND
Definition: xmllite.idl:190

Definition at line 1753 of file reader.c.

Referenced by test_read_text().

◆ xmldecl_full

const char xmldecl_full[] = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
static

Definition at line 58 of file reader.c.

Referenced by test_read_xmldeclaration().

◆ xmldecl_short

const char xmldecl_short[] = "<?xml version=\"1.0\"?><RegistrationInfo/>"
static

Definition at line 59 of file reader.c.

Referenced by test_read_xmldeclaration().