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
9a4d8c30
Commit
9a4d8c30
authored
May 19, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/tests: A test to show that writer flushes buffer to stream automatically.
parent
cce2b95a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
saxreader.c
dlls/msxml3/tests/saxreader.c
+82
-0
No files found.
dlls/msxml3/tests/saxreader.c
View file @
9a4d8c30
...
...
@@ -2813,6 +2813,7 @@ static void test_mxwriter_properties(void)
static
void
test_mxwriter_flush
(
void
)
{
static
const
WCHAR
emptyW
[]
=
{
0
};
ISAXContentHandler
*
content
;
IMXWriter
*
writer
;
LARGE_INTEGER
pos
;
...
...
@@ -2820,6 +2821,7 @@ static void test_mxwriter_flush(void)
IStream
*
stream
;
VARIANT
dest
;
HRESULT
hr
;
char
*
buff
;
hr
=
CoCreateInstance
(
&
CLSID_MXXMLWriter
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMXWriter
,
(
void
**
)
&
writer
);
...
...
@@ -2886,9 +2888,89 @@ static void test_mxwriter_flush(void)
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
pos2
.
QuadPart
!=
0
,
"expected stream position moved
\n
"
);
IStream_Release
(
stream
);
/* auto-flush feature */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
EXPECT_HR
(
hr
,
S_OK
);
EXPECT_REF
(
stream
,
1
);
V_VT
(
&
dest
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
dest
)
=
(
IUnknown
*
)
stream
;
hr
=
IMXWriter_put_output
(
writer
,
dest
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXWriter_put_byteOrderMark
(
writer
,
VARIANT_FALSE
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
IMXWriter_put_omitXMLDeclaration
(
writer
,
VARIANT_TRUE
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
ISAXContentHandler_startDocument
(
content
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
ISAXContentHandler_startElement
(
content
,
emptyW
,
0
,
emptyW
,
0
,
_bstr_
(
"a"
),
-
1
,
NULL
);
EXPECT_HR
(
hr
,
S_OK
);
/* internal buffer is flushed automatically on certain threshold */
pos
.
QuadPart
=
0
;
pos2
.
QuadPart
=
1
;
hr
=
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_CUR
,
&
pos2
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
pos2
.
QuadPart
==
0
,
"expected stream beginning
\n
"
);
buff
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2048
);
memset
(
buff
,
'A'
,
2048
);
hr
=
ISAXContentHandler_characters
(
content
,
_bstr_
(
buff
),
2048
);
EXPECT_HR
(
hr
,
S_OK
);
pos
.
QuadPart
=
0
;
pos2
.
QuadPart
=
0
;
hr
=
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_CUR
,
&
pos2
);
EXPECT_HR
(
hr
,
S_OK
);
todo_wine
ok
(
pos2
.
QuadPart
!=
0
,
"unexpected stream beginning
\n
"
);
hr
=
ISAXContentHandler_endDocument
(
content
);
EXPECT_HR
(
hr
,
S_OK
);
IStream_Release
(
stream
);
/* test char count lower than threshold */
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
EXPECT_HR
(
hr
,
S_OK
);
EXPECT_REF
(
stream
,
1
);
hr
=
ISAXContentHandler_startDocument
(
content
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
ISAXContentHandler_startElement
(
content
,
emptyW
,
0
,
emptyW
,
0
,
_bstr_
(
"a"
),
-
1
,
NULL
);
EXPECT_HR
(
hr
,
S_OK
);
pos
.
QuadPart
=
0
;
pos2
.
QuadPart
=
1
;
hr
=
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_CUR
,
&
pos2
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
pos2
.
QuadPart
==
0
,
"expected stream beginning
\n
"
);
memset
(
buff
,
'A'
,
2048
);
hr
=
ISAXContentHandler_characters
(
content
,
_bstr_
(
buff
),
2040
);
EXPECT_HR
(
hr
,
S_OK
);
pos
.
QuadPart
=
0
;
pos2
.
QuadPart
=
1
;
hr
=
IStream_Seek
(
stream
,
pos
,
STREAM_SEEK_CUR
,
&
pos2
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
pos2
.
QuadPart
==
0
,
"expected stream beginning
\n
"
);
hr
=
ISAXContentHandler_endDocument
(
content
);
EXPECT_HR
(
hr
,
S_OK
);
HeapFree
(
GetProcessHeap
(),
0
,
buff
);
ISAXContentHandler_Release
(
content
);
IStream_Release
(
stream
);
IMXWriter_Release
(
writer
);
free_bstrs
();
}
static
void
test_mxwriter_startenddocument
(
void
)
...
...
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