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
57a373af
Commit
57a373af
authored
Apr 30, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
May 01, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added comment and childNodes test.
parent
67333a2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
4 deletions
+98
-4
dom.c
dlls/mshtml/tests/dom.c
+98
-4
No files found.
dlls/mshtml/tests/dom.c
View file @
57a373af
...
...
@@ -40,7 +40,8 @@ static const char range_test2_str[] =
"<html><body>abc<hr />123<br /><hr />def</body></html>"
;
static
const
char
elem_test_str
[]
=
"<html><head><title>test</title><style>.body { margin-right: 0px; }</style>"
"<body>text test<a href=
\"
http://test
\"
name=
\"
x
\"
>link</a>"
"<body>text test<!-- a comment -->"
"<a href=
\"
http://test
\"
name=
\"
x
\"
>link</a>"
"<input id=
\"
in
\"
/>"
"<select id=
\"
s
\"
><option id=
\"
x
\"
>opt1</option><option id=
\"
y
\"
>opt2</option></select>"
"<textarea id=
\"
X
\"
>text text</textarea>"
...
...
@@ -79,7 +80,8 @@ typedef enum {
ET_TABLE
,
ET_TBODY
,
ET_SCRIPT
,
ET_TEST
ET_TEST
,
ET_COMMENT
}
elem_type_t
;
static
REFIID
const
none_iids
[]
=
{
...
...
@@ -208,6 +210,17 @@ static REFIID const window_iids[] = {
NULL
};
static
REFIID
const
comment_iids
[]
=
{
&
IID_IHTMLDOMNode
,
&
IID_IHTMLDOMNode2
,
&
IID_IHTMLElement
,
&
IID_IHTMLElement2
,
&
IID_IHTMLCommentElement
,
&
IID_IDispatchEx
,
&
IID_IConnectionPointContainer
,
NULL
};
typedef
struct
{
const
char
*
tag
;
REFIID
*
iids
;
...
...
@@ -232,7 +245,8 @@ static const elem_type_info_t elem_type_infos[] = {
{
"TABLE"
,
table_iids
,
NULL
},
{
"TBODY"
,
elem_iids
,
NULL
},
{
"SCRIPT"
,
script_iids
,
NULL
},
{
"TEST"
,
elem_iids
,
&
DIID_DispHTMLUnknownElement
}
{
"TEST"
,
elem_iids
,
&
DIID_DispHTMLUnknownElement
},
{
"!"
,
comment_iids
,
NULL
}
};
static
const
char
*
dbgstr_w
(
LPCWSTR
str
)
...
...
@@ -795,6 +809,49 @@ static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VA
ok_
(
__FILE__
,
line
)
(
disabled
==
exb
,
"disabled=%x, expected %x
\n
"
,
disabled
,
exb
);
}
#define get_child_nodes(u) _get_child_nodes(__LINE__,u)
static
IHTMLDOMChildrenCollection
*
_get_child_nodes
(
unsigned
line
,
IUnknown
*
unk
)
{
IHTMLDOMChildrenCollection
*
col
=
NULL
;
IHTMLDOMNode
*
node
;
IDispatch
*
disp
;
HRESULT
hres
;
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IHTMLDOMNode
,
(
void
**
)
&
node
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"Could not get IHTMLDOMNode: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
NULL
;
hres
=
IHTMLDOMNode_get_childNodes
(
node
,
&
disp
);
IHTMLDOMNode_Release
(
node
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"get_childNodes failed: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
NULL
;
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IHTMLDOMChildrenCollection
,
(
void
**
)
&
col
);
IDispatch_Release
(
disp
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"Could not get IHTMLDOMChildrenCollection: %08x
\n
"
,
hres
);
return
col
;
}
#define get_child_item(c,i) _get_child_item(__LINE__,c,i)
static
IHTMLDOMNode
*
_get_child_item
(
unsigned
line
,
IHTMLDOMChildrenCollection
*
col
,
long
idx
)
{
IHTMLDOMNode
*
node
=
NULL
;
IDispatch
*
disp
;
HRESULT
hres
;
hres
=
IHTMLDOMChildrenCollection_item
(
col
,
idx
,
&
disp
);
ok
(
hres
==
S_OK
,
"item failed: %08x
\n
"
,
hres
);
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IHTMLDOMNode
,
(
void
**
)
&
node
);
IDispatch_Release
(
disp
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"Could not get IHTMLDOMNode: %08x
\n
"
,
hres
);
return
node
;
}
static
void
test_elem_col_item
(
IHTMLElementCollection
*
col
,
LPCWSTR
n
,
const
elem_type_t
*
elem_types
,
long
len
)
{
...
...
@@ -1435,6 +1492,7 @@ static void test_stylesheets(IHTMLDocument2 *doc)
static
void
test_elems
(
IHTMLDocument2
*
doc
)
{
IHTMLElementCollection
*
col
;
IHTMLDOMChildrenCollection
*
child_col
;
IHTMLElement
*
elem
;
IHTMLDOMNode
*
node
,
*
node2
;
IDispatch
*
disp
;
...
...
@@ -1453,6 +1511,7 @@ static void test_elems(IHTMLDocument2 *doc)
ET_TITLE
,
ET_STYLE
,
ET_BODY
,
ET_COMMENT
,
ET_A
,
ET_INPUT
,
ET_SELECT
,
...
...
@@ -1462,7 +1521,7 @@ static void test_elems(IHTMLDocument2 *doc)
ET_TABLE
,
ET_TBODY
,
ET_SCRIPT
,
ET_TEST
ET_TEST
,
};
static
const
elem_type_t
item_types
[]
=
{
...
...
@@ -1572,6 +1631,41 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLDOMNode_Release
(
node
);
}
child_col
=
get_child_nodes
((
IUnknown
*
)
elem
);
ok
(
child_col
!=
NULL
,
"child_coll == NULL
\n
"
);
if
(
child_col
)
{
long
length
=
0
;
test_disp
((
IUnknown
*
)
child_col
,
&
DIID_DispDOMChildrenCollection
);
hres
=
IHTMLDOMChildrenCollection_get_length
(
child_col
,
&
length
);
ok
(
hres
==
S_OK
,
"get_length failed: %08x
\n
"
,
hres
);
ok
(
length
,
"length=0
\n
"
);
node
=
get_child_item
(
child_col
,
0
);
ok
(
node
!=
NULL
,
"node == NULL
\n
"
);
if
(
node
)
{
type
=
get_node_type
((
IUnknown
*
)
node
);
ok
(
type
==
3
,
"type=%ld
\n
"
,
type
);
IHTMLDOMNode_Release
(
node
);
}
node
=
get_child_item
(
child_col
,
1
);
ok
(
node
!=
NULL
,
"node == NULL
\n
"
);
if
(
node
)
{
type
=
get_node_type
((
IUnknown
*
)
node
);
ok
(
type
==
8
,
"type=%ld
\n
"
,
type
);
IHTMLDOMNode_Release
(
node
);
}
disp
=
(
void
*
)
0xdeadbeef
;
hres
=
IHTMLDOMChildrenCollection_item
(
child_col
,
6000
,
&
disp
);
ok
(
hres
==
E_INVALIDARG
,
"item failed: %08x, expected E_INVALIDARG
\n
"
,
hres
);
ok
(
disp
==
(
void
*
)
0xdeadbeef
,
"disp=%p
\n
"
,
disp
);
IHTMLDOMChildrenCollection_Release
(
child_col
);
}
IHTMLElement_Release
(
elem
);
test_stylesheets
(
doc
);
...
...
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