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
9730971e
Commit
9730971e
authored
Sep 12, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/tests: Add another test for WriteAttributeString().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7090d747
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
29 deletions
+33
-29
writer.c
dlls/xmllite/tests/writer.c
+33
-29
No files found.
dlls/xmllite/tests/writer.c
View file @
9730971e
...
...
@@ -1572,6 +1572,27 @@ static void test_indentation(void)
IXmlWriter_Release
(
writer
);
}
static
HRESULT
write_attribute_string
(
IXmlWriter
*
writer
,
const
char
*
prefix
,
const
char
*
local
,
const
char
*
uri
,
const
char
*
value
)
{
WCHAR
*
prefixW
,
*
localW
,
*
uriW
,
*
valueW
;
HRESULT
hr
;
prefixW
=
strdupAtoW
(
prefix
);
localW
=
strdupAtoW
(
local
);
uriW
=
strdupAtoW
(
uri
);
valueW
=
strdupAtoW
(
value
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
prefixW
,
localW
,
uriW
,
valueW
);
heap_free
(
prefixW
);
heap_free
(
localW
);
heap_free
(
uriW
);
heap_free
(
valueW
);
return
hr
;
}
static
void
test_WriteAttributeString
(
void
)
{
static
const
struct
...
...
@@ -1589,6 +1610,7 @@ static void test_WriteAttributeString(void)
{
NULL
,
"a"
,
NULL
,
"b"
,
"<e a=
\"
b
\"
/>"
,
"<e a=
\"
b
\"
"
},
{
"prefix"
,
"local"
,
"uri"
,
"b"
,
"<e prefix:local=
\"
b
\"
xmlns:prefix=
\"
uri
\"
/>"
,
"<e prefix:local=
\"
b
\"
"
},
{
NULL
,
"a"
,
"http://www.w3.org/2000/xmlns/"
,
"defuri"
,
"<e xmlns:a=
\"
defuri
\"
/>"
,
"<e xmlns:a=
\"
defuri
\"
"
},
{
"xmlns"
,
"a"
,
NULL
,
"uri"
,
"<e xmlns:a=
\"
uri
\"
/>"
,
"<e xmlns:a=
\"
uri
\"
"
},
/* Autogenerated prefix names. */
{
NULL
,
"a"
,
"defuri"
,
NULL
,
"<e p1:a=
\"\"
xmlns:p1=
\"
defuri
\"
/>"
,
"<e p1:a=
\"\"
"
},
...
...
@@ -1606,12 +1628,6 @@ static void test_WriteAttributeString(void)
{
"prefix"
,
"a"
,
"http://www.w3.org/2000/xmlns/"
,
"defuri"
,
"<e />"
,
"<e"
,
WR_E_XMLNSURIDECLARATION
},
};
static
const
WCHAR
prefixW
[]
=
{
'p'
,
'r'
,
'e'
,
'f'
,
'i'
,
'x'
,
0
};
static
const
WCHAR
localW
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
0
};
static
const
WCHAR
uriW
[]
=
{
'u'
,
'r'
,
'i'
,
0
};
static
const
WCHAR
elementW
[]
=
{
'e'
,
0
};
static
const
WCHAR
aW
[]
=
{
'a'
,
0
};
static
const
WCHAR
bW
[]
=
{
'b'
,
0
};
IXmlWriter
*
writer
;
IStream
*
stream
;
unsigned
int
i
;
...
...
@@ -1624,22 +1640,16 @@ static void test_WriteAttributeString(void)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
attribute_tests
);
++
i
)
{
WCHAR
*
prefixW
,
*
localW
,
*
uriW
,
*
valueW
;
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"Failed to start document, hr %#x.
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
elementW
,
NULL
);
hr
=
write_start_element
(
writer
,
NULL
,
"e"
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to start element, hr %#x.
\n
"
,
hr
);
prefixW
=
strdupAtoW
(
attribute_tests
[
i
].
prefix
);
localW
=
strdupAtoW
(
attribute_tests
[
i
].
local
);
uriW
=
strdupAtoW
(
attribute_tests
[
i
].
uri
);
valueW
=
strdupAtoW
(
attribute_tests
[
i
].
value
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
prefixW
,
localW
,
uriW
,
valueW
);
hr
=
write_attribute_string
(
writer
,
attribute_tests
[
i
].
prefix
,
attribute_tests
[
i
].
local
,
attribute_tests
[
i
].
uri
,
attribute_tests
[
i
].
value
);
todo_wine_if
(
i
!=
0
)
ok
(
hr
==
attribute_tests
[
i
].
hr
,
"%u: unexpected hr %#x.
\n
"
,
i
,
hr
);
...
...
@@ -1654,11 +1664,6 @@ static void test_WriteAttributeString(void)
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"Failed to flush, hr %#x.
\n
"
,
hr
);
heap_free
(
prefixW
);
heap_free
(
localW
);
heap_free
(
uriW
);
heap_free
(
valueW
);
check_output
(
stream
,
attribute_tests
[
i
].
output
,
i
==
1
||
i
==
2
||
i
==
3
||
i
==
4
,
__LINE__
);
IStream_Release
(
stream
);
}
...
...
@@ -1669,21 +1674,20 @@ static void test_WriteAttributeString(void)
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteStartElement
(
writer
,
NULL
,
aW
,
NULL
);
hr
=
write_start_element
(
writer
,
"p"
,
"a"
,
"outeruri"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
aW
,
NULL
,
NULL
,
bW
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
prefixW
,
localW
,
uriW
,
bW
);
hr
=
write_attribute_string
(
writer
,
"prefix"
,
"local"
,
"uri"
,
"b"
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
NULL
,
aW
,
NULL
,
bW
);
hr
=
write_attribute_string
(
writer
,
NULL
,
"a"
,
NULL
,
"b"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteAttributeString
(
writer
,
prefixW
,
localW
,
NULL
,
bW
);
hr
=
write_attribute_string
(
writer
,
"p"
,
"attr"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"Failed to write attribute string, hr %#x.
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"prefix"
,
"local"
,
NULL
,
"b"
);
todo_wine
ok
(
hr
==
WR_E_DUPLICATEATTRIBUTE
,
"got 0x%08x
\n
"
,
hr
);
...
...
@@ -1694,7 +1698,7 @@ todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
CHECK_OUTPUT_TODO
(
stream
,
"<
a prefix:local=
\"
b
\"
a=
\"
b
\"
xmlns:prefix=
\"
uri
\"
/>"
);
"<
p:a prefix:local=
\"
b
\"
a=
\"
b
\"
p:attr=
\"
value
\"
xmlns:prefix=
\"
uri
\"
xmlns:p=
\"
outer
uri
\"
/>"
);
IXmlWriter_Release
(
writer
);
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