Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
302aad9c
Commit
302aad9c
authored
Dec 13, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/tests: Test switching encoding after document is started already.
parent
5b533d82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
7 deletions
+52
-7
saxreader.c
dlls/msxml3/tests/saxreader.c
+52
-7
No files found.
dlls/msxml3/tests/saxreader.c
View file @
302aad9c
...
@@ -2600,26 +2600,30 @@ static void test_mxwriter_stream(void)
...
@@ -2600,26 +2600,30 @@ static void test_mxwriter_stream(void)
static
void
test_mxwriter_encoding
(
void
)
static
void
test_mxwriter_encoding
(
void
)
{
{
IMXWriter
*
writer
;
ISAXContentHandler
*
content
;
ISAXContentHandler
*
content
;
HRESULT
hr
;
IMXWriter
*
writer
;
IStream
*
stream
;
VARIANT
dest
;
VARIANT
dest
;
HRESULT
hr
;
HGLOBAL
g
;
char
*
ptr
;
BSTR
s
;
hr
=
CoCreateInstance
(
&
CLSID_MXXMLWriter
,
NULL
,
CLSCTX_INPROC_SERVER
,
hr
=
CoCreateInstance
(
&
CLSID_MXXMLWriter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMXWriter
,
(
void
**
)
&
writer
);
&
IID_IMXWriter
,
(
void
**
)
&
writer
);
ok
(
hr
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXWriter_QueryInterface
(
writer
,
&
IID_ISAXContentHandler
,
(
void
**
)
&
content
);
hr
=
IMXWriter_QueryInterface
(
writer
,
&
IID_ISAXContentHandler
,
(
void
**
)
&
content
);
ok
(
hr
==
S_OK
,
"QueryInterface(ISAXContentHandler) failed: %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXWriter_put_encoding
(
writer
,
_bstr_
(
"UTF-8"
));
hr
=
IMXWriter_put_encoding
(
writer
,
_bstr_
(
"UTF-8"
));
ok
(
hr
==
S_OK
,
"put_encoding failed: %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
ISAXContentHandler_startDocument
(
content
);
hr
=
ISAXContentHandler_startDocument
(
content
);
ok
(
hr
==
S_OK
,
"startDocument failed: %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
ISAXContentHandler_endDocument
(
content
);
hr
=
ISAXContentHandler_endDocument
(
content
);
ok
(
hr
==
S_OK
,
"endDocument failed: %08x
\n
"
,
hr
);
EXPECT_HR
(
hr
,
S_OK
);
/* The content is always re-encoded to UTF-16 when the output is
/* The content is always re-encoded to UTF-16 when the output is
* retrieved as a BSTR.
* retrieved as a BSTR.
...
@@ -2632,6 +2636,47 @@ static void test_mxwriter_encoding(void)
...
@@ -2632,6 +2636,47 @@ static void test_mxwriter_encoding(void)
"got wrong content: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
dest
)));
"got wrong content: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
dest
)));
VariantClear
(
&
dest
);
VariantClear
(
&
dest
);
/* switch encoding when something is written already */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
EXPECT_HR
(
hr
,
S_OK
);
V_VT
(
&
dest
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
dest
)
=
(
IUnknown
*
)
stream
;
hr
=
IMXWriter_put_output
(
writer
,
dest
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXWriter_put_encoding
(
writer
,
_bstr_
(
"UTF-8"
));
EXPECT_HR
(
hr
,
S_OK
);
/* write empty element */
hr
=
ISAXContentHandler_startElement
(
content
,
_bstr_
(
""
),
0
,
_bstr_
(
""
),
0
,
_bstr_
(
"a"
),
1
,
NULL
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
ISAXContentHandler_endElement
(
content
,
_bstr_
(
""
),
0
,
_bstr_
(
""
),
0
,
_bstr_
(
"a"
),
1
);
EXPECT_HR
(
hr
,
S_OK
);
/* switch */
hr
=
IMXWriter_put_encoding
(
writer
,
_bstr_
(
"UTF-16"
));
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXWriter_flush
(
writer
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
GetHGlobalFromStream
(
stream
,
&
g
);
EXPECT_HR
(
hr
,
S_OK
);
ptr
=
GlobalLock
(
g
);
ok
(
!
strncmp
(
ptr
,
"<a/>"
,
4
),
"got %c%c%c%c
\n
"
,
ptr
[
0
],
ptr
[
1
],
ptr
[
2
],
ptr
[
3
]);
GlobalUnlock
(
g
);
/* so output is unaffected, encoding name is stored however */
hr
=
IMXWriter_get_encoding
(
writer
,
&
s
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
!
lstrcmpW
(
s
,
_bstr_
(
"UTF-16"
)),
"got %s
\n
"
,
wine_dbgstr_w
(
s
));
SysFreeString
(
s
);
IStream_Release
(
stream
);
ISAXContentHandler_Release
(
content
);
ISAXContentHandler_Release
(
content
);
IMXWriter_Release
(
writer
);
IMXWriter_Release
(
writer
);
...
...
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