Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
05b07dbe
Commit
05b07dbe
authored
Feb 07, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/tests: Build without WINE_NO_LONG_TYPES.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6d7aeede
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
591 additions
and
592 deletions
+591
-592
Makefile.in
dlls/xmllite/tests/Makefile.in
+0
-1
reader.c
dlls/xmllite/tests/reader.c
+244
-244
writer.c
dlls/xmllite/tests/writer.c
+347
-347
No files found.
dlls/xmllite/tests/Makefile.in
View file @
05b07dbe
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
TESTDLL
=
xmllite.dll
IMPORTS
=
xmllite ole32
...
...
dlls/xmllite/tests/reader.c
View file @
05b07dbe
...
...
@@ -50,7 +50,7 @@ static IStream *create_stream_on_data(const void *data, unsigned int size)
memcpy
(
ptr
,
data
,
size
);
hr
=
CreateStreamOnHGlobal
(
hglobal
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
stream
!=
NULL
,
"Expected non-NULL stream
\n
"
);
GlobalUnlock
(
hglobal
);
...
...
@@ -209,7 +209,7 @@ static void _set_input_string(unsigned line, IXmlReader *reader, const char *xml
stream
=
create_stream_on_data
(
xml
,
strlen
(
xml
));
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IStream_Release
(
stream
);
}
...
...
@@ -222,9 +222,9 @@ static void _read_node(unsigned line, IXmlReader *reader, XmlNodeType expected_t
hr
=
IXmlReader_Read
(
reader
,
&
type
);
if
(
expected_type
==
XmlNodeType_None
)
ok_
(
__FILE__
,
line
)(
hr
==
S_FALSE
,
"Read returned %
08x, expected S_FALSE
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_FALSE
,
"Read returned %
#lx, expected S_FALSE.
\n
"
,
hr
);
else
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Read returned %
08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Read returned %
#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
type
==
expected_type
,
"read type %d, expected %d
\n
"
,
type
,
expected_type
);
}
...
...
@@ -233,7 +233,7 @@ static void _next_attribute(unsigned line, IXmlReader *reader)
{
HRESULT
hr
;
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
MoveToNextAttribute returned %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
}
#define move_to_element(a) _move_to_element(__LINE__,a)
...
...
@@ -241,7 +241,7 @@ static void _move_to_element(unsigned line, IXmlReader *reader)
{
HRESULT
hr
;
hr
=
IXmlReader_MoveToElement
(
reader
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
MoveToElement failed: %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
}
static
void
test_read_state
(
IXmlReader
*
reader
,
XmlReadState
expected
,
...
...
@@ -269,11 +269,11 @@ static void test_read_state(IXmlReader *reader, XmlReadState expected,
static
const
WCHAR
*
_reader_value
(
unsigned
line
,
IXmlReader
*
reader
,
const
WCHAR
*
expect
)
{
const
WCHAR
*
str
=
(
void
*
)
0xdeadbeef
;
U
LONG
len
=
0xdeadbeef
;
U
INT
len
=
0xdeadbeef
;
HRESULT
hr
;
hr
=
IXmlReader_GetValue
(
reader
,
&
str
,
&
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
GetValue returned %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
!
lstrcmpW
(
str
,
expect
),
"value = %s
\n
"
,
wine_dbgstr_w
(
str
));
return
str
;
...
...
@@ -283,12 +283,12 @@ static const WCHAR *_reader_value(unsigned line, IXmlReader *reader, const WCHAR
static
const
WCHAR
*
_reader_name
(
unsigned
line
,
IXmlReader
*
reader
,
const
WCHAR
*
expect
)
{
const
WCHAR
*
str
=
(
void
*
)
0xdeadbeef
;
U
LONG
len
=
0xdeadbeef
;
U
INT
len
=
0xdeadbeef
;
HRESULT
hr
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
&
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
GetLocalName returned %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
.
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
!
lstrcmpW
(
str
,
expect
),
"name = %s
\n
"
,
wine_dbgstr_w
(
str
));
return
str
;
}
...
...
@@ -297,12 +297,12 @@ static const WCHAR *_reader_name(unsigned line, IXmlReader *reader, const WCHAR
static
const
WCHAR
*
_reader_prefix
(
unsigned
line
,
IXmlReader
*
reader
,
const
WCHAR
*
expect
)
{
const
WCHAR
*
str
=
(
void
*
)
0xdeadbeef
;
U
LONG
len
=
0xdeadbeef
;
U
INT
len
=
0xdeadbeef
;
HRESULT
hr
;
hr
=
IXmlReader_GetPrefix
(
reader
,
&
str
,
&
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
GetPrefix returned %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
.
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
!
lstrcmpW
(
str
,
expect
),
"prefix = %s
\n
"
,
wine_dbgstr_w
(
str
));
return
str
;
}
...
...
@@ -311,12 +311,12 @@ static const WCHAR *_reader_prefix(unsigned line, IXmlReader *reader, const WCHA
static
const
WCHAR
*
_reader_namespace
(
unsigned
line
,
IXmlReader
*
reader
,
const
WCHAR
*
expect
)
{
const
WCHAR
*
str
=
(
void
*
)
0xdeadbeef
;
U
LONG
len
=
0xdeadbeef
;
U
INT
len
=
0xdeadbeef
;
HRESULT
hr
;
hr
=
IXmlReader_GetNamespaceUri
(
reader
,
&
str
,
&
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
GetNamespaceUri returned %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
.
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
!
lstrcmpW
(
str
,
expect
),
"namespace = %s
\n
"
,
wine_dbgstr_w
(
str
));
return
str
;
}
...
...
@@ -325,12 +325,12 @@ static const WCHAR *_reader_namespace(unsigned line, IXmlReader *reader, const W
static
const
WCHAR
*
_reader_qname
(
IXmlReader
*
reader
,
const
WCHAR
*
expect
,
unsigned
line
)
{
const
WCHAR
*
str
=
(
void
*
)
0xdeadbeef
;
U
LONG
len
=
0xdeadbeef
;
U
INT
len
=
0xdeadbeef
;
HRESULT
hr
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
GetQualifiedName returned %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
len
==
lstrlenW
(
str
),
"len = %u
.
\n
"
,
len
);
ok_
(
__FILE__
,
line
)(
!
lstrcmpW
(
str
,
expect
),
"name = %s
\n
"
,
wine_dbgstr_w
(
str
));
return
str
;
}
...
...
@@ -343,7 +343,7 @@ static void _read_value_char(IXmlReader *reader, WCHAR expected_char, unsigned l
HRESULT
hr
;
hr
=
IXmlReader_ReadValueChunk
(
reader
,
&
c
,
1
,
&
count
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
count
==
1
,
"got %u
\n
"
,
c
);
ok_
(
__FILE__
,
line
)(
c
==
expected_char
,
"got %x
\n
"
,
c
);
}
...
...
@@ -528,84 +528,84 @@ static void test_reader_create(void)
}
hr
=
CreateXmlReader
(
&
IID_IStream
,
(
void
**
)
&
unk
,
NULL
);
ok
(
hr
==
E_NOINTERFACE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlReader
(
&
IID_IUnknown
,
(
void
**
)
&
unk
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
unk
,
&
IID_IXmlReader
,
(
void
**
)
&
reader
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
unk
==
(
IUnknown
*
)
reader
,
"unexpected interface
\n
"
);
IXmlReader_Release
(
reader
);
IUnknown_Release
(
unk
);
hr
=
CreateXmlReader
(
&
IID_IUnknown
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IXmlReader_Release
(
reader
);
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_STATE
(
reader
,
XmlReadState_Closed
);
nodetype
=
XmlNodeType_Element
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
nodetype
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"got %d
\n
"
,
nodetype
);
/* crashes on XP, 2k3, works on newer versions */
if
(
0
)
{
hr
=
IXmlReader_GetNodeType
(
reader
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
}
resolver
=
(
void
*
)
0xdeadbeef
;
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_XmlResolver
,
(
LONG_PTR
*
)
&
resolver
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
resolver
==
NULL
,
"got %p
\n
"
,
resolver
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_XmlResolver
,
0
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_XmlResolver
,
(
LONG_PTR
)
&
testresolver
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
resolver
=
NULL
;
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_XmlResolver
,
(
LONG_PTR
*
)
&
resolver
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
resolver
==
&
testresolver
,
"got %p
\n
"
,
resolver
);
IXmlResolver_Release
(
resolver
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_XmlResolver
,
0
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
dtd
=
2
;
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_DtdProcessing
,
(
LONG_PTR
*
)
&
dtd
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
dtd
==
DtdProcessing_Prohibit
,
"got %d
\n
"
,
dtd
);
dtd
=
2
;
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_DtdProcessing
,
dtd
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_DtdProcessing
,
-
1
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* Null input pointer, releases previous input */
hr
=
IXmlReader_SetInput
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_STATE2
(
reader
,
XmlReadState_Initial
,
XmlReadState_Closed
);
/* test input interface selection sequence */
hr
=
testinput_createinstance
((
void
**
)
&
input
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
input_iids
.
count
=
0
;
hr
=
IXmlReader_SetInput
(
reader
,
input
);
ok
(
hr
==
E_NOINTERFACE
,
"
Expected E_NOINTERFACE, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_iids
(
&
input_iids
,
setinput_full
,
setinput_full_old
,
FALSE
);
IUnknown_Release
(
input
);
}
...
...
@@ -623,71 +623,71 @@ static void test_readerinput(void)
LONG
ref
;
hr
=
CreateXmlReaderInputWithEncodingName
(
NULL
,
NULL
,
NULL
,
FALSE
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlReaderInputWithEncodingName
(
NULL
,
NULL
,
NULL
,
FALSE
,
NULL
,
&
reader_input
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ref
=
IStream_AddRef
(
stream
);
ok
(
ref
==
2
,
"Expected 2, got %
d
\n
"
,
ref
);
ok
(
ref
==
2
,
"Expected 2, got %
ld.
\n
"
,
ref
);
IStream_Release
(
stream
);
hr
=
CreateXmlReaderInputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
NULL
,
FALSE
,
NULL
,
&
reader_input
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
reader_input
,
&
IID_IStream
,
(
void
**
)
&
stream2
);
ok
(
hr
==
E_NOINTERFACE
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
reader_input
,
&
IID_ISequentialStream
,
(
void
**
)
&
stream2
);
ok
(
hr
==
E_NOINTERFACE
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* IXmlReaderInput grabs a stream reference */
ref
=
IStream_AddRef
(
stream
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IStream_Release
(
stream
);
/* try ::SetInput() with valid IXmlReaderInput */
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ref
=
IUnknown_AddRef
(
reader_input
);
ok
(
ref
==
2
,
"Expected 2, got %
d
\n
"
,
ref
);
ok
(
ref
==
2
,
"Expected 2, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
reader_input
);
hr
=
IXmlReader_SetInput
(
reader
,
reader_input
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_STATE
(
reader
,
XmlReadState_Initial
);
nodetype
=
XmlNodeType_Element
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
nodetype
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"got %d
\n
"
,
nodetype
);
/* IXmlReader grabs a IXmlReaderInput reference */
ref
=
IUnknown_AddRef
(
reader_input
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
reader_input
);
ref
=
IStream_AddRef
(
stream
);
ok
(
ref
==
4
,
"Expected 4, got %
d
\n
"
,
ref
);
ok
(
ref
==
4
,
"Expected 4, got %
ld.
\n
"
,
ref
);
IStream_Release
(
stream
);
/* reset input and check state */
hr
=
IXmlReader_SetInput
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_STATE2
(
reader
,
XmlReadState_Initial
,
XmlReadState_Closed
);
IXmlReader_Release
(
reader
);
ref
=
IStream_AddRef
(
stream
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IStream_Release
(
stream
);
ref
=
IUnknown_AddRef
(
reader_input
);
ok
(
ref
==
2
,
"Expected 2, got %
d
\n
"
,
ref
);
ok
(
ref
==
2
,
"Expected 2, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
reader_input
);
/* IID_IXmlReaderInput */
...
...
@@ -696,9 +696,9 @@ static void test_readerinput(void)
Such query will be used only to check if input is really IXmlReaderInput */
obj
=
(
IUnknown
*
)
0xdeadbeef
;
hr
=
IUnknown_QueryInterface
(
reader_input
,
&
IID_IXmlReaderInput
,
(
void
**
)
&
obj
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ref
=
IUnknown_AddRef
(
reader_input
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
reader_input
);
IUnknown_Release
(
reader_input
);
...
...
@@ -708,59 +708,59 @@ static void test_readerinput(void)
/* test input interface selection sequence */
input
=
NULL
;
hr
=
testinput_createinstance
((
void
**
)
&
input
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
input_iids
.
count
=
0
;
ref
=
IUnknown_AddRef
(
input
);
ok
(
ref
==
2
,
"Expected 2, got %
d
\n
"
,
ref
);
ok
(
ref
==
2
,
"Expected 2, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
input
);
hr
=
CreateXmlReaderInputWithEncodingName
(
input
,
NULL
,
NULL
,
FALSE
,
NULL
,
&
reader_input
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_iids
(
&
input_iids
,
empty_seq
,
NULL
,
FALSE
);
/* IXmlReaderInput stores stream interface as IUnknown */
ref
=
IUnknown_AddRef
(
input
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
input
);
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
LPVOID
*
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
input_iids
.
count
=
0
;
ref
=
IUnknown_AddRef
(
reader_input
);
ok
(
ref
==
2
,
"Expected 2, got %
d
\n
"
,
ref
);
ok
(
ref
==
2
,
"Expected 2, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
reader_input
);
ref
=
IUnknown_AddRef
(
input
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
input
);
hr
=
IXmlReader_SetInput
(
reader
,
reader_input
);
ok
(
hr
==
E_NOINTERFACE
,
"
Expected E_NOINTERFACE, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_iids
(
&
input_iids
,
setinput_readerinput
,
NULL
,
FALSE
);
TEST_READER_STATE
(
reader
,
XmlReadState_Closed
);
ref
=
IUnknown_AddRef
(
input
);
ok
(
ref
==
3
,
"Expected 3, got %
d
\n
"
,
ref
);
ok
(
ref
==
3
,
"Expected 3, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
input
);
ref
=
IUnknown_AddRef
(
reader_input
);
ok
(
ref
==
3
||
broken
(
ref
==
2
)
/* versions 1.0.x and 1.1.x - XP, Vista */
,
"Expected 3, got %
d
\n
"
,
ref
);
"Expected 3, got %
ld.
\n
"
,
ref
);
IUnknown_Release
(
reader_input
);
/* repeat another time, no check or caching here */
input_iids
.
count
=
0
;
hr
=
IXmlReader_SetInput
(
reader
,
reader_input
);
ok
(
hr
==
E_NOINTERFACE
,
"
Expected E_NOINTERFACE, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_iids
(
&
input_iids
,
setinput_readerinput
,
NULL
,
FALSE
);
/* another reader */
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
LPVOID
*
)
&
reader2
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* resolving from IXmlReaderInput to IStream/ISequentialStream is done at
::SetInput() level, each time it's called */
input_iids
.
count
=
0
;
hr
=
IXmlReader_SetInput
(
reader2
,
reader_input
);
ok
(
hr
==
E_NOINTERFACE
,
"
Expected E_NOINTERFACE, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok_iids
(
&
input_iids
,
setinput_readerinput
,
NULL
,
FALSE
);
IXmlReader_Release
(
reader2
);
...
...
@@ -777,11 +777,11 @@ static void test_reader_state(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* invalid arguments */
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_ReadState
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* attempt to read on closed reader */
TEST_READER_STATE
(
reader
,
XmlReadState_Closed
);
...
...
@@ -790,7 +790,7 @@ if (0)
{
/* newer versions crash here, probably because no input was set */
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
}
set_input_string
(
reader
,
"xml"
);
TEST_READER_STATE
(
reader
,
XmlReadState_Initial
);
...
...
@@ -798,7 +798,7 @@ if (0)
nodetype
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
todo_wine
ok
(
FAILED
(
hr
),
"
got %08x
\n
"
,
hr
);
ok
(
FAILED
(
hr
),
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"Unexpected node type %d
\n
"
,
nodetype
);
todo_wine
...
...
@@ -807,7 +807,7 @@ if (0)
nodetype
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
todo_wine
ok
(
FAILED
(
hr
),
"
got %08x
\n
"
,
hr
);
ok
(
FAILED
(
hr
),
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"Unexpected node type %d
\n
"
,
nodetype
);
IXmlReader_Release
(
reader
);
...
...
@@ -850,26 +850,26 @@ static void test_read_xmldeclaration(void)
const
WCHAR
*
val
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
LPVOID
*
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
create_stream_on_data
(
xmldecl_full
,
sizeof
(
xmldecl_full
));
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
0
,
"got %d
\n
"
,
count
);
/* try to move without attributes */
hr
=
IXmlReader_MoveToElement
(
reader
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_POSITION
(
reader
,
0
,
0
);
...
...
@@ -890,7 +890,7 @@ static void test_read_xmldeclaration(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"got %d
\n
"
,
type
);
TEST_READER_POSITION2
(
reader
,
1
,
7
,
~
0u
,
55
);
...
...
@@ -899,40 +899,40 @@ static void test_read_xmldeclaration(void)
next_attribute
(
reader
);
next_attribute
(
reader
);
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"got %d
\n
"
,
type
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_POSITION2
(
reader
,
1
,
7
,
~
0u
,
55
);
hr
=
IXmlReader_GetAttributeCount
(
reader
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
3
,
"Expected 3, got %d
\n
"
,
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
len
=
0
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
val
,
&
len
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
lstrlenW
(
name_val
[
i
].
name
),
"expected %u, got %u
\n
"
,
lstrlenW
(
name_val
[
i
].
name
),
len
);
ok
(
!
lstrcmpW
(
name_val
[
i
].
name
,
val
),
"expected %s, got %s
\n
"
,
wine_dbgstr_w
(
name_val
[
i
].
name
),
wine_dbgstr_w
(
val
));
len
=
0
;
hr
=
IXmlReader_GetValue
(
reader
,
&
val
,
&
len
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
lstrlenW
(
name_val
[
i
].
val
),
"expected %u, got %u
\n
"
,
lstrlenW
(
name_val
[
i
].
val
),
len
);
ok
(
!
lstrcmpW
(
name_val
[
i
].
val
,
val
),
"expected %s, got %s
\n
"
,
wine_dbgstr_w
(
name_val
[
i
].
val
),
wine_dbgstr_w
(
val
));
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
((
i
<
count
-
1
)
?
S_OK
:
S_FALSE
),
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
((
i
<
count
-
1
)
?
S_OK
:
S_FALSE
),
"
Unexpected hr %#lx.
\n
"
,
hr
);
}
TEST_DEPTH
(
reader
,
1
);
...
...
@@ -942,7 +942,7 @@ static void test_read_xmldeclaration(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_XmlDeclaration
,
"got %d
\n
"
,
type
);
type
=
XmlNodeType_XmlDeclaration
;
...
...
@@ -950,7 +950,7 @@ static void test_read_xmldeclaration(void)
/* newer versions return syntax error here cause document is incomplete,
it makes more sense than invalid char error */
todo_wine
{
ok
(
hr
==
WC_E_SYNTAX
||
broken
(
hr
==
WC_E_XMLCHARACTER
),
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WC_E_SYNTAX
||
broken
(
hr
==
WC_E_XMLCHARACTER
),
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_None
,
"got %d
\n
"
,
type
);
}
IStream_Release
(
stream
);
...
...
@@ -959,14 +959,14 @@ todo_wine {
stream
=
create_stream_on_data
(
xmldecl_short
,
sizeof
(
xmldecl_short
));
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"
expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
read_node
(
reader
,
XmlNodeType_XmlDeclaration
);
TEST_READER_POSITION2
(
reader
,
1
,
3
,
~
0u
,
21
);
TEST_READER_STATE
(
reader
,
XmlReadState_Interactive
);
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
1
,
"expected 1, got %d
\n
"
,
count
);
ret
=
IXmlReader_IsEmptyElement
(
reader
);
...
...
@@ -982,20 +982,20 @@ todo_wine {
type
=
-
1
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"got %d
\n
"
,
type
);
TEST_READER_POSITION2
(
reader
,
1
,
7
,
~
0u
,
21
);
/* try to move from last attribute */
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_FALSE
,
"
expected S_FALSE, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
read_node
(
reader
,
XmlNodeType_Element
);
TEST_READER_POSITION2
(
reader
,
1
,
23
,
~
0u
,
40
);
TEST_READER_STATE
(
reader
,
XmlReadState_Interactive
);
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
0
,
"expected 0, got %d
\n
"
,
count
);
ret
=
IXmlReader_IsEmptyElement
(
reader
);
...
...
@@ -1007,7 +1007,7 @@ todo_wine {
type
=
-
1
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
todo_wine
ok
(
hr
==
WC_E_SYNTAX
||
hr
==
WC_E_XMLCHARACTER
/* XP */
,
"
expected WC_E_SYNTAX, got %08x
\n
"
,
hr
);
ok
(
hr
==
WC_E_SYNTAX
||
hr
==
WC_E_XMLCHARACTER
/* XP */
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_None
,
"expected XmlNodeType_None, got %s
\n
"
,
type_to_str
(
type
));
TEST_READER_POSITION
(
reader
,
1
,
41
);
todo_wine
...
...
@@ -1053,7 +1053,7 @@ static void test_read_comment(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
teststr
);
...
...
@@ -1066,7 +1066,7 @@ static void test_read_comment(void)
if
(
type
==
XmlNodeType_Text
||
type
==
XmlNodeType_Comment
)
{
hr
=
IXmlReader_GetValue
(
reader
,
&
value
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
value
!=
0
,
"Expected node value
\n
"
);
}
i
++
;
...
...
@@ -1079,9 +1079,9 @@ static void test_read_comment(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
if
(
test
->
hr_broken
)
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
else
ok
(
hr
==
test
->
hr
,
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
,
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
if
(
hr
==
S_OK
)
{
const
WCHAR
*
str
;
...
...
@@ -1092,14 +1092,14 @@ static void test_read_comment(void)
str
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
reader_qname
(
reader
,
L""
);
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
/* value */
...
...
@@ -1134,7 +1134,7 @@ static void test_read_pi(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
while
(
test
->
xml
)
{
...
...
@@ -1145,9 +1145,9 @@ static void test_read_pi(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
if
(
test
->
hr_broken
)
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
else
ok
(
hr
==
test
->
hr
,
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
,
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
if
(
hr
==
S_OK
)
{
const
WCHAR
*
str
;
...
...
@@ -1160,7 +1160,7 @@ static void test_read_pi(void)
len
=
0
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
lstrlenW
(
test
->
name
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
test
->
name
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
...
...
@@ -1230,7 +1230,7 @@ static void test_read_full(void)
int
i
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
test
->
xml
);
...
...
@@ -1257,10 +1257,10 @@ static void test_read_public_dtd(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_DtdProcessing
,
DtdProcessing_Parse
);
ok
(
hr
==
S_OK
,
"
got 0x%8x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
test_public_dtd
);
...
...
@@ -1268,15 +1268,15 @@ static void test_read_public_dtd(void)
count
=
0
;
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
2
,
"got %d
\n
"
,
count
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"got %d
\n
"
,
type
);
reader_name
(
reader
,
L"PUBLIC"
);
...
...
@@ -1286,7 +1286,7 @@ static void test_read_public_dtd(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"got %d
\n
"
,
type
);
reader_name
(
reader
,
L"SYSTEM"
);
...
...
@@ -1298,7 +1298,7 @@ static void test_read_public_dtd(void)
len
=
0
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
lstrlenW
(
dtdnameW
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
dtdnameW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
...
...
@@ -1320,10 +1320,10 @@ static void test_read_system_dtd(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_DtdProcessing
,
DtdProcessing_Parse
);
ok
(
hr
==
S_OK
,
"
got 0x%8x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
test_system_dtd
);
...
...
@@ -1331,15 +1331,15 @@ static void test_read_system_dtd(void)
count
=
0
;
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
1
,
"got %d
\n
"
,
count
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"got %d
\n
"
,
type
);
reader_name
(
reader
,
L"SYSTEM"
);
...
...
@@ -1351,7 +1351,7 @@ static void test_read_system_dtd(void)
len
=
0
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
{
ok
(
len
==
lstrlenW
(
dtdnameW
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
dtdnameW
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
...
...
@@ -1397,7 +1397,7 @@ static void test_read_element(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
while
(
test
->
xml
)
{
...
...
@@ -1406,10 +1406,10 @@ static void test_read_element(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
if
(
test
->
hr_broken
)
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
else
todo_wine_if
(
test
->
hr
==
NC_E_UNDECLAREDPREFIX
)
ok
(
hr
==
test
->
hr
,
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
,
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
if
(
hr
==
S_OK
)
{
const
WCHAR
*
str
;
...
...
@@ -1420,7 +1420,7 @@ static void test_read_element(void)
len
=
0
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
lstrlenW
(
test
->
name
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
test
->
name
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
...
...
@@ -1444,7 +1444,7 @@ static void test_read_element(void)
depth
=
123
;
hr
=
IXmlReader_GetDepth
(
reader
,
&
depth
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
depth
==
depths
[
i
],
"%u: got depth %u, expected %u
\n
"
,
i
,
depth
,
depths
[
i
]);
if
(
type
==
XmlNodeType_Element
||
type
==
XmlNodeType_EndElement
)
...
...
@@ -1453,7 +1453,7 @@ static void test_read_element(void)
prefix
=
NULL
;
hr
=
IXmlReader_GetPrefix
(
reader
,
&
prefix
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
prefix
!=
NULL
,
"got %p
\n
"
,
prefix
);
if
(
!*
prefix
)
...
...
@@ -1462,12 +1462,12 @@ static void test_read_element(void)
local
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
local
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
local
!=
NULL
,
"got %p
\n
"
,
local
);
qname
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
qname
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
qname
!=
NULL
,
"got %p
\n
"
,
qname
);
ok
(
local
==
qname
,
"expected same pointer
\n
"
);
...
...
@@ -1478,7 +1478,7 @@ static void test_read_element(void)
{
count
=
1
;
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
count
==
0
,
"got %u
\n
"
,
count
);
}
...
...
@@ -1486,7 +1486,7 @@ static void test_read_element(void)
{
count
=
0
;
hr
=
IXmlReader_GetAttributeCount
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* moving to attributes increases depth */
if
(
count
)
...
...
@@ -1496,14 +1496,14 @@ static void test_read_element(void)
reader_value
(
reader
,
L""
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_GetValue
(
reader
,
&
value
,
NULL
);
ok
(
*
value
!=
0
,
"Unexpected value %s
\n
"
,
wine_dbgstr_w
(
value
));
depth
=
123
;
hr
=
IXmlReader_GetDepth
(
reader
,
&
depth
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
depth
==
depths
[
i
]
+
1
,
"%u: got depth %u, expected %u
\n
"
,
i
,
depth
,
depths
[
i
]
+
1
);
move_to_element
(
reader
);
...
...
@@ -1511,7 +1511,7 @@ static void test_read_element(void)
depth
=
123
;
hr
=
IXmlReader_GetDepth
(
reader
,
&
depth
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
depth
==
depths
[
i
],
"%u: got depth %u, expected %u
\n
"
,
i
,
depth
,
depths
[
i
]);
}
}
...
...
@@ -1526,7 +1526,7 @@ static void test_read_element(void)
type
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
WC_E_ELEMENTMATCH
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
WC_E_ELEMENTMATCH
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_None
,
"got %d
\n
"
,
type
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
...
...
@@ -1544,16 +1544,16 @@ static void test_read_pending(void)
int
c
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
&
teststream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* first read call returns incomplete node, second attempt fails with E_PENDING */
stream_readcall
=
0
;
type
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
E_PENDING
),
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
E_PENDING
),
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* newer versions are happy when it's enough data to detect node type,
older versions keep reading until it fails to read more */
todo_wine
...
...
@@ -1564,7 +1564,7 @@ static void test_read_pending(void)
c
=
stream_readcall
;
value
=
(
void
*
)
0xdeadbeef
;
hr
=
IXmlReader_GetValue
(
reader
,
&
value
,
NULL
);
ok
(
hr
==
E_PENDING
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_PENDING
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
NULL
||
broken
(
value
==
(
void
*
)
0xdeadbeef
)
/* Win8 sets it to NULL */
,
"got %p
\n
"
,
value
);
ok
(
c
<
stream_readcall
||
broken
(
c
==
stream_readcall
),
"got %d, expected %d
\n
"
,
stream_readcall
,
c
+
1
);
...
...
@@ -1581,12 +1581,12 @@ static void test_readvaluechunk(void)
UINT
c
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
"<!-- comment1 --><!-- comment2 -->"
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Comment
,
"type = %u
\n
"
,
type
);
read_value_char
(
reader
,
' '
);
...
...
@@ -1599,13 +1599,13 @@ static void test_readvaluechunk(void)
c
=
0
;
b
=
0
;
hr
=
IXmlReader_ReadValueChunk
(
reader
,
&
b
,
1
,
&
c
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
c
==
0
,
"got %u
\n
"
,
c
);
ok
(
b
==
0
,
"got %x
\n
"
,
b
);
c
=
0xdeadbeef
;
hr
=
IXmlReader_ReadValueChunk
(
reader
,
buf
,
0
,
&
c
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
c
,
"c = %u
\n
"
,
c
);
reader_value
(
reader
,
L"omment1 "
);
...
...
@@ -1615,13 +1615,13 @@ static void test_readvaluechunk(void)
c
=
0xdeadbeef
;
hr
=
IXmlReader_ReadValueChunk
(
reader
,
buf
,
0
,
&
c
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
c
,
"c = %u
\n
"
,
c
);
c
=
0xdeadbeef
;
memset
(
buf
,
0xcc
,
sizeof
(
buf
));
hr
=
IXmlReader_ReadValueChunk
(
reader
,
buf
,
ARRAY_SIZE
(
buf
),
&
c
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
c
==
10
,
"got %u
\n
"
,
c
);
ok
(
buf
[
c
]
==
0xcccc
,
"buffer overflow
\n
"
);
buf
[
c
]
=
0
;
...
...
@@ -1630,7 +1630,7 @@ static void test_readvaluechunk(void)
c
=
0xdeadbeef
;
memset
(
buf
,
0xcc
,
sizeof
(
buf
));
hr
=
IXmlReader_ReadValueChunk
(
reader
,
buf
,
ARRAY_SIZE
(
buf
),
&
c
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
c
,
"got %u
\n
"
,
c
);
/* portion read as chunk is skipped from resulting node value */
...
...
@@ -1640,7 +1640,7 @@ static void test_readvaluechunk(void)
c
=
0xdeadbeef
;
b
=
0xffff
;
hr
=
IXmlReader_ReadValueChunk
(
reader
,
&
b
,
1
,
&
c
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
c
==
0
,
"got %u
\n
"
,
c
);
ok
(
b
==
0xffff
,
"got %x
\n
"
,
b
);
...
...
@@ -1666,7 +1666,7 @@ static void test_read_cdata(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
while
(
test
->
xml
)
{
...
...
@@ -1685,9 +1685,9 @@ static void test_read_cdata(void)
}
if
(
test
->
hr_broken
)
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
else
ok
(
hr
==
test
->
hr
,
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
,
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
if
(
hr
==
S_OK
)
{
const
WCHAR
*
str
;
...
...
@@ -1699,19 +1699,19 @@ static void test_read_cdata(void)
str
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
len
=
1
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
0
,
"got %u
\n
"
,
len
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
/* value */
...
...
@@ -1740,7 +1740,7 @@ static void test_read_text(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
while
(
test
->
xml
)
{
...
...
@@ -1757,7 +1757,7 @@ static void test_read_text(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
}
ok
(
hr
==
test
->
hr
,
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
,
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
if
(
hr
==
S_OK
)
{
const
WCHAR
*
str
;
...
...
@@ -1769,19 +1769,19 @@ static void test_read_text(void)
str
=
NULL
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
str
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
len
=
1
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
0
,
"got %u
\n
"
,
len
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
*
str
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
/* value */
...
...
@@ -1812,7 +1812,7 @@ static void test_isemptyelement(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
while
(
test
->
xml
)
{
...
...
@@ -1823,7 +1823,7 @@ static void test_isemptyelement(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"got %d
\n
"
,
type
);
ret
=
IXmlReader_IsEmptyElement
(
reader
);
...
...
@@ -1867,7 +1867,7 @@ static void test_read_attribute(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
while
(
test
->
xml
)
{
...
...
@@ -1878,9 +1878,9 @@ static void test_read_attribute(void)
hr
=
IXmlReader_Read
(
reader
,
NULL
);
if
(
test
->
hr_broken
)
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
||
broken
(
hr
==
test
->
hr_broken
),
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
else
ok
(
hr
==
test
->
hr
,
"
got %08x for %s
\n
"
,
hr
,
test
->
xml
);
ok
(
hr
==
test
->
hr
,
"
Unexpected hr %#lx, for %s.
\n
"
,
hr
,
test
->
xml
);
if
(
hr
==
S_OK
)
{
const
WCHAR
*
str
;
...
...
@@ -1888,19 +1888,19 @@ static void test_read_attribute(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
Failed to get node type, %#x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"got %d for %s
\n
"
,
type
,
test
->
xml
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
reader_name
(
reader
,
test
->
name
);
len
=
1
;
str
=
NULL
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
str
,
&
len
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
len
==
lstrlenW
(
test
->
name
),
"got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
str
,
test
->
name
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
...
...
@@ -1921,23 +1921,23 @@ static void test_reader_properties(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
value
=
0
;
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
&
value
);
ok
(
hr
==
S_OK
,
"
GetProperty failed: %08x
\n
"
,
hr
);
ok
(
value
==
256
,
"Unexpected default max depth value %
ld
\n
"
,
value
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
256
,
"Unexpected default max depth value %
Id.
\n
"
,
value
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MultiLanguage
,
0
);
ok
(
hr
==
S_OK
,
"
SetProperty failed: %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
0
);
ok
(
hr
==
S_OK
,
"
SetProperty failed: %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
value
=
256
;
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
&
value
);
ok
(
hr
==
S_OK
,
"
GetProperty failed: %08x
\n
"
,
hr
);
ok
(
value
==
0
,
"Unexpected max depth value %
ld
\n
"
,
value
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
0
,
"Unexpected max depth value %
Id.
\n
"
,
value
);
IXmlReader_Release
(
reader
);
}
...
...
@@ -1960,7 +1960,7 @@ static void test_prefix(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
prefix_tests
);
i
++
)
{
XmlNodeType
type
;
...
...
@@ -1968,16 +1968,16 @@ static void test_prefix(void)
set_input_string
(
reader
,
prefix_tests
[
i
].
xml
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
Read() failed, %#x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"Unexpected node type %d.
\n
"
,
type
);
reader_prefix
(
reader
,
prefix_tests
[
i
].
prefix1
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
MoveToFirstAttribute() failed, %#
x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#l
x.
\n
"
,
hr
);
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
GetNodeType() failed, %#
x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#l
x.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"Unexpected node type %d.
\n
"
,
type
);
reader_prefix
(
reader
,
prefix_tests
[
i
].
prefix2
);
...
...
@@ -1985,7 +1985,7 @@ static void test_prefix(void)
next_attribute
(
reader
);
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
GetNodeType() failed, %#
x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#l
x.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"Unexpected node type %d.
\n
"
,
type
);
reader_prefix
(
reader
,
prefix_tests
[
i
].
prefix3
);
...
...
@@ -2035,7 +2035,7 @@ static void test_namespaceuri(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
uri_tests
);
i
++
)
{
unsigned
int
j
=
0
;
...
...
@@ -2059,13 +2059,13 @@ static void test_namespaceuri(void)
local
=
NULL
;
length
=
0
;
hr
=
IXmlReader_GetLocalName
(
reader
,
&
local
,
&
length
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
local
!=
NULL
,
"Unexpected NULL local name pointer
\n
"
);
qname
=
NULL
;
length2
=
0
;
hr
=
IXmlReader_GetQualifiedName
(
reader
,
&
qname
,
&
length2
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
qname
!=
NULL
,
"Unexpected NULL qualified name pointer
\n
"
);
if
(
type
==
XmlNodeType_Element
||
...
...
@@ -2100,28 +2100,28 @@ static void test_read_charref(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
testA
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"Unexpected node type %d
\n
"
,
type
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Text
,
"Unexpected node type %d
\n
"
,
type
);
hr
=
IXmlReader_GetValue
(
reader
,
&
value
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
value
,
chardataW
),
"Text value : %s
\n
"
,
wine_dbgstr_w
(
value
));
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_EndElement
,
"Unexpected node type %d
\n
"
,
type
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_FALSE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_None
,
"Unexpected node type %d
\n
"
,
type
);
IXmlReader_Release
(
reader
);
...
...
@@ -2154,7 +2154,7 @@ static void test_encoding_detection(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* there's no way to query detected encoding back, so just verify that document is browsable */
...
...
@@ -2164,7 +2164,7 @@ static void test_encoding_detection(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
!=
XmlNodeType_None
,
"Unexpected node type %d
\n
"
,
type
);
}
...
...
@@ -2173,11 +2173,11 @@ static void test_encoding_detection(void)
stream
=
create_stream_on_data
(
encoding_testsW
[
i
].
text
,
lstrlenW
(
encoding_testsW
[
i
].
text
)
*
sizeof
(
WCHAR
));
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"%u:
got %08x
\n
"
,
i
,
hr
);
ok
(
hr
==
S_OK
,
"%u:
unexpected hr %#lx.
\n
"
,
i
,
hr
);
ok
(
type
!=
XmlNodeType_None
,
"%u: unexpected node type %d
\n
"
,
i
,
type
);
IStream_Release
(
stream
);
...
...
@@ -2193,8 +2193,8 @@ static void test_eof_state(IXmlReader *reader, BOOL eof)
ok
(
IXmlReader_IsEOF
(
reader
)
==
eof
,
"Unexpected IsEOF() result
\n
"
);
hr
=
IXmlReader_GetProperty
(
reader
,
XmlReaderProperty_ReadState
,
&
state
);
ok
(
hr
==
S_OK
,
"
GetProperty() failed, %#x
\n
"
,
hr
);
ok
((
state
==
XmlReadState_EndOfFile
)
==
eof
,
"Unexpected EndOfFile state %
ld
\n
"
,
state
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
((
state
==
XmlReadState_EndOfFile
)
==
eof
,
"Unexpected EndOfFile state %
Id.
\n
"
,
state
);
}
static
void
test_endoffile
(
void
)
...
...
@@ -2204,7 +2204,7 @@ static void test_endoffile(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
test_eof_state
(
reader
,
FALSE
);
...
...
@@ -2214,46 +2214,46 @@ static void test_endoffile(void)
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %#x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"Unexpected type %d
\n
"
,
type
);
test_eof_state
(
reader
,
FALSE
);
type
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_FALSE
,
"
got %#x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_None
,
"Unexpected type %d
\n
"
,
type
);
test_eof_state
(
reader
,
TRUE
);
hr
=
IXmlReader_SetInput
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
test_eof_state
(
reader
,
FALSE
);
IXmlReader_Release
(
reader
);
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
"<a/>text"
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %#x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"Unexpected type %d
\n
"
,
type
);
test_eof_state
(
reader
,
FALSE
);
type
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
WC_E_SYNTAX
,
"
got %#x
\n
"
,
hr
);
ok
(
hr
==
WC_E_SYNTAX
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_None
,
"Unexpected type %d
\n
"
,
type
);
test_eof_state
(
reader
,
FALSE
);
hr
=
IXmlReader_SetInput
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IXmlReader_Release
(
reader
);
}
...
...
@@ -2274,37 +2274,37 @@ static void test_max_element_depth(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
xml
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
2
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
0
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
0
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
1
);
TEST_READER_STATE
(
reader
,
XmlReadState_Interactive
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH2
(
reader
,
0
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
10
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH2
(
reader
,
0
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
...
...
@@ -2313,34 +2313,34 @@ static void test_max_element_depth(void)
set_input_string
(
reader
,
xml
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
2
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
0
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
0
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
1
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_DEPTH
(
reader
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Interactive
);
nodetype
=
123
;
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"got node type %d
\n
"
,
nodetype
);
nodetype
=
123
;
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"got node type %d
\n
"
,
nodetype
);
TEST_DEPTH2
(
reader
,
0
,
2
);
...
...
@@ -2350,7 +2350,7 @@ static void test_max_element_depth(void)
set_input_string
(
reader
,
xml
);
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
0
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
count
=
0
;
while
(
IXmlReader_Read
(
reader
,
NULL
)
==
S_OK
)
...
...
@@ -2370,25 +2370,25 @@ static void test_reader_position(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_STATE
(
reader
,
XmlReadState_Closed
);
/* position methods with Null args */
hr
=
IXmlReader_GetLineNumber
(
reader
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlReader_GetLinePosition
(
reader
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
Expected E_INVALIDARG, got %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
position
=
123
;
hr
=
IXmlReader_GetLinePosition
(
reader
,
&
position
);
ok
(
hr
==
S_FALSE
,
"
got %#x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
position
==
0
,
"got %u
\n
"
,
position
);
position
=
123
;
hr
=
IXmlReader_GetLineNumber
(
reader
,
&
position
);
ok
(
hr
==
S_FALSE
,
"
got %#x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
position
==
0
,
"got %u
\n
"
,
position
);
set_input_string
(
reader
,
xml
);
...
...
@@ -2396,7 +2396,7 @@ static void test_reader_position(void)
TEST_READER_STATE
(
reader
,
XmlReadState_Initial
);
TEST_READER_POSITION
(
reader
,
0
,
0
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"got type %d
\n
"
,
type
);
TEST_READER_POSITION2
(
reader
,
1
,
2
,
~
0u
,
34
);
...
...
@@ -2410,17 +2410,17 @@ static void test_reader_position(void)
TEST_READER_POSITION2
(
reader
,
1
,
2
,
~
0u
,
34
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Whitespace
,
"got type %d
\n
"
,
type
);
TEST_READER_POSITION2
(
reader
,
1
,
35
,
2
,
6
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_EndElement
,
"got type %d
\n
"
,
type
);
TEST_READER_POSITION2
(
reader
,
2
,
3
,
2
,
6
);
hr
=
IXmlReader_SetInput
(
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
TEST_READER_STATE2
(
reader
,
XmlReadState_Initial
,
XmlReadState_Closed
);
TEST_READER_POSITION
(
reader
,
0
,
0
);
...
...
@@ -2434,7 +2434,7 @@ static void test_string_pointers(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
set_input_string
(
reader
,
"<elem xmlns=
\"
myns
\"
>myns<elem2 /></elem>"
);
...
...
@@ -2565,67 +2565,67 @@ static void test_attribute_by_name(void)
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"
Failed to create reader, hr %#
x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#l
x.
\n
"
,
hr
);
set_input_string
(
reader
,
xml
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
||
broken
(
hr
==
S_FALSE
)
/* WinXP */
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
||
broken
(
hr
==
S_FALSE
)
/* WinXP */
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
emptyW
,
NULL
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
read_node
(
reader
,
XmlNodeType_Element
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
emptyW
,
NULL
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
read_node
(
reader
,
XmlNodeType_Element
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
NULL
,
xmlns_uriW
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
emptyW
,
xmlns_uriW
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
xmlnsW
,
NULL
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
xmlnsW
,
xmlns_uriW
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"myns"
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"value a"
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
bW
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"value b"
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
aW
,
mynsW
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
nsW
,
NULL
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
nsW
,
xmlns_uriW
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"ns uri"
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
bW
,
emptyW
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"value b"
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
cW
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"value c2"
);
hr
=
IXmlReader_MoveToAttributeByName
(
reader
,
cW
,
nsuriW
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
reader_value
(
reader
,
L"value c"
);
IXmlReader_Release
(
reader
);
...
...
dlls/xmllite/tests/writer.c
View file @
05b07dbe
...
...
@@ -41,7 +41,7 @@ static void _expect_ref(IUnknown *obj, ULONG ref, int line)
ULONG
refcount
;
IUnknown_AddRef
(
obj
);
refcount
=
IUnknown_Release
(
obj
);
ok_
(
__FILE__
,
line
)(
refcount
==
ref
,
"expected refcount %
d, got %d
\n
"
,
ref
,
refcount
);
ok_
(
__FILE__
,
line
)(
refcount
==
ref
,
"expected refcount %
lu, got %lu.
\n
"
,
ref
,
refcount
);
}
static
void
check_output_raw
(
IStream
*
stream
,
const
void
*
expected
,
SIZE_T
size
,
int
line
)
...
...
@@ -52,10 +52,10 @@ static void check_output_raw(IStream *stream, const void *expected, SIZE_T size,
WCHAR
*
ptr
;
hr
=
GetHGlobalFromStream
(
stream
,
&
hglobal
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Failed to get the stream handle, hr %#x.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Failed to get the stream handle, hr %#
l
x.
\n
"
,
hr
);
content_size
=
GlobalSize
(
hglobal
);
ok_
(
__FILE__
,
line
)(
size
==
content_size
,
"Unexpected test output size %
l
d.
\n
"
,
content_size
);
ok_
(
__FILE__
,
line
)(
size
==
content_size
,
"Unexpected test output size %
I
d.
\n
"
,
content_size
);
ptr
=
GlobalLock
(
hglobal
);
if
(
size
<=
content_size
)
ok_
(
__FILE__
,
line
)(
!
memcmp
(
expected
,
ptr
,
size
),
"Unexpected output content.
\n
"
);
...
...
@@ -73,7 +73,7 @@ static void check_output(IStream *stream, const char *expected, BOOL todo, int l
char
*
ptr
;
hr
=
GetHGlobalFromStream
(
stream
,
&
hglobal
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
size
=
GlobalSize
(
hglobal
);
ptr
=
GlobalLock
(
hglobal
);
...
...
@@ -111,7 +111,7 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
HRESULT
hr
;
hr
=
IXmlWriter_SetProperty
(
writer
,
property
,
TRUE
);
ok
(
hr
==
S_OK
,
"Failed to set writer property, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to set writer property, hr %#
l
x.
\n
"
,
hr
);
}
/* used to test all Write* methods for consistent error state */
...
...
@@ -123,67 +123,67 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
/* FIXME: add WriteAttributes */
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
NULL
,
aW
,
NULL
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteCData
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteCharEntity
(
writer
,
aW
[
0
]);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteChars
(
writer
,
aW
,
1
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteDocType
(
writer
,
aW
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
aW
,
NULL
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteEntityRef
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteName
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteNmToken
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx, expected %#lx.
\n
"
,
hr
,
exp_hr
);
/* FIXME: add WriteNode */
/* FIXME: add WriteNodeShallow */
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
aW
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteQualifiedName
(
writer
,
aW
,
NULL
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteRawChars
(
writer
,
aW
,
1
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
hr
=
IXmlWriter_WriteString
(
writer
,
aW
);
ok
(
hr
==
exp_hr
,
"
got 0x%08x, expected 0x%08x
\n
"
,
hr
,
exp_hr
);
ok
(
hr
==
exp_hr
,
"
Unexpected hr %#lx., expected %#lx.
\n
"
,
hr
,
exp_hr
);
/* FIXME: add WriteSurrogateCharEntity */
/* FIXME: add WriteWhitespace */
...
...
@@ -195,10 +195,10 @@ static IStream *writer_set_output(IXmlWriter *writer)
HRESULT
hr
;
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
return
stream
;
}
...
...
@@ -295,39 +295,39 @@ static void test_writer_create(void)
}
hr
=
CreateXmlWriter
(
&
IID_IStream
,
(
void
**
)
&
unk
,
NULL
);
ok
(
hr
==
E_NOINTERFACE
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
E_NOINTERFACE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriter
(
&
IID_IUnknown
,
(
void
**
)
&
unk
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IUnknown_QueryInterface
(
unk
,
&
IID_IXmlWriter
,
(
void
**
)
&
writer
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
unk
==
(
IUnknown
*
)
writer
,
"unexpected interface pointer
\n
"
);
IUnknown_Release
(
unk
);
IXmlWriter_Release
(
writer
);
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* check default properties values */
value
=
0
;
hr
=
IXmlWriter_GetProperty
(
writer
,
XmlWriterProperty_ByteOrderMark
,
&
value
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
value
==
TRUE
,
"got %
ld
\n
"
,
value
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
TRUE
,
"got %
Id.
\n
"
,
value
);
value
=
TRUE
;
hr
=
IXmlWriter_GetProperty
(
writer
,
XmlWriterProperty_Indent
,
&
value
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
value
==
FALSE
,
"got %
ld
\n
"
,
value
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
FALSE
,
"got %
Id.
\n
"
,
value
);
value
=
TRUE
;
hr
=
IXmlWriter_GetProperty
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
,
&
value
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
value
==
FALSE
,
"got %
ld
\n
"
,
value
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
FALSE
,
"got %
Id.
\n
"
,
value
);
value
=
XmlConformanceLevel_Auto
;
hr
=
IXmlWriter_GetProperty
(
writer
,
XmlWriterProperty_ConformanceLevel
,
&
value
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
value
==
XmlConformanceLevel_Document
,
"got %
ld
\n
"
,
value
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value
==
XmlConformanceLevel_Document
,
"got %
Id.
\n
"
,
value
);
IXmlWriter_Release
(
writer
);
}
...
...
@@ -337,78 +337,78 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
HRESULT
hr
;
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"Failed to set output, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to set output, hr %#
l
x.
\n
"
,
hr
);
/* TODO: WriteAttributes */
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
NULL
,
aW
,
NULL
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCData
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCharEntity
(
writer
,
0x100
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteChars
(
writer
,
aW
,
1
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteDocType
(
writer
,
aW
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
aW
,
NULL
,
NULL
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEntityRef
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteName
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteNmToken
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
/* TODO: WriteNode */
/* TODO: WriteNodeShallow */
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
aW
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteQualifiedName
(
writer
,
aW
,
NULL
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRawChars
(
writer
,
aW
,
1
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteString
(
writer
,
aW
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MX_E_ENCODING
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
/* TODO: WriteSurrogateCharEntity */
/*
ًُُ
TODO: WriteWhitespace */
/* TODO: WriteWhitespace */
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
}
static
void
test_writeroutput
(
void
)
...
...
@@ -425,15 +425,15 @@ static void test_writeroutput(void)
output
=
NULL
;
hr
=
CreateXmlWriterOutputWithEncodingName
(
&
testoutput
,
NULL
,
NULL
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
EXPECT_REF
(
output
,
1
);
IUnknown_Release
(
output
);
hr
=
CreateXmlWriterOutputWithEncodingName
(
&
testoutput
,
NULL
,
utf16W
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
unk
=
NULL
;
hr
=
IUnknown_QueryInterface
(
output
,
&
IID_IXmlWriterOutput
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
unk
!=
NULL
&&
unk
!=
output
,
"got %p, output %p
\n
"
,
unk
,
output
);
EXPECT_REF
(
output
,
2
);
...
...
@@ -444,14 +444,14 @@ static void test_writeroutput(void)
output
=
NULL
;
hr
=
CreateXmlWriterOutputWithEncodingCodePage
(
&
testoutput
,
NULL
,
~
0u
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IUnknown_Release
(
output
);
hr
=
CreateXmlWriterOutputWithEncodingCodePage
(
&
testoutput
,
NULL
,
CP_UTF8
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
unk
=
NULL
;
hr
=
IUnknown_QueryInterface
(
output
,
&
IID_IXmlWriterOutput
,
(
void
**
)
&
unk
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
unk
!=
NULL
,
"got %p
\n
"
,
unk
);
/* releasing 'unk' crashes on native */
IUnknown_Release
(
output
);
...
...
@@ -460,27 +460,27 @@ static void test_writeroutput(void)
/* create with us-ascii */
output
=
NULL
;
hr
=
CreateXmlWriterOutputWithEncodingName
(
&
testoutput
,
NULL
,
usasciiW
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IUnknown_Release
(
output
);
/* Output with codepage 1200. */
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to create writer, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create writer, hr %#
l
x.
\n
"
,
hr
);
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"Failed to create stream, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create stream, hr %#
l
x.
\n
"
,
hr
);
hr
=
CreateXmlWriterOutputWithEncodingCodePage
((
IUnknown
*
)
stream
,
NULL
,
1200
,
&
output
);
ok
(
hr
==
S_OK
,
"Failed to create writer output, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create writer output, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"Failed to set writer output, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to set writer output, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"Write failed, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Write failed, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT_RAW
(
stream
,
utf16_outputW
,
sizeof
(
utf16_outputW
));
...
...
@@ -489,11 +489,11 @@ static void test_writeroutput(void)
/* Create output with meaningless code page value. */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"Failed to create stream, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create stream, hr %#
l
x.
\n
"
,
hr
);
output
=
NULL
;
hr
=
CreateXmlWriterOutputWithEncodingCodePage
((
IUnknown
*
)
stream
,
NULL
,
~
0u
,
&
output
);
ok
(
hr
==
S_OK
,
"Failed to create writer output, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create writer output, hr %#
l
x.
\n
"
,
hr
);
test_invalid_output_encoding
(
writer
,
output
);
CHECK_OUTPUT
(
stream
,
""
);
...
...
@@ -503,11 +503,11 @@ static void test_writeroutput(void)
/* Same, with invalid encoding name. */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
output
=
NULL
;
hr
=
CreateXmlWriterOutputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
dummyW
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
test_invalid_output_encoding
(
writer
,
output
);
CHECK_OUTPUT
(
stream
,
""
);
...
...
@@ -532,55 +532,55 @@ static void test_writestartdocument(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* output not set */
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
/* nothing written yet */
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
fullprolog
);
/* one more time */
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IStream_Release
(
stream
);
/* now add PI manually, and try to start a document */
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* another attempt to add 'xml' PI */
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
prologversion
);
...
...
@@ -589,23 +589,23 @@ static void test_writestartdocument(void)
/* create with us-ascii */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
output
=
NULL
;
hr
=
CreateXmlWriterOutputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
usasciiW
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
prologversion2
);
...
...
@@ -620,28 +620,28 @@ static void test_flush(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
(
IUnknown
*
)
&
teststream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
g_write_len
=
0
;
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
g_write_len
>
0
,
"
got %d
\n
"
,
g_write_len
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
g_write_len
>
0
,
"
Unexpected length %lu.
\n
"
,
g_write_len
);
g_write_len
=
1
;
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
g_write_len
==
0
,
"
got %d
\n
"
,
g_write_len
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
g_write_len
==
0
,
"
Unexpected length %lu.
\n
"
,
g_write_len
);
/* Release() flushes too */
g_write_len
=
1
;
IXmlWriter_Release
(
writer
);
ok
(
g_write_len
==
0
,
"
got %d
\n
"
,
g_write_len
);
ok
(
g_write_len
==
0
,
"
Unexpected length %lu.
\n
"
,
g_write_len
);
}
static
void
test_omitxmldeclaration
(
void
)
...
...
@@ -656,20 +656,20 @@ static void test_omitxmldeclaration(void)
char
*
ptr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
GetHGlobalFromStream
(
stream
,
&
hglobal
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ptr
=
GlobalLock
(
hglobal
);
ok
(
!
ptr
,
"got %p
\n
"
,
ptr
);
...
...
@@ -677,7 +677,7 @@ static void test_omitxmldeclaration(void)
/* one more time */
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IStream_Release
(
stream
);
...
...
@@ -685,35 +685,35 @@ static void test_omitxmldeclaration(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
prologversion
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
prologversion
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
prologversion
);
/* another attempt to add 'xml' PI */
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IStream_Release
(
stream
);
IXmlWriter_Release
(
writer
);
...
...
@@ -735,25 +735,25 @@ static void test_bom(void)
HRESULT
hr
;
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriterOutputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
utf16W
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* BOM is on by default */
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT_RAW
(
stream
,
bomW
,
sizeof
(
bomW
));
...
...
@@ -762,19 +762,19 @@ static void test_bom(void)
/* start with PI */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriterOutputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
utf16W
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
xmlW
,
versionW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT_RAW
(
stream
,
piW
,
sizeof
(
piW
));
...
...
@@ -783,19 +783,19 @@ static void test_bom(void)
/* start with element */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriterOutputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
utf16W
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT_RAW
(
stream
,
aopenW
,
sizeof
(
aopenW
));
...
...
@@ -804,24 +804,24 @@ static void test_bom(void)
/* WriteElementString */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
CreateXmlWriterOutputWithEncodingName
((
IUnknown
*
)
stream
,
NULL
,
utf16W
,
&
output
);
ok
(
hr
==
S_OK
,
"
got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
output
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
writer_set_property
(
writer
,
XmlWriterProperty_Indent
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
aW
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
GetHGlobalFromStream
(
stream
,
&
hglobal
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT_RAW
(
stream
,
afullW
,
sizeof
(
afullW
));
...
...
@@ -922,65 +922,65 @@ static void test_WriteStartElement(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"a"
,
NULL
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
NULL
,
"a"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a"
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteProcessingInstruction
(
writer
,
aW
,
aW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
IStream_Release
(
stream
);
IXmlWriter_Release
(
writer
);
/* WriteElementString */
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"b"
,
NULL
,
"value"
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
"prefix"
,
"a"
,
"uri"
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"b"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"Failed to write element string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element string, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"c"
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element string, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"d"
,
"uri"
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
""
,
"e"
,
"uri"
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
"prefix2"
,
"f"
,
"uri"
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<prefix:a xmlns:prefix=
\"
uri
\"
>"
...
...
@@ -1000,24 +1000,24 @@ static void test_WriteStartElement(void)
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
start_element_tests
[
i
].
prefix
,
start_element_tests
[
i
].
local
,
start_element_tests
[
i
].
uri
);
ok
(
hr
==
start_element_tests
[
i
].
hr
,
"%u: unexpected hr %#x.
\n
"
,
i
,
hr
);
ok
(
hr
==
start_element_tests
[
i
].
hr
,
"%u: unexpected hr %#
l
x.
\n
"
,
i
,
hr
);
if
(
SUCCEEDED
(
start_element_tests
[
i
].
hr
))
{
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
check_output
(
stream
,
start_element_tests
[
i
].
output_partial
,
start_element_tests
[
i
].
todo_partial
,
__LINE__
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end document, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end document, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
check_output
(
stream
,
start_element_tests
[
i
].
output
,
start_element_tests
[
i
].
todo
,
__LINE__
);
}
...
...
@@ -1072,54 +1072,54 @@ static void test_WriteElementString(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"b"
,
NULL
,
"value"
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
NULL
,
"a"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"b"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"b"
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
"prefix"
,
"b"
,
"uri"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
"prefix"
,
"c"
,
"uri"
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
"prefix"
,
"d"
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
"prefix2"
,
"d"
,
"uri"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"e"
,
"uri"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
"prefix"
,
"f"
,
"uri2"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
NULL
,
"g"
,
"uri3"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
"prefix"
,
"h"
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
"prefix_i"
,
"i"
,
NULL
,
NULL
);
ok
(
hr
==
WR_E_NSPREFIXWITHEMPTYNSURI
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
WR_E_NSPREFIXWITHEMPTYNSURI
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
""
,
"j"
,
"uri"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a><b>value</b><b />"
...
...
@@ -1142,24 +1142,24 @@ static void test_WriteElementString(void)
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_element_string
(
writer
,
element_string_tests
[
i
].
prefix
,
element_string_tests
[
i
].
local
,
element_string_tests
[
i
].
uri
,
element_string_tests
[
i
].
value
);
ok
(
hr
==
element_string_tests
[
i
].
hr
,
"%u: unexpected hr %#x.
\n
"
,
i
,
hr
);
ok
(
hr
==
element_string_tests
[
i
].
hr
,
"%u: unexpected hr %#
l
x.
\n
"
,
i
,
hr
);
if
(
SUCCEEDED
(
element_string_tests
[
i
].
hr
))
{
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
check_output
(
stream
,
element_string_tests
[
i
].
output
,
element_string_tests
[
i
].
todo
,
__LINE__
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end document, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end document, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
check_output
(
stream
,
element_string_tests
[
i
].
output
,
element_string_tests
[
i
].
todo
,
__LINE__
);
}
...
...
@@ -1177,24 +1177,24 @@ static void test_WriteEndElement(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
NULL
,
"a"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"b"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a><b /></a>"
);
...
...
@@ -1213,47 +1213,47 @@ static void test_writeenddocument(void)
char
*
ptr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
/* WriteEndDocument resets it to initial state */
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_SetOutput
(
writer
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
bW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
GetHGlobalFromStream
(
stream
,
&
hglobal
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
ptr
=
GlobalLock
(
hglobal
);
ok
(
ptr
==
NULL
,
"got %p
\n
"
,
ptr
);
/* we still need to flush manually, WriteEndDocument doesn't do that */
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a><b /></a>"
);
...
...
@@ -1271,35 +1271,35 @@ static void test_WriteComment(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_WriteComment
(
writer
,
aW
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
aW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
bW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
aW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
closeW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<!--a--><b><!--a--><!----><!--- ->-->"
);
...
...
@@ -1318,32 +1318,32 @@ static void test_WriteCData(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_WriteCData
(
writer
,
aW
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
bW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCData
(
writer
,
aW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCData
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCData
(
writer
,
closeW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCData
(
writer
,
close2W
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<b>"
...
...
@@ -1367,48 +1367,48 @@ static void test_WriteRaw(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
aW
,
NULL
,
aW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Yes
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
rawW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteRaw
(
writer
,
rawW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>a<:a<:<!--a<:-->a<:<a>a</a>"
);
...
...
@@ -1424,7 +1424,7 @@ static void test_writer_state(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* initial state */
check_writer_state
(
writer
,
E_UNEXPECTED
);
...
...
@@ -1433,7 +1433,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1442,7 +1442,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
NULL
,
aW
,
NULL
,
aW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1451,7 +1451,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1460,7 +1460,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1469,7 +1469,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteCData
(
writer
,
aW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1478,7 +1478,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteName
(
writer
,
aW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1487,7 +1487,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteNmToken
(
writer
,
aW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1496,7 +1496,7 @@ static void test_writer_state(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteString
(
writer
,
aW
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
check_writer_state
(
writer
,
WR_E_INVALIDACTION
);
IStream_Release
(
stream
);
...
...
@@ -1514,7 +1514,7 @@ static void test_indentation(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
...
...
@@ -1522,22 +1522,22 @@ static void test_indentation(void)
writer_set_property
(
writer
,
XmlWriterProperty_Indent
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteComment
(
writer
,
commentW
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
bW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -1551,19 +1551,19 @@ static void test_indentation(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
bW
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteElementString
(
writer
,
NULL
,
bW
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -1678,7 +1678,7 @@ static void test_WriteAttributeString(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
...
...
@@ -1687,26 +1687,26 @@ static void test_WriteAttributeString(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"e"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
attribute_tests
[
i
].
prefix
,
attribute_tests
[
i
].
local
,
attribute_tests
[
i
].
uri
,
attribute_tests
[
i
].
value
);
todo_wine_if
(
attribute_tests
[
i
].
todo_hr
)
ok
(
hr
==
attribute_tests
[
i
].
hr
,
"%u: unexpected hr %#
x, expected %#
x.
\n
"
,
i
,
hr
,
attribute_tests
[
i
].
hr
);
ok
(
hr
==
attribute_tests
[
i
].
hr
,
"%u: unexpected hr %#
lx, expected %#l
x.
\n
"
,
i
,
hr
,
attribute_tests
[
i
].
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
check_output
(
stream
,
attribute_tests
[
i
].
output_partial
,
attribute_tests
[
i
].
todo_partial
,
__LINE__
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end document, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end document, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
check_output
(
stream
,
attribute_tests
[
i
].
output
,
attribute_tests
[
i
].
todo
,
__LINE__
);
IStream_Release
(
stream
);
...
...
@@ -1716,41 +1716,41 @@ static void test_WriteAttributeString(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
"p"
,
"a"
,
"outeruri"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"prefix"
,
"local"
,
"uri"
,
"b"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
NULL
,
"a"
,
NULL
,
"b"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"xmlns"
,
"prefix"
,
NULL
,
"uri"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"p"
,
"attr"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"prefix"
,
"local"
,
NULL
,
"b"
);
todo_wine
ok
(
hr
==
WR_E_DUPLICATEATTRIBUTE
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
WR_E_DUPLICATEATTRIBUTE
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"b"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
NULL
,
"attr2"
,
"outeruri"
,
"value"
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"pr"
,
"attr3"
,
"outeruri"
,
"value"
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT_TODO
(
stream
,
"<p:a prefix:local=
\"
b
\"
a=
\"
b
\"
xmlns:prefix=
\"
uri
\"
p:attr=
\"
value
\"
xmlns:p=
\"
outeruri
\"
>"
...
...
@@ -1763,22 +1763,22 @@ static void test_WriteAttributeString(void)
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"e"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"xmlns"
,
"prefix"
,
NULL
,
"uri"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"prefix"
,
"attr"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<e xmlns:prefix=
\"
uri
\"
prefix:attr=
\"
value
\"
/>"
);
...
...
@@ -1796,7 +1796,7 @@ static void test_WriteFullEndElement(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* standalone element */
stream
=
writer_set_output
(
writer
);
...
...
@@ -1805,19 +1805,19 @@ static void test_WriteFullEndElement(void)
writer_set_property
(
writer
,
XmlWriterProperty_Indent
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a></a>"
);
...
...
@@ -1830,22 +1830,22 @@ static void test_WriteFullEndElement(void)
writer_set_property
(
writer
,
XmlWriterProperty_Indent
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -1864,7 +1864,7 @@ static void test_WriteCharEntity(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* without indentation */
stream
=
writer_set_output
(
writer
);
...
...
@@ -1872,22 +1872,22 @@ static void test_WriteCharEntity(void)
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteCharEntity
(
writer
,
0x100
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>Ā<a /></a>"
);
...
...
@@ -1903,39 +1903,39 @@ static void test_WriteString(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
writer_set_property
(
writer
,
XmlWriterProperty_OmitXmlDeclaration
);
hr
=
write_string
(
writer
,
"a"
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
""
);
ok
(
hr
==
E_UNEXPECTED
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_UNEXPECTED
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
NULL
,
"b"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
""
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
"a"
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
/* WriteString automatically escapes markup characters */
hr
=
write_string
(
writer
,
"<&
\"
>="
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<b>a<&
\"
>="
);
...
...
@@ -1944,22 +1944,22 @@ static void test_WriteString(void)
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
NULL
,
"b"
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<b"
);
hr
=
write_string
(
writer
,
""
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"
got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"
Unexpected hr %#lx.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<b>"
);
...
...
@@ -1969,43 +1969,43 @@ static void test_WriteString(void)
/* With indentation */
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to create a writer, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create a writer, hr %#
l
x.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
writer_set_property
(
writer
,
XmlWriterProperty_Indent
);
hr
=
write_start_element
(
writer
,
NULL
,
"a"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"b"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
"text"
);
ok
(
hr
==
S_OK
,
"Failed to write a string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write a string, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
" <b>text"
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
" <b>text</b>"
);
hr
=
IXmlWriter_WriteFullEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -2017,29 +2017,29 @@ static void test_WriteString(void)
stream
=
writer_set_output
(
writer
);
hr
=
write_start_element
(
writer
,
NULL
,
"a"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"b"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
" <b />"
);
hr
=
write_start_element
(
writer
,
NULL
,
"c"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
NULL
,
"attr"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -2047,10 +2047,10 @@ static void test_WriteString(void)
" <c attr=
\"
value
\"
"
);
hr
=
write_string
(
writer
,
"text"
);
ok
(
hr
==
S_OK
,
"Failed to write a string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write a string, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -2058,10 +2058,10 @@ static void test_WriteString(void)
" <c attr=
\"
value
\"
>text"
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -2069,16 +2069,16 @@ static void test_WriteString(void)
" <c attr=
\"
value
\"
>text</c>"
);
hr
=
write_start_element
(
writer
,
NULL
,
"d"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#
l
x.
\n
"
,
hr
);
hr
=
write_string
(
writer
,
""
);
ok
(
hr
==
S_OK
,
"Failed to write a string, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to write a string, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -2087,10 +2087,10 @@ static void test_WriteString(void)
" <d></d>"
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to end element, hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<a>
\r\n
"
...
...
@@ -2163,23 +2163,23 @@ static void test_WriteDocType(void)
HRESULT
hr
;
hr
=
CreateXmlWriter
(
&
IID_IXmlWriter
,
(
void
**
)
&
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to create writer instance, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to create writer instance, hr %#
l
x.
\n
"
,
hr
);
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteDocType
(
writer
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteDocType
(
writer
,
emptyW
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
/* Name validation. */
hr
=
IXmlWriter_WriteDocType
(
writer
,
nameW
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
WC_E_NAMECHARACTER
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
WC_E_NAMECHARACTER
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
/* Pubid validation. */
hr
=
IXmlWriter_WriteDocType
(
writer
,
aW
,
pubidW
,
NULL
,
NULL
);
ok
(
hr
==
WC_E_PUBLICID
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
WC_E_PUBLICID
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
IStream_Release
(
stream
);
...
...
@@ -2189,16 +2189,16 @@ static void test_WriteDocType(void)
hr
=
write_doctype
(
writer
,
doctype_tests
[
i
].
name
,
doctype_tests
[
i
].
pubid
,
doctype_tests
[
i
].
sysid
,
doctype_tests
[
i
].
subset
);
ok
(
hr
==
S_OK
,
"%u: failed to write doctype, hr %#x.
\n
"
,
i
,
hr
);
ok
(
hr
==
S_OK
,
"%u: failed to write doctype, hr %#
l
x.
\n
"
,
i
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#
l
x.
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
doctype_tests
[
i
].
output
);
hr
=
write_doctype
(
writer
,
doctype_tests
[
i
].
name
,
doctype_tests
[
i
].
pubid
,
doctype_tests
[
i
].
sysid
,
doctype_tests
[
i
].
subset
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
WR_E_INVALIDACTION
,
"Unexpected hr %#
l
x.
\n
"
,
hr
);
IStream_Release
(
stream
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment