ReactOS  0.4.15-dev-489-g75a0787
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 850 of file reader.c.

◆ TEST_DEPTH2

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

Definition at line 851 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 }
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:48
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
Definition: reader.h:83
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
Definition: parser.c:48
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
Definition: reader.h:83
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
#define S_FALSE
Definition: winerror.h:2357
Definition: parser.c:48
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
Definition: reader.h:83
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
const GLubyte * c
Definition: glext.h:8905
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
#define c
Definition: ke_i.h:80
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define lstrlenW
Definition: compat.h:416
const WCHAR * str
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
static int strcmp_wa(const WCHAR *str1, const char *stra)
Definition: reader.c:50
#define S_OK
Definition: intsafe.h:59
#define expect(expected, got)
Definition: combo.c:36
Definition: reader.h:83
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define lstrlenW
Definition: compat.h:416
const WCHAR * str
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
static int strcmp_wa(const WCHAR *str1, const char *stra)
Definition: reader.c:50
#define S_OK
Definition: intsafe.h:59
#define expect(expected, got)
Definition: combo.c:36
Definition: reader.h:83
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define lstrlenW
Definition: compat.h:416
const WCHAR * str
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
static int strcmp_wa(const WCHAR *str1, const char *stra)
Definition: reader.c:50
#define S_OK
Definition: intsafe.h:59
#define expect(expected, got)
Definition: combo.c:36
Definition: reader.h:83
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define lstrlenW
Definition: compat.h:416
const WCHAR * str
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
static int strcmp_wa(const WCHAR *str1, const char *stra)
Definition: reader.c:50
#define S_OK
Definition: intsafe.h:59
#define expect(expected, got)
Definition: combo.c:36
Definition: reader.h:83
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define lstrlenW
Definition: compat.h:416
const WCHAR * str
Definition: parser.c:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
static int strcmp_wa(const WCHAR *str1, const char *stra)
Definition: reader.c:50
#define S_OK
Definition: intsafe.h:59
#define expect(expected, got)
Definition: combo.c:36
Definition: reader.h:83
unsigned int ULONG
Definition: retypes.h:1
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _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 {
227  IStream *stream;
228  HRESULT hr;
229 
230  stream = create_stream_on_data(xml, strlen(xml));
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 }
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: parser.c:48
LONG HRESULT
Definition: typedefs.h:78
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define S_OK
Definition: intsafe.h:59
Definition: reader.h:83
static IStream * create_stream_on_data(const void *data, unsigned int size)
Definition: reader.c:61
#define ok_(x1, x2)
Definition: atltest.h:61

◆ 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 }
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100

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 {
63  IStream *stream = NULL;
64  HGLOBAL hglobal;
65  void *ptr;
66  HRESULT hr;
67 
68  hglobal = GlobalAlloc(GHND, size);
69  ptr = GlobalLock(hglobal);
70 
71  memcpy(ptr, data, size);
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 TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define GHND
Definition: winbase.h:294
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:78
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

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 {
47  heap_free(str);
48 }
const WCHAR * str
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

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 }
BOOL todo
Definition: filedlg.c:313
const char * wine_dbgstr_guid(const GUID *guid)
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
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:163
GLsizeiptr size
Definition: glext.h:5919
int count
Definition: reader.c:107
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
IID iids[10]
Definition: reader.c:106
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61

◆ 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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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 ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ START_TEST()

START_TEST ( reader  )

Definition at line 2657 of file reader.c.

2658 {
2660  test_readerinput();
2663  test_read_cdata();
2665  test_read_pi();
2670  test_read_text();
2671  test_read_full();
2676  test_prefix();
2680  test_endoffile();
2685 }
static void test_read_xmldeclaration(void)
Definition: reader.c:853
static void test_read_comment(void)
Definition: reader.c:1058
static void test_read_element(void)
Definition: reader.c:1401
static void test_read_attribute(void)
Definition: reader.c:1883
static void test_reader_create(void)
Definition: reader.c:535
static void test_reader_position(void)
Definition: reader.c:2387
static void test_readvaluechunk(void)
Definition: reader.c:1597
static void test_read_public_dtd(void)
Definition: reader.c:1271
static void test_read_cdata(void)
Definition: reader.c:1684
static void test_readerinput(void)
Definition: reader.c:636
static void test_string_pointers(void)
Definition: reader.c:2453
static void test_read_system_dtd(void)
Definition: reader.c:1334
static void test_read_full(void)
Definition: reader.c:1246
static void test_reader_state(void)
Definition: reader.c:794
static void test_isemptyelement(void)
Definition: reader.c:1829
static void test_read_text(void)
Definition: reader.c:1757
static void test_attribute_by_name(void)
Definition: reader.c:2573
static void test_reader_properties(void)
Definition: reader.c:1940
static void test_endoffile(void)
Definition: reader.c:2223
static void test_prefix(void)
Definition: reader.c:1968
static void test_namespaceuri(void)
Definition: reader.c:2024
static void test_read_pi(void)
Definition: reader.c:1148
static void test_read_pending(void)
Definition: reader.c:1561
static void test_encoding_detection(void)
Definition: reader.c:2153
static void test_read_charref(void)
Definition: reader.c:2116
static void test_max_element_depth(void)
Definition: reader.c:2284

◆ 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  {
173  case XmlReadState_Error:
175  case XmlReadState_Closed:
176  return state_names[state];
177  default:
178  return unknown;
179  }
180 }
Definition: id3.c:95
static int state
Definition: maze.c:121

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 }
static void free_str(WCHAR *str)
Definition: reader.c:45
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static WCHAR * a2w(const char *str)
Definition: reader.c:37
__wchar_t WCHAR
Definition: xmlstorage.h:180

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 2573 of file reader.c.

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

Referenced by START_TEST().

◆ test_encoding_detection()

static void test_encoding_detection ( void  )
static

Definition at line 2153 of file reader.c.

2154 {
2155  static const struct encoding_testW
2156  {
2157  WCHAR text[16];
2158  }
2159  encoding_testsW[] =
2160  {
2161  { { '<','?','p','i',' ','?','>',0 } },
2162  { { '<','!','-','-',' ','c','-','-','>',0 } },
2163  { { 0xfeff,'<','a','/','>',0 } },
2164  { { '<','a','/','>',0 } },
2165  };
2166  static const char *encoding_testsA[] =
2167  {
2168  "<?pi ?>",
2169  "<!-- comment -->",
2170  "\xef\xbb\xbf<a/>", /* UTF-8 BOM */
2171  "<a/>",
2172  };
2173  IXmlReader *reader;
2174  XmlNodeType type;
2175  IStream *stream;
2176  unsigned int i;
2177  HRESULT hr;
2178 
2179  hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2180  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2181 
2182  /* there's no way to query detected encoding back, so just verify that document is browsable */
2183 
2184  for (i = 0; i < ARRAY_SIZE(encoding_testsA); i++)
2185  {
2186  set_input_string(reader, encoding_testsA[i]);
2187 
2189  hr = IXmlReader_Read(reader, &type);
2190  ok(hr == S_OK, "got %08x\n", hr);
2191  ok(type != XmlNodeType_None, "Unexpected node type %d\n", type);
2192  }
2193 
2194  for (i = 0; i < ARRAY_SIZE(encoding_testsW); i++)
2195  {
2196  stream = create_stream_on_data(encoding_testsW[i].text, lstrlenW(encoding_testsW[i].text) * sizeof(WCHAR));
2197 
2198  hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
2199  ok(hr == S_OK, "got %08x\n", hr);
2200 
2202  hr = IXmlReader_Read(reader, &type);
2203  ok(hr == S_OK, "%u: got %08x\n", i, hr);
2204  ok(type != XmlNodeType_None, "%u: unexpected node type %d\n", i, type);
2205 
2206  IStream_Release(stream);
2207  }
2208 
2209  IXmlReader_Release(reader);
2210 }
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * text
Definition: package.c:1827
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
#define lstrlenW
Definition: compat.h:416
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
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
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83
static IStream * create_stream_on_data(const void *data, unsigned int size)
Definition: reader.c:61

Referenced by START_TEST().

◆ test_endoffile()

static void test_endoffile ( void  )
static

Definition at line 2223 of file reader.c.

2224 {
2225  IXmlReader *reader;
2226  XmlNodeType type;
2227  HRESULT hr;
2228 
2229  hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2230  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2231 
2233 
2234  set_input_string(reader, "<a/>");
2235 
2237 
2239  hr = IXmlReader_Read(reader, &type);
2240  ok(hr == S_OK, "got %#x\n", hr);
2241  ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
2242 
2244 
2246  hr = IXmlReader_Read(reader, &type);
2247  ok(hr == S_FALSE, "got %#x\n", hr);
2248  ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
2249 
2251 
2252  hr = IXmlReader_SetInput(reader, NULL);
2253  ok(hr == S_OK, "got %08x\n", hr);
2254 
2256 
2257  IXmlReader_Release(reader);
2258 
2259  hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2260  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2261 
2262  set_input_string(reader, "<a/>text");
2263 
2265  hr = IXmlReader_Read(reader, &type);
2266  ok(hr == S_OK, "got %#x\n", hr);
2267  ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
2268 
2270 
2272  hr = IXmlReader_Read(reader, &type);
2273  ok(hr == WC_E_SYNTAX, "got %#x\n", hr);
2274  ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
2275 
2277 
2278  hr = IXmlReader_SetInput(reader, NULL);
2279  ok(hr == S_OK, "got %08x\n", hr);
2280 
2281  IXmlReader_Release(reader);
2282 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
static void test_eof_state(IXmlReader *reader, BOOL eof)
Definition: reader.c:2212
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83

Referenced by START_TEST().

◆ test_eof_state()

static void test_eof_state ( IXmlReader reader,
BOOL  eof 
)
static

Definition at line 2212 of file reader.c.

2213 {
2214  LONG_PTR state;
2215  HRESULT hr;
2216 
2217  ok(IXmlReader_IsEOF(reader) == eof, "Unexpected IsEOF() result\n");
2218  hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
2219  ok(hr == S_OK, "GetProperty() failed, %#x\n", hr);
2220  ok((state == XmlReadState_EndOfFile) == eof, "Unexpected EndOfFile state %ld\n", state);
2221 }
HRESULT hr
Definition: shlfolder.c:183
LONG HRESULT
Definition: typedefs.h:78
static int state
Definition: maze.c:121
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
Definition: reader.h:83

Referenced by test_endoffile().

◆ test_isemptyelement()

static void test_isemptyelement ( void  )
static

Definition at line 1829 of file reader.c.

1830 {
1832  IXmlReader *reader;
1833  HRESULT hr;
1834 
1835  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1836  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1837 
1838  while (test->xml)
1839  {
1840  XmlNodeType type;
1841  BOOL ret;
1842 
1843  set_input_string(reader, test->xml);
1844 
1846  hr = IXmlReader_Read(reader, &type);
1847  ok(hr == S_OK, "got 0x%08x\n", hr);
1848  ok(type == XmlNodeType_Element, "got %d\n", type);
1849 
1850  ret = IXmlReader_IsEmptyElement(reader);
1851  ok(ret == test->empty, "got %d, expected %d. xml=%s\n", ret, test->empty, test->xml);
1852 
1853  test++;
1854  }
1855 
1856  IXmlReader_Release(reader);
1857 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
Definition: reader.c:1818
int ret
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83
static struct test_entry_empty empty_element_tests[]
Definition: reader.c:1823

Referenced by START_TEST().

◆ test_max_element_depth()

static void test_max_element_depth ( void  )
static

Definition at line 2284 of file reader.c.

2285 {
2286  static const char *xml =
2287  "<a>"
2288  "<b attrb=\"_b\">"
2289  "<c>"
2290  "<d></d>"
2291  "</c>"
2292  "</b>"
2293  "</a>";
2294  XmlNodeType nodetype;
2295  unsigned int count;
2296  IXmlReader *reader;
2297  HRESULT hr;
2298 
2299  hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2300  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2301 
2303 
2304  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
2305  ok(hr == S_OK, "got %08x\n", hr);
2306 
2307  TEST_DEPTH(reader, 0);
2308 
2309  hr = IXmlReader_Read(reader, NULL);
2310  ok(hr == S_OK, "got %08x\n", hr);
2311 
2312  TEST_DEPTH(reader, 0);
2313 
2314  hr = IXmlReader_Read(reader, NULL);
2315  ok(hr == S_OK, "got %08x\n", hr);
2316 
2317  TEST_DEPTH(reader, 1);
2319 
2320  hr = IXmlReader_Read(reader, NULL);
2321  ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2322 
2323  TEST_DEPTH2(reader, 0, 2);
2325 
2326  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 10);
2327  ok(hr == S_OK, "got %08x\n", hr);
2328 
2329  hr = IXmlReader_Read(reader, NULL);
2330  ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2331 
2332  TEST_DEPTH2(reader, 0, 2);
2334 
2335  /* test if stepping into attributes enforces depth limit too */
2337 
2338  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
2339  ok(hr == S_OK, "got %08x\n", hr);
2340 
2341  TEST_DEPTH(reader, 0);
2342 
2343  hr = IXmlReader_Read(reader, NULL);
2344  ok(hr == S_OK, "got %08x\n", hr);
2345 
2346  TEST_DEPTH(reader, 0);
2347 
2348  hr = IXmlReader_Read(reader, NULL);
2349  ok(hr == S_OK, "got %08x\n", hr);
2350 
2351  TEST_DEPTH(reader, 1);
2352 
2353  hr = IXmlReader_MoveToFirstAttribute(reader);
2354  ok(hr == S_OK, "got %08x\n", hr);
2355 
2356  TEST_DEPTH(reader, 2);
2358 
2359  nodetype = 123;
2360  hr = IXmlReader_Read(reader, &nodetype);
2361  ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2362  ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
2363 
2364  nodetype = 123;
2365  hr = IXmlReader_Read(reader, &nodetype);
2366  ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr);
2367  ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
2368 
2369  TEST_DEPTH2(reader, 0, 2);
2371 
2372  /* set max depth to 0, this disables depth limit */
2374 
2375  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
2376  ok(hr == S_OK, "got %08x\n", hr);
2377 
2378  count = 0;
2379  while (IXmlReader_Read(reader, NULL) == S_OK)
2380  count++;
2381  ok(count == 8, "Unexpected node number %u\n", count);
2383 
2384  IXmlReader_Release(reader);
2385 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TEST_DEPTH2(reader, depth, brk)
Definition: reader.c:851
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
const char * xml
Definition: reader.c:1819
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83
#define TEST_DEPTH(reader, depth)
Definition: reader.c:850
#define TEST_READER_STATE(reader, state)
Definition: reader.c:286

Referenced by START_TEST().

◆ test_namespaceuri()

static void test_namespaceuri ( void  )
static

Definition at line 2024 of file reader.c.

2025 {
2026  struct uri_test
2027  {
2028  const char *xml;
2029  const char *uri[5];
2030  } uri_tests[] =
2031  {
2032  { "<a xmlns=\"defns a\"><b xmlns=\"defns b\"><c xmlns=\"defns c\"/></b></a>",
2033  { "defns a", "defns b", "defns c", "defns b", "defns a" }},
2034  { "<r:a xmlns=\"defns a\" xmlns:r=\"ns r\"/>",
2035  { "ns r" }},
2036  { "<r:a xmlns=\"defns a\" xmlns:r=\"ns r\"><b/></r:a>",
2037  { "ns r", "defns a", "ns r" }},
2038  { "<a xmlns=\"defns a\" xmlns:r=\"ns r\"><r:b/></a>",
2039  { "defns a", "ns r", "defns a" }},
2040  { "<a><b><c/></b></a>",
2041  { "", "", "", "", "" }},
2042  { "<a>text</a>",
2043  { "", "", "" }},
2044  { "<a>\r\n</a>",
2045  { "", "", "" }},
2046  { "<a><![CDATA[data]]></a>",
2047  { "", "", "" }},
2048  { "<?xml version=\"1.0\" ?><a/>",
2049  { "", "" }},
2050  { "<a><?pi ?></a>",
2051  { "", "", "" }},
2052  { "<a><!-- comment --></a>",
2053  { "", "", "" }},
2054  };
2055  IXmlReader *reader;
2056  XmlNodeType type;
2057  unsigned int i;
2058  HRESULT hr;
2059 
2060  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
2061  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2062 
2063  for (i = 0; i < ARRAY_SIZE(uri_tests); i++) {
2064  unsigned int j = 0;
2065 
2067 
2068  type = ~0u;
2069  while (IXmlReader_Read(reader, &type) == S_OK) {
2070  const WCHAR *local, *qname;
2071  UINT length, length2;
2072 
2074  type == XmlNodeType_Text ||
2075  type == XmlNodeType_CDATA ||
2080  type == XmlNodeType_XmlDeclaration, "Unexpected node type %d.\n", type);
2081 
2082  local = NULL;
2083  length = 0;
2084  hr = IXmlReader_GetLocalName(reader, &local, &length);
2085  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2086  ok(local != NULL, "Unexpected NULL local name pointer\n");
2087 
2088  qname = NULL;
2089  length2 = 0;
2090  hr = IXmlReader_GetQualifiedName(reader, &qname, &length2);
2091  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2092  ok(qname != NULL, "Unexpected NULL qualified name pointer\n");
2093 
2094  if (type == XmlNodeType_Element ||
2098  {
2099  ok(*local != 0, "Unexpected empty local name\n");
2100  ok(length > 0, "Unexpected local name length\n");
2101 
2102  ok(*qname != 0, "Unexpected empty qualified name\n");
2103  ok(length2 > 0, "Unexpected qualified name length\n");
2104  }
2105 
2107 
2108  j++;
2109  }
2110  ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
2111  }
2112 
2113  IXmlReader_Release(reader);
2114 }
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
HRESULT hr
Definition: shlfolder.c:183
static const uri_properties uri_tests[]
Definition: uri.c:140
const char * uri
Definition: sec_mgr.c:1588
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
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
#define reader_namespace(a, b)
Definition: reader.c:331
smooth NULL
Definition: ftsmooth.c:416
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define local
Definition: zutil.h:30
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83

Referenced by START_TEST().

◆ test_prefix()

static void test_prefix ( void  )
static

Definition at line 1968 of file reader.c.

1969 {
1970  static const struct
1971  {
1972  const char *xml;
1973  const char *prefix1;
1974  const char *prefix2;
1975  const char *prefix3;
1976  } prefix_tests[] =
1977  {
1978  { "<b xmlns=\"defns\" xml:a=\"a ns\"/>", "", "", "xml" },
1979  { "<c:b xmlns:c=\"c ns\" xml:a=\"a ns\"/>", "c", "xmlns", "xml" },
1980  };
1981  IXmlReader *reader;
1982  unsigned int i;
1983  HRESULT hr;
1984 
1985  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1986  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1987 
1988  for (i = 0; i < ARRAY_SIZE(prefix_tests); i++) {
1989  XmlNodeType type;
1990 
1991  set_input_string(reader, prefix_tests[i].xml);
1992 
1993  hr = IXmlReader_Read(reader, &type);
1994  ok(hr == S_OK, "Read() failed, %#x\n", hr);
1995  ok(type == XmlNodeType_Element, "Unexpected node type %d.\n", type);
1996 
1997  reader_prefix(reader, prefix_tests[i].prefix1);
1998 
1999  hr = IXmlReader_MoveToFirstAttribute(reader);
2000  ok(hr == S_OK, "MoveToFirstAttribute() failed, %#x.\n", hr);
2001 
2002  hr = IXmlReader_GetNodeType(reader, &type);
2003  ok(hr == S_OK, "GetNodeType() failed, %#x.\n", hr);
2004  ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
2005 
2006  reader_prefix(reader, prefix_tests[i].prefix2);
2007 
2009 
2010  hr = IXmlReader_GetNodeType(reader, &type);
2011  ok(hr == S_OK, "GetNodeType() failed, %#x.\n", hr);
2012  ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
2013 
2014  reader_prefix(reader, prefix_tests[i].prefix3);
2015 
2016  /* back to the element, check prefix */
2018  reader_prefix(reader, prefix_tests[i].prefix1);
2019  }
2020 
2021  IXmlReader_Release(reader);
2022 }
HRESULT hr
Definition: shlfolder.c:183
#define reader_prefix(a, b)
Definition: reader.c:317
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
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
#define next_attribute(a)
Definition: reader.c:252
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
#define move_to_element(a)
Definition: reader.c:260
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_attribute()

static void test_read_attribute ( void  )
static

Definition at line 1883 of file reader.c.

1884 {
1885  struct test_entry *test = attributes_tests;
1886  IXmlReader *reader;
1887  HRESULT hr;
1888 
1889  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1890  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1891 
1892  while (test->xml)
1893  {
1894  XmlNodeType type;
1895 
1896  set_input_string(reader, test->xml);
1897 
1898  hr = IXmlReader_Read(reader, NULL);
1899 
1900  if (test->hr_broken)
1901  ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1902  else
1903  ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1904  if (hr == S_OK)
1905  {
1906  const WCHAR *str;
1907  WCHAR *str_exp;
1908  UINT len;
1909 
1911  hr = IXmlReader_GetNodeType(reader, &type);
1912  ok(hr == S_OK, "Failed to get node type, %#x\n", hr);
1913 
1914  ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
1915 
1916  hr = IXmlReader_MoveToFirstAttribute(reader);
1917  ok(hr == S_OK, "got 0x%08x\n", hr);
1918 
1920 
1921  len = 1;
1922  str = NULL;
1923  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1924  ok(hr == S_OK, "got 0x%08x\n", hr);
1925  ok(len == strlen(test->name), "got %u\n", len);
1926  str_exp = a2w(test->name);
1927  ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
1928  free_str(str_exp);
1929 
1930  /* value */
1932  }
1933 
1934  test++;
1935  }
1936 
1937  IXmlReader_Release(reader);
1938 }
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void free_str(WCHAR *str)
Definition: reader.c:45
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
static WCHAR * a2w(const char *str)
Definition: reader.c:37
#define set_input_string(a, b)
Definition: reader.c:224
static struct test_entry attributes_tests[]
Definition: reader.c:1859
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
char * name
Definition: compiler.c:66
GLenum GLsizei len
Definition: glext.h:6722
char * value
Definition: compiler.c:67
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_cdata()

static void test_read_cdata ( void  )
static

Definition at line 1684 of file reader.c.

1685 {
1686  struct test_entry *test = cdata_tests;
1687  IXmlReader *reader;
1688  HRESULT hr;
1689 
1690  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1691  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1692 
1693  while (test->xml)
1694  {
1695  XmlNodeType type;
1696 
1697  set_input_string(reader, test->xml);
1698 
1700  hr = IXmlReader_Read(reader, &type);
1701 
1702  /* read one more to get to CDATA */
1703  if (type == XmlNodeType_Element)
1704  {
1706  hr = IXmlReader_Read(reader, &type);
1707  }
1708 
1709  if (test->hr_broken)
1710  ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1711  else
1712  ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1713  if (hr == S_OK)
1714  {
1715  const WCHAR *str;
1716  UINT len;
1717 
1718  ok(type == XmlNodeType_CDATA, "got %d for %s\n", type, test->xml);
1719 
1720  reader_name(reader, "");
1721 
1722  str = NULL;
1723  hr = IXmlReader_GetLocalName(reader, &str, NULL);
1724  ok(hr == S_OK, "got 0x%08x\n", hr);
1725  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1726 
1727  len = 1;
1728  str = NULL;
1729  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1730  ok(hr == S_OK, "got 0x%08x\n", hr);
1731  ok(len == 0, "got %u\n", len);
1732  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1733 
1734  str = NULL;
1735  hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1736  ok(hr == S_OK, "got 0x%08x\n", hr);
1737  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1738 
1739  /* value */
1741  }
1742 
1743  test++;
1744  }
1745 
1746  IXmlReader_Release(reader);
1747 }
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
char * value
Definition: compiler.c:67
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static struct test_entry cdata_tests[]
Definition: reader.c:1675
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_charref()

static void test_read_charref ( void  )
static

Definition at line 2116 of file reader.c.

2117 {
2118  static const char testA[] = "<a b=\"c\">&#x1f3;&#x103;&gt;</a>";
2119  static const WCHAR chardataW[] = {0x01f3,0x0103,'>',0};
2120  const WCHAR *value;
2121  IXmlReader *reader;
2122  XmlNodeType type;
2123  HRESULT hr;
2124 
2125  hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2126  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2127 
2129 
2130  hr = IXmlReader_Read(reader, &type);
2131  ok(hr == S_OK, "got %08x\n", hr);
2132  ok(type == XmlNodeType_Element, "Unexpected node type %d\n", type);
2133 
2134  hr = IXmlReader_Read(reader, &type);
2135  ok(hr == S_OK, "got %08x\n", hr);
2136  ok(type == XmlNodeType_Text, "Unexpected node type %d\n", type);
2137 
2138  hr = IXmlReader_GetValue(reader, &value, NULL);
2139  ok(hr == S_OK, "got %08x\n", hr);
2140  ok(!lstrcmpW(value, chardataW), "Text value : %s\n", wine_dbgstr_w(value));
2141 
2142  hr = IXmlReader_Read(reader, &type);
2143  ok(hr == S_OK, "got %08x\n", hr);
2144  ok(type == XmlNodeType_EndElement, "Unexpected node type %d\n", type);
2145 
2146  hr = IXmlReader_Read(reader, &type);
2147  ok(hr == S_FALSE, "got %08x\n", hr);
2148  ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
2149 
2150  IXmlReader_Release(reader);
2151 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
static const CHAR testA[]
Definition: run.c:171
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_comment()

static void test_read_comment ( void  )
static

Definition at line 1058 of file reader.c.

1059 {
1060  static const char *teststr = "<a>text<!-- comment --></a>";
1061  struct test_entry *test = comment_tests;
1062  static const XmlNodeType types[] =
1063  {
1068  };
1069  unsigned int i = 0;
1070  IXmlReader *reader;
1071  XmlNodeType type;
1072  HRESULT hr;
1073 
1074  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1075  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1076 
1077  set_input_string(reader, teststr);
1078 
1079  while (IXmlReader_Read(reader, &type) == S_OK)
1080  {
1081  const WCHAR *value;
1082 
1083  ok(type == types[i], "%d: unexpected node type %d\n", i, type);
1084 
1086  {
1087  hr = IXmlReader_GetValue(reader, &value, NULL);
1088  ok(hr == S_OK, "got %08x\n", hr);
1089  ok(*value != 0, "Expected node value\n");
1090  }
1091  i++;
1092  }
1093 
1094  while (test->xml)
1095  {
1096  set_input_string(reader, test->xml);
1097 
1099  hr = IXmlReader_Read(reader, &type);
1100  if (test->hr_broken)
1101  ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1102  else
1103  ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1104  if (hr == S_OK)
1105  {
1106  const WCHAR *str;
1107 
1108  ok(type == XmlNodeType_Comment, "got %d for %s\n", type, test->xml);
1109 
1110  reader_name(reader, "");
1111 
1112  str = NULL;
1113  hr = IXmlReader_GetLocalName(reader, &str, NULL);
1114  ok(hr == S_OK, "got 0x%08x\n", hr);
1115  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1116 
1117  reader_qname(reader, "");
1118 
1119  str = NULL;
1120  hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1121  ok(hr == S_OK, "got 0x%08x\n", hr);
1122  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1123 
1124  /* value */
1126  }
1127 
1128  test++;
1129  }
1130 
1131  IXmlReader_Release(reader);
1132 }
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
#define reader_qname(a, b)
Definition: reader.c:345
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
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
Definition: cmds.c:130
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
char * value
Definition: compiler.c:67
static struct test_entry comment_tests[]
Definition: reader.c:1050
GLsizei const GLfloat * value
Definition: glext.h:6069
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_element()

static void test_read_element ( void  )
static

Definition at line 1401 of file reader.c.

1402 {
1403  struct test_entry *test = element_tests;
1404  static const char stag[] =
1405  "<a attr1=\"_a\">"
1406  "<b attr2=\"_b\">"
1407  "text"
1408  "<c attr3=\"_c\"/>"
1409  "<d attr4=\"_d\"></d>"
1410  "</b>"
1411  "</a>";
1412  static const UINT depths[] = { 0, 1, 2, 2, 2, 3, 2, 1 };
1413  IXmlReader *reader;
1414  XmlNodeType type;
1415  unsigned int i;
1416  UINT depth;
1417  HRESULT hr;
1418 
1419  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1420  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1421 
1422  while (test->xml)
1423  {
1424  set_input_string(reader, test->xml);
1425 
1427  hr = IXmlReader_Read(reader, &type);
1428  if (test->hr_broken)
1429  ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1430  else
1432  ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1433  if (hr == S_OK)
1434  {
1435  const WCHAR *str;
1436  WCHAR *str_exp;
1437  UINT len;
1438 
1439  ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
1440 
1441  len = 0;
1442  str = NULL;
1443  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1444  ok(hr == S_OK, "got 0x%08x\n", hr);
1445  ok(len == strlen(test->name), "got %u\n", len);
1446  str_exp = a2w(test->name);
1447  ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
1448  free_str(str_exp);
1449 
1450  /* value */
1451  reader_value(reader, "");
1452  }
1453 
1454  test++;
1455  }
1456 
1457  /* test reader depth increment */
1458  set_input_string(reader, stag);
1459 
1460  i = 0;
1461  while (IXmlReader_Read(reader, &type) == S_OK)
1462  {
1463  UINT count;
1464 
1466  type == XmlNodeType_Text, "Unexpected node type %d\n", type);
1467 
1468  depth = 123;
1469  hr = IXmlReader_GetDepth(reader, &depth);
1470  ok(hr == S_OK, "got %08x\n", hr);
1471  ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
1472 
1474  {
1475  const WCHAR *prefix;
1476 
1477  prefix = NULL;
1478  hr = IXmlReader_GetPrefix(reader, &prefix, NULL);
1479  ok(hr == S_OK, "got %08x\n", hr);
1480  ok(prefix != NULL, "got %p\n", prefix);
1481 
1482  if (!*prefix)
1483  {
1484  const WCHAR *local, *qname;
1485 
1486  local = NULL;
1487  hr = IXmlReader_GetLocalName(reader, &local, NULL);
1488  ok(hr == S_OK, "got %08x\n", hr);
1489  ok(local != NULL, "got %p\n", local);
1490 
1491  qname = NULL;
1492  hr = IXmlReader_GetQualifiedName(reader, &qname, NULL);
1493  ok(hr == S_OK, "got %08x\n", hr);
1494  ok(qname != NULL, "got %p\n", qname);
1495 
1496  ok(local == qname, "expected same pointer\n");
1497  }
1498  }
1499 
1501  {
1502  count = 1;
1503  hr = IXmlReader_GetAttributeCount(reader, &count);
1504  ok(hr == S_OK, "got %08x\n", hr);
1505  ok(count == 0, "got %u\n", count);
1506  }
1507 
1508  if (type == XmlNodeType_Element)
1509  {
1510  count = 0;
1511  hr = IXmlReader_GetAttributeCount(reader, &count);
1512  ok(hr == S_OK, "got %08x\n", hr);
1513 
1514  /* moving to attributes increases depth */
1515  if (count)
1516  {
1517  const WCHAR *value;
1518 
1519  reader_value(reader, "");
1520 
1521  hr = IXmlReader_MoveToFirstAttribute(reader);
1522  ok(hr == S_OK, "got %08x\n", hr);
1523 
1524  hr = IXmlReader_GetValue(reader, &value, NULL);
1525  ok(*value != 0, "Unexpected value %s\n", wine_dbgstr_w(value));
1526 
1527  depth = 123;
1528  hr = IXmlReader_GetDepth(reader, &depth);
1529  ok(hr == S_OK, "got %08x\n", hr);
1530  ok(depth == depths[i] + 1, "%u: got depth %u, expected %u\n", i, depth, depths[i] + 1);
1531 
1533  reader_value(reader, "");
1534 
1535  depth = 123;
1536  hr = IXmlReader_GetDepth(reader, &depth);
1537  ok(hr == S_OK, "got %08x\n", hr);
1538  ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
1539  }
1540  }
1541 
1542  i++;
1543  }
1544 
1545  /* start/end tag mismatch */
1546  set_input_string(reader, "<a></b>");
1547 
1549 
1551  hr = IXmlReader_Read(reader, &type);
1552  ok(hr == WC_E_ELEMENTMATCH, "got %08x\n", hr);
1553  ok(type == XmlNodeType_None, "got %d\n", type);
1555 
1556  IXmlReader_Release(reader);
1557 }
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void free_str(WCHAR *str)
Definition: reader.c:45
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static struct test_entry element_tests[]
Definition: reader.c:1386
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
XmlNodeType
Definition: xmllite.idl:23
#define read_node(a, b)
Definition: reader.c:238
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
static WCHAR * a2w(const char *str)
Definition: reader.c:37
#define set_input_string(a, b)
Definition: reader.c:224
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
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define todo_wine_if(is_todo)
Definition: test.h:163
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
char * name
Definition: compiler.c:66
#define move_to_element(a)
Definition: reader.c:260
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLenum GLsizei len
Definition: glext.h:6722
GLsizei const GLfloat * value
Definition: glext.h:6069
#define broken(x)
Definition: _sntprintf.h:21
#define local
Definition: zutil.h:30
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
#define TEST_READER_STATE(reader, state)
Definition: reader.c:286

Referenced by START_TEST().

◆ test_read_full()

static void test_read_full ( void  )
static

Definition at line 1246 of file reader.c.

1247 {
1248  struct nodes_test *test = &misc_test;
1249  IXmlReader *reader;
1250  HRESULT hr;
1251  int i;
1252 
1253  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1254  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1255 
1256  set_input_string(reader, test->xml);
1257 
1258  i = 0;
1259  do
1260  {
1261  read_node(reader, test->nodes[i].type);
1262  reader_value(reader, test->nodes[i].value);
1263  } while(test->nodes[i++].type != XmlNodeType_None);
1264 
1265  IXmlReader_Release(reader);
1266 }
HRESULT hr
Definition: shlfolder.c:183
#define test
Definition: rosglue.h:37
#define read_node(a, b)
Definition: reader.c:238
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
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
static struct nodes_test misc_test
Definition: reader.c:1224
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
char * value
Definition: compiler.c:67
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_pending()

static void test_read_pending ( void  )
static

Definition at line 1561 of file reader.c.

1562 {
1563  IXmlReader *reader;
1564  const WCHAR *value;
1565  XmlNodeType type;
1566  HRESULT hr;
1567  int c;
1568 
1569  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1570  ok(hr == S_OK, "S_OK, got 0x%08x\n", hr);
1571 
1572  hr = IXmlReader_SetInput(reader, (IUnknown*)&teststream);
1573  ok(hr == S_OK, "got 0x%08x\n", hr);
1574 
1575  /* first read call returns incomplete node, second attempt fails with E_PENDING */
1576  stream_readcall = 0;
1578  hr = IXmlReader_Read(reader, &type);
1579  ok(hr == S_OK || broken(hr == E_PENDING), "got 0x%08x\n", hr);
1580  /* newer versions are happy when it's enough data to detect node type,
1581  older versions keep reading until it fails to read more */
1582 todo_wine
1583  ok(stream_readcall == 1 || broken(stream_readcall > 1), "got %d\n", stream_readcall);
1584  ok(type == XmlNodeType_Comment || broken(type == XmlNodeType_None), "got %d\n", type);
1585 
1586  /* newer versions' GetValue() makes an attempt to read more */
1587  c = stream_readcall;
1588  value = (void*)0xdeadbeef;
1589  hr = IXmlReader_GetValue(reader, &value, NULL);
1590  ok(hr == E_PENDING, "got 0x%08x\n", hr);
1591  ok(value == NULL || broken(value == (void*)0xdeadbeef) /* Win8 sets it to NULL */, "got %p\n", value);
1592  ok(c < stream_readcall || broken(c == stream_readcall), "got %d, expected %d\n", stream_readcall, c+1);
1593 
1594  IXmlReader_Release(reader);
1595 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
static int stream_readcall
Definition: reader.c:461
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
const GLubyte * c
Definition: glext.h:8905
#define todo_wine
Definition: test.h:162
GLsizei const GLfloat * value
Definition: glext.h:6069
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
Definition: reader.h:83
#define c
Definition: ke_i.h:80
static ISequentialStream teststream
Definition: reader.c:1559
#define E_PENDING
Definition: dinput.h:172

Referenced by START_TEST().

◆ test_read_pi()

static void test_read_pi ( void  )
static

Definition at line 1148 of file reader.c.

1149 {
1150  struct test_entry *test = pi_tests;
1151  IXmlReader *reader;
1152  HRESULT hr;
1153 
1154  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1155  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1156 
1157  while (test->xml)
1158  {
1159  XmlNodeType type;
1160 
1161  set_input_string(reader, test->xml);
1162 
1164  hr = IXmlReader_Read(reader, &type);
1165  if (test->hr_broken)
1166  ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml);
1167  else
1168  ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1169  if (hr == S_OK)
1170  {
1171  const WCHAR *str;
1172  WCHAR *str_exp;
1173  UINT len;
1174 
1175  ok(type == XmlNodeType_ProcessingInstruction, "got %d for %s\n", type, test->xml);
1176 
1178 
1179  len = 0;
1180  str = NULL;
1181  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1182  ok(hr == S_OK, "got 0x%08x\n", hr);
1183  ok(len == strlen(test->name), "got %u\n", len);
1184  str_exp = a2w(test->name);
1185  ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
1186  free_str(str_exp);
1187 
1188  /* value */
1190  }
1191 
1192  test++;
1193  }
1194 
1195  IXmlReader_Release(reader);
1196 }
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void free_str(WCHAR *str)
Definition: reader.c:45
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
static struct test_entry pi_tests[]
Definition: reader.c:1134
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
static WCHAR * a2w(const char *str)
Definition: reader.c:37
#define set_input_string(a, b)
Definition: reader.c:224
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
char * name
Definition: compiler.c:66
GLenum GLsizei len
Definition: glext.h:6722
char * value
Definition: compiler.c:67
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83

Referenced by START_TEST().

◆ test_read_public_dtd()

static void test_read_public_dtd ( void  )
static

Definition at line 1271 of file reader.c.

1272 {
1273  static const WCHAR dtdnameW[] = {'t','e','s','t','d','t','d',0};
1274  IXmlReader *reader;
1275  const WCHAR *str;
1276  XmlNodeType type;
1277  UINT len, count;
1278  HRESULT hr;
1279 
1280  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1281  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1282 
1283  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse);
1284  ok(hr == S_OK, "got 0x%8x\n", hr);
1285 
1287 
1289 
1290  count = 0;
1291  hr = IXmlReader_GetAttributeCount(reader, &count);
1292  ok(hr == S_OK, "got %08x\n", hr);
1293  ok(count == 2, "got %d\n", count);
1294 
1295  hr = IXmlReader_MoveToFirstAttribute(reader);
1296  ok(hr == S_OK, "got %08x\n", hr);
1297 
1299  hr = IXmlReader_GetNodeType(reader, &type);
1300  ok(hr == S_OK, "got %08x\n", hr);
1301  ok(type == XmlNodeType_Attribute, "got %d\n", type);
1302 
1303  reader_name(reader, "PUBLIC");
1304  reader_value(reader, "pubid");
1305 
1307 
1309  hr = IXmlReader_GetNodeType(reader, &type);
1310  ok(hr == S_OK, "got %08x\n", hr);
1311  ok(type == XmlNodeType_Attribute, "got %d\n", type);
1312 
1313  reader_name(reader, "SYSTEM");
1314  reader_value(reader, "externalid uri");
1315 
1317  reader_name(reader, "testdtd");
1318 
1319  len = 0;
1320  str = NULL;
1321  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1322  ok(hr == S_OK, "got 0x%08x\n", hr);
1323 todo_wine {
1324  ok(len == lstrlenW(dtdnameW), "got %u\n", len);
1325  ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str));
1326 }
1327  IXmlReader_Release(reader);
1328 }
static const char test_public_dtd[]
Definition: reader.c:1268
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
#define lstrlenW
Definition: compat.h:416
#define read_node(a, b)
Definition: reader.c:238
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
#define next_attribute(a)
Definition: reader.c:252
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define move_to_element(a)
Definition: reader.c:260
#define todo_wine
Definition: test.h:162
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83

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;
272  LONG_PTR 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
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
static int state
Definition: maze.c:121
#define broken(x)
Definition: _sntprintf.h:21
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
Definition: reader.h:83
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61

◆ test_read_system_dtd()

static void test_read_system_dtd ( void  )
static

Definition at line 1334 of file reader.c.

1335 {
1336  static const WCHAR dtdnameW[] = {'t','e','s','t','d','t','d',0};
1337  IXmlReader *reader;
1338  const WCHAR *str;
1339  XmlNodeType type;
1340  UINT len, count;
1341  HRESULT hr;
1342 
1343  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1344  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1345 
1346  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse);
1347  ok(hr == S_OK, "got 0x%8x\n", hr);
1348 
1350 
1352 
1353  count = 0;
1354  hr = IXmlReader_GetAttributeCount(reader, &count);
1355  ok(hr == S_OK, "got %08x\n", hr);
1356  ok(count == 1, "got %d\n", count);
1357 
1358  hr = IXmlReader_MoveToFirstAttribute(reader);
1359  ok(hr == S_OK, "got %08x\n", hr);
1360 
1362  hr = IXmlReader_GetNodeType(reader, &type);
1363  ok(hr == S_OK, "got %08x\n", hr);
1364  ok(type == XmlNodeType_Attribute, "got %d\n", type);
1365 
1366  reader_name(reader, "SYSTEM");
1367  reader_value(reader, "externalid uri");
1368 
1370  reader_name(reader, "testdtd");
1371 
1372  len = 0;
1373  str = NULL;
1374  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1375  ok(hr == S_OK, "got 0x%08x\n", hr);
1376 todo_wine {
1377  ok(len == lstrlenW(dtdnameW), "got %u\n", len);
1378  ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str));
1379 }
1380 
1382 
1383  IXmlReader_Release(reader);
1384 }
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
#define lstrlenW
Definition: compat.h:416
#define read_node(a, b)
Definition: reader.c:238
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
#define move_to_element(a)
Definition: reader.c:260
#define todo_wine
Definition: test.h:162
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static const char test_system_dtd[]
Definition: reader.c:1330

Referenced by START_TEST().

◆ test_read_text()

static void test_read_text ( void  )
static

Definition at line 1757 of file reader.c.

1758 {
1759  struct test_entry *test = text_tests;
1760  IXmlReader *reader;
1761  HRESULT hr;
1762 
1763  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1764  ok(hr == S_OK, "S_OK, got %08x\n", hr);
1765 
1766  while (test->xml)
1767  {
1768  XmlNodeType type;
1769 
1770  set_input_string(reader, test->xml);
1771 
1773  hr = IXmlReader_Read(reader, &type);
1774 
1775  /* read one more to get to text node */
1776  if (type == XmlNodeType_Element)
1777  {
1779  hr = IXmlReader_Read(reader, &type);
1780  }
1781  ok(hr == test->hr, "got %08x for %s\n", hr, test->xml);
1782  if (hr == S_OK)
1783  {
1784  const WCHAR *str;
1785  UINT len;
1786 
1787  ok(type == XmlNodeType_Text, "got %d for %s\n", type, test->xml);
1788 
1789  reader_name(reader, "");
1790 
1791  str = NULL;
1792  hr = IXmlReader_GetLocalName(reader, &str, NULL);
1793  ok(hr == S_OK, "got 0x%08x\n", hr);
1794  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1795 
1796  len = 1;
1797  str = NULL;
1798  hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1799  ok(hr == S_OK, "got 0x%08x\n", hr);
1800  ok(len == 0, "got %u\n", len);
1801  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1802 
1803  str = NULL;
1804  hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1805  ok(hr == S_OK, "got 0x%08x\n", hr);
1806  ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1807 
1808  /* value */
1810  }
1811 
1812  test++;
1813  }
1814 
1815  IXmlReader_Release(reader);
1816 }
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define test
Definition: rosglue.h:37
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define set_input_string(a, b)
Definition: reader.c:224
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
GLenum GLsizei len
Definition: glext.h:6722
char * value
Definition: compiler.c:67
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
static struct test_entry text_tests[]
Definition: reader.c:1749

Referenced by START_TEST().

◆ test_read_xmldeclaration()

static void test_read_xmldeclaration ( void  )
static

Definition at line 853 of file reader.c.

854 {
855  static const struct
856  {
857  WCHAR name[12];
858  WCHAR val[12];
859  } name_val[] =
860  {
861  { {'v','e','r','s','i','o','n',0}, {'1','.','0',0} },
862  { {'e','n','c','o','d','i','n','g',0}, {'U','T','F','-','8',0} },
863  { {'s','t','a','n','d','a','l','o','n','e',0}, {'y','e','s',0} }
864  };
866  IStream *stream;
867  HRESULT hr;
869  UINT count = 0, len, i;
870  BOOL ret;
871  const WCHAR *val;
872 
873  hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
874  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
875 
877 
878  hr = IXmlReader_SetInput(reader, (IUnknown*)stream);
879  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
880 
881  hr = IXmlReader_GetAttributeCount(reader, &count);
882  ok(hr == S_OK, "got %08x\n", hr);
883  ok(count == 0, "got %d\n", count);
884 
885  /* try to move without attributes */
886  hr = IXmlReader_MoveToElement(reader);
887  ok(hr == S_FALSE, "got %08x\n", hr);
888 
889  hr = IXmlReader_MoveToNextAttribute(reader);
890  ok(hr == S_FALSE, "got %08x\n", hr);
891 
892  hr = IXmlReader_MoveToFirstAttribute(reader);
893  ok(hr == S_FALSE, "got %08x\n", hr);
894 
896 
898 
899  /* new version 1.2.x and 1.3.x properly update position for <?xml ?> */
900  TEST_READER_POSITION2(reader, 1, 3, ~0u, 55);
901 
902  TEST_DEPTH(reader, 0);
904 
905  reader_value(reader, "");
906 
907  /* check attributes */
909 
910  TEST_DEPTH(reader, 1);
911 
913  hr = IXmlReader_GetNodeType(reader, &type);
914  ok(hr == S_OK, "got %08x\n", hr);
915  ok(type == XmlNodeType_Attribute, "got %d\n", type);
916 
917  TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
918 
919  /* try to move from last attribute */
922  hr = IXmlReader_MoveToNextAttribute(reader);
923  ok(hr == S_FALSE, "got %08x\n", hr);
924 
926  hr = IXmlReader_GetNodeType(reader, &type);
927  ok(hr == S_OK, "got %08x\n", hr);
928  ok(type == XmlNodeType_Attribute, "got %d\n", type);
929 
930  hr = IXmlReader_MoveToFirstAttribute(reader);
931  ok(hr == S_OK, "got %08x\n", hr);
932  TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
933 
934  hr = IXmlReader_GetAttributeCount(reader, NULL);
935  ok(hr == E_INVALIDARG, "got %08x\n", hr);
936 
937  hr = IXmlReader_GetAttributeCount(reader, &count);
938  ok(hr == S_OK, "got %08x\n", hr);
939  ok(count == 3, "Expected 3, got %d\n", count);
940 
941  for (i = 0; i < count; i++)
942  {
943  len = 0;
944  hr = IXmlReader_GetLocalName(reader, &val, &len);
945  ok(hr == S_OK, "got %08x\n", hr);
946  ok(len == lstrlenW(name_val[i].name), "expected %u, got %u\n", lstrlenW(name_val[i].name), len);
947  ok(!lstrcmpW(name_val[i].name, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].name), wine_dbgstr_w(val));
948 
949  len = 0;
950  hr = IXmlReader_GetValue(reader, &val, &len);
951  ok(hr == S_OK, "got %08x\n", hr);
952  ok(len == lstrlenW(name_val[i].val), "expected %u, got %u\n", lstrlenW(name_val[i].val), len);
953  ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val));
954 
955  hr = IXmlReader_MoveToNextAttribute(reader);
956  ok(hr == ((i < count - 1) ? S_OK : S_FALSE), "got %08x\n", hr);
957  }
958 
959  TEST_DEPTH(reader, 1);
960 
962  TEST_READER_POSITION2(reader, 1, 3, ~0u, 55);
963 
965  hr = IXmlReader_GetNodeType(reader, &type);
966  ok(hr == S_OK, "got %08x\n", hr);
967  ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type);
968 
970  hr = IXmlReader_Read(reader, &type);
971  /* newer versions return syntax error here cause document is incomplete,
972  it makes more sense than invalid char error */
973 todo_wine {
974  ok(hr == WC_E_SYNTAX || broken(hr == WC_E_XMLCHARACTER), "got 0x%08x\n", hr);
975  ok(type == XmlNodeType_None, "got %d\n", type);
976 }
977  IStream_Release(stream);
978 
979  /* test short variant */
981 
982  hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
983  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
984 
986  TEST_READER_POSITION2(reader, 1, 3, ~0u, 21);
988 
989  hr = IXmlReader_GetAttributeCount(reader, &count);
990  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
991  ok(count == 1, "expected 1, got %d\n", count);
992 
993  ret = IXmlReader_IsEmptyElement(reader);
994  ok(!ret, "element should not be empty\n");
995 
996  reader_value(reader, "");
997  reader_name(reader, "xml");
998 
999  reader_qname(reader, "xml");
1000 
1001  /* check attributes */
1003 
1004  type = -1;
1005  hr = IXmlReader_GetNodeType(reader, &type);
1006  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
1007  ok(type == XmlNodeType_Attribute, "got %d\n", type);
1008  TEST_READER_POSITION2(reader, 1, 7, ~0u, 21);
1009 
1010  /* try to move from last attribute */
1011  hr = IXmlReader_MoveToNextAttribute(reader);
1012  ok(hr == S_FALSE, "expected S_FALSE, got %08x\n", hr);
1013 
1015  TEST_READER_POSITION2(reader, 1, 23, ~0u, 40);
1017 
1018  hr = IXmlReader_GetAttributeCount(reader, &count);
1019  ok(hr == S_OK, "expected S_OK, got %08x\n", hr);
1020  ok(count == 0, "expected 0, got %d\n", count);
1021 
1022  ret = IXmlReader_IsEmptyElement(reader);
1023  ok(ret, "element should be empty\n");
1024 
1025  reader_value(reader, "");
1026  reader_name(reader, "RegistrationInfo");
1027 
1028  type = -1;
1029  hr = IXmlReader_Read(reader, &type);
1030 todo_wine
1031  ok(hr == WC_E_SYNTAX || hr == WC_E_XMLCHARACTER /* XP */, "expected WC_E_SYNTAX, got %08x\n", hr);
1032  ok(type == XmlNodeType_None, "expected XmlNodeType_None, got %s\n", type_to_str(type));
1033  TEST_READER_POSITION(reader, 1, 41);
1034 todo_wine
1036 
1037  IStream_Release(stream);
1038  IXmlReader_Release(reader);
1039 }
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
static const char xmldecl_short[]
Definition: reader.c:59
#define reader_name(a, b)
Definition: reader.c:303
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XmlNodeType
Definition: xmllite.idl:23
#define lstrlenW
Definition: compat.h:416
#define read_node(a, b)
Definition: reader.c:238
#define TEST_READER_POSITION(reader, line, pos)
Definition: reader.c:100
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define reader_qname(a, b)
Definition: reader.c:345
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
#define next_attribute(a)
Definition: reader.c:252
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static const char xmldecl_full[]
Definition: reader.c:58
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TEST_READER_POSITION2(reader, line, pos, line_broken, pos_broken)
Definition: reader.c:102
LONG HRESULT
Definition: typedefs.h:78
static const char * type_to_str(XmlNodeType type)
Definition: reader.c:182
#define move_to_element(a)
Definition: reader.c:260
int ret
#define todo_wine
Definition: test.h:162
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
GLenum GLsizei len
Definition: glext.h:6722
#define broken(x)
Definition: _sntprintf.h:21
#define S_OK
Definition: intsafe.h:59
#define reader_value(a, b)
Definition: reader.c:289
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
Definition: name.c:38
#define TEST_DEPTH(reader, depth)
Definition: reader.c:850
#define TEST_READER_STATE(reader, state)
Definition: reader.c:286
static IStream * create_stream_on_data(const void *data, unsigned int size)
Definition: reader.c:61

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  DtdProcessing dtd;
541  XmlNodeType nodetype;
542  HRESULT hr;
543 
544  /* crashes native */
545  if (0)
546  {
547  CreateXmlReader(&IID_IXmlReader, NULL, NULL);
548  CreateXmlReader(NULL, (void**)&reader, NULL);
549  }
550 
551  hr = CreateXmlReader(&IID_IStream, (void **)&unk, NULL);
552  ok(hr == E_NOINTERFACE, "got %08x\n", hr);
553 
554  hr = CreateXmlReader(&IID_IUnknown, (void **)&unk, NULL);
555  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
556  hr = IUnknown_QueryInterface(unk, &IID_IXmlReader, (void **)&reader);
557  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
558  ok(unk == (IUnknown *)reader, "unexpected interface\n");
559  IXmlReader_Release(reader);
560  IUnknown_Release(unk);
561 
562  hr = CreateXmlReader(&IID_IUnknown, (void **)&reader, NULL);
563  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
564  IXmlReader_Release(reader);
565 
566  hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
567  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
568 
570 
571  nodetype = XmlNodeType_Element;
572  hr = IXmlReader_GetNodeType(reader, &nodetype);
573  ok(hr == S_FALSE, "got %08x\n", hr);
574  ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
575 
576  /* crashes on XP, 2k3, works on newer versions */
577  if (0)
578  {
579  hr = IXmlReader_GetNodeType(reader, NULL);
580  ok(hr == E_INVALIDARG, "got %08x\n", hr);
581  }
582 
583  resolver = (void*)0xdeadbeef;
584  hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
585  ok(hr == S_OK, "got 0x%08x\n", hr);
586  ok(resolver == NULL, "got %p\n", resolver);
587 
588  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
589  ok(hr == S_OK, "got 0x%08x\n", hr);
590 
591  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR)&testresolver);
592  ok(hr == S_OK, "got 0x%08x\n", hr);
593 
594  resolver = NULL;
595  hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
596  ok(hr == S_OK, "got 0x%08x\n", hr);
597  ok(resolver == &testresolver, "got %p\n", resolver);
598  IXmlResolver_Release(resolver);
599 
600  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
601  ok(hr == S_OK, "got 0x%08x\n", hr);
602 
603  dtd = 2;
604  hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, (LONG_PTR*)&dtd);
605  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
606  ok(dtd == DtdProcessing_Prohibit, "got %d\n", dtd);
607 
608  dtd = 2;
609  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, dtd);
610  ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
611 
612  hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, -1);
613  ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
614 
615  /* Null input pointer, releases previous input */
616  hr = IXmlReader_SetInput(reader, NULL);
617  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
618 
620 
621  /* test input interface selection sequence */
622  hr = testinput_createinstance((void**)&input);
623  ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
624 
625  if (hr == S_OK)
626  {
627  input_iids.count = 0;
628  hr = IXmlReader_SetInput(reader, input);
629  ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
631  IUnknown_Release(input);
632  }
633  IXmlReader_Release(reader);
634 }
static input_iids_t input_iids
Definition: reader.c:136
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
DtdProcessing
Definition: xmllite.idl:116
#define ok_iids(got, exp, brk, todo)
Definition: reader.c:155
static HRESULT testinput_createinstance(void **ppObj)
Definition: reader.c:424
XmlNodeType
Definition: xmllite.idl:23
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3653
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static const IID * setinput_full[]
Definition: reader.c:110
LONG HRESULT
Definition: typedefs.h:78
int count
Definition: reader.c:107
const GUID IID_IUnknown
#define TEST_READER_STATE2(reader, state, brk)
Definition: reader.c:287
static IXmlResolver testresolver
Definition: reader.c:533
#define S_OK
Definition: intsafe.h:59
GLenum GLenum GLenum input
Definition: glext.h:9031
#define ok(value,...)
Definition: atltest.h:57
static const IID * setinput_full_old[]
Definition: reader.c:118
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
Definition: reader.h:83
#define TEST_READER_STATE(reader, state)
Definition: reader.c:286

Referenced by START_TEST().

◆ test_reader_depth()

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

Definition at line 837 of file reader.c.

838 {
839  BOOL condition;
840  UINT d = ~0u;
841 
842  IXmlReader_GetDepth(reader, &d);
843 
844  condition = d == depth;
845  if (brk != ~0u)
846  condition |= broken(d == brk);
847  ok_(__FILE__, line)(condition, "Unexpected nesting depth %u, expected %u\n", d, depth);
848 }
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
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum condition
Definition: glext.h:9255
Definition: parser.c:48
#define d
Definition: ke_i.h:81
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define broken(x)
Definition: _sntprintf.h:21
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
#define ok_(x1, x2)
Definition: atltest.h:61

◆ 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 }
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
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
r l[0]
Definition: byte_order.h:167
#define broken(x)
Definition: _sntprintf.h:21
unsigned int UINT
Definition: ndis.h:50
Definition: reader.h:83
GLfloat GLfloat p
Definition: glext.h:8902
#define ok_(x1, x2)
Definition: atltest.h:61

◆ test_reader_position()

static void test_reader_position ( void  )
static

Definition at line 2387 of file reader.c.

2388 {
2389  static const char *xml = "<c:a xmlns:c=\"nsdef c\" b=\"attr b\">\n</c:a>";
2390  IXmlReader *reader;
2391  XmlNodeType type;
2392  UINT position;
2393  HRESULT hr;
2394 
2395  hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2396  ok(hr == S_OK, "S_OK, got %08x\n", hr);
2397 
2399 
2400  /* position methods with Null args */
2401  hr = IXmlReader_GetLineNumber(reader, NULL);
2402  ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
2403 
2404  hr = IXmlReader_GetLinePosition(reader, NULL);
2405  ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
2406 
2407  position = 123;
2408  hr = IXmlReader_GetLinePosition(reader, &position);
2409  ok(hr == S_FALSE, "got %#x\n", hr);
2410  ok(position == 0, "got %u\n", position);
2411 
2412  position = 123;
2413  hr = IXmlReader_GetLineNumber(reader, &position);
2414  ok(hr == S_FALSE, "got %#x\n", hr);
2415  ok(position == 0, "got %u\n", position);
2416 
2418 
2421  hr = IXmlReader_Read(reader, &type);
2422  ok(hr == S_OK, "got %08x\n", hr);
2423  ok(type == XmlNodeType_Element, "got type %d\n", type);
2424  TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
2425 
2427  TEST_READER_POSITION2(reader, 1, 6, ~0u, 34);
2428 
2430  TEST_READER_POSITION2(reader, 1, 24, ~0u, 34);
2431 
2433  TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
2434 
2435  hr = IXmlReader_Read(reader, &type);
2436  ok(hr == S_OK, "got %08x\n", hr);
2437  ok(type == XmlNodeType_Whitespace, "got type %d\n", type);
2438  TEST_READER_POSITION2(reader, 1, 35, 2, 6);
2439 
2440  hr = IXmlReader_Read(reader, &type);
2441  ok(hr == S_OK, "got %08x\n", hr);
2442  ok(type == XmlNodeType_EndElement, "got type %d\n", type);
2443  TEST_READER_POSITION2(reader, 2, 3, 2, 6);
2444 
2445  hr = IXmlReader_SetInput(reader, NULL);
2446  ok(hr == S_OK, "got %08x\n", hr);
2449 
2450  IXmlReader_Release(reader);
2451 }
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
const char * xml
Definition: reader.c:1042
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545