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
dec0e471
Commit
dec0e471
authored
Dec 09, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/tests: Some tests for returned namespace prefixes and uris.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
682d4f14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
135 additions
and
0 deletions
+135
-0
reader.c
dlls/xmllite/tests/reader.c
+135
-0
No files found.
dlls/xmllite/tests/reader.c
View file @
dec0e471
...
...
@@ -1906,6 +1906,139 @@ static void test_reader_properties(void)
IXmlReader_Release
(
reader
);
}
static
void
test_prefix
(
void
)
{
static
const
struct
{
const
char
*
xml
;
const
char
*
prefix1
;
const
char
*
prefix2
;
const
char
*
prefix3
;
}
prefix_tests
[]
=
{
{
"<b xmlns=
\"
defns
\"
xml:a=
\"
a ns
\"
/>"
,
""
,
""
,
"xml"
},
};
IXmlReader
*
reader
;
unsigned
int
i
;
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"S_OK, got %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
prefix_tests
)
/
sizeof
(
prefix_tests
[
0
]);
i
++
)
{
const
WCHAR
*
prefix
;
XmlNodeType
type
;
WCHAR
*
expected
;
IStream
*
stream
;
stream
=
create_stream_on_data
(
prefix_tests
[
i
].
xml
,
strlen
(
prefix_tests
[
i
].
xml
)
+
1
);
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"Read() failed, %#x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"Unexpected node type %d.
\n
"
,
type
);
expected
=
a2w
(
prefix_tests
[
i
].
prefix1
);
hr
=
IXmlReader_GetPrefix
(
reader
,
&
prefix
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPrefix() failed, %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
prefix
,
expected
),
"Unexpected prefix %s, expected %s.
\n
"
,
wine_dbgstr_w
(
prefix
),
wine_dbgstr_w
(
expected
));
free_str
(
expected
);
hr
=
IXmlReader_MoveToFirstAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"MoveToFirstAttribute() failed, %#x.
\n
"
,
hr
);
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"GetNodeType() failed, %#x.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"Unexpected node type %d.
\n
"
,
type
);
expected
=
a2w
(
prefix_tests
[
i
].
prefix2
);
hr
=
IXmlReader_GetPrefix
(
reader
,
&
prefix
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPrefix() failed, %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
prefix
,
expected
),
"Unexpected prefix %s, expected %s.
\n
"
,
wine_dbgstr_w
(
prefix
),
wine_dbgstr_w
(
expected
));
free_str
(
expected
);
hr
=
IXmlReader_MoveToNextAttribute
(
reader
);
ok
(
hr
==
S_OK
,
"MoveToNextAttribute() failed, %#x.
\n
"
,
hr
);
hr
=
IXmlReader_GetNodeType
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"GetNodeType() failed, %#x.
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Attribute
,
"Unexpected node type %d.
\n
"
,
type
);
expected
=
a2w
(
prefix_tests
[
i
].
prefix3
);
hr
=
IXmlReader_GetPrefix
(
reader
,
&
prefix
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPrefix() failed, %#x.
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
prefix
,
expected
),
"Unexpected prefix %s, expected %s.
\n
"
,
wine_dbgstr_w
(
prefix
),
wine_dbgstr_w
(
expected
));
free_str
(
expected
);
IStream_Release
(
stream
);
}
IXmlReader_Release
(
reader
);
}
static
void
test_namespaceuri
(
void
)
{
struct
uri_test
{
const
char
*
xml
;
const
char
*
uri
[
5
];
}
uri_tests
[]
=
{
{
"<a xmlns=
\"
defns a
\"
><b xmlns=
\"
defns b
\"
><c xmlns=
\"
defns c
\"
/></b></a>"
,
{
"defns a"
,
"defns b"
,
"defns c"
,
"defns b"
,
"defns a"
}},
{
"<r:a xmlns=
\"
defns a
\"
xmlns:r=
\"
ns r
\"
/>"
,
{
"ns r"
}},
{
"<r:a xmlns=
\"
defns a
\"
xmlns:r=
\"
ns r
\"
><b/></r:a>"
,
{
"ns r"
,
"defns a"
,
"ns r"
}},
{
"<a xmlns=
\"
defns a
\"
xmlns:r=
\"
ns r
\"
><r:b/></a>"
,
{
"defns a"
,
"ns r"
,
"defns a"
}},
{
"<a><b><c/></b></a>"
,
{
""
,
""
,
""
,
""
,
""
}},
};
IXmlReader
*
reader
;
XmlNodeType
type
;
unsigned
int
i
;
HRESULT
hr
;
hr
=
CreateXmlReader
(
&
IID_IXmlReader
,
(
void
**
)
&
reader
,
NULL
);
ok
(
hr
==
S_OK
,
"S_OK, got %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
uri_tests
)
/
sizeof
(
uri_tests
[
0
]);
i
++
)
{
IStream
*
stream
=
create_stream_on_data
(
uri_tests
[
i
].
xml
,
strlen
(
uri_tests
[
i
].
xml
)
+
1
);
unsigned
int
j
=
0
;
hr
=
IXmlReader_SetInput
(
reader
,
(
IUnknown
*
)
stream
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
while
(
IXmlReader_Read
(
reader
,
&
type
)
==
S_OK
)
{
const
WCHAR
*
uri
,
*
local
;
WCHAR
*
uriW
;
ok
(
type
==
XmlNodeType_Element
||
type
==
XmlNodeType_EndElement
,
"Unexpected node type %d.
\n
"
,
type
);
hr
=
IXmlReader_GetLocalName
(
reader
,
&
local
,
NULL
);
ok
(
hr
==
S_OK
,
"S_OK, got %08x
\n
"
,
hr
);
hr
=
IXmlReader_GetNamespaceUri
(
reader
,
&
uri
,
NULL
);
ok
(
hr
==
S_OK
,
"S_OK, got %08x
\n
"
,
hr
);
uriW
=
a2w
(
uri_tests
[
i
].
uri
[
j
]);
ok
(
!
lstrcmpW
(
uriW
,
uri
),
"%s: uri %s
\n
"
,
wine_dbgstr_w
(
local
),
wine_dbgstr_w
(
uri
));
free_str
(
uriW
);
j
++
;
}
IStream_Release
(
stream
);
}
IXmlReader_Release
(
reader
);
}
START_TEST
(
reader
)
{
test_reader_create
();
...
...
@@ -1925,4 +2058,6 @@ START_TEST(reader)
test_readvaluechunk
();
test_read_xmldeclaration
();
test_reader_properties
();
test_prefix
();
test_namespaceuri
();
}
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