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
08c32f4e
Commit
08c32f4e
authored
Nov 11, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices/tests: Add tests.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f236df36
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
writer.c
dlls/webservices/tests/writer.c
+79
-0
No files found.
dlls/webservices/tests/writer.c
View file @
08c32f4e
...
...
@@ -326,10 +326,89 @@ static void test_WsSetOutputToBuffer(void)
WsFreeHeap
(
heap
);
}
static
void
check_output
(
WS_XML_WRITER
*
writer
,
const
char
*
expected
,
unsigned
int
line
)
{
WS_BYTES
bytes
;
ULONG
size
=
sizeof
(
bytes
);
int
len
=
strlen
(
expected
);
HRESULT
hr
;
memset
(
&
bytes
,
0
,
sizeof
(
bytes
)
);
hr
=
WsGetWriterProperty
(
writer
,
WS_XML_WRITER_PROPERTY_BYTES
,
&
bytes
,
size
,
NULL
);
ok
(
hr
==
S_OK
,
"%u: got %08x
\n
"
,
line
,
hr
);
ok
(
bytes
.
length
==
len
,
"%u: got %u expected %u
\n
"
,
line
,
bytes
.
length
,
len
);
if
(
bytes
.
length
!=
len
)
return
;
ok
(
!
memcmp
(
bytes
.
bytes
,
expected
,
len
),
"%u: got %s expected %s
\n
"
,
line
,
bytes
.
bytes
,
expected
);
}
static
void
test_WsWriteStartElement
(
void
)
{
HRESULT
hr
;
WS_XML_WRITER
*
writer
;
WS_XML_STRING
prefix
=
{
1
,
(
BYTE
*
)
"p"
},
ns
=
{
2
,
(
BYTE
*
)
"ns"
};
WS_XML_STRING
localname
=
{
1
,
(
BYTE
*
)
"a"
},
localname2
=
{
1
,
(
BYTE
*
)
"b"
};
hr
=
WsCreateWriter
(
NULL
,
0
,
&
writer
,
NULL
)
;
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
NULL
,
&
prefix
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
/* first call to WsWriteStartElement doesn't output anything */
hr
=
WsWriteStartElement
(
writer
,
&
prefix
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
/* two ways to close an element */
hr
=
WsWriteEndStartElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:a xmlns:p=
\"
ns
\"
>"
,
__LINE__
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:a xmlns:p=
\"
ns
\"
></p:a>"
,
__LINE__
);
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
&
prefix
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<p:a xmlns:p=
\"
ns
\"
/>"
,
__LINE__
);
/* nested elements */
hr
=
set_output
(
writer
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
""
,
__LINE__
);
hr
=
WsWriteStartElement
(
writer
,
NULL
,
&
localname2
,
&
ns
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<a xmlns=
\"
ns
\"
>"
,
__LINE__
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<a xmlns=
\"
ns
\"
><b/>"
,
__LINE__
);
hr
=
WsWriteEndElement
(
writer
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
check_output
(
writer
,
"<a xmlns=
\"
ns
\"
><b/></a>"
,
__LINE__
);
WsFreeWriter
(
writer
);
}
START_TEST
(
writer
)
{
test_WsCreateWriter
();
test_WsCreateXmlBuffer
();
test_WsSetOutput
();
test_WsSetOutputToBuffer
();
test_WsWriteStartElement
();
}
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