2 * Copyright 2007-2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
34 #include "mshtml_test.h"
36 static const char doc_blank
[] = "<html></html>";
37 static const char doc_str1
[] = "<html><body>test</body></html>";
38 static const char range_test_str
[] =
39 "<html><body>test \na<font size=\"2\">bc\t123<br /> it's\r\n \t</font>text<br /></body></html>";
40 static const char range_test2_str
[] =
41 "<html><body>abc<hr />123<br /><hr />def</body></html>";
42 static const char elem_test_str
[] =
43 "<html><head><title>test</title><style>.body { margin-right: 0px; }</style>"
44 "<body onload=\"Testing()\">text test<!-- a comment -->"
45 "<a id=\"a\" href=\"http://test\" name=\"x\">link</a>"
46 "<input id=\"in\" class=\"testclass\" tabIndex=\"2\" title=\"test title\" />"
47 "<select id=\"s\"><option id=\"x\" value=\"val1\">opt1</option><option id=\"y\">opt2</option></select>"
48 "<textarea id=\"X\">text text</textarea>"
49 "<table id=\"tbl\"><tbody><tr></tr><tr id=\"row2\"><td>td1 text</td><td>td2 text</td></tr></tbody></table>"
50 "<script id=\"sc\" type=\"text/javascript\"><!--\nfunction Testing() {}\n// -->\n</script>"
53 "<iframe src=\"about:blank\" id=\"ifr\"></iframe>"
54 "<form id=\"frm\"></form>"
56 static const char elem_test2_str
[] =
57 "<html><head><title>test</title><style>.body { margin-right: 0px; }</style>"
58 "<body><div id=\"divid\"></div></body>"
61 static const char indent_test_str
[] =
62 "<html><head><title>test</title></head><body>abc<br /><a href=\"about:blank\">123</a></body></html>";
63 static const char cond_comment_str
[] =
64 "<html><head><title>test</title></head><body>"
65 "<!--[if gte IE 4]> <br> <![endif]-->"
67 static const char frameset_str
[] =
68 "<html><head><title>frameset test</title></head><frameset rows=\"25, 25, *\">"
69 "<frame src=\"about:blank\" name=\"nm1\" id=\"fr1\"><frame src=\"about:blank\" name=\"nm2\" id=\"fr2\">"
70 "<frame src=\"about:blank\" id=\"fr3\">"
73 static WCHAR characterW
[] = {'c','h','a','r','a','c','t','e','r',0};
74 static WCHAR texteditW
[] = {'t','e','x','t','e','d','i','t',0};
75 static WCHAR wordW
[] = {'w','o','r','d',0};
105 static const IID
* const none_iids
[] = {
110 static const IID
* const doc_node_iids
[] = {
119 &IID_IConnectionPointContainer
,
120 &IID_IInternetHostSecurityManager
,
124 static const IID
* const doc_obj_iids
[] = {
131 &IID_IConnectionPointContainer
,
136 static const IID
* const elem_iids
[] = {
143 &IID_IConnectionPointContainer
,
147 static const IID
* const body_iids
[] = {
153 &IID_IHTMLTextContainer
,
154 &IID_IHTMLBodyElement
,
156 &IID_IConnectionPointContainer
,
160 static const IID
* const anchor_iids
[] = {
166 &IID_IHTMLAnchorElement
,
168 &IID_IConnectionPointContainer
,
172 static const IID
* const input_iids
[] = {
178 &IID_IHTMLInputElement
,
179 &IID_IHTMLInputTextElement
,
181 &IID_IConnectionPointContainer
,
185 static const IID
* const select_iids
[] = {
191 &IID_IHTMLSelectElement
,
193 &IID_IConnectionPointContainer
,
197 static const IID
* const textarea_iids
[] = {
203 &IID_IHTMLTextAreaElement
,
205 &IID_IConnectionPointContainer
,
209 static const IID
* const option_iids
[] = {
215 &IID_IHTMLOptionElement
,
217 &IID_IConnectionPointContainer
,
221 static const IID
* const table_iids
[] = {
229 &IID_IConnectionPointContainer
,
233 static const IID
* const script_iids
[] = {
239 &IID_IHTMLScriptElement
,
241 &IID_IConnectionPointContainer
,
245 static const IID
* const text_iids
[] = {
248 &IID_IHTMLDOMTextNode
,
252 static const IID
* const location_iids
[] = {
258 static const IID
* const window_iids
[] = {
266 static const IID
* const comment_iids
[] = {
272 &IID_IHTMLCommentElement
,
274 &IID_IConnectionPointContainer
,
278 static const IID
* const img_iids
[] = {
285 &IID_IHTMLImgElement
,
286 &IID_IConnectionPointContainer
,
290 static const IID
* const tr_iids
[] = {
298 &IID_IConnectionPointContainer
,
302 static const IID
* const td_iids
[] = {
309 &IID_IConnectionPointContainer
,
313 static const IID
* const iframe_iids
[] = {
320 &IID_IHTMLFrameBase2
,
322 &IID_IConnectionPointContainer
,
326 static const IID
* const form_iids
[] = {
332 &IID_IHTMLFormElement
,
334 &IID_IConnectionPointContainer
,
338 static const IID
* const generic_iids
[] = {
344 &IID_IHTMLGenericElement
,
346 &IID_IConnectionPointContainer
,
350 static const IID
* const style_iids
[] = {
361 static const IID
* const cstyle_iids
[] = {
365 &IID_IHTMLCurrentStyle
,
369 static const IID
* const img_factory_iids
[] = {
373 &IID_IHTMLImageElementFactory
,
383 static const elem_type_info_t elem_type_infos
[] = {
384 {"", none_iids
, NULL
},
385 {"HTML", elem_iids
, NULL
},
386 {"HEAD", elem_iids
, NULL
},
387 {"TITLE", elem_iids
, NULL
},
388 {"BODY", body_iids
, &DIID_DispHTMLBody
},
389 {"A", anchor_iids
, &DIID_DispHTMLAnchorElement
},
390 {"INPUT", input_iids
, &DIID_DispHTMLInputElement
},
391 {"SELECT", select_iids
, &DIID_DispHTMLSelectElement
},
392 {"TEXTAREA", textarea_iids
, NULL
},
393 {"OPTION", option_iids
, &DIID_DispHTMLOptionElement
},
394 {"STYLE", elem_iids
, NULL
},
395 {"BLOCKQUOTE",elem_iids
, NULL
},
396 {"P", elem_iids
, NULL
},
397 {"BR", elem_iids
, NULL
},
398 {"TABLE", table_iids
, &DIID_DispHTMLTable
},
399 {"TBODY", elem_iids
, NULL
},
400 {"SCRIPT", script_iids
, NULL
},
401 {"TEST", elem_iids
, &DIID_DispHTMLUnknownElement
},
402 {"TEST", generic_iids
, &DIID_DispHTMLGenericElement
},
403 {"!", comment_iids
, &DIID_DispHTMLCommentElement
},
404 {"IMG", img_iids
, &DIID_DispHTMLImg
},
405 {"TR", tr_iids
, &DIID_DispHTMLTableRow
},
406 {"TD", td_iids
, NULL
},
407 {"IFRAME", iframe_iids
, &DIID_DispHTMLIFrame
},
408 {"FORM", form_iids
, &DIID_DispHTMLFormElement
}
411 static const char *dbgstr_guid(REFIID riid
)
415 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
416 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
417 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
418 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
423 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
426 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
427 return lstrcmpA(stra
, buf
);
430 static BSTR
a2bstr(const char *str
)
435 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
436 ret
= SysAllocStringLen(NULL
, len
);
437 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
442 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
444 IUnknown
*unk1
, *unk2
;
449 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
450 IUnknown_Release(unk1
);
451 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
452 IUnknown_Release(unk2
);
457 static IHTMLDocument2
*create_document(void)
460 IHTMLDocument5
*doc5
;
463 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
464 &IID_IHTMLDocument2
, (void**)&doc
);
465 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
469 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
471 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
472 IHTMLDocument2_Release(doc
);
476 IHTMLDocument5_Release(doc5
);
480 #define test_ifaces(i,ids) _test_ifaces(__LINE__,i,ids)
481 static void _test_ifaces(unsigned line
, IUnknown
*iface
, REFIID
*iids
)
483 const IID
* const *piid
;
487 for(piid
= iids
; *piid
; piid
++) {
488 hres
= IDispatch_QueryInterface(iface
, *piid
, (void**)&unk
);
489 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get %s interface: %08x\n", dbgstr_guid(*piid
), hres
);
491 IUnknown_Release(unk
);
495 #define test_get_dispid(u,id) _test_disp(__LINE__,u,id)
496 static BOOL
_test_get_dispid(unsigned line
, IUnknown
*unk
, IID
*iid
)
504 hres
= IUnknown_QueryInterface(unk
, &IID_IDispatchEx
, (void**)&dispex
);
505 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IDispatchEx: %08x\n", hres
);
510 hres
= IDispatchEx_GetTypeInfoCount(dispex
, &ticnt
);
511 ok_(__FILE__
,line
) (hres
== S_OK
, "GetTypeInfoCount failed: %08x\n", hres
);
512 ok_(__FILE__
,line
) (ticnt
== 1, "ticnt=%u\n", ticnt
);
514 hres
= IDispatchEx_GetTypeInfo(dispex
, 0, 0, &typeinfo
);
515 ok_(__FILE__
,line
) (hres
== S_OK
, "GetTypeInfo failed: %08x\n", hres
);
517 if(SUCCEEDED(hres
)) {
520 hres
= ITypeInfo_GetTypeAttr(typeinfo
, &type_attr
);
521 ok_(__FILE__
,line
) (hres
== S_OK
, "GetTypeAttr failed: %08x\n", hres
);
523 *iid
= type_attr
->guid
;
527 ITypeInfo_ReleaseTypeAttr(typeinfo
, type_attr
);
528 ITypeInfo_Release(typeinfo
);
531 IDispatchEx_Release(dispex
);
535 #define test_disp_value(u) _test_disp_value(__LINE__,u,v)
536 static void _test_disp_value(unsigned line
, IUnknown
*unk
, const char *val
)
538 DISPPARAMS dp
= {NULL
,NULL
,0,0};
544 hres
= IUnknown_QueryInterface(unk
, &IID_IDispatchEx
, (void**)&dispex
);
545 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IDispatchEx interface: %08x\n", hres
);
549 hres
= IDispatchEx_InvokeEx(dispex
, DISPID_VALUE
, 0, DISPATCH_PROPERTYGET
, &dp
, &var
, &ei
, NULL
);
550 IDispatchEx_Release(dispex
);
551 ok_(__FILE__
,line
)(hres
== S_OK
, "InvokeEx(DISPID_VALUE) returned: %08x\n", hres
);
553 ok_(__FILE__
,line
)(V_VT(&var
) == VT_BSTR
, "V_VT(value) = %d\n", V_VT(&var
));
554 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(&var
), val
), "value = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&var
)), val
);
558 #define test_disp(u,id,v) _test_disp(__LINE__,u,id,v)
559 static void _test_disp(unsigned line
, IUnknown
*unk
, const IID
*diid
, const char *val
)
563 if(_test_get_dispid(line
, unk
, &iid
))
564 ok_(__FILE__
,line
) (IsEqualGUID(&iid
, diid
), "unexpected guid %s\n", dbgstr_guid(&iid
));
567 _test_disp_value(line
, unk
, val
);
570 #define test_disp2(u,id,id2,v) _test_disp2(__LINE__,u,id,id2,v)
571 static void _test_disp2(unsigned line
, IUnknown
*unk
, const IID
*diid
, const IID
*diid2
, const char *val
)
575 if(_test_get_dispid(line
, unk
, &iid
))
576 ok_(__FILE__
,line
) (IsEqualGUID(&iid
, diid
) || broken(IsEqualGUID(&iid
, diid2
)),
577 "unexpected guid %s\n", dbgstr_guid(&iid
));
580 _test_disp_value(line
, unk
, val
);
583 #define get_elem_iface(u) _get_elem_iface(__LINE__,u)
584 static IHTMLElement
*_get_elem_iface(unsigned line
, IUnknown
*unk
)
589 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement
, (void**)&elem
);
590 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement: %08x\n", hres
);
594 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
595 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
600 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
601 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
605 #define get_elem3_iface(u) _get_elem3_iface(__LINE__,u)
606 static IHTMLElement3
*_get_elem3_iface(unsigned line
, IUnknown
*unk
)
611 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement3
, (void**)&elem
);
612 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement3: %08x\n", hres
);
616 #define get_node_iface(u) _get_node_iface(__LINE__,u)
617 static IHTMLDOMNode
*_get_node_iface(unsigned line
, IUnknown
*unk
)
622 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMNode
, (void**)&node
);
623 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMNode: %08x\n", hres
);
627 #define get_node2_iface(u) _get_node2_iface(__LINE__,u)
628 static IHTMLDOMNode2
*_get_node2_iface(unsigned line
, IUnknown
*unk
)
633 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMNode2
, (void**)&node
);
634 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMNode2: %08x\n", hres
);
638 #define get_img_iface(u) _get_img_iface(__LINE__,u)
639 static IHTMLImgElement
*_get_img_iface(unsigned line
, IUnknown
*unk
)
641 IHTMLImgElement
*img
;
644 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLImgElement
, (void**)&img
);
645 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLImgElement: %08x\n", hres
);
649 #define get_anchor_iface(u) _get_anchor_iface(__LINE__,u)
650 static IHTMLAnchorElement
*_get_anchor_iface(unsigned line
, IUnknown
*unk
)
652 IHTMLAnchorElement
*anchor
;
655 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLAnchorElement
, (void**)&anchor
);
656 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLAnchorElement: %08x\n", hres
);
660 #define get_text_iface(u) _get_text_iface(__LINE__,u)
661 static IHTMLDOMTextNode
*_get_text_iface(unsigned line
, IUnknown
*unk
)
663 IHTMLDOMTextNode
*text
;
666 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMTextNode
, (void**)&text
);
667 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMTextNode: %08x\n", hres
);
671 #define test_node_name(u,n) _test_node_name(__LINE__,u,n)
672 static void _test_node_name(unsigned line
, IUnknown
*unk
, const char *exname
)
674 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
678 hres
= IHTMLDOMNode_get_nodeName(node
, &name
);
679 IHTMLDOMNode_Release(node
);
680 ok_(__FILE__
, line
) (hres
== S_OK
, "get_nodeName failed: %08x\n", hres
);
681 ok_(__FILE__
, line
) (!strcmp_wa(name
, exname
), "got name: %s, expected %s\n", wine_dbgstr_w(name
), exname
);
686 #define get_owner_doc(u) _get_owner_doc(__LINE__,u)
687 static IHTMLDocument2
*_get_owner_doc(unsigned line
, IUnknown
*unk
)
689 IHTMLDOMNode2
*node
= _get_node2_iface(line
, unk
);
690 IDispatch
*disp
= (void*)0xdeadbeef;
691 IHTMLDocument2
*doc
= NULL
;
694 hres
= IHTMLDOMNode2_get_ownerDocument(node
, &disp
);
695 IHTMLDOMNode2_Release(node
);
696 ok_(__FILE__
,line
)(hres
== S_OK
, "get_ownerDocument failed: %08x\n", hres
);
699 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDocument2
, (void**)&doc
);
700 IDispatch_Release(disp
);
701 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IHTMLDocument2 iface: %08x\n", hres
);
707 #define get_doc_window(d) _get_doc_window(__LINE__,d)
708 static IHTMLWindow2
*_get_doc_window(unsigned line
, IHTMLDocument2
*doc
)
710 IHTMLWindow2
*window
;
714 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
715 ok_(__FILE__
,line
)(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
716 ok_(__FILE__
,line
)(window
!= NULL
, "window == NULL\n");
721 #define clone_node(n,d) _clone_node(__LINE__,n,d)
722 static IHTMLDOMNode
*_clone_node(unsigned line
, IUnknown
*unk
, VARIANT_BOOL deep
)
724 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
725 IHTMLDOMNode
*ret
= NULL
;
728 hres
= IHTMLDOMNode_cloneNode(node
, deep
, &ret
);
729 IHTMLDOMNode_Release(node
);
730 ok_(__FILE__
,line
)(hres
== S_OK
, "cloneNode failed: %08x\n", hres
);
731 ok_(__FILE__
,line
)(ret
!= NULL
, "ret == NULL\n");
737 #define test_elem_tag(u,n) _test_elem_tag(__LINE__,u,n)
738 static void _test_elem_tag(unsigned line
, IUnknown
*unk
, const char *extag
)
740 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
744 hres
= IHTMLElement_get_tagName(elem
, &tag
);
745 IHTMLElement_Release(elem
);
746 ok_(__FILE__
, line
) (hres
== S_OK
, "get_tagName failed: %08x\n", hres
);
747 ok_(__FILE__
, line
) (!strcmp_wa(tag
, extag
), "got tag: %s, expected %s\n", wine_dbgstr_w(tag
), extag
);
752 #define test_elem_type(ifc,t) _test_elem_type(__LINE__,ifc,t)
753 static void _test_elem_type(unsigned line
, IUnknown
*unk
, elem_type_t type
)
755 _test_elem_tag(line
, unk
, elem_type_infos
[type
].tag
);
756 _test_ifaces(line
, unk
, elem_type_infos
[type
].iids
);
758 if(elem_type_infos
[type
].dispiid
&& type
!= ET_A
)
759 _test_disp(line
, unk
, elem_type_infos
[type
].dispiid
, "[object]");
762 #define get_node_type(n) _get_node_type(__LINE__,n)
763 static LONG
_get_node_type(unsigned line
, IUnknown
*unk
)
765 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
769 hres
= IHTMLDOMNode_get_nodeType(node
, &type
);
770 ok(hres
== S_OK
, "get_nodeType failed: %08x\n", hres
);
772 IHTMLDOMNode_Release(node
);
777 #define get_child_nodes(u) _get_child_nodes(__LINE__,u)
778 static IHTMLDOMChildrenCollection
*_get_child_nodes(unsigned line
, IUnknown
*unk
)
780 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
781 IHTMLDOMChildrenCollection
*col
= NULL
;
785 hres
= IHTMLDOMNode_get_childNodes(node
, &disp
);
786 IHTMLDOMNode_Release(node
);
787 ok_(__FILE__
,line
) (hres
== S_OK
, "get_childNodes failed: %08x\n", hres
);
791 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDOMChildrenCollection
, (void**)&col
);
792 IDispatch_Release(disp
);
793 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMChildrenCollection: %08x\n", hres
);
798 #define get_child_item(c,i) _get_child_item(__LINE__,c,i)
799 static IHTMLDOMNode
*_get_child_item(unsigned line
, IHTMLDOMChildrenCollection
*col
, LONG idx
)
801 IHTMLDOMNode
*node
= NULL
;
805 hres
= IHTMLDOMChildrenCollection_item(col
, idx
, &disp
);
806 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
808 node
= _get_node_iface(line
, (IUnknown
*)disp
);
809 IDispatch_Release(disp
);
814 #define test_elem_attr(e,n,v) _test_elem_attr(__LINE__,e,n,v)
815 static void _test_elem_attr(unsigned line
, IHTMLElement
*elem
, const char *name
, const char *exval
)
824 hres
= IHTMLElement_getAttribute(elem
, tmp
, 0, &value
);
826 ok_(__FILE__
,line
) (hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
829 ok_(__FILE__
,line
) (V_VT(&value
) == VT_BSTR
, "vt=%d\n", V_VT(&value
));
830 ok_(__FILE__
,line
) (!strcmp_wa(V_BSTR(&value
), exval
), "unexpected value %s\n", wine_dbgstr_w(V_BSTR(&value
)));
832 ok_(__FILE__
,line
) (V_VT(&value
) == VT_NULL
, "vt=%d\n", V_VT(&value
));
835 VariantClear(&value
);
838 #define test_elem_offset(u) _test_elem_offset(__LINE__,u)
839 static void _test_elem_offset(unsigned line
, IUnknown
*unk
)
841 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
845 hres
= IHTMLElement_get_offsetTop(elem
, &l
);
846 ok_(__FILE__
,line
) (hres
== S_OK
, "get_offsetTop failed: %08x\n", hres
);
848 hres
= IHTMLElement_get_offsetHeight(elem
, &l
);
849 ok_(__FILE__
,line
) (hres
== S_OK
, "get_offsetHeight failed: %08x\n", hres
);
851 hres
= IHTMLElement_get_offsetWidth(elem
, &l
);
852 ok_(__FILE__
,line
) (hres
== S_OK
, "get_offsetWidth failed: %08x\n", hres
);
854 IHTMLElement_Release(elem
);
857 #define get_doc_node(d) _get_doc_node(__LINE__,d)
858 static IHTMLDocument2
*_get_doc_node(unsigned line
, IHTMLDocument2
*doc
)
860 IHTMLWindow2
*window
;
864 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
865 ok_(__FILE__
,line
)(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
867 hres
= IHTMLWindow2_get_document(window
, &ret
);
868 ok_(__FILE__
,line
)(hres
== S_OK
, "get_document failed: %08x\n", hres
);
869 ok_(__FILE__
,line
)(ret
!= NULL
, "document = NULL\n");
874 #define test_window_name(d,e) _test_window_name(__LINE__,d,e)
875 static void _test_window_name(unsigned line
, IHTMLWindow2
*window
, const char *exname
)
880 hres
= IHTMLWindow2_get_name(window
, &name
);
881 ok_(__FILE__
,line
)(hres
== S_OK
, "get_name failed: %08x\n", hres
);
883 ok_(__FILE__
,line
)(!strcmp_wa(name
, exname
), "name = %s\n", wine_dbgstr_w(name
));
885 ok_(__FILE__
,line
)(!name
, "name = %s\n", wine_dbgstr_w(name
));
888 #define set_window_name(w,n) _set_window_name(__LINE__,w,n)
889 static void _set_window_name(unsigned line
, IHTMLWindow2
*window
, const char *name
)
895 hres
= IHTMLWindow2_put_name(window
, str
);
897 ok_(__FILE__
,line
)(hres
== S_OK
, "put_name failed: %08x\n", hres
);
899 _test_window_name(line
, window
, name
);
902 #define test_window_length(w,l) _test_window_length(__LINE__,w,l)
903 static void _test_window_length(unsigned line
, IHTMLWindow2
*window
, LONG exlen
)
908 hres
= IHTMLWindow2_get_length(window
, &length
);
909 ok_(__FILE__
,line
)(hres
== S_OK
, "get_length failed: %08x\n", hres
);
910 ok_(__FILE__
,line
)(length
== exlen
, "length = %d, expected %d\n", length
, exlen
);
913 #define get_frame_content_window(e) _get_frame_content_window(__LINE__,e)
914 static IHTMLWindow2
*_get_frame_content_window(unsigned line
, IUnknown
*elem
)
916 IHTMLFrameBase2
*base2
;
917 IHTMLWindow2
*window
;
920 hres
= IUnknown_QueryInterface(elem
, &IID_IHTMLFrameBase2
, (void**)&base2
);
921 ok(hres
== S_OK
, "Could not get IHTMFrameBase2 iface: %08x\n", hres
);
924 hres
= IHTMLFrameBase2_get_contentWindow(base2
, &window
);
925 IHTMLFrameBase2_Release(base2
);
926 ok(hres
== S_OK
, "get_contentWindow failed: %08x\n", hres
);
927 ok(window
!= NULL
, "contentWindow = NULL\n");
932 static void test_get_set_attr(IHTMLDocument2
*doc
)
935 IHTMLDocument3
*doc3
;
940 /* grab an element to test with */
941 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
942 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
944 hres
= IHTMLDocument3_get_documentElement(doc3
, &elem
);
945 IHTMLDocument3_Release(doc3
);
946 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
948 /* get a non-present attribute */
949 bstr
= a2bstr("notAnAttribute");
950 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
951 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
952 ok(V_VT(&val
) == VT_NULL
, "variant type should have been VT_NULL (0x%x), was: 0x%x\n", VT_NULL
, V_VT(&val
));
956 /* get a present attribute */
957 bstr
= a2bstr("scrollHeight");
958 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
959 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
960 ok(V_VT(&val
) == VT_I4
, "variant type should have been VT_I4 (0x%x), was: 0x%x\n", VT_I4
, V_VT(&val
));
964 /* create a new BSTR attribute */
965 bstr
= a2bstr("newAttribute");
967 V_VT(&val
) = VT_BSTR
;
968 V_BSTR(&val
) = a2bstr("the value");
969 hres
= IHTMLElement_setAttribute(elem
, bstr
, val
, 0);
970 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
973 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
974 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
975 ok(V_VT(&val
) == VT_BSTR
, "variant type should have been VT_BSTR (0x%x), was: 0x%x\n", VT_BSTR
, V_VT(&val
));
976 ok(strcmp_wa(V_BSTR(&val
), "the value") == 0, "variant value should have been L\"the value\", was %s\n", wine_dbgstr_w(V_BSTR(&val
)));
979 /* overwrite the attribute with a BOOL */
980 V_VT(&val
) = VT_BOOL
;
981 V_BOOL(&val
) = VARIANT_TRUE
;
982 hres
= IHTMLElement_setAttribute(elem
, bstr
, val
, 0);
983 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
986 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
987 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
988 ok(V_VT(&val
) == VT_BOOL
, "variant type should have been VT_BOOL (0x%x), was: 0x%x\n", VT_BOOL
, V_VT(&val
));
989 ok(V_BOOL(&val
) == VARIANT_TRUE
, "variant value should have been VARIANT_TRUE (0x%x), was %d\n", VARIANT_TRUE
, V_BOOL(&val
));
994 /* case-insensitive */
995 bstr
= a2bstr("newattribute");
996 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
997 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
998 ok(V_VT(&val
) == VT_BOOL
, "variant type should have been VT_BOOL (0x%x), was: 0x%x\n", VT_BOOL
, V_VT(&val
));
999 ok(V_BOOL(&val
) == VARIANT_TRUE
, "variant value should have been VARIANT_TRUE (0x%x), was %d\n", VARIANT_TRUE
, V_BOOL(&val
));
1001 SysFreeString(bstr
);
1003 IHTMLElement_Release(elem
);
1006 #define get_doc_elem(d) _get_doc_elem(__LINE__,d)
1007 static IHTMLElement
*_get_doc_elem(unsigned line
, IHTMLDocument2
*doc
)
1010 IHTMLDocument3
*doc3
;
1013 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
1014 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDocument3 interface: %08x\n", hres
);
1015 hres
= IHTMLDocument3_get_documentElement(doc3
, &elem
);
1016 ok_(__FILE__
,line
) (hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
1017 IHTMLDocument3_Release(doc3
);
1022 #define test_anchor_href(a,h) _test_anchor_href(__LINE__,a,h)
1023 static void _test_anchor_href(unsigned line
, IUnknown
*unk
, const char *exhref
)
1025 IHTMLAnchorElement
*anchor
= _get_anchor_iface(line
, unk
);
1029 hres
= IHTMLAnchorElement_get_href(anchor
, &str
);
1030 ok_(__FILE__
,line
)(hres
== S_OK
, "get_href failed: %08x\n", hres
);
1031 ok_(__FILE__
,line
)(!strcmp_wa(str
, exhref
), "href = %s, expected %s\n", wine_dbgstr_w(str
), exhref
);
1034 _test_disp_value(line
, unk
, exhref
);
1037 #define test_option_text(o,t) _test_option_text(__LINE__,o,t)
1038 static void _test_option_text(unsigned line
, IHTMLOptionElement
*option
, const char *text
)
1043 hres
= IHTMLOptionElement_get_text(option
, &bstr
);
1044 ok_(__FILE__
,line
) (hres
== S_OK
, "get_text failed: %08x\n", hres
);
1045 ok_(__FILE__
,line
) (!strcmp_wa(bstr
, text
), "text=%s\n", wine_dbgstr_w(bstr
));
1046 SysFreeString(bstr
);
1049 #define test_option_put_text(o,t) _test_option_put_text(__LINE__,o,t)
1050 static void _test_option_put_text(unsigned line
, IHTMLOptionElement
*option
, const char *text
)
1055 bstr
= a2bstr(text
);
1056 hres
= IHTMLOptionElement_put_text(option
, bstr
);
1057 SysFreeString(bstr
);
1058 ok(hres
== S_OK
, "put_text failed: %08x\n", hres
);
1060 _test_option_text(line
, option
, text
);
1063 #define test_option_value(o,t) _test_option_value(__LINE__,o,t)
1064 static void _test_option_value(unsigned line
, IHTMLOptionElement
*option
, const char *value
)
1069 hres
= IHTMLOptionElement_get_value(option
, &bstr
);
1070 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
1071 ok_(__FILE__
,line
) (!strcmp_wa(bstr
, value
), "value=%s\n", wine_dbgstr_w(bstr
));
1072 SysFreeString(bstr
);
1075 #define test_option_put_value(o,t) _test_option_put_value(__LINE__,o,t)
1076 static void _test_option_put_value(unsigned line
, IHTMLOptionElement
*option
, const char *value
)
1081 bstr
= a2bstr(value
);
1082 hres
= IHTMLOptionElement_put_value(option
, bstr
);
1083 SysFreeString(bstr
);
1084 ok(hres
== S_OK
, "put_value failed: %08x\n", hres
);
1086 _test_option_value(line
, option
, value
);
1089 #define create_option_elem(d,t,v) _create_option_elem(__LINE__,d,t,v)
1090 static IHTMLOptionElement
*_create_option_elem(unsigned line
, IHTMLDocument2
*doc
,
1091 const char *txt
, const char *val
)
1093 IHTMLOptionElementFactory
*factory
;
1094 IHTMLOptionElement
*option
;
1095 IHTMLWindow2
*window
;
1096 VARIANT text
, value
, empty
;
1099 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
1100 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentElement failed: %08x\n", hres
);
1102 hres
= IHTMLWindow2_get_Option(window
, &factory
);
1103 IHTMLWindow2_Release(window
);
1104 ok_(__FILE__
,line
) (hres
== S_OK
, "get_Option failed: %08x\n", hres
);
1106 V_VT(&text
) = VT_BSTR
;
1107 V_BSTR(&text
) = a2bstr(txt
);
1108 V_VT(&value
) = VT_BSTR
;
1109 V_BSTR(&value
) = a2bstr(val
);
1110 V_VT(&empty
) = VT_EMPTY
;
1112 hres
= IHTMLOptionElementFactory_create(factory
, text
, value
, empty
, empty
, &option
);
1113 ok_(__FILE__
,line
) (hres
== S_OK
, "create failed: %08x\n", hres
);
1115 IHTMLOptionElementFactory_Release(factory
);
1116 VariantClear(&text
);
1117 VariantClear(&value
);
1119 _test_option_text(line
, option
, txt
);
1120 _test_option_value(line
, option
, val
);
1125 #define test_img_width(o,w) _test_img_width(__LINE__,o,w)
1126 static void _test_img_width(unsigned line
, IHTMLImgElement
*img
, const long exp
)
1131 hres
= IHTMLImgElement_get_width(img
, &found
);
1132 todo_wine
ok_(__FILE__
,line
) (hres
== S_OK
, "get_width failed: %08x\n", hres
);
1133 todo_wine
ok_(__FILE__
,line
) (found
== exp
, "width=%d\n", found
);
1136 #define test_img_put_width(o,w) _test_img_put_width(__LINE__,o,w)
1137 static void _test_img_put_width(unsigned line
, IHTMLImgElement
*img
, const long width
)
1141 hres
= IHTMLImgElement_put_width(img
, width
);
1142 todo_wine
ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1144 _test_img_width(line
, img
, width
);
1147 #define test_img_height(o,h) _test_img_height(__LINE__,o,h)
1148 static void _test_img_height(unsigned line
, IHTMLImgElement
*img
, const long exp
)
1153 hres
= IHTMLImgElement_get_height(img
, &found
);
1154 todo_wine
ok_(__FILE__
,line
) (hres
== S_OK
, "get_height failed: %08x\n", hres
);
1155 todo_wine
ok_(__FILE__
,line
) (found
== exp
, "height=%d\n", found
);
1158 #define test_img_put_height(o,w) _test_img_put_height(__LINE__,o,w)
1159 static void _test_img_put_height(unsigned line
, IHTMLImgElement
*img
, const long height
)
1163 hres
= IHTMLImgElement_put_height(img
, height
);
1164 todo_wine
ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1166 _test_img_height(line
, img
, height
);
1169 #define create_img_elem(d,t,v) _create_img_elem(__LINE__,d,t,v)
1170 static IHTMLImgElement
*_create_img_elem(unsigned line
, IHTMLDocument2
*doc
,
1171 LONG wdth
, LONG hght
)
1173 IHTMLImageElementFactory
*factory
;
1174 IHTMLImgElement
*img
;
1175 IHTMLWindow2
*window
;
1176 VARIANT width
, height
;
1180 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
1181 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentElement failed: %08x\n", hres
);
1183 hres
= IHTMLWindow2_get_Image(window
, &factory
);
1184 IHTMLWindow2_Release(window
);
1185 ok_(__FILE__
,line
) (hres
== S_OK
, "get_Image failed: %08x\n", hres
);
1187 test_ifaces((IUnknown
*)factory
, img_factory_iids
);
1188 test_disp((IUnknown
*)factory
, &IID_IHTMLImageElementFactory
, "[object]");
1191 snprintf(buf
, 16, "%d", wdth
);
1192 V_VT(&width
) = VT_BSTR
;
1193 V_BSTR(&width
) = a2bstr(buf
);
1195 V_VT(&width
) = VT_EMPTY
;
1200 snprintf(buf
, 16, "%d", hght
);
1201 V_VT(&height
) = VT_BSTR
;
1202 V_BSTR(&height
) = a2bstr(buf
);
1204 V_VT(&height
) = VT_EMPTY
;
1208 hres
= IHTMLImageElementFactory_create(factory
, width
, height
, &img
);
1209 ok_(__FILE__
,line
) (hres
== S_OK
, "create failed: %08x\n", hres
);
1211 IHTMLImageElementFactory_Release(factory
);
1212 VariantClear(&width
);
1213 VariantClear(&height
);
1215 if(SUCCEEDED(hres
)) {
1216 _test_img_width(line
, img
, wdth
);
1217 _test_img_height(line
, img
, hght
);
1224 #define test_select_length(s,l) _test_select_length(__LINE__,s,l)
1225 static void _test_select_length(unsigned line
, IHTMLSelectElement
*select
, LONG length
)
1227 LONG len
= 0xdeadbeef;
1230 hres
= IHTMLSelectElement_get_length(select
, &len
);
1231 ok_(__FILE__
,line
) (hres
== S_OK
, "get_length failed: %08x\n", hres
);
1232 ok_(__FILE__
,line
) (len
== length
, "len=%d, expected %d\n", len
, length
);
1235 #define test_select_selidx(s,i) _test_select_selidx(__LINE__,s,i)
1236 static void _test_select_selidx(unsigned line
, IHTMLSelectElement
*select
, LONG index
)
1238 LONG idx
= 0xdeadbeef;
1241 hres
= IHTMLSelectElement_get_selectedIndex(select
, &idx
);
1242 ok_(__FILE__
,line
) (hres
== S_OK
, "get_selectedIndex failed: %08x\n", hres
);
1243 ok_(__FILE__
,line
) (idx
== index
, "idx=%d, expected %d\n", idx
, index
);
1246 #define test_select_put_selidx(s,i) _test_select_put_selidx(__LINE__,s,i)
1247 static void _test_select_put_selidx(unsigned line
, IHTMLSelectElement
*select
, LONG index
)
1251 hres
= IHTMLSelectElement_put_selectedIndex(select
, index
);
1252 ok_(__FILE__
,line
) (hres
== S_OK
, "get_selectedIndex failed: %08x\n", hres
);
1253 _test_select_selidx(line
, select
, index
);
1256 #define test_select_value(s,v) _test_select_value(__LINE__,s,v)
1257 static void _test_select_value(unsigned line
, IHTMLSelectElement
*select
, const char *exval
)
1262 hres
= IHTMLSelectElement_get_value(select
, &val
);
1263 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
1265 ok_(__FILE__
,line
) (!strcmp_wa(val
, exval
), "unexpected value %s\n", wine_dbgstr_w(val
));
1267 ok_(__FILE__
,line
) (val
== NULL
, "val=%s, expected NULL\n", wine_dbgstr_w(val
));
1270 #define test_select_set_value(s,v) _test_select_set_value(__LINE__,s,v)
1271 static void _test_select_set_value(unsigned line
, IHTMLSelectElement
*select
, const char *val
)
1277 hres
= IHTMLSelectElement_put_value(select
, bstr
);
1278 SysFreeString(bstr
);
1279 ok_(__FILE__
,line
) (hres
== S_OK
, "put_value failed: %08x\n", hres
);
1282 #define test_select_type(s,t) _test_select_type(__LINE__,s,t)
1283 static void _test_select_type(unsigned line
, IHTMLSelectElement
*select
, const char *extype
)
1288 hres
= IHTMLSelectElement_get_type(select
, &type
);
1289 ok_(__FILE__
,line
) (hres
== S_OK
, "get_type failed: %08x\n", hres
);
1290 ok_(__FILE__
,line
) (!strcmp_wa(type
, extype
), "type=%s, expected %s\n", wine_dbgstr_w(type
), extype
);
1293 #define test_range_text(r,t) _test_range_text(__LINE__,r,t)
1294 static void _test_range_text(unsigned line
, IHTMLTxtRange
*range
, const char *extext
)
1299 hres
= IHTMLTxtRange_get_text(range
, &text
);
1300 ok_(__FILE__
, line
) (hres
== S_OK
, "get_text failed: %08x\n", hres
);
1303 ok_(__FILE__
, line
) (text
!= NULL
, "text == NULL\n");
1304 ok_(__FILE__
, line
) (!strcmp_wa(text
, extext
), "text=%s, expected %s\n", wine_dbgstr_w(text
), extext
);
1306 ok_(__FILE__
, line
) (text
== NULL
, "text=%s, expected NULL\n", wine_dbgstr_w(text
));
1309 SysFreeString(text
);
1313 #define test_range_collapse(r,b) _test_range_collapse(__LINE__,r,b)
1314 static void _test_range_collapse(unsigned line
, IHTMLTxtRange
*range
, BOOL b
)
1318 hres
= IHTMLTxtRange_collapse(range
, b
);
1319 ok_(__FILE__
, line
) (hres
== S_OK
, "collapse failed: %08x\n", hres
);
1320 _test_range_text(line
, range
, NULL
);
1323 #define test_range_expand(r,u,b,t) _test_range_expand(__LINE__,r,u,b,t)
1324 static void _test_range_expand(unsigned line
, IHTMLTxtRange
*range
, LPWSTR unit
,
1325 VARIANT_BOOL exb
, const char *extext
)
1327 VARIANT_BOOL b
= 0xe0e0;
1330 hres
= IHTMLTxtRange_expand(range
, unit
, &b
);
1331 ok_(__FILE__
,line
) (hres
== S_OK
, "expand failed: %08x\n", hres
);
1332 ok_(__FILE__
,line
) (b
== exb
, "b=%x, expected %x\n", b
, exb
);
1333 _test_range_text(line
, range
, extext
);
1336 #define test_range_move(r,u,c,e) _test_range_move(__LINE__,r,u,c,e)
1337 static void _test_range_move(unsigned line
, IHTMLTxtRange
*range
, LPWSTR unit
, LONG cnt
, LONG excnt
)
1339 LONG c
= 0xdeadbeef;
1342 hres
= IHTMLTxtRange_move(range
, unit
, cnt
, &c
);
1343 ok_(__FILE__
,line
) (hres
== S_OK
, "move failed: %08x\n", hres
);
1344 ok_(__FILE__
,line
) (c
== excnt
, "count=%d, expected %d\n", c
, excnt
);
1345 _test_range_text(line
, range
, NULL
);
1348 #define test_range_movestart(r,u,c,e) _test_range_movestart(__LINE__,r,u,c,e)
1349 static void _test_range_movestart(unsigned line
, IHTMLTxtRange
*range
,
1350 LPWSTR unit
, LONG cnt
, LONG excnt
)
1352 LONG c
= 0xdeadbeef;
1355 hres
= IHTMLTxtRange_moveStart(range
, unit
, cnt
, &c
);
1356 ok_(__FILE__
,line
) (hres
== S_OK
, "move failed: %08x\n", hres
);
1357 ok_(__FILE__
,line
) (c
== excnt
, "count=%d, expected %d\n", c
, excnt
);
1360 #define test_range_moveend(r,u,c,e) _test_range_moveend(__LINE__,r,u,c,e)
1361 static void _test_range_moveend(unsigned line
, IHTMLTxtRange
*range
, LPWSTR unit
, LONG cnt
, LONG excnt
)
1363 LONG c
= 0xdeadbeef;
1366 hres
= IHTMLTxtRange_moveEnd(range
, unit
, cnt
, &c
);
1367 ok_(__FILE__
,line
) (hres
== S_OK
, "move failed: %08x\n", hres
);
1368 ok_(__FILE__
,line
) (c
== excnt
, "count=%d, expected %d\n", c
, excnt
);
1371 #define test_range_put_text(r,t) _test_range_put_text(__LINE__,r,t)
1372 static void _test_range_put_text(unsigned line
, IHTMLTxtRange
*range
, const char *text
)
1375 BSTR bstr
= a2bstr(text
);
1377 hres
= IHTMLTxtRange_put_text(range
, bstr
);
1378 ok_(__FILE__
,line
) (hres
== S_OK
, "put_text failed: %08x\n", hres
);
1379 SysFreeString(bstr
);
1380 _test_range_text(line
, range
, NULL
);
1383 #define test_range_inrange(r1,r2,b) _test_range_inrange(__LINE__,r1,r2,b)
1384 static void _test_range_inrange(unsigned line
, IHTMLTxtRange
*range1
, IHTMLTxtRange
*range2
, VARIANT_BOOL exb
)
1390 hres
= IHTMLTxtRange_inRange(range1
, range2
, &b
);
1391 ok_(__FILE__
,line
) (hres
== S_OK
, "(1->2) isEqual failed: %08x\n", hres
);
1392 ok_(__FILE__
,line
) (b
== exb
, "(1->2) b=%x, expected %x\n", b
, exb
);
1395 #define test_range_isequal(r1,r2,b) _test_range_isequal(__LINE__,r1,r2,b)
1396 static void _test_range_isequal(unsigned line
, IHTMLTxtRange
*range1
, IHTMLTxtRange
*range2
, VARIANT_BOOL exb
)
1402 hres
= IHTMLTxtRange_isEqual(range1
, range2
, &b
);
1403 ok_(__FILE__
,line
) (hres
== S_OK
, "(1->2) isEqual failed: %08x\n", hres
);
1404 ok_(__FILE__
,line
) (b
== exb
, "(1->2) b=%x, expected %x\n", b
, exb
);
1407 hres
= IHTMLTxtRange_isEqual(range2
, range1
, &b
);
1408 ok_(__FILE__
,line
) (hres
== S_OK
, "(2->1) isEqual failed: %08x\n", hres
);
1409 ok_(__FILE__
,line
) (b
== exb
, "(2->1) b=%x, expected %x\n", b
, exb
);
1412 test_range_inrange(range1
, range2
, VARIANT_TRUE
);
1413 test_range_inrange(range2
, range1
, VARIANT_TRUE
);
1417 #define test_range_parent(r,t) _test_range_parent(__LINE__,r,t)
1418 static void _test_range_parent(unsigned line
, IHTMLTxtRange
*range
, elem_type_t type
)
1423 hres
= IHTMLTxtRange_parentElement(range
, &elem
);
1424 ok_(__FILE__
,line
) (hres
== S_OK
, "parentElement failed: %08x\n", hres
);
1426 _test_elem_type(line
, (IUnknown
*)elem
, type
);
1428 IHTMLElement_Release(elem
);
1431 #define test_elem_collection(c,t,l) _test_elem_collection(__LINE__,c,t,l)
1432 static void _test_elem_collection(unsigned line
, IUnknown
*unk
,
1433 const elem_type_t
*elem_types
, LONG exlen
)
1435 IHTMLElementCollection
*col
;
1438 VARIANT name
, index
;
1439 IDispatch
*disp
, *disp2
;
1442 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElementCollection
, (void**)&col
);
1443 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElementCollection: %08x\n", hres
);
1445 test_disp((IUnknown
*)col
, &DIID_DispHTMLElementCollection
, "[object]");
1447 hres
= IHTMLElementCollection_get_length(col
, &len
);
1448 ok_(__FILE__
,line
) (hres
== S_OK
, "get_length failed: %08x\n", hres
);
1449 ok_(__FILE__
,line
) (len
== exlen
, "len=%d, expected %d\n", len
, exlen
);
1454 V_VT(&index
) = VT_EMPTY
;
1456 for(i
=0; i
<len
; i
++) {
1457 V_VT(&name
) = VT_I4
;
1459 disp
= (void*)0xdeadbeef;
1460 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
1461 ok_(__FILE__
,line
) (hres
== S_OK
, "item(%d) failed: %08x\n", i
, hres
);
1462 ok_(__FILE__
,line
) (disp
!= NULL
, "item returned NULL\n");
1463 if(FAILED(hres
) || !disp
)
1466 _test_elem_type(line
, (IUnknown
*)disp
, elem_types
[i
]);
1469 V_VT(&name
) = VT_UINT
;
1471 disp2
= (void*)0xdeadbeef;
1472 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp2
);
1473 ok_(__FILE__
,line
) (hres
== S_OK
, "item(%d) failed: %08x\n", i
, hres
);
1474 ok_(__FILE__
,line
) (iface_cmp((IUnknown
*)disp
, (IUnknown
*)disp2
), "disp != disp2\n");
1476 IDispatch_Release(disp2
);
1479 IDispatch_Release(disp
);
1482 V_VT(&name
) = VT_I4
;
1484 disp
= (void*)0xdeadbeef;
1485 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
1486 ok_(__FILE__
,line
) (hres
== S_OK
, "item failed: %08x\n", hres
);
1487 ok_(__FILE__
,line
) (disp
== NULL
, "disp != NULL\n");
1489 V_VT(&name
) = VT_I4
;
1491 disp
= (void*)0xdeadbeef;
1492 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
1493 ok_(__FILE__
,line
) (hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
1494 ok_(__FILE__
,line
) (disp
== NULL
, "disp != NULL\n");
1496 IHTMLElementCollection_Release(col
);
1499 #define test_elem_all(c,t,l) _test_elem_all(__LINE__,c,t,l)
1500 static void _test_elem_all(unsigned line
, IUnknown
*unk
, const elem_type_t
*elem_types
, LONG exlen
)
1502 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1506 hres
= IHTMLElement_get_all(elem
, &disp
);
1507 IHTMLElement_Release(elem
);
1508 ok_(__FILE__
,line
)(hres
== S_OK
, "get_all failed: %08x\n", hres
);
1510 _test_elem_collection(line
, (IUnknown
*)disp
, elem_types
, exlen
);
1511 IDispatch_Release(disp
);
1514 #define test_elem_getelembytag(u,t,l) _test_elem_getelembytag(__LINE__,u,t,l)
1515 static void _test_elem_getelembytag(unsigned line
, IUnknown
*unk
, elem_type_t type
, LONG exlen
)
1517 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1518 IHTMLElementCollection
*col
= NULL
;
1519 elem_type_t
*types
= NULL
;
1524 tmp
= a2bstr(elem_type_infos
[type
].tag
);
1525 hres
= IHTMLElement2_getElementsByTagName(elem
, tmp
, &col
);
1527 IHTMLElement2_Release(elem
);
1528 ok_(__FILE__
,line
) (hres
== S_OK
, "getElementByTagName failed: %08x\n", hres
);
1529 ok_(__FILE__
,line
) (col
!= NULL
, "col == NULL\n");
1532 types
= HeapAlloc(GetProcessHeap(), 0, exlen
*sizeof(elem_type_t
));
1533 for(i
=0; i
<exlen
; i
++)
1537 _test_elem_collection(line
, (IUnknown
*)col
, types
, exlen
);
1539 HeapFree(GetProcessHeap(), 0, types
);
1542 #define test_elem_innertext(e,t) _test_elem_innertext(__LINE__,e,t)
1543 static void _test_elem_innertext(unsigned line
, IHTMLElement
*elem
, const char *extext
)
1548 hres
= IHTMLElement_get_innerText(elem
, &text
);
1549 ok_(__FILE__
,line
) (hres
== S_OK
, "get_innerText failed: %08x\n", hres
);
1550 ok_(__FILE__
,line
) (!strcmp_wa(text
, extext
), "get_innerText returned %s expected %s\n",
1551 wine_dbgstr_w(text
), extext
);
1552 SysFreeString(text
);
1555 #define test_elem_set_innertext(e,t) _test_elem_set_innertext(__LINE__,e,t)
1556 static void _test_elem_set_innertext(unsigned line
, IHTMLElement
*elem
, const char *text
)
1558 IHTMLDOMChildrenCollection
*col
;
1563 hres
= IHTMLElement_put_innerText(elem
, str
);
1564 ok_(__FILE__
,line
) (hres
== S_OK
, "put_innerText failed: %08x\n", hres
);
1567 _test_elem_innertext(line
, elem
, text
);
1570 col
= _get_child_nodes(line
, (IUnknown
*)elem
);
1571 ok(col
!= NULL
, "col == NULL\n");
1573 LONG length
= 0, type
;
1576 hres
= IHTMLDOMChildrenCollection_get_length(col
, &length
);
1577 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
1578 ok(length
== 1, "length = %d\n", length
);
1580 node
= _get_child_item(line
, col
, 0);
1581 ok(node
!= NULL
, "node == NULL\n");
1583 type
= _get_node_type(line
, (IUnknown
*)node
);
1584 ok(type
== 3, "type=%d\n", type
);
1585 IHTMLDOMNode_Release(node
);
1588 IHTMLDOMChildrenCollection_Release(col
);
1593 #define test_elem_innerhtml(e,t) _test_elem_innerhtml(__LINE__,e,t)
1594 static void _test_elem_innerhtml(unsigned line
, IUnknown
*unk
, const char *inner_html
)
1596 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1600 hres
= IHTMLElement_get_innerHTML(elem
, &html
);
1601 ok_(__FILE__
,line
)(hres
== S_OK
, "get_innerHTML failed: %08x\n", hres
);
1603 ok_(__FILE__
,line
)(!strcmp_wa(html
, inner_html
), "unexpected innerHTML: %s\n", wine_dbgstr_w(html
));
1605 ok_(__FILE__
,line
)(!html
, "innerHTML = %s\n", wine_dbgstr_w(html
));
1607 IHTMLElement_Release(elem
);
1608 SysFreeString(html
);
1611 #define test_elem_set_innerhtml(e,t) _test_elem_set_innerhtml(__LINE__,e,t)
1612 static void _test_elem_set_innerhtml(unsigned line
, IUnknown
*unk
, const char *inner_html
)
1614 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1618 html
= a2bstr(inner_html
);
1619 hres
= IHTMLElement_put_innerHTML(elem
, html
);
1620 ok_(__FILE__
,line
)(hres
== S_OK
, "put_innerHTML failed: %08x\n", hres
);
1622 IHTMLElement_Release(elem
);
1623 SysFreeString(html
);
1626 #define test_elem_set_outerhtml(e,t) _test_elem_set_outerhtml(__LINE__,e,t)
1627 static void _test_elem_set_outerhtml(unsigned line
, IUnknown
*unk
, const char *outer_html
)
1629 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1633 html
= a2bstr(outer_html
);
1634 hres
= IHTMLElement_put_outerHTML(elem
, html
);
1635 ok_(__FILE__
,line
)(hres
== S_OK
, "put_outerHTML failed: %08x\n", hres
);
1637 IHTMLElement_Release(elem
);
1638 SysFreeString(html
);
1641 #define get_first_child(n) _get_first_child(__LINE__,n)
1642 static IHTMLDOMNode
*_get_first_child(unsigned line
, IUnknown
*unk
)
1644 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1645 IHTMLDOMNode
*child
= NULL
;
1648 hres
= IHTMLDOMNode_get_firstChild(node
, &child
);
1649 IHTMLDOMNode_Release(node
);
1650 ok_(__FILE__
,line
) (hres
== S_OK
, "get_firstChild failed: %08x\n", hres
);
1655 #define test_node_has_child(u,b) _test_node_has_child(__LINE__,u,b)
1656 static void _test_node_has_child(unsigned line
, IUnknown
*unk
, VARIANT_BOOL exb
)
1658 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1659 VARIANT_BOOL b
= 0xdead;
1662 hres
= IHTMLDOMNode_hasChildNodes(node
, &b
);
1663 ok_(__FILE__
,line
) (hres
== S_OK
, "hasChildNodes failed: %08x\n", hres
);
1664 ok_(__FILE__
,line
) (b
== exb
, "hasChildNodes=%x, expected %x\n", b
, exb
);
1666 IHTMLDOMNode_Release(node
);
1669 #define test_node_get_parent(u) _test_node_get_parent(__LINE__,u)
1670 static IHTMLDOMNode
*_test_node_get_parent(unsigned line
, IUnknown
*unk
)
1672 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1673 IHTMLDOMNode
*parent
;
1676 hres
= IHTMLDOMNode_get_parentNode(node
, &parent
);
1677 IHTMLDOMNode_Release(node
);
1678 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentNode failed: %08x\n", hres
);
1683 #define node_get_next(u) _node_get_next(__LINE__,u)
1684 static IHTMLDOMNode
*_node_get_next(unsigned line
, IUnknown
*unk
)
1686 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1690 hres
= IHTMLDOMNode_get_nextSibling(node
, &next
);
1691 IHTMLDOMNode_Release(node
);
1692 ok_(__FILE__
,line
) (hres
== S_OK
, "get_nextSiblibg failed: %08x\n", hres
);
1697 #define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
1698 static IHTMLElement
*_test_elem_get_parent(unsigned line
, IUnknown
*unk
)
1700 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1701 IHTMLElement
*parent
;
1704 hres
= IHTMLElement_get_parentElement(elem
, &parent
);
1705 IHTMLElement_Release(elem
);
1706 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentElement failed: %08x\n", hres
);
1711 #define test_elem3_get_disabled(i,b) _test_elem3_get_disabled(__LINE__,i,b)
1712 static void _test_elem3_get_disabled(unsigned line
, IUnknown
*unk
, VARIANT_BOOL exb
)
1714 IHTMLElement3
*elem3
= _get_elem3_iface(line
, unk
);
1715 VARIANT_BOOL disabled
= 100;
1719 hres
= IHTMLElement3_get_disabled(elem3
, &disabled
);
1720 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1721 ok_(__FILE__
,line
) (disabled
== exb
, "disabled=%x, expected %x\n", disabled
, exb
);
1722 IHTMLElement3_Release(elem3
);
1725 #define test_elem3_set_disabled(i,b) _test_elem3_set_disabled(__LINE__,i,b)
1726 static void _test_elem3_set_disabled(unsigned line
, IUnknown
*unk
, VARIANT_BOOL b
)
1728 IHTMLElement3
*elem3
= _get_elem3_iface(line
, unk
);
1732 hres
= IHTMLElement3_put_disabled(elem3
, b
);
1733 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1735 IHTMLElement3_Release(elem3
);
1736 _test_elem3_get_disabled(line
, unk
, b
);
1739 #define test_select_get_disabled(i,b) _test_select_get_disabled(__LINE__,i,b)
1740 static void _test_select_get_disabled(unsigned line
, IHTMLSelectElement
*select
, VARIANT_BOOL exb
)
1742 VARIANT_BOOL disabled
= 100;
1745 hres
= IHTMLSelectElement_get_disabled(select
, &disabled
);
1746 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1747 ok_(__FILE__
,line
) (disabled
== exb
, "disabled=%x, expected %x\n", disabled
, exb
);
1749 _test_elem3_get_disabled(line
, (IUnknown
*)select
, exb
);
1752 #define test_text_length(u,l) _test_text_length(__LINE__,u,l)
1753 static void _test_text_length(unsigned line
, IUnknown
*unk
, LONG l
)
1755 IHTMLDOMTextNode
*text
= _get_text_iface(line
, unk
);
1759 hres
= IHTMLDOMTextNode_get_length(text
, &length
);
1760 ok_(__FILE__
,line
)(hres
== S_OK
, "get_length failed: %08x\n", hres
);
1761 ok_(__FILE__
,line
)(length
== l
, "length = %d, expected %d\n", length
, l
);
1762 IHTMLDOMTextNode_Release(text
);
1765 #define test_select_set_disabled(i,b) _test_select_set_disabled(__LINE__,i,b)
1766 static void _test_select_set_disabled(unsigned line
, IHTMLSelectElement
*select
, VARIANT_BOOL b
)
1770 hres
= IHTMLSelectElement_put_disabled(select
, b
);
1771 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1773 _test_select_get_disabled(line
, select
, b
);
1776 #define elem_get_scroll_height(u) _elem_get_scroll_height(__LINE__,u)
1777 static LONG
_elem_get_scroll_height(unsigned line
, IUnknown
*unk
)
1779 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1780 IHTMLTextContainer
*txtcont
;
1781 LONG l
= -1, l2
= -1;
1784 hres
= IHTMLElement2_get_scrollHeight(elem
, &l
);
1785 ok_(__FILE__
,line
) (hres
== S_OK
, "get_scrollHeight failed: %08x\n", hres
);
1786 IHTMLElement2_Release(elem
);
1788 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1789 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1791 hres
= IHTMLTextContainer_get_scrollHeight(txtcont
, &l2
);
1792 IHTMLTextContainer_Release(txtcont
);
1793 ok_(__FILE__
,line
) (hres
== S_OK
, "IHTMLTextContainer::get_scrollHeight failed: %d\n", l2
);
1794 ok_(__FILE__
,line
) (l
== l2
, "unexpected height %d, expected %d\n", l2
, l
);
1799 #define elem_get_scroll_width(u) _elem_get_scroll_width(__LINE__,u)
1800 static LONG
_elem_get_scroll_width(unsigned line
, IUnknown
*unk
)
1802 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1803 IHTMLTextContainer
*txtcont
;
1804 LONG l
= -1, l2
= -1;
1807 hres
= IHTMLElement2_get_scrollWidth(elem
, &l
);
1808 ok_(__FILE__
,line
) (hres
== S_OK
, "get_scrollWidth failed: %08x\n", hres
);
1809 IHTMLElement2_Release(elem
);
1811 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1812 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1814 hres
= IHTMLTextContainer_get_scrollWidth(txtcont
, &l2
);
1815 IHTMLTextContainer_Release(txtcont
);
1816 ok_(__FILE__
,line
) (hres
== S_OK
, "IHTMLTextContainer::get_scrollWidth failed: %d\n", l2
);
1817 ok_(__FILE__
,line
) (l
== l2
, "unexpected width %d, expected %d\n", l2
, l
);
1822 #define elem_get_scroll_top(u) _elem_get_scroll_top(__LINE__,u)
1823 static LONG
_elem_get_scroll_top(unsigned line
, IUnknown
*unk
)
1825 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1826 IHTMLTextContainer
*txtcont
;
1827 LONG l
= -1, l2
= -1;
1830 hres
= IHTMLElement2_get_scrollTop(elem
, &l
);
1831 ok_(__FILE__
,line
) (hres
== S_OK
, "get_scrollTop failed: %08x\n", hres
);
1832 IHTMLElement2_Release(elem
);
1834 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1835 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1837 hres
= IHTMLTextContainer_get_scrollTop(txtcont
, &l2
);
1838 IHTMLTextContainer_Release(txtcont
);
1839 ok_(__FILE__
,line
) (hres
== S_OK
, "IHTMLTextContainer::get_scrollTop failed: %d\n", l2
);
1840 ok_(__FILE__
,line
) (l
== l2
, "unexpected top %d, expected %d\n", l2
, l
);
1845 #define elem_get_scroll_left(u) _elem_get_scroll_left(__LINE__,u)
1846 static void _elem_get_scroll_left(unsigned line
, IUnknown
*unk
)
1848 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1849 IHTMLTextContainer
*txtcont
;
1850 LONG l
= -1, l2
= -1;
1853 hres
= IHTMLElement2_get_scrollLeft(elem
, NULL
);
1854 ok(hres
== E_INVALIDARG
, "expect E_INVALIDARG got 0x%08x\n", hres
);
1856 hres
= IHTMLElement2_get_scrollLeft(elem
, &l
);
1857 ok(hres
== S_OK
, "get_scrollTop failed: %08x\n", hres
);
1858 IHTMLElement2_Release(elem
);
1860 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1861 ok(hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1863 hres
= IHTMLTextContainer_get_scrollLeft(txtcont
, &l2
);
1864 IHTMLTextContainer_Release(txtcont
);
1865 ok(hres
== S_OK
, "IHTMLTextContainer::get_scrollLeft failed: %d\n", l2
);
1866 ok(l
== l2
, "unexpected left %d, expected %d\n", l2
, l
);
1869 #define test_img_src(i,s) _test_img_src(__LINE__,i,s)
1870 static void _test_img_src(unsigned line
, IUnknown
*unk
, const char *exsrc
)
1872 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1876 hres
= IHTMLImgElement_get_src(img
, &src
);
1877 IHTMLImgElement_Release(img
);
1878 ok_(__FILE__
,line
) (hres
== S_OK
, "get_src failed: %08x\n", hres
);
1879 ok_(__FILE__
,line
) (!strcmp_wa(src
, exsrc
), "get_src returned %s expected %s\n", wine_dbgstr_w(src
), exsrc
);
1883 #define test_img_set_src(u,s) _test_img_set_src(__LINE__,u,s)
1884 static void _test_img_set_src(unsigned line
, IUnknown
*unk
, const char *src
)
1886 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1891 hres
= IHTMLImgElement_put_src(img
, tmp
);
1892 IHTMLImgElement_Release(img
);
1894 ok_(__FILE__
,line
) (hres
== S_OK
, "put_src failed: %08x\n", hres
);
1896 _test_img_src(line
, unk
, src
);
1899 #define test_img_alt(u,a) _test_img_alt(__LINE__,u,a)
1900 static void _test_img_alt(unsigned line
, IUnknown
*unk
, const char *exalt
)
1902 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1906 hres
= IHTMLImgElement_get_alt(img
, &alt
);
1907 ok_(__FILE__
,line
) (hres
== S_OK
, "get_alt failed: %08x\n", hres
);
1909 ok_(__FILE__
,line
) (!strcmp_wa(alt
, exalt
), "inexopected alt %s\n", wine_dbgstr_w(alt
));
1911 ok_(__FILE__
,line
) (!alt
, "alt != NULL\n");
1915 #define test_img_set_alt(u,a) _test_img_set_alt(__LINE__,u,a)
1916 static void _test_img_set_alt(unsigned line
, IUnknown
*unk
, const char *alt
)
1918 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1923 hres
= IHTMLImgElement_put_alt(img
, tmp
);
1924 ok_(__FILE__
,line
) (hres
== S_OK
, "get_alt failed: %08x\n", hres
);
1927 _test_img_alt(line
, unk
, alt
);
1930 #define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b)
1931 static void _test_input_get_disabled(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL exb
)
1933 VARIANT_BOOL disabled
= 100;
1936 hres
= IHTMLInputElement_get_disabled(input
, &disabled
);
1937 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1938 ok_(__FILE__
,line
) (disabled
== exb
, "disabled=%x, expected %x\n", disabled
, exb
);
1940 _test_elem3_get_disabled(line
, (IUnknown
*)input
, exb
);
1943 #define test_input_set_disabled(i,b) _test_input_set_disabled(__LINE__,i,b)
1944 static void _test_input_set_disabled(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL b
)
1948 hres
= IHTMLInputElement_put_disabled(input
, b
);
1949 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1951 _test_input_get_disabled(line
, input
, b
);
1954 #define test_input_get_defaultchecked(i,b) _test_input_get_defaultchecked(__LINE__,i,b)
1955 static void _test_input_get_defaultchecked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL exb
)
1957 VARIANT_BOOL checked
= 100;
1960 hres
= IHTMLInputElement_get_defaultChecked(input
, &checked
);
1961 ok_(__FILE__
,line
) (hres
== S_OK
, "get_defaultChecked failed: %08x\n", hres
);
1962 ok_(__FILE__
,line
) (checked
== exb
, "checked=%x, expected %x\n", checked
, exb
);
1965 #define test_input_set_defaultchecked(i,b) _test_input_set_defaultchecked(__LINE__,i,b)
1966 static void _test_input_set_defaultchecked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL b
)
1970 hres
= IHTMLInputElement_put_defaultChecked(input
, b
);
1971 ok_(__FILE__
,line
) (hres
== S_OK
, "get_defaultChecked failed: %08x\n", hres
);
1973 _test_input_get_defaultchecked(line
, input
, b
);
1976 #define test_input_get_checked(i,b) _test_input_get_checked(__LINE__,i,b)
1977 static void _test_input_get_checked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL exb
)
1979 VARIANT_BOOL checked
= 100;
1982 hres
= IHTMLInputElement_get_checked(input
, &checked
);
1983 ok_(__FILE__
,line
) (hres
== S_OK
, "get_checked failed: %08x\n", hres
);
1984 ok_(__FILE__
,line
) (checked
== exb
, "checked=%x, expected %x\n", checked
, exb
);
1987 #define test_input_set_checked(i,b) _test_input_set_checked(__LINE__,i,b)
1988 static void _test_input_set_checked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL b
)
1992 hres
= IHTMLInputElement_put_checked(input
, b
);
1993 ok_(__FILE__
,line
) (hres
== S_OK
, "get_checked failed: %08x\n", hres
);
1995 _test_input_get_checked(line
, input
, b
);
1998 #define test_input_value(o,t) _test_input_value(__LINE__,o,t)
1999 static void _test_input_value(unsigned line
, IUnknown
*unk
, const char *exval
)
2001 IHTMLInputElement
*input
;
2005 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLInputElement
, (void**)&input
);
2006 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLInputElement: %08x\n", hres
);
2010 hres
= IHTMLInputElement_get_value(input
, &bstr
);
2011 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
2013 ok_(__FILE__
,line
) (!strcmp_wa(bstr
, exval
), "value=%s\n", wine_dbgstr_w(bstr
));
2015 ok_(__FILE__
,line
) (!exval
, "exval != NULL\n");
2016 SysFreeString(bstr
);
2017 IHTMLInputElement_Release(input
);
2020 #define test_input_put_value(o,v) _test_input_put_value(__LINE__,o,v)
2021 static void _test_input_put_value(unsigned line
, IUnknown
*unk
, const char *val
)
2023 IHTMLInputElement
*input
;
2027 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLInputElement
, (void**)&input
);
2028 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLInputElement: %08x\n", hres
);
2033 hres
= IHTMLInputElement_get_value(input
, &bstr
);
2034 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
2035 SysFreeString(bstr
);
2036 IHTMLInputElement_Release(input
);
2039 #define test_input_src(i,s) _test_input_src(__LINE__,i,s)
2040 static void _test_input_src(unsigned line
, IHTMLInputElement
*input
, const char *exsrc
)
2045 hres
= IHTMLInputElement_get_src(input
, &src
);
2046 ok_(__FILE__
,line
) (hres
== S_OK
, "get_src failed: %08x\n", hres
);
2048 ok_(__FILE__
,line
) (!strcmp_wa(src
, exsrc
), "get_src returned %s expected %s\n", wine_dbgstr_w(src
), exsrc
);
2050 ok_(__FILE__
,line
) (!src
, "get_src returned %s expected NULL\n", wine_dbgstr_w(src
));
2054 #define test_input_set_src(u,s) _test_input_set_src(__LINE__,u,s)
2055 static void _test_input_set_src(unsigned line
, IHTMLInputElement
*input
, const char *src
)
2061 hres
= IHTMLInputElement_put_src(input
, tmp
);
2063 ok_(__FILE__
,line
) (hres
== S_OK
, "put_src failed: %08x\n", hres
);
2065 _test_input_src(line
, input
, src
);
2068 #define test_elem_class(u,c) _test_elem_class(__LINE__,u,c)
2069 static void _test_elem_class(unsigned line
, IUnknown
*unk
, const char *exclass
)
2071 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2072 BSTR
class = (void*)0xdeadbeef;
2075 hres
= IHTMLElement_get_className(elem
, &class);
2076 IHTMLElement_Release(elem
);
2077 ok_(__FILE__
,line
) (hres
== S_OK
, "get_className failed: %08x\n", hres
);
2079 ok_(__FILE__
,line
) (!strcmp_wa(class, exclass
), "unexpected className %s\n", wine_dbgstr_w(class));
2081 ok_(__FILE__
,line
) (!class, "class != NULL\n");
2082 SysFreeString(class);
2085 #define test_elem_tabindex(u,i) _test_elem_tabindex(__LINE__,u,i)
2086 static void _test_elem_tabindex(unsigned line
, IUnknown
*unk
, short exindex
)
2088 IHTMLElement2
*elem2
= _get_elem2_iface(line
, unk
);
2092 hres
= IHTMLElement2_get_tabIndex(elem2
, &index
);
2093 IHTMLElement2_Release(elem2
);
2094 ok_(__FILE__
,line
) (hres
== S_OK
, "get_tabIndex failed: %08x\n", hres
);
2095 ok_(__FILE__
,line
) (index
== exindex
, "unexpected index %d\n", index
);
2098 #define test_elem_set_tabindex(u,i) _test_elem_set_tabindex(__LINE__,u,i)
2099 static void _test_elem_set_tabindex(unsigned line
, IUnknown
*unk
, short index
)
2101 IHTMLElement2
*elem2
= _get_elem2_iface(line
, unk
);
2104 hres
= IHTMLElement2_put_tabIndex(elem2
, index
);
2105 IHTMLElement2_Release(elem2
);
2106 ok_(__FILE__
,line
) (hres
== S_OK
, "get_tabIndex failed: %08x\n", hres
);
2108 _test_elem_tabindex(line
, unk
, index
);
2111 #define test_elem_set_class(u,c) _test_elem_set_class(__LINE__,u,c)
2112 static void _test_elem_set_class(unsigned line
, IUnknown
*unk
, const char *class)
2114 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2118 tmp
= class ? a2bstr(class) : NULL
;
2119 hres
= IHTMLElement_put_className(elem
, tmp
);
2120 IHTMLElement_Release(elem
);
2121 ok_(__FILE__
,line
) (hres
== S_OK
, "put_className failed: %08x\n", hres
);
2124 _test_elem_class(line
, unk
, class);
2127 #define test_elem_id(e,i) _test_elem_id(__LINE__,e,i)
2128 static void _test_elem_id(unsigned line
, IUnknown
*unk
, const char *exid
)
2130 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2131 BSTR id
= (void*)0xdeadbeef;
2134 hres
= IHTMLElement_get_id(elem
, &id
);
2135 IHTMLElement_Release(elem
);
2136 ok_(__FILE__
,line
) (hres
== S_OK
, "get_id failed: %08x\n", hres
);
2139 ok_(__FILE__
,line
) (!strcmp_wa(id
, exid
), "unexpected id %s\n", wine_dbgstr_w(id
));
2141 ok_(__FILE__
,line
) (!id
, "id=%s\n", wine_dbgstr_w(id
));
2146 #define test_elem_put_id(u,i) _test_elem_put_id(__LINE__,u,i)
2147 static void _test_elem_put_id(unsigned line
, IUnknown
*unk
, const char *new_id
)
2149 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2150 BSTR tmp
= a2bstr(new_id
);
2153 hres
= IHTMLElement_put_id(elem
, tmp
);
2154 IHTMLElement_Release(elem
);
2156 ok_(__FILE__
,line
) (hres
== S_OK
, "put_id failed: %08x\n", hres
);
2158 _test_elem_id(line
, unk
, new_id
);
2161 #define test_elem_title(u,t) _test_elem_title(__LINE__,u,t)
2162 static void _test_elem_title(unsigned line
, IUnknown
*unk
, const char *extitle
)
2164 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2168 hres
= IHTMLElement_get_title(elem
, &title
);
2169 IHTMLElement_Release(elem
);
2170 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2172 ok_(__FILE__
,line
) (!strcmp_wa(title
, extitle
), "unexpected title %s\n", wine_dbgstr_w(title
));
2174 ok_(__FILE__
,line
) (!title
, "title=%s, expected NULL\n", wine_dbgstr_w(title
));
2176 SysFreeString(title
);
2179 #define test_elem_set_title(u,t) _test_elem_set_title(__LINE__,u,t)
2180 static void _test_elem_set_title(unsigned line
, IUnknown
*unk
, const char *title
)
2182 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2186 tmp
= a2bstr(title
);
2187 hres
= IHTMLElement_put_title(elem
, tmp
);
2188 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2190 IHTMLElement_Release(elem
);
2194 #define test_node_get_value_str(u,e) _test_node_get_value_str(__LINE__,u,e)
2195 static void _test_node_get_value_str(unsigned line
, IUnknown
*unk
, const char *exval
)
2197 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
2201 hres
= IHTMLDOMNode_get_nodeValue(node
, &var
);
2202 IHTMLDOMNode_Release(node
);
2203 ok_(__FILE__
,line
) (hres
== S_OK
, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres
);
2206 ok_(__FILE__
,line
) (V_VT(&var
) == VT_BSTR
, "vt=%d\n", V_VT(&var
));
2207 ok_(__FILE__
,line
) (!strcmp_wa(V_BSTR(&var
), exval
), "unexpected value %s\n", wine_dbgstr_w(V_BSTR(&var
)));
2209 ok_(__FILE__
,line
) (V_VT(&var
) == VT_NULL
, "vt=%d, expected VT_NULL\n", V_VT(&var
));
2215 #define test_node_put_value_str(u,v) _test_node_put_value_str(__LINE__,u,v)
2216 static void _test_node_put_value_str(unsigned line
, IUnknown
*unk
, const char *val
)
2218 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
2222 V_VT(&var
) = VT_BSTR
;
2223 V_BSTR(&var
) = a2bstr(val
);
2225 hres
= IHTMLDOMNode_put_nodeValue(node
, var
);
2226 ok_(__FILE__
,line
) (hres
== S_OK
, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres
);
2227 IHTMLDOMNode_Release(node
);
2231 #define test_elem_client_size(u) _test_elem_client_size(__LINE__,u)
2232 static void _test_elem_client_size(unsigned line
, IUnknown
*unk
)
2234 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
2238 hres
= IHTMLElement2_get_clientWidth(elem
, &l
);
2239 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientWidth failed: %08x\n", hres
);
2240 hres
= IHTMLElement2_get_clientHeight(elem
, &l
);
2241 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientHeight failed: %08x\n", hres
);
2243 IHTMLElement2_Release(elem
);
2246 #define test_elem_client_rect(u) _test_elem_client_rect(__LINE__,u)
2247 static void _test_elem_client_rect(unsigned line
, IUnknown
*unk
)
2249 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
2253 hres
= IHTMLElement2_get_clientLeft(elem
, &l
);
2254 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientLeft failed: %08x\n", hres
);
2255 ok_(__FILE__
,line
) (!l
, "clientLeft = %d\n", l
);
2257 hres
= IHTMLElement2_get_clientTop(elem
, &l
);
2258 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientTop failed: %08x\n", hres
);
2259 ok_(__FILE__
,line
) (!l
, "clientTop = %d\n", l
);
2261 IHTMLElement2_Release(elem
);
2264 #define get_elem_doc(e) _get_elem_doc(__LINE__,e)
2265 static IHTMLDocument2
*_get_elem_doc(unsigned line
, IUnknown
*unk
)
2267 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2268 IHTMLDocument2
*doc
;
2273 hres
= IHTMLElement_get_document(elem
, &disp
);
2274 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
2275 ok(disp
!= NULL
, "disp == NULL\n");
2277 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDocument2
, (void**)&doc
);
2278 IDispatch_Release(disp
);
2279 ok(hres
== S_OK
, "Could not get IHTMLDocument2 iface: %08x\n", hres
);
2284 #define get_window_doc(e) _get_window_doc(__LINE__,e)
2285 static IHTMLDocument2
*_get_window_doc(unsigned line
, IHTMLWindow2
*window
)
2287 IHTMLDocument2
*doc
;
2291 hres
= IHTMLWindow2_get_document(window
, &doc
);
2292 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
2293 ok(doc
!= NULL
, "disp == NULL\n");
2298 #define test_create_elem(d,t) _test_create_elem(__LINE__,d,t)
2299 static IHTMLElement
*_test_create_elem(unsigned line
, IHTMLDocument2
*doc
, const char *tag
)
2301 IHTMLElement
*elem
= NULL
;
2306 hres
= IHTMLDocument2_createElement(doc
, tmp
, &elem
);
2307 ok_(__FILE__
,line
) (hres
== S_OK
, "createElement failed: %08x\n", hres
);
2308 ok_(__FILE__
,line
) (elem
!= NULL
, "elem == NULL\n");
2313 #define test_create_text(d,t) _test_create_text(__LINE__,d,t)
2314 static IHTMLDOMNode
*_test_create_text(unsigned line
, IHTMLDocument2
*doc
, const char *text
)
2316 IHTMLDocument3
*doc3
;
2317 IHTMLDOMNode
*node
= NULL
;
2321 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
2322 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDocument3: %08x\n", hres
);
2325 hres
= IHTMLDocument3_createTextNode(doc3
, tmp
, &node
);
2326 IHTMLDocument3_Release(doc3
);
2327 ok_(__FILE__
,line
) (hres
== S_OK
, "createElement failed: %08x\n", hres
);
2328 ok_(__FILE__
,line
) (node
!= NULL
, "node == NULL\n");
2333 #define test_node_append_child(n,c) _test_node_append_child(__LINE__,n,c)
2334 static IHTMLDOMNode
*_test_node_append_child(unsigned line
, IUnknown
*node_unk
, IUnknown
*child_unk
)
2336 IHTMLDOMNode
*node
= _get_node_iface(line
, node_unk
);
2337 IHTMLDOMNode
*child
= _get_node_iface(line
, child_unk
);
2338 IHTMLDOMNode
*new_child
= NULL
;
2341 hres
= IHTMLDOMNode_appendChild(node
, child
, &new_child
);
2342 ok_(__FILE__
,line
) (hres
== S_OK
, "appendChild failed: %08x\n", hres
);
2343 ok_(__FILE__
,line
) (new_child
!= NULL
, "new_child == NULL\n");
2344 /* TODO ok_(__FILE__,line) (new_child != child, "new_child == child\n"); */
2346 IHTMLDOMNode_Release(node
);
2347 IHTMLDOMNode_Release(child
);
2352 #define test_node_insertbefore(n,c,v) _test_node_insertbefore(__LINE__,n,c,v)
2353 static IHTMLDOMNode
*_test_node_insertbefore(unsigned line
, IUnknown
*node_unk
, IHTMLDOMNode
*child
, VARIANT
*var
)
2355 IHTMLDOMNode
*node
= _get_node_iface(line
, node_unk
);
2356 IHTMLDOMNode
*new_child
= NULL
;
2359 hres
= IHTMLDOMNode_insertBefore(node
, child
, *var
, &new_child
);
2360 ok_(__FILE__
,line
) (hres
== S_OK
, "insertBefore failed: %08x\n", hres
);
2361 ok_(__FILE__
,line
) (new_child
!= NULL
, "new_child == NULL\n");
2362 /* TODO ok_(__FILE__,line) (new_child != child, "new_child == child\n"); */
2364 IHTMLDOMNode_Release(node
);
2369 #define test_node_remove_child(n,c) _test_node_remove_child(__LINE__,n,c)
2370 static void _test_node_remove_child(unsigned line
, IUnknown
*unk
, IHTMLDOMNode
*child
)
2372 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
2373 IHTMLDOMNode
*new_node
= NULL
;
2376 hres
= IHTMLDOMNode_removeChild(node
, child
, &new_node
);
2377 ok_(__FILE__
,line
) (hres
== S_OK
, "removeChild failed: %08x\n", hres
);
2378 ok_(__FILE__
,line
) (new_node
!= NULL
, "new_node == NULL\n");
2379 /* TODO ok_(__FILE__,line) (new_node != child, "new_node == child\n"); */
2381 IHTMLDOMNode_Release(node
);
2382 IHTMLDOMNode_Release(new_node
);
2385 #define test_doc_title(d,t) _test_doc_title(__LINE__,d,t)
2386 static void _test_doc_title(unsigned line
, IHTMLDocument2
*doc
, const char *extitle
)
2391 hres
= IHTMLDocument2_get_title(doc
, &title
);
2392 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2393 ok_(__FILE__
,line
) (!strcmp_wa(title
, extitle
), "unexpected title %s\n", wine_dbgstr_w(title
));
2394 SysFreeString(title
);
2397 #define test_doc_set_title(d,t) _test_doc_set_title(__LINE__,d,t)
2398 static void _test_doc_set_title(unsigned line
, IHTMLDocument2
*doc
, const char *title
)
2403 tmp
= a2bstr(title
);
2404 hres
= IHTMLDocument2_put_title(doc
, tmp
);
2405 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2409 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
2410 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
2415 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
2416 LOCALE_USER_DEFAULT
, &dispid
);
2417 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
2420 DISPPARAMS params
= {NULL
,NULL
,0,0};
2421 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2426 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2427 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
2428 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
2431 params
.cNamedArgs
= 1;
2432 params
.rgdispidNamedArgs
= &dispidNamed
;
2433 V_VT(&arg
) = VT_BSTR
;
2434 V_BSTR(&arg
) = a2bstr("none");
2435 params
.rgvarg
= &arg
;
2436 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2437 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2438 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
2441 V_VT(&arg
) = VT_BSTR
;
2442 V_BSTR(&arg
) = a2bstr("dotted");
2443 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2444 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2445 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
2448 V_VT(&arg
) = VT_BSTR
;
2449 V_BSTR(&arg
) = a2bstr("dashed");
2450 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2451 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2452 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
2455 V_VT(&arg
) = VT_BSTR
;
2456 V_BSTR(&arg
) = a2bstr("solid");
2457 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2458 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2459 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
2462 V_VT(&arg
) = VT_BSTR
;
2463 V_BSTR(&arg
) = a2bstr("double");
2464 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2465 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2466 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
2469 V_VT(&arg
) = VT_BSTR
;
2470 V_BSTR(&arg
) = a2bstr("groove");
2471 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2472 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2473 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
2476 V_VT(&arg
) = VT_BSTR
;
2477 V_BSTR(&arg
) = a2bstr("ridge");
2478 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2479 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2480 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
2483 V_VT(&arg
) = VT_BSTR
;
2484 V_BSTR(&arg
) = a2bstr("inset");
2485 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2486 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2487 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
2490 V_VT(&arg
) = VT_BSTR
;
2491 V_BSTR(&arg
) = a2bstr("outset");
2492 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2493 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2494 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
2497 V_VT(&arg
) = VT_BSTR
;
2498 V_BSTR(&arg
) = a2bstr("invalid");
2499 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2500 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2501 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
2504 params
.rgvarg
= &vDefault
;
2505 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2506 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2507 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
2511 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
2512 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
2514 BSTR text
= (void*)0xdeadbeef;
2517 hres
= IHTMLStyle_get_cssText(style
, &text
);
2518 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
2520 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
2522 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
2524 SysFreeString(text
);
2527 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
2528 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
2534 hres
= IHTMLStyle_put_cssText(style
, tmp
);
2535 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
2539 static void test_elem_col_item(IHTMLElementCollection
*col
, const char *n
,
2540 const elem_type_t
*elem_types
, LONG len
)
2543 VARIANT name
, index
;
2547 V_VT(&index
) = VT_EMPTY
;
2548 V_VT(&name
) = VT_BSTR
;
2549 V_BSTR(&name
) = a2bstr(n
);
2551 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2552 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2554 test_elem_collection((IUnknown
*)disp
, elem_types
, len
);
2555 IDispatch_Release(disp
);
2556 ok(hres
== S_OK
, "Could not get IHTMLElementCollection interface: %08x\n", hres
);
2560 V_VT(&index
) = VT_I4
;
2562 for(i
=0; i
<len
; i
++) {
2564 disp
= (void*)0xdeadbeef;
2565 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2566 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2567 ok(disp
!= NULL
, "disp == NULL\n");
2568 if(FAILED(hres
) || !disp
)
2571 test_elem_type((IUnknown
*)disp
, elem_types
[i
]);
2573 IDispatch_Release(disp
);
2577 disp
= (void*)0xdeadbeef;
2578 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2579 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2580 ok(disp
== NULL
, "disp != NULL\n");
2583 disp
= (void*)0xdeadbeef;
2584 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2585 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
2586 ok(disp
== NULL
, "disp != NULL\n");
2589 SysFreeString(V_BSTR(&name
));
2592 static IHTMLElement
*get_elem_by_id(IHTMLDocument2
*doc
, const char *id
, BOOL expect_success
)
2594 IHTMLElementCollection
*col
;
2596 IDispatch
*disp
= (void*)0xdeadbeef;
2597 VARIANT name
, index
;
2600 hres
= IHTMLDocument2_get_all(doc
, &col
);
2601 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
2602 ok(col
!= NULL
, "col == NULL\n");
2603 if(FAILED(hres
) || !col
)
2606 V_VT(&index
) = VT_EMPTY
;
2607 V_VT(&name
) = VT_BSTR
;
2608 V_BSTR(&name
) = a2bstr(id
);
2610 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2611 IHTMLElementCollection_Release(col
);
2612 SysFreeString(V_BSTR(&name
));
2613 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2614 if(!expect_success
) {
2615 ok(disp
== NULL
, "disp != NULL\n");
2619 ok(disp
!= NULL
, "disp == NULL\n");
2623 elem
= get_elem_iface((IUnknown
*)disp
);
2624 IDispatch_Release(disp
);
2629 static IHTMLElement
*get_doc_elem_by_id(IHTMLDocument2
*doc
, const char *id
)
2631 IHTMLDocument3
*doc3
;
2636 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
2637 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
2640 hres
= IHTMLDocument3_getElementById(doc3
, tmp
, &elem
);
2642 ok(hres
== S_OK
, "getElementById(%s) failed: %08x\n", id
, hres
);
2644 IHTMLDocument3_Release(doc3
);
2649 static void test_select_elem(IHTMLSelectElement
*select
)
2651 test_select_type(select
, "select-one");
2652 test_select_length(select
, 2);
2653 test_select_selidx(select
, 0);
2654 test_select_put_selidx(select
, 1);
2656 test_select_set_value(select
, "val1");
2657 test_select_value(select
, "val1");
2659 test_select_get_disabled(select
, VARIANT_FALSE
);
2660 test_select_set_disabled(select
, VARIANT_TRUE
);
2661 test_select_set_disabled(select
, VARIANT_FALSE
);
2664 static void test_create_option_elem(IHTMLDocument2
*doc
)
2666 IHTMLOptionElement
*option
;
2668 option
= create_option_elem(doc
, "test text", "test value");
2670 test_option_put_text(option
, "new text");
2671 test_option_put_value(option
, "new value");
2673 IHTMLOptionElement_Release(option
);
2676 static void test_create_img_elem(IHTMLDocument2
*doc
)
2678 IHTMLImgElement
*img
;
2680 img
= create_img_elem(doc
, 10, 15);
2683 test_img_put_width(img
, 5);
2684 test_img_put_height(img
, 20);
2686 IHTMLImgElement_Release(img
);
2690 img
= create_img_elem(doc
, -1, -1);
2693 test_img_put_width(img
, 5);
2694 test_img_put_height(img
, 20);
2696 IHTMLImgElement_Release(img
);
2700 static IHTMLTxtRange
*test_create_body_range(IHTMLDocument2
*doc
)
2702 IHTMLBodyElement
*body
;
2703 IHTMLTxtRange
*range
;
2707 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2708 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2710 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLBodyElement
, (void**)&body
);
2711 IHTMLElement_Release(elem
);
2713 hres
= IHTMLBodyElement_createTextRange(body
, &range
);
2714 IHTMLBodyElement_Release(body
);
2715 ok(hres
== S_OK
, "createTextRange failed: %08x\n", hres
);
2720 static void test_txtrange(IHTMLDocument2
*doc
)
2722 IHTMLTxtRange
*body_range
, *range
, *range2
;
2723 IHTMLSelectionObject
*selection
;
2724 IDispatch
*disp_range
;
2727 body_range
= test_create_body_range(doc
);
2729 test_range_text(body_range
, "test abc 123\r\nit's text");
2731 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2732 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2734 hres
= IHTMLTxtRange_duplicate(body_range
, &range2
);
2735 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2736 test_range_isequal(range
, range2
, VARIANT_TRUE
);
2738 test_range_text(range
, "test abc 123\r\nit's text");
2739 test_range_text(body_range
, "test abc 123\r\nit's text");
2741 test_range_collapse(range
, TRUE
);
2742 test_range_isequal(range
, range2
, VARIANT_FALSE
);
2743 test_range_inrange(range
, range2
, VARIANT_FALSE
);
2744 test_range_inrange(range2
, range
, VARIANT_TRUE
);
2745 IHTMLTxtRange_Release(range2
);
2747 test_range_expand(range
, wordW
, VARIANT_TRUE
, "test ");
2748 test_range_expand(range
, wordW
, VARIANT_FALSE
, "test ");
2749 test_range_move(range
, characterW
, 2, 2);
2750 test_range_expand(range
, wordW
, VARIANT_TRUE
, "test ");
2752 test_range_collapse(range
, FALSE
);
2753 test_range_expand(range
, wordW
, VARIANT_TRUE
, "abc ");
2755 test_range_collapse(range
, FALSE
);
2756 test_range_expand(range
, wordW
, VARIANT_TRUE
, "123");
2757 test_range_expand(range
, wordW
, VARIANT_FALSE
, "123");
2758 test_range_move(range
, characterW
, 2, 2);
2759 test_range_expand(range
, wordW
, VARIANT_TRUE
, "123");
2760 test_range_moveend(range
, characterW
, -5, -5);
2761 test_range_text(range
, NULL
);
2762 test_range_moveend(range
, characterW
, 3, 3);
2763 test_range_text(range
, "c 1");
2764 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "test abc 123\r\nit's text");
2765 test_range_collapse(range
, TRUE
);
2766 test_range_move(range
, characterW
, 4, 4);
2767 test_range_moveend(range
, characterW
, 1, 1);
2768 test_range_text(range
, " ");
2769 test_range_move(range
, wordW
, 1, 1);
2770 test_range_moveend(range
, characterW
, 2, 2);
2771 test_range_text(range
, "ab");
2773 IHTMLTxtRange_Release(range
);
2775 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2776 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2778 test_range_text(range
, "test abc 123\r\nit's text");
2779 test_range_move(range
, characterW
, 3, 3);
2780 test_range_moveend(range
, characterW
, 1, 1);
2781 test_range_text(range
, "t");
2782 test_range_moveend(range
, characterW
, 3, 3);
2783 test_range_text(range
, "t ab");
2784 test_range_moveend(range
, characterW
, -2, -2);
2785 test_range_text(range
, "t ");
2786 test_range_move(range
, characterW
, 6, 6);
2787 test_range_moveend(range
, characterW
, 3, 3);
2788 test_range_text(range
, "123");
2789 test_range_moveend(range
, characterW
, 2, 2);
2790 test_range_text(range
, "123\r\ni");
2792 IHTMLTxtRange_Release(range
);
2794 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2795 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2797 test_range_move(range
, wordW
, 1, 1);
2798 test_range_moveend(range
, characterW
, 2, 2);
2799 test_range_text(range
, "ab");
2801 test_range_move(range
, characterW
, -2, -2);
2802 test_range_moveend(range
, characterW
, 2, 2);
2803 test_range_text(range
, "t ");
2805 test_range_move(range
, wordW
, 3, 3);
2806 test_range_move(range
, wordW
, -2, -2);
2807 test_range_moveend(range
, characterW
, 2, 2);
2808 test_range_text(range
, "ab");
2810 test_range_move(range
, characterW
, -6, -5);
2811 test_range_moveend(range
, characterW
, -1, 0);
2812 test_range_moveend(range
, characterW
, -6, 0);
2813 test_range_move(range
, characterW
, 2, 2);
2814 test_range_moveend(range
, characterW
, 2, 2);
2815 test_range_text(range
, "st");
2816 test_range_moveend(range
, characterW
, -6, -4);
2817 test_range_moveend(range
, characterW
, 2, 2);
2819 IHTMLTxtRange_Release(range
);
2821 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2822 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2824 test_range_move(range
, wordW
, 2, 2);
2825 test_range_moveend(range
, characterW
, 2, 2);
2826 test_range_text(range
, "12");
2828 test_range_move(range
, characterW
, 15, 14);
2829 test_range_move(range
, characterW
, -2, -2);
2830 test_range_moveend(range
, characterW
, 3, 2);
2831 test_range_text(range
, "t");
2832 test_range_moveend(range
, characterW
, -1, -1);
2833 test_range_text(range
, "t");
2834 test_range_expand(range
, wordW
, VARIANT_TRUE
, "text");
2835 test_range_move(range
, characterW
, -2, -2);
2836 test_range_moveend(range
, characterW
, 2, 2);
2837 test_range_text(range
, "s ");
2838 test_range_move(range
, characterW
, 100, 7);
2839 test_range_move(range
, wordW
, 1, 0);
2840 test_range_move(range
, characterW
, -2, -2);
2841 test_range_moveend(range
, characterW
, 3, 2);
2842 test_range_text(range
, "t");
2844 IHTMLTxtRange_Release(range
);
2846 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2847 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2849 test_range_collapse(range
, TRUE
);
2850 test_range_expand(range
, wordW
, VARIANT_TRUE
, "test ");
2851 test_range_put_text(range
, "word");
2852 test_range_text(body_range
, "wordabc 123\r\nit's text");
2853 test_range_text(range
, NULL
);
2854 test_range_moveend(range
, characterW
, 3, 3);
2855 test_range_text(range
, "abc");
2856 test_range_movestart(range
, characterW
, -2, -2);
2857 test_range_text(range
, "rdabc");
2858 test_range_movestart(range
, characterW
, 3, 3);
2859 test_range_text(range
, "bc");
2860 test_range_movestart(range
, characterW
, 4, 4);
2861 test_range_text(range
, NULL
);
2862 test_range_movestart(range
, characterW
, -3, -3);
2863 test_range_text(range
, "c 1");
2864 test_range_movestart(range
, characterW
, -7, -6);
2865 test_range_text(range
, "wordabc 1");
2866 test_range_movestart(range
, characterW
, 100, 22);
2867 test_range_text(range
, NULL
);
2869 IHTMLTxtRange_Release(range
);
2870 IHTMLTxtRange_Release(body_range
);
2872 hres
= IHTMLDocument2_get_selection(doc
, &selection
);
2873 ok(hres
== S_OK
, "IHTMLDocument2_get_selection failed: %08x\n", hres
);
2875 hres
= IHTMLSelectionObject_createRange(selection
, &disp_range
);
2876 ok(hres
== S_OK
, "IHTMLSelectionObject_createRange failed: %08x\n", hres
);
2877 IHTMLSelectionObject_Release(selection
);
2879 hres
= IDispatch_QueryInterface(disp_range
, &IID_IHTMLTxtRange
, (void **)&range
);
2880 ok(hres
== S_OK
, "Could not get IID_IHTMLTxtRange interface: 0x%08x\n", hres
);
2881 IDispatch_Release(disp_range
);
2883 test_range_text(range
, NULL
);
2884 test_range_moveend(range
, characterW
, 3, 3);
2885 test_range_text(range
, "wor");
2886 test_range_parent(range
, ET_BODY
);
2887 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "wordabc 123\r\nit's text");
2888 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "wordabc 123\r\nit's text");
2889 test_range_move(range
, characterW
, 3, 3);
2890 test_range_expand(range
, wordW
, VARIANT_TRUE
, "wordabc ");
2891 test_range_moveend(range
, characterW
, -4, -4);
2892 test_range_put_text(range
, "abc def ");
2893 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "abc def abc 123\r\nit's text");
2894 test_range_move(range
, wordW
, 1, 1);
2895 test_range_movestart(range
, characterW
, -1, -1);
2896 test_range_text(range
, " ");
2897 test_range_move(range
, wordW
, 1, 1);
2898 test_range_moveend(range
, characterW
, 3, 3);
2899 test_range_text(range
, "def");
2900 test_range_put_text(range
, "xyz");
2901 test_range_moveend(range
, characterW
, 1, 1);
2902 test_range_move(range
, wordW
, 1, 1);
2903 test_range_moveend(range
, characterW
, 2, 2);
2904 test_range_text(range
, "ab");
2906 IHTMLTxtRange_Release(range
);
2909 static void test_txtrange2(IHTMLDocument2
*doc
)
2911 IHTMLTxtRange
*range
;
2913 range
= test_create_body_range(doc
);
2915 test_range_text(range
, "abc\r\n\r\n123\r\n\r\n\r\ndef");
2916 test_range_move(range
, characterW
, 5, 5);
2917 test_range_moveend(range
, characterW
, 1, 1);
2918 test_range_text(range
, "2");
2919 test_range_move(range
, characterW
, -3, -3);
2920 test_range_moveend(range
, characterW
, 3, 3);
2921 test_range_text(range
, "c\r\n\r\n1");
2922 test_range_collapse(range
, VARIANT_FALSE
);
2923 test_range_moveend(range
, characterW
, 4, 4);
2924 test_range_text(range
, "23");
2925 test_range_moveend(range
, characterW
, 1, 1);
2926 test_range_text(range
, "23\r\n\r\n\r\nd");
2927 test_range_moveend(range
, characterW
, -1, -1);
2928 test_range_text(range
, "23");
2929 test_range_moveend(range
, characterW
, -1, -1);
2930 test_range_text(range
, "23");
2931 test_range_moveend(range
, characterW
, -2, -2);
2932 test_range_text(range
, "2");
2934 IHTMLTxtRange_Release(range
);
2937 static void test_compatmode(IHTMLDocument2
*doc
)
2939 IHTMLDocument5
*doc5
;
2943 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2944 ok(hres
== S_OK
, "Could not get IHTMLDocument5 interface: %08x\n", hres
);
2948 hres
= IHTMLDocument5_get_compatMode(doc5
, &mode
);
2949 IHTMLDocument5_Release(doc5
);
2950 ok(hres
== S_OK
, "get_compatMode failed: %08x\n", hres
);
2951 ok(!strcmp_wa(mode
, "BackCompat"), "compatMode=%s\n", wine_dbgstr_w(mode
));
2952 SysFreeString(mode
);
2955 static void test_location(IHTMLDocument2
*doc
)
2957 IHTMLLocation
*location
, *location2
;
2958 IHTMLWindow2
*window
;
2963 hres
= IHTMLDocument2_get_location(doc
, &location
);
2964 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2966 hres
= IHTMLDocument2_get_location(doc
, &location2
);
2967 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2969 ok(location
== location2
, "location != location2\n");
2970 IHTMLLocation_Release(location2
);
2972 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
2973 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
2975 hres
= IHTMLWindow2_get_location(window
, &location2
);
2976 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2977 ok(location
== location2
, "location != location2\n");
2978 IHTMLLocation_Release(location2
);
2980 test_ifaces((IUnknown
*)location
, location_iids
);
2981 test_disp2((IUnknown
*)location
, &DIID_DispHTMLLocation
, &IID_IHTMLLocation
, "about:blank");
2983 hres
= IHTMLLocation_get_pathname(location
, &str
);
2984 ok(hres
== S_OK
, "get_pathname failed: %08x\n", hres
);
2985 ok(!strcmp_wa(str
, "blank"), "unexpected pathname %s\n", wine_dbgstr_w(str
));
2987 hres
= IHTMLLocation_get_href(location
, NULL
);
2988 ok(hres
== E_POINTER
, "get_href passed: %08x\n", hres
);
2990 hres
= IHTMLLocation_get_href(location
, &str
);
2991 ok(hres
== S_OK
, "get_href failed: %08x\n", hres
);
2992 ok(!strcmp_wa(str
, "about:blank"), "unexpected href %s\n", wine_dbgstr_w(str
));
2994 ref
= IHTMLLocation_Release(location
);
2995 ok(!ref
, "location chould be destroyed here\n");
2998 static void test_navigator(IHTMLDocument2
*doc
)
3000 IHTMLWindow2
*window
;
3001 IOmNavigator
*navigator
, *navigator2
;
3008 static const WCHAR v40
[] = {'4','.','0'};
3010 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
3011 ok(hres
== S_OK
, "parentWidnow failed: %08x\n", hres
);
3013 hres
= IHTMLWindow2_get_navigator(window
, &navigator
);
3014 ok(hres
== S_OK
, "get_navigator failed: %08x\n", hres
);
3015 ok(navigator
!= NULL
, "navigator == NULL\n");
3016 test_disp2((IUnknown
*)navigator
, &DIID_DispHTMLNavigator
, &IID_IOmNavigator
, "[object]");
3018 hres
= IHTMLWindow2_get_navigator(window
, &navigator2
);
3019 ok(hres
== S_OK
, "get_navigator failed: %08x\n", hres
);
3020 ok(navigator
!= navigator2
, "navigator2 != navihgator\n");
3022 IHTMLWindow2_Release(window
);
3023 IOmNavigator_Release(navigator2
);
3025 hres
= IOmNavigator_get_appCodeName(navigator
, &bstr
);
3026 ok(hres
== S_OK
, "get_appCodeName failed: %08x\n", hres
);
3027 ok(!strcmp_wa(bstr
, "Mozilla"), "Unexpected appCodeName %s\n", wine_dbgstr_w(bstr
));
3028 SysFreeString(bstr
);
3031 hres
= IOmNavigator_get_appName(navigator
, &bstr
);
3032 ok(hres
== S_OK
, "get_appName failed: %08x\n", hres
);
3033 ok(!strcmp_wa(bstr
, "Microsoft Internet Explorer"), "Unexpected appCodeName %s\n", wine_dbgstr_w(bstr
));
3034 SysFreeString(bstr
);
3037 hres
= IOmNavigator_get_platform(navigator
, &bstr
);
3038 ok(hres
== S_OK
, "get_platform failed: %08x\n", hres
);
3040 ok(!strcmp_wa(bstr
, "Win64"), "unexpected platform %s\n", wine_dbgstr_w(bstr
));
3042 ok(!strcmp_wa(bstr
, "Win32"), "unexpected platform %s\n", wine_dbgstr_w(bstr
));
3044 SysFreeString(bstr
);
3047 hres
= IOmNavigator_get_appVersion(navigator
, &bstr
);
3048 ok(hres
== S_OK
, "get_appVersion failed: %08x\n", hres
);
3049 ok(!memcmp(bstr
, v40
, sizeof(v40
)), "appVersion is %s\n", wine_dbgstr_w(bstr
));
3050 SysFreeString(bstr
);
3052 hres
= IOmNavigator_toString(navigator
, NULL
);
3053 ok(hres
== E_INVALIDARG
, "toString failed: %08x\n", hres
);
3056 hres
= IOmNavigator_toString(navigator
, &bstr
);
3057 ok(hres
== S_OK
, "toString failed: %08x\n", hres
);
3058 ok(!strcmp_wa(bstr
, "[object]"), "toString returned %s\n", wine_dbgstr_w(bstr
));
3059 SysFreeString(bstr
);
3062 hres
= ObtainUserAgentString(0, buf
, &size
);
3063 ok(hres
== S_OK
, "ObtainUserAgentString failed: %08x\n", hres
);
3066 hres
= IOmNavigator_get_userAgent(navigator
, &bstr
);
3067 ok(hres
== S_OK
, "get_userAgent failed: %08x\n", hres
);
3068 ok(!strcmp_wa(bstr
, buf
), "userAgent returned %s, expected \"%s\"\n", wine_dbgstr_w(bstr
), buf
);
3069 SysFreeString(bstr
);
3071 ref
= IOmNavigator_Release(navigator
);
3072 ok(!ref
, "navigator should be destroyed here\n");
3075 static void test_screen(IHTMLWindow2
*window
)
3077 IHTMLScreen
*screen
, *screen2
;
3078 IDispatchEx
*dispex
;
3083 static const WCHAR displayW
[] = {'D','I','S','P','L','A','Y',0};
3086 hres
= IHTMLWindow2_get_screen(window
, &screen
);
3087 ok(hres
== S_OK
, "get_screen failed: %08x\n", hres
);
3088 ok(screen
!= NULL
, "screen == NULL\n");
3091 hres
= IHTMLWindow2_get_screen(window
, &screen2
);
3092 ok(hres
== S_OK
, "get_screen failed: %08x\n", hres
);
3093 ok(screen2
!= NULL
, "screen == NULL\n");
3094 ok(iface_cmp((IUnknown
*)screen2
, (IUnknown
*)screen
), "screen2 != screen\n");
3095 IHTMLScreen_Release(screen2
);
3097 hres
= IHTMLScreen_QueryInterface(screen
, &IID_IDispatchEx
, (void**)&dispex
);
3098 ok(hres
== S_OK
|| broken(hres
== E_NOINTERFACE
), "Could not get IDispatchEx interface: %08x\n", hres
);
3099 if(SUCCEEDED(hres
)) {
3100 test_disp((IUnknown
*)screen
, &DIID_DispHTMLScreen
, "[object]");
3101 IDispatchEx_Release(dispex
);
3104 hdc
= CreateICW(displayW
, NULL
, NULL
, NULL
);
3106 exl
= GetDeviceCaps(hdc
, HORZRES
);
3108 hres
= IHTMLScreen_get_width(screen
, &l
);
3109 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3110 ok(l
== exl
, "width = %d, expected %d\n", l
, exl
);
3112 exl
= GetDeviceCaps(hdc
, VERTRES
);
3114 hres
= IHTMLScreen_get_height(screen
, &l
);
3115 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3116 ok(l
== exl
, "height = %d, expected %d\n", l
, exl
);
3118 exl
= GetDeviceCaps(hdc
, BITSPIXEL
);
3120 hres
= IHTMLScreen_get_colorDepth(screen
, &l
);
3121 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3122 ok(l
== exl
, "height = %d, expected %d\n", l
, exl
);
3126 IHTMLScreen_Release(screen
);
3129 static void test_current_style(IHTMLCurrentStyle
*current_style
)
3135 test_disp((IUnknown
*)current_style
, &DIID_DispHTMLCurrentStyle
, "[object]");
3136 test_ifaces((IUnknown
*)current_style
, cstyle_iids
);
3138 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
3139 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
3140 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
3143 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
3144 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3145 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
3148 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
3149 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
3152 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
3153 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
3154 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
3157 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
3158 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
3159 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
3162 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
3163 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
3164 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
3167 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
3168 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
3169 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
3172 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
3173 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
3174 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
3177 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
3178 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
3179 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
3182 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
3183 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
3184 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
3187 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
3188 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
3189 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
3192 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
3193 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3194 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
3197 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
3198 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3199 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
3202 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
3203 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
3204 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
3207 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
3208 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
3211 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
3212 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
3215 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
3216 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
3219 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
3220 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
3223 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
3224 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
3227 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
3228 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3231 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
3232 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3233 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
3234 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
3237 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
3238 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
3239 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3242 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
3243 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3244 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3247 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
3248 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3249 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3252 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
3253 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3254 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3257 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
3258 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3259 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3262 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
3263 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
3264 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3267 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
3268 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
3269 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
3270 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
3273 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
3274 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
3275 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3276 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3279 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
3280 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
3281 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3284 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
3285 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
3286 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3289 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
3290 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
3291 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3295 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
3296 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
3297 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3300 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
3301 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
3302 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3305 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
3306 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
3307 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3310 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
3311 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
3312 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3315 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
3316 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
3317 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3320 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
3321 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
3322 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3325 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
3326 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
3327 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3330 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
3331 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
3332 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3335 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
3336 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
3337 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3340 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
3341 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
3342 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3345 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
3346 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
3347 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3350 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
3351 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
3352 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3355 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
3356 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
3357 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3360 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
3361 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
3362 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3365 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
3366 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
3367 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3370 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
3371 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
3372 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3375 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
3376 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
3377 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3380 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
3381 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
3382 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3385 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
3386 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
3387 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3391 static void test_style2(IHTMLStyle2
*style2
)
3396 str
= (void*)0xdeadbeef;
3397 hres
= IHTMLStyle2_get_position(style2
, &str
);
3398 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3399 ok(!str
, "str != NULL\n");
3401 str
= a2bstr("absolute");
3402 hres
= IHTMLStyle2_put_position(style2
, str
);
3403 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
3407 hres
= IHTMLStyle2_get_position(style2
, &str
);
3408 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3409 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
3413 static void test_style3(IHTMLStyle3
*style3
)
3418 str
= (void*)0xdeadbeef;
3419 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
3420 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
3421 ok(!str
, "str != NULL\n");
3423 str
= a2bstr("break-word");
3424 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
3425 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
3429 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
3430 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
3431 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
3435 static void test_style4(IHTMLStyle4
*style4
)
3441 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
3442 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
3445 V_BSTR(&v
) = a2bstr("10px");
3446 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
3447 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
3450 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
3451 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
3452 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3453 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
3455 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
3456 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
3457 VariantClear(&vdefault
);
3460 static void test_default_style(IHTMLStyle
*style
)
3462 IHTMLStyle2
*style2
;
3463 IHTMLStyle3
*style3
;
3464 IHTMLStyle4
*style4
;
3470 BSTR sOverflowDefault
;
3474 test_disp((IUnknown
*)style
, &DIID_DispHTMLStyle
, "[object]");
3475 test_ifaces((IUnknown
*)style
, style_iids
);
3477 test_style_csstext(style
, NULL
);
3479 hres
= IHTMLStyle_get_position(style
, &str
);
3480 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3481 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
3484 hres
= IHTMLStyle_get_marginRight(style
, &v
);
3485 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
3486 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
3487 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3490 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
3491 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
3492 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
3493 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3495 str
= (void*)0xdeadbeef;
3496 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
3497 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
3498 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
3500 str
= (void*)0xdeadbeef;
3501 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
3502 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3503 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
3505 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
3506 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3508 str
= a2bstr("test");
3509 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3510 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
3513 str
= a2bstr("bold");
3514 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3515 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3518 str
= a2bstr("bolder");
3519 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3520 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3523 str
= a2bstr("lighter");
3524 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3525 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3528 str
= a2bstr("100");
3529 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3530 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3533 str
= a2bstr("200");
3534 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3535 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3538 str
= a2bstr("300");
3539 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3540 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3543 str
= a2bstr("400");
3544 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3545 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3548 str
= a2bstr("500");
3549 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3550 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3553 str
= a2bstr("600");
3554 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3555 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3558 str
= a2bstr("700");
3559 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3560 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3563 str
= a2bstr("800");
3564 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3565 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3568 str
= a2bstr("900");
3569 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3570 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3573 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
3574 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3575 ok(!strcmp_wa(str
, "900"), "str != style900\n");
3578 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
3579 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3580 SysFreeString(sDefault
);
3583 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
3584 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
3586 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
3587 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
3589 str
= a2bstr("test");
3590 hres
= IHTMLStyle_put_fontVariant(style
, str
);
3591 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
3594 str
= a2bstr("small-caps");
3595 hres
= IHTMLStyle_put_fontVariant(style
, str
);
3596 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
3599 str
= a2bstr("normal");
3600 hres
= IHTMLStyle_put_fontVariant(style
, str
);
3601 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
3604 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
3605 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
3606 SysFreeString(sDefault
);
3608 str
= (void*)0xdeadbeef;
3609 hres
= IHTMLStyle_get_display(style
, &str
);
3610 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
3611 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
3613 str
= (void*)0xdeadbeef;
3614 hres
= IHTMLStyle_get_visibility(style
, &str
);
3615 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
3616 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
3619 hres
= IHTMLStyle_get_fontSize(style
, &v
);
3620 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
3621 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
3622 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3625 hres
= IHTMLStyle_get_color(style
, &v
);
3626 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
3627 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
3628 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3631 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
3632 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
3633 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
3635 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
3636 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
3637 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
3639 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
3640 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
3641 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
3643 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
3644 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
3647 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
3648 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
3649 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
3651 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
3652 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
3653 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
3655 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
3656 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
3657 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
3659 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
3660 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
3663 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
3664 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
3665 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
3667 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
3668 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
3669 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
3671 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
3672 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
3673 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
3675 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
3676 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
3679 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
3680 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
3681 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
3683 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
3684 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
3685 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
3687 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
3688 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
3689 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
3691 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
3692 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
3695 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
3696 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
3697 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
3699 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
3700 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
3701 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
3703 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
3704 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
3705 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
3707 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
3708 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
3710 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
3711 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3713 str
= a2bstr("invalid");
3714 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3715 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
3718 str
= a2bstr("none");
3719 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3720 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3723 str
= a2bstr("underline");
3724 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3725 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3728 str
= a2bstr("overline");
3729 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3730 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3733 str
= a2bstr("line-through");
3734 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3735 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3738 str
= a2bstr("blink");
3739 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3740 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3743 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
3744 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3745 ok(!strcmp_wa(str
, "blink"), "str != blink\n");
3748 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
3749 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3750 SysFreeString(sDefault
);
3752 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
3753 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
3755 hres
= IHTMLStyle_get_posWidth(style
, &f
);
3756 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
3757 ok(f
== 0.0f
, "f = %f\n", f
);
3759 V_VT(&v
) = VT_EMPTY
;
3760 hres
= IHTMLStyle_get_width(style
, &v
);
3761 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3762 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3763 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
3765 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
3766 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
3768 hres
= IHTMLStyle_get_posWidth(style
, &f
);
3769 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
3771 f
== 2.2f
, /* IE8 */
3775 V_BSTR(&v
) = a2bstr("auto");
3776 hres
= IHTMLStyle_put_width(style
, v
);
3777 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
3780 V_VT(&v
) = VT_EMPTY
;
3781 hres
= IHTMLStyle_get_width(style
, &v
);
3782 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3783 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3784 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
3788 str
= (void*)0xdeadbeef;
3789 hres
= IHTMLStyle_get_margin(style
, &str
);
3790 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3791 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
3794 hres
= IHTMLStyle_put_margin(style
, str
);
3795 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
3798 hres
= IHTMLStyle_get_margin(style
, &str
);
3799 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3800 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
3802 hres
= IHTMLStyle_put_margin(style
, NULL
);
3803 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
3806 hres
= IHTMLStyle_get_border(style
, &str
);
3807 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
3808 ok(!str
|| !*str
, "str is not empty\n");
3811 str
= a2bstr("1px");
3812 hres
= IHTMLStyle_put_border(style
, str
);
3813 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
3816 V_VT(&v
) = VT_EMPTY
;
3817 hres
= IHTMLStyle_get_left(style
, &v
);
3818 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3819 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3820 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3824 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
3825 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
3828 hres
= IHTMLStyle_get_posLeft(style
, &f
);
3829 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
3830 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
3832 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
3833 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
3835 hres
= IHTMLStyle_get_posLeft(style
, &f
);
3836 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
3838 f
== 4.9f
, /* IE8 */
3839 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
3841 /* Ensure left is updated correctly. */
3842 V_VT(&v
) = VT_EMPTY
;
3843 hres
= IHTMLStyle_get_left(style
, &v
);
3844 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3845 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3846 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
3847 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
3848 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3853 V_BSTR(&v
) = a2bstr("3px");
3854 hres
= IHTMLStyle_put_left(style
, v
);
3855 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
3858 hres
= IHTMLStyle_get_posLeft(style
, &f
);
3859 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
3860 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
3862 V_VT(&v
) = VT_EMPTY
;
3863 hres
= IHTMLStyle_get_left(style
, &v
);
3864 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3865 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3866 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3870 hres
= IHTMLStyle_put_left(style
, v
);
3871 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
3873 V_VT(&v
) = VT_EMPTY
;
3874 hres
= IHTMLStyle_get_left(style
, &v
);
3875 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3876 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3877 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3880 V_VT(&v
) = VT_EMPTY
;
3881 hres
= IHTMLStyle_get_top(style
, &v
);
3882 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3883 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3884 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3888 hres
= IHTMLStyle_get_posTop(style
, NULL
);
3889 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
3892 hres
= IHTMLStyle_get_posTop(style
, &f
);
3893 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
3894 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
3896 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
3897 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
3899 hres
= IHTMLStyle_get_posTop(style
, &f
);
3900 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
3902 f
== 4.9f
, /* IE8 */
3903 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
3906 V_BSTR(&v
) = a2bstr("3px");
3907 hres
= IHTMLStyle_put_top(style
, v
);
3908 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
3911 V_VT(&v
) = VT_EMPTY
;
3912 hres
= IHTMLStyle_get_top(style
, &v
);
3913 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3914 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3915 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3918 hres
= IHTMLStyle_get_posTop(style
, &f
);
3919 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
3920 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
3923 hres
= IHTMLStyle_put_top(style
, v
);
3924 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
3926 V_VT(&v
) = VT_EMPTY
;
3927 hres
= IHTMLStyle_get_top(style
, &v
);
3928 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3929 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3930 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3933 /* Test posHeight */
3934 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
3935 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
3937 V_VT(&v
) = VT_EMPTY
;
3938 hres
= IHTMLStyle_get_height(style
, &v
);
3939 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3940 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3941 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3945 hres
= IHTMLStyle_get_posHeight(style
, &f
);
3946 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
3947 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
3949 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
3950 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
3952 hres
= IHTMLStyle_get_posHeight(style
, &f
);
3953 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
3955 f
== 4.9f
, /* IE8 */
3956 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
3959 V_BSTR(&v
) = a2bstr("64px");
3960 hres
= IHTMLStyle_put_height(style
, v
);
3961 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
3964 V_VT(&v
) = VT_EMPTY
;
3965 hres
= IHTMLStyle_get_height(style
, &v
);
3966 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3967 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3968 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3971 hres
= IHTMLStyle_get_posHeight(style
, &f
);
3972 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
3973 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
3975 str
= (void*)0xdeadbeef;
3976 hres
= IHTMLStyle_get_cursor(style
, &str
);
3977 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3978 ok(!str
, "get_cursor != NULL\n");
3981 str
= a2bstr("default");
3982 hres
= IHTMLStyle_put_cursor(style
, str
);
3983 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
3987 hres
= IHTMLStyle_get_cursor(style
, &str
);
3988 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3989 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
3992 V_VT(&v
) = VT_EMPTY
;
3993 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
3994 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
3995 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3996 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
4000 V_BSTR(&v
) = a2bstr("middle");
4001 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
4002 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
4005 V_VT(&v
) = VT_EMPTY
;
4006 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
4007 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
4008 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4009 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4012 str
= (void*)0xdeadbeef;
4013 hres
= IHTMLStyle_get_textAlign(style
, &str
);
4014 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
4015 ok(!str
, "textAlign != NULL\n");
4017 str
= a2bstr("center");
4018 hres
= IHTMLStyle_put_textAlign(style
, str
);
4019 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
4023 hres
= IHTMLStyle_get_textAlign(style
, &str
);
4024 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
4025 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4028 str
= (void*)0xdeadbeef;
4029 hres
= IHTMLStyle_get_filter(style
, &str
);
4030 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
4031 ok(!str
, "filter != NULL\n");
4033 str
= a2bstr("alpha(opacity=100)");
4034 hres
= IHTMLStyle_put_filter(style
, str
);
4035 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
4038 V_VT(&v
) = VT_EMPTY
;
4039 hres
= IHTMLStyle_get_zIndex(style
, &v
);
4040 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
4041 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
4042 ok(!V_I4(&v
), "V_I4(v) != 0\n");
4046 V_BSTR(&v
) = a2bstr("1");
4047 hres
= IHTMLStyle_put_zIndex(style
, v
);
4048 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
4051 V_VT(&v
) = VT_EMPTY
;
4052 hres
= IHTMLStyle_get_zIndex(style
, &v
);
4053 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
4054 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
4055 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
4059 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
4060 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
4062 str
= a2bstr("test");
4063 hres
= IHTMLStyle_put_fontStyle(style
, str
);
4064 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
4067 str
= a2bstr("italic");
4068 hres
= IHTMLStyle_put_fontStyle(style
, str
);
4069 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
4072 str
= a2bstr("oblique");
4073 hres
= IHTMLStyle_put_fontStyle(style
, str
);
4074 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
4077 str
= a2bstr("normal");
4078 hres
= IHTMLStyle_put_fontStyle(style
, str
);
4079 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
4082 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
4083 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
4084 SysFreeString(sDefault
);
4087 hres
= IHTMLStyle_get_overflow(style
, NULL
);
4088 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
4090 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
4091 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
4093 str
= a2bstr("test");
4094 hres
= IHTMLStyle_put_overflow(style
, str
);
4095 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
4098 str
= a2bstr("visible");
4099 hres
= IHTMLStyle_put_overflow(style
, str
);
4100 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
4103 str
= a2bstr("scroll");
4104 hres
= IHTMLStyle_put_overflow(style
, str
);
4105 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
4108 str
= a2bstr("hidden");
4109 hres
= IHTMLStyle_put_overflow(style
, str
);
4110 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
4113 str
= a2bstr("auto");
4114 hres
= IHTMLStyle_put_overflow(style
, str
);
4115 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
4118 hres
= IHTMLStyle_get_overflow(style
, &str
);
4119 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
4120 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
4124 hres
= IHTMLStyle_put_overflow(style
, str
);
4125 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
4128 hres
= IHTMLStyle_get_overflow(style
, &str
);
4129 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
4130 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
4133 /* restore overflow default */
4134 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
4135 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
4136 SysFreeString(sOverflowDefault
);
4138 /* Attribute Tests*/
4139 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
4140 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
4142 str
= a2bstr("position");
4143 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
4144 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
4146 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
4147 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
4148 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
4151 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
4152 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
4155 V_BSTR(&v
) = a2bstr("absolute");
4156 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
4157 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
4160 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
4161 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
4162 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
4163 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4168 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
4169 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
4174 str
= a2bstr("borderLeftStyle");
4175 test_border_styles(style
, str
);
4178 str
= a2bstr("borderbottomstyle");
4179 test_border_styles(style
, str
);
4182 str
= a2bstr("borderrightstyle");
4183 test_border_styles(style
, str
);
4186 str
= a2bstr("bordertopstyle");
4187 test_border_styles(style
, str
);
4190 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
4191 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
4193 str
= a2bstr("none dotted dashed solid");
4194 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4195 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4198 str
= a2bstr("none dotted dashed solid");
4199 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
4200 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
4201 ok(!strcmp_wa(str
, "none dotted dashed solid"),
4202 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
4205 str
= a2bstr("double groove ridge inset");
4206 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4207 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4210 str
= a2bstr("window-inset outset ridge inset");
4211 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4212 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4215 str
= a2bstr("window-inset");
4216 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4217 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4220 str
= a2bstr("none none none none none");
4221 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4222 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4225 str
= a2bstr("invalid none none none");
4226 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4227 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
4230 str
= a2bstr("none invalid none none");
4231 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4232 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
4235 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
4236 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4237 SysFreeString(sDefault
);
4239 /* backgoundColor */
4240 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
4241 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
4242 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
4243 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4247 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
4248 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
4251 V_BSTR(&v
) = a2bstr("10");
4252 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
4253 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
4256 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
4257 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
4258 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4260 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
4261 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
4263 /* BackgroundRepeat */
4264 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
4265 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
4267 str
= a2bstr("invalid");
4268 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4269 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
4272 str
= a2bstr("repeat");
4273 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4274 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4277 str
= a2bstr("no-repeat");
4278 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4279 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4282 str
= a2bstr("repeat-x");
4283 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4284 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4287 str
= a2bstr("repeat-y");
4288 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4289 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4292 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
4293 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
4294 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
4297 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
4298 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4299 SysFreeString(sDefault
);
4302 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
4303 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
4305 str
= a2bstr("red green red blue");
4306 hres
= IHTMLStyle_put_borderColor(style
, str
);
4307 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
4310 hres
= IHTMLStyle_get_borderColor(style
, &str
);
4311 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
4312 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
4315 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
4316 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
4317 SysFreeString(sDefault
);
4320 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
4321 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
4323 str
= a2bstr("thick dotted red");
4324 hres
= IHTMLStyle_put_borderRight(style
, str
);
4325 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
4328 /* IHTMLStyle_get_borderRight appears to have a bug where
4329 it returns the first letter of the color. So we check
4330 each style individually.
4333 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
4334 todo_wine
ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
4335 todo_wine
ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4339 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
4340 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
4341 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4344 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
4345 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
4346 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
4349 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
4350 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
4351 SysFreeString(sDefault
);
4354 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
4355 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
4357 str
= a2bstr("thick dotted red");
4358 hres
= IHTMLStyle_put_borderTop(style
, str
);
4359 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
4362 /* IHTMLStyle_get_borderTop appears to have a bug where
4363 it returns the first letter of the color. So we check
4364 each style individually.
4367 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
4368 todo_wine
ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
4369 todo_wine
ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4373 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
4374 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
4375 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4378 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
4379 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
4380 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
4383 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
4384 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
4385 SysFreeString(sDefault
);
4388 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
4389 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
4391 str
= a2bstr("thick dotted red");
4392 hres
= IHTMLStyle_put_borderBottom(style
, str
);
4393 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
4396 /* IHTMLStyle_get_borderBottom appears to have a bug where
4397 it returns the first letter of the color. So we check
4398 each style individually.
4401 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
4402 todo_wine
ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
4403 todo_wine
ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4407 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
4408 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
4409 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4412 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
4413 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
4414 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
4417 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
4418 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
4419 SysFreeString(sDefault
);
4422 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
4423 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
4425 str
= a2bstr("thick dotted red");
4426 hres
= IHTMLStyle_put_borderLeft(style
, str
);
4427 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
4430 /* IHTMLStyle_get_borderLeft appears to have a bug where
4431 it returns the first letter of the color. So we check
4432 each style individually.
4435 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
4436 todo_wine
ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
4437 todo_wine
ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4441 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
4442 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
4443 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4446 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
4447 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
4448 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
4451 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
4452 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
4453 SysFreeString(sDefault
);
4455 /* backgroundPositionX */
4456 hres
= IHTMLStyle_get_backgroundPositionX(style
, &vDefault
);
4457 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
4460 V_BSTR(&v
) = a2bstr("10px");
4461 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
4462 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
4465 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
4466 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
4467 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4470 hres
= IHTMLStyle_put_backgroundPositionX(style
, vDefault
);
4471 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
4472 VariantClear(&vDefault
);
4474 /* backgroundPositionY */
4475 hres
= IHTMLStyle_get_backgroundPositionY(style
, &vDefault
);
4476 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
4479 V_BSTR(&v
) = a2bstr("10px");
4480 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
4481 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
4484 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
4485 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
4486 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4489 hres
= IHTMLStyle_put_backgroundPositionY(style
, vDefault
);
4490 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
4491 VariantClear(&vDefault
);
4493 /* borderTopWidth */
4494 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
4495 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
4498 V_BSTR(&v
) = a2bstr("10px");
4499 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
4500 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
4503 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
4504 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
4505 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4508 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
4509 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
4510 VariantClear(&vDefault
);
4512 /* borderRightWidth */
4513 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
4514 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
4517 V_BSTR(&v
) = a2bstr("10");
4518 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
4519 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
4522 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
4523 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
4524 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4527 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
4528 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
4529 VariantClear(&vDefault
);
4531 /* borderBottomWidth */
4532 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
4533 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
4536 V_BSTR(&v
) = a2bstr("10");
4537 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
4538 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
4541 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
4542 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
4543 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4546 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
4547 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
4548 VariantClear(&vDefault
);
4550 /* borderLeftWidth */
4551 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
4552 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
4555 V_BSTR(&v
) = a2bstr("10");
4556 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
4557 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
4560 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
4561 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
4562 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4565 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
4566 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
4567 VariantClear(&vDefault
);
4570 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
4571 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
4574 V_BSTR(&v
) = a2bstr("10");
4575 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
4576 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
4579 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
4580 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
4581 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4582 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4585 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
4586 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
4587 VariantClear(&vDefault
);
4590 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
4591 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
4594 V_BSTR(&v
) = a2bstr("11");
4595 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
4596 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
4599 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
4600 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
4601 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4602 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4605 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
4606 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
4607 VariantClear(&vDefault
);
4609 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
4610 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
4611 if(SUCCEEDED(hres
)) {
4612 test_style2(style2
);
4613 IHTMLStyle2_Release(style2
);
4616 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
4617 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
4618 if(SUCCEEDED(hres
)) {
4619 test_style3(style3
);
4620 IHTMLStyle3_Release(style3
);
4623 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
4624 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
4625 if(SUCCEEDED(hres
)) {
4626 test_style4(style4
);
4627 IHTMLStyle4_Release(style4
);
4631 static void test_set_csstext(IHTMLStyle
*style
)
4636 test_style_set_csstext(style
, "background-color: black;");
4638 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
4639 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
4640 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
4641 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4645 static void test_default_selection(IHTMLDocument2
*doc
)
4647 IHTMLSelectionObject
*selection
;
4648 IHTMLTxtRange
*range
;
4653 hres
= IHTMLDocument2_get_selection(doc
, &selection
);
4654 ok(hres
== S_OK
, "get_selection failed: %08x\n", hres
);
4656 hres
= IHTMLSelectionObject_get_type(selection
, &str
);
4657 ok(hres
== S_OK
, "get_type failed: %08x\n", hres
);
4658 ok(!strcmp_wa(str
, "None"), "type = %s\n", wine_dbgstr_w(str
));
4661 hres
= IHTMLSelectionObject_createRange(selection
, &disp
);
4662 IHTMLSelectionObject_Release(selection
);
4663 ok(hres
== S_OK
, "createRange failed: %08x\n", hres
);
4665 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLTxtRange
, (void**)&range
);
4666 IDispatch_Release(disp
);
4667 ok(hres
== S_OK
, "Could not get IHTMLTxtRange interface: %08x\n", hres
);
4669 test_range_text(range
, NULL
);
4670 IHTMLTxtRange_Release(range
);
4673 static void test_doc_elem(IHTMLDocument2
*doc
)
4675 IHTMLDocument2
*doc_node
, *owner_doc
;
4677 IHTMLDocument3
*doc3
;
4680 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
4681 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
4683 hres
= IHTMLDocument3_get_documentElement(doc3
, &elem
);
4684 IHTMLDocument3_Release(doc3
);
4685 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
4687 test_node_name((IUnknown
*)elem
, "HTML");
4688 test_elem_tag((IUnknown
*)elem
, "HTML");
4690 doc_node
= get_doc_node(doc
);
4691 owner_doc
= get_owner_doc((IUnknown
*)elem
);
4692 ok(iface_cmp((IUnknown
*)doc_node
, (IUnknown
*)owner_doc
), "doc_node != owner_doc\n");
4693 IHTMLDocument2_Release(owner_doc
);
4695 owner_doc
= get_owner_doc((IUnknown
*)doc_node
);
4696 ok(!owner_doc
, "owner_doc = %p\n", owner_doc
);
4697 IHTMLDocument2_Release(doc_node
);
4699 test_elem_client_rect((IUnknown
*)elem
);
4701 IHTMLElement_Release(elem
);
4704 static void test_default_body(IHTMLBodyElement
*body
)
4710 WCHAR sBodyText
[] = {'#','F','F','0','0','0','0',0};
4711 WCHAR sTextInvalid
[] = {'I','n','v','a','l','i','d',0};
4713 bstr
= (void*)0xdeadbeef;
4714 hres
= IHTMLBodyElement_get_background(body
, &bstr
);
4715 ok(hres
== S_OK
, "get_background failed: %08x\n", hres
);
4716 ok(bstr
== NULL
, "bstr != NULL\n");
4718 l
= elem_get_scroll_height((IUnknown
*)body
);
4719 ok(l
!= -1, "scrollHeight == -1\n");
4720 l
= elem_get_scroll_width((IUnknown
*)body
);
4721 ok(l
!= -1, "scrollWidth == -1\n");
4722 l
= elem_get_scroll_top((IUnknown
*)body
);
4723 ok(!l
, "scrollTop = %d\n", l
);
4724 elem_get_scroll_left((IUnknown
*)body
);
4726 /* get_text tests */
4727 hres
= IHTMLBodyElement_get_text(body
, &v
);
4728 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4729 ok(V_VT(&v
) == VT_BSTR
, "Expected VT_BSTR got %d\n", V_VT(&v
));
4730 ok(bstr
== NULL
, "bstr != NULL\n");
4733 /* get_text - Invalid Text */
4735 V_BSTR(&v
) = SysAllocString(sTextInvalid
);
4736 hres
= IHTMLBodyElement_put_text(body
, v
);
4737 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4741 hres
= IHTMLBodyElement_get_text(body
, &v
);
4742 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4743 ok(V_VT(&v
) == VT_BSTR
, "Expected VT_BSTR got %d\n", V_VT(&v
));
4744 ok(!strcmp_wa(V_BSTR(&v
), "#00a0d0"), "v != '#00a0d0'\n");
4747 /* get_text - Valid Text */
4749 V_BSTR(&v
) = SysAllocString(sBodyText
);
4750 hres
= IHTMLBodyElement_put_text(body
, v
);
4751 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4755 hres
= IHTMLBodyElement_get_text(body
, &v
);
4756 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4757 ok(V_VT(&v
) == VT_BSTR
, "Expected VT_BSTR got %d\n", V_VT(&v
));
4758 ok(!strcmp_wa(V_BSTR(&v
), "#ff0000"), "v != '#ff0000'\n");
4762 static void test_body_funs(IHTMLBodyElement
*body
)
4764 static WCHAR sRed
[] = {'r','e','d',0};
4769 hres
= IHTMLBodyElement_get_bgColor(body
, &vDefaultbg
);
4770 ok(hres
== S_OK
, "get_bgColor failed: %08x\n", hres
);
4771 ok(V_VT(&vDefaultbg
) == VT_BSTR
, "bstr != NULL\n");
4773 V_VT(&vbg
) = VT_BSTR
;
4774 V_BSTR(&vbg
) = SysAllocString(sRed
);
4775 hres
= IHTMLBodyElement_put_bgColor(body
, vbg
);
4776 ok(hres
== S_OK
, "put_bgColor failed: %08x\n", hres
);
4779 hres
= IHTMLBodyElement_get_bgColor(body
, &vbg
);
4780 ok(hres
== S_OK
, "get_bgColor failed: %08x\n", hres
);
4781 ok(V_VT(&vDefaultbg
) == VT_BSTR
, "V_VT(&vDefaultbg) != VT_BSTR\n");
4782 ok(!strcmp_wa(V_BSTR(&vbg
), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg
)));
4785 /* Restore Originial */
4786 hres
= IHTMLBodyElement_put_bgColor(body
, vDefaultbg
);
4787 ok(hres
== S_OK
, "put_bgColor failed: %08x\n", hres
);
4788 VariantClear(&vDefaultbg
);
4791 static void test_window(IHTMLDocument2
*doc
)
4793 IHTMLWindow2
*window
, *window2
, *self
;
4794 IHTMLDocument2
*doc2
= NULL
;
4800 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
4801 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
4802 test_ifaces((IUnknown
*)window
, window_iids
);
4803 test_disp((IUnknown
*)window
, &DIID_DispHTMLWindow2
, "[object]");
4805 hres
= IHTMLWindow2_get_document(window
, &doc2
);
4806 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
4807 ok(doc2
!= NULL
, "doc2 == NULL\n");
4809 test_ifaces((IUnknown
*)doc2
, doc_node_iids
);
4810 test_disp((IUnknown
*)doc2
, &DIID_DispHTMLDocument
, "[object]");
4812 test_ifaces((IUnknown
*)doc
, doc_obj_iids
);
4813 test_disp((IUnknown
*)doc2
, &DIID_DispHTMLDocument
, "[object]");
4815 unk
= (void*)0xdeadbeef;
4816 hres
= IHTMLDocument2_QueryInterface(doc2
, &IID_ICustomDoc
, (void**)&unk
);
4817 ok(hres
== E_NOINTERFACE
, "QueryInterface(IID_ICustomDoc) returned: %08x\n", hres
);
4818 ok(!unk
, "unk = %p\n", unk
);
4820 IHTMLDocument_Release(doc2
);
4822 hres
= IHTMLWindow2_get_window(window
, &window2
);
4823 ok(hres
== S_OK
, "get_window failed: %08x\n", hres
);
4824 ok(window2
!= NULL
, "window2 == NULL\n");
4826 hres
= IHTMLWindow2_get_self(window
, &self
);
4827 ok(hres
== S_OK
, "get_self failed: %08x\n", hres
);
4828 ok(window2
!= NULL
, "self == NULL\n");
4830 ok(self
== window2
, "self != window2\n");
4832 IHTMLWindow2_Release(window2
);
4833 IHTMLWindow2_Release(self
);
4836 hres
= IHTMLDocument2_get_Script(doc
, &disp
);
4837 ok(hres
== S_OK
, "get_Script failed: %08x\n", hres
);
4838 ok(disp
== (void*)window
, "disp != window\n");
4839 IDispatch_Release(disp
);
4841 hres
= IHTMLWindow2_toString(window
, NULL
);
4842 ok(hres
== E_INVALIDARG
, "toString failed: %08x\n", hres
);
4845 hres
= IHTMLWindow2_toString(window
, &str
);
4846 ok(hres
== S_OK
, "toString failed: %08x\n", hres
);
4847 ok(!strcmp_wa(str
, "[object]"), "toString returned %s\n", wine_dbgstr_w(str
));
4850 test_window_name(window
, NULL
);
4851 set_window_name(window
, "test");
4852 test_window_length(window
, 0);
4853 test_screen(window
);
4855 IHTMLWindow2_Release(window
);
4858 static void test_defaults(IHTMLDocument2
*doc
)
4860 IHTMLStyleSheetsCollection
*stylesheetcol
;
4861 IHTMLCurrentStyle
*cstyle
;
4862 IHTMLBodyElement
*body
;
4863 IHTMLElement2
*elem2
;
4868 IHTMLElementCollection
*collection
;
4870 hres
= IHTMLDocument2_get_body(doc
, &elem
);
4871 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
4873 hres
= IHTMLDocument2_get_images(doc
, NULL
);
4874 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4876 hres
= IHTMLDocument2_get_images(doc
, &collection
);
4877 ok(hres
== S_OK
, "get_images failed: %08x\n", hres
);
4880 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4881 IHTMLElementCollection_Release(collection
);
4884 hres
= IHTMLDocument2_get_applets(doc
, NULL
);
4885 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4887 hres
= IHTMLDocument2_get_applets(doc
, &collection
);
4888 ok(hres
== S_OK
, "get_applets failed: %08x\n", hres
);
4891 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4892 IHTMLElementCollection_Release(collection
);
4895 hres
= IHTMLDocument2_get_links(doc
, NULL
);
4896 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4898 hres
= IHTMLDocument2_get_links(doc
, &collection
);
4899 ok(hres
== S_OK
, "get_links failed: %08x\n", hres
);
4902 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4903 IHTMLElementCollection_Release(collection
);
4906 hres
= IHTMLDocument2_get_forms(doc
, NULL
);
4907 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4909 hres
= IHTMLDocument2_get_forms(doc
, &collection
);
4910 ok(hres
== S_OK
, "get_forms failed: %08x\n", hres
);
4913 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4914 IHTMLElementCollection_Release(collection
);
4917 hres
= IHTMLDocument2_get_anchors(doc
, NULL
);
4918 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4920 hres
= IHTMLDocument2_get_anchors(doc
, &collection
);
4921 ok(hres
== S_OK
, "get_anchors failed: %08x\n", hres
);
4924 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4925 IHTMLElementCollection_Release(collection
);
4928 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLBodyElement
, (void**)&body
);
4929 ok(hres
== S_OK
, "Could not get IHTMBodyElement: %08x\n", hres
);
4930 test_default_body(body
);
4931 test_body_funs(body
);
4932 IHTMLBodyElement_Release(body
);
4934 hres
= IHTMLElement_get_style(elem
, &style
);
4935 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
4937 test_default_style(style
);
4939 test_compatmode(doc
);
4941 test_navigator(doc
);
4943 elem2
= get_elem2_iface((IUnknown
*)elem
);
4944 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
4945 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
4946 if(SUCCEEDED(hres
)) {
4947 test_current_style(cstyle
);
4948 IHTMLCurrentStyle_Release(cstyle
);
4950 IHTMLElement2_Release(elem2
);
4952 IHTMLElement_Release(elem
);
4954 test_set_csstext(style
);
4955 IHTMLStyle_Release(style
);
4957 hres
= IHTMLDocument2_get_styleSheets(doc
, &stylesheetcol
);
4958 ok(hres
== S_OK
, "get_styleSheets failed: %08x\n", hres
);
4961 hres
= IHTMLStyleSheetsCollection_get_length(stylesheetcol
, &l
);
4962 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
4963 ok(l
== 0, "length = %d\n", l
);
4965 IHTMLStyleSheetsCollection_Release(stylesheetcol
);
4967 test_default_selection(doc
);
4968 test_doc_title(doc
, "");
4971 static void test_tr_elem(IHTMLElement
*elem
)
4973 IHTMLElementCollection
*col
;
4977 static const elem_type_t cell_types
[] = {ET_TD
,ET_TD
};
4979 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLTableRow
, (void**)&row
);
4980 ok(hres
== S_OK
, "Could not get IHTMLTableRow iface: %08x\n", hres
);
4985 hres
= IHTMLTableRow_get_cells(row
, &col
);
4986 ok(hres
== S_OK
, "get_cells failed: %08x\n", hres
);
4987 ok(col
!= NULL
, "get_cells returned NULL\n");
4989 test_elem_collection((IUnknown
*)col
, cell_types
, sizeof(cell_types
)/sizeof(*cell_types
));
4990 IHTMLElementCollection_Release(col
);
4992 IHTMLTable_Release(row
);
4995 static void test_table_elem(IHTMLElement
*elem
)
4997 IHTMLElementCollection
*col
;
5002 static const elem_type_t row_types
[] = {ET_TR
,ET_TR
};
5003 static const elem_type_t all_types
[] = {ET_TBODY
,ET_TR
,ET_TR
,ET_TD
,ET_TD
};
5005 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLTable
, (void**)&table
);
5006 ok(hres
== S_OK
, "Could not get IHTMLTable iface: %08x\n", hres
);
5011 hres
= IHTMLTable_get_rows(table
, &col
);
5012 ok(hres
== S_OK
, "get_rows failed: %08x\n", hres
);
5013 ok(col
!= NULL
, "get_ros returned NULL\n");
5015 test_elem_collection((IUnknown
*)col
, row_types
, sizeof(row_types
)/sizeof(*row_types
));
5016 IHTMLElementCollection_Release(col
);
5018 test_elem_all((IUnknown
*)table
, all_types
, sizeof(all_types
)/sizeof(*all_types
));
5020 node
= clone_node((IUnknown
*)table
, VARIANT_TRUE
);
5021 test_elem_tag((IUnknown
*)node
, "TABLE");
5022 test_elem_all((IUnknown
*)node
, all_types
, sizeof(all_types
)/sizeof(*all_types
));
5023 IHTMLDOMNode_Release(node
);
5025 node
= clone_node((IUnknown
*)table
, VARIANT_FALSE
);
5026 test_elem_tag((IUnknown
*)node
, "TABLE");
5027 test_elem_all((IUnknown
*)node
, NULL
, 0);
5028 IHTMLDOMNode_Release(node
);
5030 IHTMLTable_Release(table
);
5033 static void doc_write(IHTMLDocument2
*doc
, BOOL ln
, const char *text
)
5043 sa
= SafeArrayCreate(VT_VARIANT
, 1, &dim
);
5044 SafeArrayAccessData(sa
, (void**)&var
);
5045 V_VT(var
) = VT_BSTR
;
5046 V_BSTR(var
) = str
= a2bstr(text
);
5047 SafeArrayUnaccessData(sa
);
5050 hres
= IHTMLDocument2_writeln(doc
, sa
);
5052 hres
= IHTMLDocument2_write(doc
, sa
);
5053 ok(hres
== S_OK
, "write failed: %08x\n", hres
);
5056 SafeArrayDestroy(sa
);
5059 static void test_frame_doc(IUnknown
*frame_elem
)
5061 IHTMLDocument2
*window_doc
, *elem_doc
;
5062 IHTMLWindow2
*content_window
;
5064 content_window
= get_frame_content_window(frame_elem
);
5065 window_doc
= get_window_doc(content_window
);
5066 IHTMLWindow2_Release(content_window
);
5068 elem_doc
= get_elem_doc(frame_elem
);
5069 ok(iface_cmp((IUnknown
*)window_doc
, (IUnknown
*)elem_doc
), "content_doc != elem_doc\n");
5071 IHTMLDocument2_Release(elem_doc
);
5072 IHTMLDocument2_Release(window_doc
);
5075 static void test_iframe_elem(IHTMLElement
*elem
)
5077 IHTMLDocument2
*content_doc
, *owner_doc
;
5078 IHTMLElementCollection
*col
;
5079 IHTMLWindow2
*content_window
;
5085 static const elem_type_t all_types
[] = {
5093 test_frame_doc((IUnknown
*)elem
);
5095 content_window
= get_frame_content_window((IUnknown
*)elem
);
5096 test_window_length(content_window
, 0);
5098 content_doc
= get_window_doc(content_window
);
5099 IHTMLWindow2_Release(content_window
);
5101 str
= a2bstr("text/html");
5102 V_VT(&errv
) = VT_ERROR
;
5104 hres
= IHTMLDocument2_open(content_doc
, str
, errv
, errv
, errv
, &disp
);
5106 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
5107 ok(disp
!= NULL
, "disp == NULL\n");
5108 ok(iface_cmp((IUnknown
*)disp
, (IUnknown
*)content_window
), "disp != content_window\n");
5109 IDispatch_Release(disp
);
5111 doc_write(content_doc
, FALSE
, "<html><head><title>test</title></head><body><br /></body>");
5112 doc_write(content_doc
, TRUE
, "</html>");
5114 hres
= IHTMLDocument2_get_all(content_doc
, &col
);
5115 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5116 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
5117 IHTMLElementCollection_Release(col
);
5119 hres
= IHTMLDocument2_close(content_doc
);
5120 ok(hres
== S_OK
, "close failed: %08x\n", hres
);
5122 owner_doc
= get_owner_doc((IUnknown
*)content_doc
);
5123 ok(!owner_doc
, "owner_doc = %p\n", owner_doc
);
5125 IHTMLDocument2_Release(content_doc
);
5128 static void test_stylesheet(IDispatch
*disp
)
5130 IHTMLStyleSheetRulesCollection
*col
= NULL
;
5131 IHTMLStyleSheet
*stylesheet
;
5134 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLStyleSheet
, (void**)&stylesheet
);
5135 ok(hres
== S_OK
, "Could not get IHTMLStyleSheet: %08x\n", hres
);
5137 hres
= IHTMLStyleSheet_get_rules(stylesheet
, &col
);
5138 ok(hres
== S_OK
, "get_rules failed: %08x\n", hres
);
5139 ok(col
!= NULL
, "col == NULL\n");
5141 IHTMLStyleSheetRulesCollection_Release(col
);
5142 IHTMLStyleSheet_Release(stylesheet
);
5145 static void test_stylesheets(IHTMLDocument2
*doc
)
5147 IHTMLStyleSheetsCollection
*col
= NULL
;
5152 hres
= IHTMLDocument2_get_styleSheets(doc
, &col
);
5153 ok(hres
== S_OK
, "get_styleSheets failed: %08x\n", hres
);
5154 ok(col
!= NULL
, "col == NULL\n");
5156 hres
= IHTMLStyleSheetsCollection_get_length(col
, &len
);
5157 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
5158 ok(len
== 1, "len=%d\n", len
);
5164 hres
= IHTMLStyleSheetsCollection_item(col
, &idx
, &res
);
5165 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
5166 ok(V_VT(&res
) == VT_DISPATCH
, "V_VT(res) = %d\n", V_VT(&res
));
5167 ok(V_DISPATCH(&res
) != NULL
, "V_DISPATCH(&res) == NULL\n");
5168 test_stylesheet(V_DISPATCH(&res
));
5175 hres
= IHTMLStyleSheetsCollection_item(col
, &idx
, &res
);
5176 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
5177 ok(V_VT(&res
) == VT_EMPTY
, "V_VT(res) = %d\n", V_VT(&res
));
5178 ok(V_DISPATCH(&res
) != NULL
, "V_DISPATCH(&res) == NULL\n");
5181 IHTMLStyleSheetsCollection_Release(col
);
5184 static void test_child_col_disp(IHTMLDOMChildrenCollection
*col
)
5186 IDispatchEx
*dispex
;
5188 DISPPARAMS dp
= {NULL
, NULL
, 0, 0};
5196 static const WCHAR w0
[] = {'0',0};
5197 static const WCHAR w100
[] = {'1','0','0',0};
5199 hres
= IHTMLDOMChildrenCollection_QueryInterface(col
, &IID_IDispatchEx
, (void**)&dispex
);
5200 ok(hres
== S_OK
, "Could not get IDispatchEx: %08x\n", hres
);
5202 bstr
= SysAllocString(w0
);
5203 hres
= IDispatchEx_GetDispID(dispex
, bstr
, fdexNameCaseSensitive
, &id
);
5204 ok(hres
== S_OK
, "GetDispID failed: %08x\n", hres
);
5205 SysFreeString(bstr
);
5208 hres
= IDispatchEx_InvokeEx(dispex
, id
, LOCALE_NEUTRAL
, INVOKE_PROPERTYGET
, &dp
, &var
, &ei
, NULL
);
5209 ok(hres
== S_OK
, "InvokeEx failed: %08x\n", hres
);
5210 ok(V_VT(&var
) == VT_DISPATCH
, "V_VT(var)=%d\n", V_VT(&var
));
5211 ok(V_DISPATCH(&var
) != NULL
, "V_DISPATCH(var) == NULL\n");
5212 node
= get_node_iface((IUnknown
*)V_DISPATCH(&var
));
5213 type
= get_node_type((IUnknown
*)node
);
5214 ok(type
== 3, "type=%d\n", type
);
5215 IHTMLDOMNode_Release(node
);
5218 bstr
= SysAllocString(w100
);
5219 hres
= IDispatchEx_GetDispID(dispex
, bstr
, fdexNameCaseSensitive
, &id
);
5220 ok(hres
== DISP_E_UNKNOWNNAME
, "GetDispID failed: %08x, expected DISP_E_UNKNOWNNAME\n", hres
);
5221 SysFreeString(bstr
);
5223 IDispatchEx_Release(dispex
);
5228 static void test_elems(IHTMLDocument2
*doc
)
5230 IHTMLElementCollection
*col
;
5231 IHTMLDOMChildrenCollection
*child_col
;
5232 IHTMLElement
*elem
, *elem2
, *elem3
;
5233 IHTMLDOMNode
*node
, *node2
;
5234 IHTMLWindow2
*window
;
5238 IHTMLElementCollection
*collection
;
5239 IHTMLDocument3
*doc3
;
5242 static const elem_type_t all_types
[] = {
5268 static const elem_type_t item_types
[] = {
5274 hres
= IHTMLDocument2_get_all(doc
, &col
);
5275 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5276 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
5277 test_elem_col_item(col
, "x", item_types
, sizeof(item_types
)/sizeof(item_types
[0]));
5278 IHTMLElementCollection_Release(col
);
5280 hres
= IHTMLDocument2_get_images(doc
, &collection
);
5281 ok(hres
== S_OK
, "get_images failed: %08x\n", hres
);
5284 static const elem_type_t images_types
[] = {ET_IMG
};
5285 test_elem_collection((IUnknown
*)collection
, images_types
, 1);
5287 IHTMLElementCollection_Release(collection
);
5290 hres
= IHTMLDocument2_get_links(doc
, &collection
);
5291 ok(hres
== S_OK
, "get_links failed: %08x\n", hres
);
5294 static const elem_type_t images_types
[] = {ET_A
};
5295 test_elem_collection((IUnknown
*)collection
, images_types
, 1);
5297 IHTMLElementCollection_Release(collection
);
5300 hres
= IHTMLDocument2_get_anchors(doc
, &collection
);
5301 ok(hres
== S_OK
, "get_anchors failed: %08x\n", hres
);
5304 static const elem_type_t anchor_types
[] = {ET_A
};
5305 test_elem_collection((IUnknown
*)collection
, anchor_types
, 1);
5307 IHTMLElementCollection_Release(collection
);
5310 elem
= get_doc_elem(doc
);
5311 test_elem_all((IUnknown
*)elem
, all_types
+1, sizeof(all_types
)/sizeof(all_types
[0])-1);
5312 IHTMLElement_Release(elem
);
5314 get_elem_by_id(doc
, "xxx", FALSE
);
5315 elem
= get_doc_elem_by_id(doc
, "xxx");
5316 ok(!elem
, "elem != NULL\n");
5318 elem
= get_doc_elem_by_id(doc
, "s");
5319 ok(elem
!= NULL
, "elem == NULL\n");
5321 test_elem_type((IUnknown
*)elem
, ET_SELECT
);
5322 test_elem_attr(elem
, "xxx", NULL
);
5323 test_elem_attr(elem
, "id", "s");
5324 test_elem_class((IUnknown
*)elem
, NULL
);
5325 test_elem_set_class((IUnknown
*)elem
, "cl");
5326 test_elem_set_class((IUnknown
*)elem
, NULL
);
5327 test_elem_tabindex((IUnknown
*)elem
, 0);
5328 test_elem_set_tabindex((IUnknown
*)elem
, 1);
5330 node
= test_node_get_parent((IUnknown
*)elem
);
5331 ok(node
!= NULL
, "node == NULL\n");
5332 test_node_name((IUnknown
*)node
, "BODY");
5333 node2
= test_node_get_parent((IUnknown
*)node
);
5334 IHTMLDOMNode_Release(node
);
5335 ok(node2
!= NULL
, "node == NULL\n");
5336 test_node_name((IUnknown
*)node2
, "HTML");
5337 node
= test_node_get_parent((IUnknown
*)node2
);
5338 IHTMLDOMNode_Release(node2
);
5339 ok(node
!= NULL
, "node == NULL\n");
5342 test_node_name((IUnknown
*)node
, "#document");
5343 type
= get_node_type((IUnknown
*)node
);
5344 ok(type
== 9, "type=%d, expected 9\n", type
);
5345 node2
= test_node_get_parent((IUnknown
*)node
);
5346 IHTMLDOMNode_Release(node
);
5347 ok(node2
== NULL
, "node != NULL\n");
5350 elem2
= test_elem_get_parent((IUnknown
*)elem
);
5351 ok(elem2
!= NULL
, "elem2 == NULL\n");
5352 test_node_name((IUnknown
*)elem2
, "BODY");
5353 elem3
= test_elem_get_parent((IUnknown
*)elem2
);
5354 IHTMLElement_Release(elem2
);
5355 ok(elem3
!= NULL
, "elem3 == NULL\n");
5356 test_node_name((IUnknown
*)elem3
, "HTML");
5357 elem2
= test_elem_get_parent((IUnknown
*)elem3
);
5358 IHTMLElement_Release(elem3
);
5359 ok(elem2
== NULL
, "elem2 != NULL\n");
5361 test_elem_getelembytag((IUnknown
*)elem
, ET_OPTION
, 2);
5362 test_elem_getelembytag((IUnknown
*)elem
, ET_SELECT
, 0);
5363 test_elem_getelembytag((IUnknown
*)elem
, ET_HTML
, 0);
5365 test_elem_innertext(elem
, "opt1opt2");
5367 IHTMLElement_Release(elem
);
5370 elem
= get_elem_by_id(doc
, "s", TRUE
);
5372 IHTMLSelectElement
*select
;
5373 IHTMLDocument2
*doc_node
, *elem_doc
;
5375 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLSelectElement
, (void**)&select
);
5376 ok(hres
== S_OK
, "Could not get IHTMLSelectElement interface: %08x\n", hres
);
5378 test_select_elem(select
);
5380 test_elem_title((IUnknown
*)select
, NULL
);
5381 test_elem_set_title((IUnknown
*)select
, "Title");
5382 test_elem_title((IUnknown
*)select
, "Title");
5383 test_elem_offset((IUnknown
*)select
);
5385 node
= get_first_child((IUnknown
*)select
);
5386 ok(node
!= NULL
, "node == NULL\n");
5388 test_elem_type((IUnknown
*)node
, ET_OPTION
);
5389 IHTMLDOMNode_Release(node
);
5392 type
= get_node_type((IUnknown
*)select
);
5393 ok(type
== 1, "type=%d\n", type
);
5395 IHTMLSelectElement_Release(select
);
5397 elem_doc
= get_elem_doc((IUnknown
*)elem
);
5399 doc_node
= get_doc_node(doc
);
5400 ok(iface_cmp((IUnknown
*)elem_doc
, (IUnknown
*)doc_node
), "disp != doc\n");
5401 IHTMLDocument2_Release(doc_node
);
5402 IHTMLDocument2_Release(elem_doc
);
5404 IHTMLElement_Release(elem
);
5407 elem
= get_elem_by_id(doc
, "sc", TRUE
);
5409 IHTMLScriptElement
*script
;
5412 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLScriptElement
, (void**)&script
);
5413 ok(hres
== S_OK
, "Could not get IHTMLScriptElement interface: %08x\n", hres
);
5419 hres
= IHTMLScriptElement_get_type(script
, &type
);
5420 ok(hres
== S_OK
, "get_type failed: %08x\n", hres
);
5421 ok(!strcmp_wa(type
, "text/javascript"), "Unexpected type %s\n", wine_dbgstr_w(type
));
5422 SysFreeString(type
);
5425 hres
= IHTMLScriptElement_put_defer(script
, VARIANT_TRUE
);
5426 ok(hres
== S_OK
, "put_defer failed: %08x\n", hres
);
5428 hres
= IHTMLScriptElement_get_defer(script
, &vb
);
5429 ok(hres
== S_OK
, "get_defer failed: %08x\n", hres
);
5430 ok(vb
== VARIANT_TRUE
, "get_defer result is %08x\n", hres
);
5432 hres
= IHTMLScriptElement_put_defer(script
, VARIANT_FALSE
);
5433 ok(hres
== S_OK
, "put_defer failed: %08x\n", hres
);
5436 IHTMLScriptElement_Release(script
);
5439 elem
= get_elem_by_id(doc
, "in", TRUE
);
5441 IHTMLInputElement
*input
;
5443 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLInputElement
, (void**)&input
);
5444 ok(hres
== S_OK
, "Could not get IHTMLInputElement: %08x\n", hres
);
5446 test_elem_id((IUnknown
*)elem
, "in");
5447 test_elem_put_id((IUnknown
*)elem
, "newin");
5448 test_input_get_disabled(input
, VARIANT_FALSE
);
5449 test_input_set_disabled(input
, VARIANT_TRUE
);
5450 test_input_set_disabled(input
, VARIANT_FALSE
);
5451 test_elem3_set_disabled((IUnknown
*)input
, VARIANT_TRUE
);
5452 test_input_get_disabled(input
, VARIANT_TRUE
);
5453 test_elem3_set_disabled((IUnknown
*)input
, VARIANT_FALSE
);
5454 test_input_get_disabled(input
, VARIANT_FALSE
);
5455 test_elem_client_size((IUnknown
*)elem
);
5457 test_node_get_value_str((IUnknown
*)elem
, NULL
);
5458 test_node_put_value_str((IUnknown
*)elem
, "test");
5459 test_node_get_value_str((IUnknown
*)elem
, NULL
);
5460 test_input_value((IUnknown
*)elem
, NULL
);
5461 test_input_put_value((IUnknown
*)elem
, "test");
5462 test_input_value((IUnknown
*)elem
, NULL
);
5463 test_elem_class((IUnknown
*)elem
, "testclass");
5464 test_elem_tabindex((IUnknown
*)elem
, 2);
5465 test_elem_set_tabindex((IUnknown
*)elem
, 3);
5466 test_elem_title((IUnknown
*)elem
, "test title");
5468 test_input_get_defaultchecked(input
, VARIANT_FALSE
);
5469 test_input_set_defaultchecked(input
, VARIANT_TRUE
);
5470 test_input_set_defaultchecked(input
, VARIANT_FALSE
);
5472 test_input_get_checked(input
, VARIANT_FALSE
);
5473 test_input_set_checked(input
, VARIANT_TRUE
);
5474 test_input_set_checked(input
, VARIANT_FALSE
);
5476 test_input_src(input
, NULL
);
5477 test_input_set_src(input
, "about:blank");
5479 IHTMLInputElement_Release(input
);
5480 IHTMLElement_Release(elem
);
5483 elem
= get_elem_by_id(doc
, "imgid", TRUE
);
5485 test_img_src((IUnknown
*)elem
, "");
5486 test_img_set_src((IUnknown
*)elem
, "about:blank");
5487 test_img_alt((IUnknown
*)elem
, NULL
);
5488 test_img_set_alt((IUnknown
*)elem
, "alt test");
5489 IHTMLElement_Release(elem
);
5492 elem
= get_doc_elem_by_id(doc
, "tbl");
5493 ok(elem
!= NULL
, "elem == NULL\n");
5495 test_table_elem(elem
);
5496 IHTMLElement_Release(elem
);
5499 elem
= get_doc_elem_by_id(doc
, "row2");
5500 ok(elem
!= NULL
, "elem == NULL\n");
5503 IHTMLElement_Release(elem
);
5506 elem
= get_doc_elem_by_id(doc
, "ifr");
5507 ok(elem
!= NULL
, "elem == NULL\n");
5509 test_iframe_elem(elem
);
5510 IHTMLElement_Release(elem
);
5513 elem
= get_elem_by_id(doc
, "a", TRUE
);
5515 test_anchor_href((IUnknown
*)elem
, "http://test/");
5516 IHTMLElement_Release(elem
);
5519 hres
= IHTMLDocument2_get_body(doc
, &elem
);
5520 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
5522 node
= get_first_child((IUnknown
*)elem
);
5523 ok(node
!= NULL
, "node == NULL\n");
5525 test_ifaces((IUnknown
*)node
, text_iids
);
5526 test_disp((IUnknown
*)node
, &DIID_DispHTMLDOMTextNode
, "[object]");
5528 node2
= get_first_child((IUnknown
*)node
);
5529 ok(!node2
, "node2 != NULL\n");
5531 type
= get_node_type((IUnknown
*)node
);
5532 ok(type
== 3, "type=%d\n", type
);
5534 test_node_get_value_str((IUnknown
*)node
, "text test");
5535 test_node_put_value_str((IUnknown
*)elem
, "test text");
5536 test_node_get_value_str((IUnknown
*)node
, "text test");
5538 IHTMLDOMNode_Release(node
);
5541 child_col
= get_child_nodes((IUnknown
*)elem
);
5542 ok(child_col
!= NULL
, "child_coll == NULL\n");
5546 test_disp((IUnknown
*)child_col
, &DIID_DispDOMChildrenCollection
, "[object]");
5548 hres
= IHTMLDOMChildrenCollection_get_length(child_col
, &length
);
5549 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
5550 ok(length
, "length=0\n");
5553 node
= get_child_item(child_col
, 0);
5554 ok(node
!= NULL
, "node == NULL\n");
5556 type
= get_node_type((IUnknown
*)node
);
5557 ok(type
== 3, "type=%d\n", type
);
5558 node2
= node_get_next((IUnknown
*)node
);
5559 IHTMLDOMNode_Release(node
);
5562 node
= get_child_item(child_col
, 1);
5563 ok(node
!= NULL
, "node == NULL\n");
5565 type
= get_node_type((IUnknown
*)node
);
5566 ok(type
== 8, "type=%d\n", type
);
5568 test_elem_id((IUnknown
*)node
, NULL
);
5569 ok(iface_cmp((IUnknown
*)node2
, (IUnknown
*)node
), "node2 != node\n");
5570 IHTMLDOMNode_Release(node2
);
5571 IHTMLDOMNode_Release(node
);
5574 hres
= IHTMLDOMChildrenCollection_item(child_col
, length
- 1, NULL
);
5575 ok(hres
== E_POINTER
, "item failed: %08x, expected E_POINTER\n", hres
);
5577 hres
= IHTMLDOMChildrenCollection_item(child_col
, length
, NULL
);
5578 ok(hres
== E_POINTER
, "item failed: %08x, expected E_POINTER\n", hres
);
5580 hres
= IHTMLDOMChildrenCollection_item(child_col
, 6000, &disp
);
5581 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
5583 hres
= IHTMLDOMChildrenCollection_item(child_col
, length
, &disp
);
5584 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
5586 test_child_col_disp(child_col
);
5588 IHTMLDOMChildrenCollection_Release(child_col
);
5591 test_elem3_get_disabled((IUnknown
*)elem
, VARIANT_FALSE
);
5592 test_elem3_set_disabled((IUnknown
*)elem
, VARIANT_TRUE
);
5593 test_elem3_set_disabled((IUnknown
*)elem
, VARIANT_FALSE
);
5595 IHTMLElement_Release(elem
);
5597 test_stylesheets(doc
);
5598 test_create_option_elem(doc
);
5599 test_create_img_elem(doc
);
5601 elem
= get_doc_elem_by_id(doc
, "tbl");
5602 ok(elem
!= NULL
, "elem = NULL\n");
5603 test_elem_set_innertext(elem
, "inner text");
5604 IHTMLElement_Release(elem
);
5606 test_doc_title(doc
, "test");
5607 test_doc_set_title(doc
, "test title");
5608 test_doc_title(doc
, "test title");
5611 hres
= IHTMLDocument2_get_Script(doc
, &disp
);
5612 ok(hres
== S_OK
, "get_Script failed: %08x\n", hres
);
5615 IDispatchEx
*dispex
;
5616 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&dispex
);
5617 ok(hres
== S_OK
, "IDispatch_QueryInterface failed: %08x\n", hres
);
5621 BSTR str
= a2bstr("Testing");
5622 hres
= IDispatchEx_GetDispID(dispex
, str
, 1, &pid
);
5623 ok(hres
== S_OK
, "GetDispID failed: %08x\n", hres
);
5624 ok(pid
!= -1, "pid == -1\n");
5626 IDispatchEx_Release(dispex
);
5629 IDispatch_Release(disp
);
5631 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
5632 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
5634 str
= a2bstr("img");
5635 hres
= IHTMLDocument3_getElementsByTagName(doc3
, str
, &col
);
5636 ok(hres
== S_OK
, "getElementsByTagName(%s) failed: %08x\n", wine_dbgstr_w(str
), hres
);
5640 static const elem_type_t img_types
[] = { ET_IMG
};
5642 test_elem_collection((IUnknown
*)col
, img_types
, sizeof(img_types
)/sizeof(img_types
[0]));
5643 IHTMLElementCollection_Release(col
);
5646 elem
= get_doc_elem_by_id(doc
, "y");
5647 test_elem_set_innerhtml((IUnknown
*)elem
, "inner html");
5648 test_elem_innerhtml((IUnknown
*)elem
, "inner html");
5649 test_elem_set_innerhtml((IUnknown
*)elem
, "");
5650 test_elem_innerhtml((IUnknown
*)elem
, NULL
);
5651 node
= node_get_next((IUnknown
*)elem
);
5652 ok(!node
, "node = %p\n", node
);
5654 elem2
= get_doc_elem_by_id(doc
, "x");
5655 test_elem_tag((IUnknown
*)elem2
, "A");
5656 node
= node_get_next((IUnknown
*)elem2
);
5657 IHTMLDOMNode_Release(node
);
5658 IHTMLElement_Release(elem2
);
5659 IHTMLElement_Release(elem
);
5661 IHTMLDocument3_Release(doc3
);
5663 window
= get_doc_window(doc
);
5664 test_window_name(window
, NULL
);
5665 set_window_name(window
, "test name");
5666 test_window_length(window
, 1);
5667 IHTMLWindow2_Release(window
);
5670 static void test_elems2(IHTMLDocument2
*doc
)
5672 IHTMLElement
*elem
, *elem2
;
5674 static const elem_type_t outer_types
[] = {
5679 elem
= get_doc_elem_by_id(doc
, "divid");
5681 test_elem_set_innerhtml((IUnknown
*)elem
, "<div id=\"innerid\"></div>");
5682 elem2
= get_doc_elem_by_id(doc
, "innerid");
5683 ok(elem2
!= NULL
, "elem2 == NULL\n");
5684 test_elem_set_outerhtml((IUnknown
*)elem2
, "<br><a href=\"about:blank\" id=\"aid\">a</a>");
5685 test_elem_all((IUnknown
*)elem
, outer_types
, sizeof(outer_types
)/sizeof(*outer_types
));
5686 IHTMLElement_Release(elem2
);
5688 elem2
= get_doc_elem_by_id(doc
, "aid");
5689 ok(elem2
!= NULL
, "elem2 == NULL\n");
5690 test_elem_set_outerhtml((IUnknown
*)elem2
, "");
5691 test_elem_all((IUnknown
*)elem
, outer_types
, 1);
5692 IHTMLElement_Release(elem2
);
5694 IHTMLElement_Release(elem
);
5697 static void test_create_elems(IHTMLDocument2
*doc
)
5699 IHTMLElement
*elem
, *body
, *elem2
;
5700 IHTMLDOMNode
*node
, *node2
, *node3
, *comment
;
5701 IHTMLDocument5
*doc5
;
5708 static const elem_type_t types1
[] = { ET_TESTG
};
5710 elem
= test_create_elem(doc
, "TEST");
5711 test_elem_tag((IUnknown
*)elem
, "TEST");
5712 type
= get_node_type((IUnknown
*)elem
);
5713 ok(type
== 1, "type=%d\n", type
);
5714 test_ifaces((IUnknown
*)elem
, elem_iids
);
5715 test_disp((IUnknown
*)elem
, &DIID_DispHTMLGenericElement
, "[object]");
5717 hres
= IHTMLDocument2_get_body(doc
, &body
);
5718 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
5719 test_node_has_child((IUnknown
*)body
, VARIANT_FALSE
);
5721 node
= test_node_append_child((IUnknown
*)body
, (IUnknown
*)elem
);
5722 test_node_has_child((IUnknown
*)body
, VARIANT_TRUE
);
5723 elem2
= get_elem_iface((IUnknown
*)node
);
5724 IHTMLElement_Release(elem2
);
5726 hres
= IHTMLElement_get_all(body
, &disp
);
5727 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5728 test_elem_collection((IUnknown
*)disp
, types1
, sizeof(types1
)/sizeof(types1
[0]));
5729 IDispatch_Release(disp
);
5731 test_node_remove_child((IUnknown
*)body
, node
);
5733 hres
= IHTMLElement_get_all(body
, &disp
);
5734 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5735 test_elem_collection((IUnknown
*)disp
, NULL
, 0);
5736 IDispatch_Release(disp
);
5737 test_node_has_child((IUnknown
*)body
, VARIANT_FALSE
);
5739 IHTMLElement_Release(elem
);
5740 IHTMLDOMNode_Release(node
);
5742 node
= test_create_text(doc
, "test");
5743 test_ifaces((IUnknown
*)node
, text_iids
);
5744 test_disp((IUnknown
*)node
, &DIID_DispHTMLDOMTextNode
, "[object]");
5745 test_text_length((IUnknown
*)node
, 4);
5747 V_VT(&var
) = VT_NULL
;
5748 node2
= test_node_insertbefore((IUnknown
*)body
, node
, &var
);
5749 IHTMLDOMNode_Release(node
);
5751 node
= test_create_text(doc
, "insert ");
5753 V_VT(&var
) = VT_DISPATCH
;
5754 V_DISPATCH(&var
) = (IDispatch
*)node2
;
5755 node3
= test_node_insertbefore((IUnknown
*)body
, node
, &var
);
5756 IHTMLDOMNode_Release(node
);
5757 IHTMLDOMNode_Release(node2
);
5758 IHTMLDOMNode_Release(node3
);
5760 test_elem_innertext(body
, "insert test");
5761 test_elem_innerhtml((IUnknown
*)body
, "insert test");
5763 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
5766 str
= a2bstr("testing");
5767 hres
= IHTMLDocument5_createComment(doc5
, str
, &comment
);
5769 ok(hres
== S_OK
, "createComment failed: %08x\n", hres
);
5772 type
= get_node_type((IUnknown
*)comment
);
5773 ok(type
== 8, "type=%d, expected 8\n", type
);
5775 test_node_get_value_str((IUnknown
*)comment
, "testing");
5777 IHTMLDOMNode_Release(comment
);
5780 IHTMLDocument5_Release(doc5
);
5783 IHTMLElement_Release(body
);
5786 static void test_exec(IUnknown
*unk
, const GUID
*grpid
, DWORD cmdid
, VARIANT
*in
, VARIANT
*out
)
5788 IOleCommandTarget
*cmdtrg
;
5791 hres
= IHTMLTxtRange_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5792 ok(hres
== S_OK
, "Could not get IOleCommandTarget interface: %08x\n", hres
);
5794 hres
= IOleCommandTarget_Exec(cmdtrg
, grpid
, cmdid
, 0, in
, out
);
5795 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
5797 IOleCommandTarget_Release(cmdtrg
);
5800 static void test_indent(IHTMLDocument2
*doc
)
5802 IHTMLElementCollection
*col
;
5803 IHTMLTxtRange
*range
;
5806 static const elem_type_t all_types
[] = {
5815 static const elem_type_t indent_types
[] = {
5826 hres
= IHTMLDocument2_get_all(doc
, &col
);
5827 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5828 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
5829 IHTMLElementCollection_Release(col
);
5831 range
= test_create_body_range(doc
);
5832 test_exec((IUnknown
*)range
, &CGID_MSHTML
, IDM_INDENT
, NULL
, NULL
);
5833 IHTMLTxtRange_Release(range
);
5835 hres
= IHTMLDocument2_get_all(doc
, &col
);
5836 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5837 test_elem_collection((IUnknown
*)col
, indent_types
, sizeof(indent_types
)/sizeof(indent_types
[0]));
5838 IHTMLElementCollection_Release(col
);
5841 static void test_cond_comment(IHTMLDocument2
*doc
)
5843 IHTMLElementCollection
*col
;
5846 static const elem_type_t all_types
[] = {
5854 hres
= IHTMLDocument2_get_all(doc
, &col
);
5855 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5856 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
5857 IHTMLElementCollection_Release(col
);
5860 static void test_frame(IDispatch
*disp
, const char *exp_id
)
5862 IHTMLWindow2
*frame2
, *parent
, *top
;
5863 IHTMLDocument2
*parent_doc
, *top_doc
;
5864 IHTMLWindow4
*frame
;
5865 IHTMLFrameBase
*frame_elem
;
5868 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLWindow4
, (void**)&frame
);
5869 ok(hres
== S_OK
, "Could not get IHTMLWindow4 interface: 0x%08x\n", hres
);
5873 hres
= IHTMLWindow4_get_frameElement(frame
, &frame_elem
);
5874 ok(hres
== S_OK
, "IHTMLWindow4_get_frameElement failed: 0x%08x\n", hres
);
5875 IHTMLWindow4_Release(frame
);
5879 test_frame_doc((IUnknown
*)frame_elem
);
5880 test_elem_id((IUnknown
*)frame_elem
, exp_id
);
5881 IHTMLElement_Release(frame_elem
);
5883 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLWindow2
, (void**)&frame2
);
5884 ok(hres
== S_OK
, "Could not get IHTMLWindow2 interface: 0x%08x\n", hres
);
5888 hres
= IHTMLWindow2_get_parent(frame2
, &parent
);
5889 ok(hres
== S_OK
, "IHTMLWindow2_get_parent failed: 0x%08x\n", hres
);
5891 IHTMLWindow2_Release(frame2
);
5895 hres
= IHTMLWindow2_get_document(parent
, &parent_doc
);
5896 ok(hres
== S_OK
, "IHTMLWindow2_get_document failed: 0x%08x\n", hres
);
5897 IHTMLWindow2_Release(parent
);
5899 IHTMLWindow2_Release(frame2
);
5903 test_doc_title(parent_doc
, "frameset test");
5904 IHTMLDocument2_Release(parent_doc
);
5907 hres
= IHTMLWindow2_get_top(frame2
, &top
);
5908 ok(hres
== S_OK
, "IHTMLWindow2_get_top failed: 0x%08x\n", hres
);
5909 IHTMLWindow2_Release(frame2
);
5913 hres
= IHTMLWindow2_get_document(top
, &top_doc
);
5914 ok(hres
== S_OK
, "IHTMLWindow2_get_document failed: 0x%08x\n", hres
);
5915 IHTMLWindow2_Release(top
);
5919 test_doc_title(top_doc
, "frameset test");
5920 IHTMLDocument2_Release(top_doc
);
5923 static void test_frameset(IHTMLDocument2
*doc
)
5925 IHTMLWindow2
*window
;
5926 IHTMLFramesCollection2
*frames
;
5928 IHTMLFrameBase
*fbase
;
5930 VARIANT index_var
, result_var
;
5934 window
= get_doc_window(doc
);
5936 /* test using IHTMLFramesCollection object */
5938 hres
= IHTMLWindow2_get_frames(window
, &frames
);
5939 ok(hres
== S_OK
, "IHTMLWindow2_get_frames failed: 0x%08x\n", hres
);
5940 IHTMLWindow2_Release(window
);
5944 /* test result length */
5945 hres
= IHTMLFramesCollection2_get_length(frames
, &length
);
5946 ok(hres
== S_OK
, "IHTMLFramesCollection2_get_length failed: 0x%08x\n", hres
);
5947 ok(length
== 3, "IHTMLFramesCollection2_get_length should have been 3, was: %d\n", length
);
5949 /* test first frame */
5950 V_VT(&index_var
) = VT_I4
;
5951 V_I4(&index_var
) = 0;
5952 hres
= IHTMLFramesCollection2_item(frames
, &index_var
, &result_var
);
5953 ok(hres
== S_OK
, "IHTMLFramesCollection2_item failed: 0x%08x\n", hres
);
5954 if(SUCCEEDED(hres
)) {
5955 ok(V_VT(&result_var
) == VT_DISPATCH
, "result type should have been VT_DISPATCH, was: 0x%x\n", V_VT(&result_var
));
5956 test_frame((IDispatch
*)V_DISPATCH(&result_var
), "fr1");
5958 VariantClear(&result_var
);
5960 /* test second frame */
5961 V_I4(&index_var
) = 1;
5962 hres
= IHTMLFramesCollection2_item(frames
, &index_var
, &result_var
);
5963 ok(hres
== S_OK
, "IHTMLFramesCollection2_item failed: 0x%08x\n", hres
);
5964 if(SUCCEEDED(hres
)) {
5965 ok(V_VT(&result_var
) == VT_DISPATCH
, "result type should have been VT_DISPATCH, was: 0x%x\n", V_VT(&result_var
));
5966 test_frame((IDispatch
*)V_DISPATCH(&result_var
), "fr2");
5968 VariantClear(&result_var
);
5970 /* fail on next frame */
5971 V_I4(&index_var
) = 3;
5972 hres
= IHTMLFramesCollection2_item(frames
, &index_var
, &result_var
);
5973 ok(hres
== DISP_E_MEMBERNOTFOUND
, "IHTMLFramesCollection2_item should have"
5974 "failed with DISP_E_MEMBERNOTFOUND, instead: 0x%08x\n", hres
);
5975 VariantClear(&result_var
);
5977 /* string argument (element id lookup) */
5978 V_VT(&index_var
) = VT_BSTR
;
5979 V_BSTR(&index_var
) = a2bstr("fr1");
5980 hres
= IHTMLFramesCollection2_item(frames
, &index_var
, &result_var
);
5981 ok(hres
== S_OK
, "IHTMLFramesCollection2_item failed: 0x%08x\n", hres
);
5982 if(SUCCEEDED(hres
)) {
5983 ok(V_VT(&result_var
) == VT_DISPATCH
, "result type should have been VT_DISPATCH, was: 0x%x\n", V_VT(&result_var
));
5984 test_frame(V_DISPATCH(&result_var
), "fr1");
5986 VariantClear(&result_var
);
5987 VariantClear(&index_var
);
5989 /* invalid argument */
5990 V_VT(&index_var
) = VT_BOOL
;
5991 V_BOOL(&index_var
) = VARIANT_TRUE
;
5992 hres
= IHTMLFramesCollection2_item(frames
, &index_var
, &result_var
);
5993 ok(hres
== E_INVALIDARG
, "IHTMLFramesCollection2_item should have"
5994 "failed with E_INVALIDARG, instead: 0x%08x\n", hres
);
5995 VariantClear(&result_var
);
5997 IHTMLFramesCollection2_Release(frames
);
5999 /* test using IHTMLWindow2 inheritance */
6001 /* test result length */
6002 hres
= IHTMLWindow2_get_length(window
, &length
);
6003 ok(hres
== S_OK
, "IHTMLWindow2_get_length failed: 0x%08x\n", hres
);
6004 ok(length
== 3, "IHTMLWindow2_get_length should have been 3, was: %d\n", length
);
6006 /* test first frame */
6007 V_VT(&index_var
) = VT_I4
;
6008 V_I4(&index_var
) = 0;
6009 hres
= IHTMLWindow2_item(window
, &index_var
, &result_var
);
6010 ok(hres
== S_OK
, "IHTMLWindow2_item failed: 0x%08x\n", hres
);
6011 if(SUCCEEDED(hres
)) {
6012 ok(V_VT(&result_var
) == VT_DISPATCH
, "result type should have been VT_DISPATCH, was: 0x%x\n", V_VT(&result_var
));
6013 test_frame((IDispatch
*)V_DISPATCH(&result_var
), "fr1");
6015 VariantClear(&result_var
);
6017 /* test second frame */
6018 V_I4(&index_var
) = 1;
6019 hres
= IHTMLWindow2_item(window
, &index_var
, &result_var
);
6020 ok(hres
== S_OK
, "IHTMLWindow2_item failed: 0x%08x\n", hres
);
6021 if(SUCCEEDED(hres
)) {
6022 ok(V_VT(&result_var
) == VT_DISPATCH
, "result type should have been VT_DISPATCH, was: 0x%x\n", V_VT(&result_var
));
6023 test_frame((IDispatch
*)V_DISPATCH(&result_var
), "fr2");
6025 VariantClear(&result_var
);
6027 /* fail on next frame */
6028 V_I4(&index_var
) = 3;
6029 hres
= IHTMLWindow2_item(window
, &index_var
, &result_var
);
6030 ok(hres
== DISP_E_MEMBERNOTFOUND
, "IHTMLWindow2_item should have"
6031 "failed with DISP_E_MEMBERNOTFOUND, instead: 0x%08x\n", hres
);
6032 VariantClear(&result_var
);
6034 /* string argument (element id lookup) */
6035 V_VT(&index_var
) = VT_BSTR
;
6036 V_BSTR(&index_var
) = a2bstr("fr2");
6037 hres
= IHTMLWindow2_item(window
, &index_var
, &result_var
);
6038 ok(hres
== S_OK
, "IHTMLWindow2_item failed: 0x%08x\n", hres
);
6039 if(SUCCEEDED(hres
)) {
6040 ok(V_VT(&result_var
) == VT_DISPATCH
, "result type should have been VT_DISPATCH, was: 0x%x\n", V_VT(&result_var
));
6041 test_frame((IDispatch
*)V_DISPATCH(&result_var
), "fr2");
6043 VariantClear(&result_var
);
6044 VariantClear(&index_var
);
6046 /* invalid argument */
6047 V_VT(&index_var
) = VT_BOOL
;
6048 V_BOOL(&index_var
) = VARIANT_TRUE
;
6049 hres
= IHTMLWindow2_item(window
, &index_var
, &result_var
);
6050 ok(hres
== E_INVALIDARG
, "IHTMLWindow2_item should have"
6051 "failed with E_INVALIDARG, instead: 0x%08x\n", hres
);
6052 VariantClear(&result_var
);
6054 /* getElementById with node name attributes */
6055 elem
= get_doc_elem_by_id(doc
, "nm1");
6056 test_elem_id((IUnknown
*)elem
, "fr1");
6058 /* get/put scrolling */
6059 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLFrameBase
, (void**)&fbase
);
6060 ok(hres
== S_OK
, "Could not get IHTMLFrameBase interface: 0x%08x\n", hres
);
6062 hres
= IHTMLFrameBase_get_scrolling(fbase
, &str
);
6063 ok(hres
== S_OK
, "IHTMLFrameBase_get_scrolling failed: 0x%08x\n", hres
);
6064 ok(!strcmp_wa(str
, "auto"), "get_scrolling should have given 'auto', gave: %s\n", wine_dbgstr_w(str
));
6068 hres
= IHTMLFrameBase_put_scrolling(fbase
, str
);
6069 ok(hres
== S_OK
, "IHTMLFrameBase_put_scrolling failed: 0x%08x\n", hres
);
6072 hres
= IHTMLFrameBase_get_scrolling(fbase
, &str
);
6073 ok(hres
== S_OK
, "IHTMLFrameBase_get_scrolling failed: 0x%08x\n", hres
);
6074 ok(!strcmp_wa(str
, "no"), "get_scrolling should have given 'no', gave: %s\n", wine_dbgstr_w(str
));
6077 str
= a2bstr("junk");
6078 hres
= IHTMLFrameBase_put_scrolling(fbase
, str
);
6079 ok(hres
== E_INVALIDARG
, "IHTMLFrameBase_put_scrolling should have failed "
6080 "with E_INVALIDARG, instead: 0x%08x\n", hres
);
6083 hres
= IHTMLFrameBase_get_scrolling(fbase
, &str
);
6084 ok(hres
== S_OK
, "IHTMLFrameBase_get_scrolling failed: 0x%08x\n", hres
);
6085 ok(!strcmp_wa(str
, "no"), "get_scrolling should have given 'no', gave: %s\n", wine_dbgstr_w(str
));
6089 hres
= IHTMLFrameBase_get_name(fbase
, &str
);
6090 ok(hres
== S_OK
, "IHTMLFrameBase_get_name failed: 0x%08x\n", hres
);
6091 ok(!strcmp_wa(str
, "nm1"), "get_name should have given 'nm1', gave: %s\n", wine_dbgstr_w(str
));
6094 IHTMLFrameBase_Release(fbase
);
6095 IHTMLElement_Release(elem
);
6097 /* get_name with no name attr */
6098 elem
= get_doc_elem_by_id(doc
, "fr3");
6099 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLFrameBase
, (void**)&fbase
);
6100 ok(hres
== S_OK
, "Could not get IHTMLFrameBase interface: 0x%08x\n", hres
);
6102 hres
= IHTMLFrameBase_get_name(fbase
, &str
);
6103 ok(hres
== S_OK
, "IHTMLFrameBase_get_name failed: 0x%08x\n", hres
);
6104 ok(str
== NULL
, "get_name should have given 'null', gave: %s\n", wine_dbgstr_w(str
));
6107 IHTMLFrameBase_Release(fbase
);
6108 IHTMLElement_Release(elem
);
6111 static IHTMLDocument2
*notif_doc
;
6112 static BOOL doc_complete
;
6114 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
6115 REFIID riid
, void**ppv
)
6117 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
6122 ok(0, "unexpected call\n");
6123 return E_NOINTERFACE
;
6126 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
6131 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
6136 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
6138 if(dispID
== DISPID_READYSTATE
){
6142 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
6143 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
6145 if(!strcmp_wa(state
, "complete"))
6146 doc_complete
= TRUE
;
6148 SysFreeString(state
);
6154 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
6156 ok(0, "unexpected call\n");
6160 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
6161 PropertyNotifySink_QueryInterface
,
6162 PropertyNotifySink_AddRef
,
6163 PropertyNotifySink_Release
,
6164 PropertyNotifySink_OnChanged
,
6165 PropertyNotifySink_OnRequestEdit
6168 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
6170 static IHTMLDocument2
*create_doc_with_string(const char *str
)
6172 IPersistStreamInit
*init
;
6174 IHTMLDocument2
*doc
;
6178 notif_doc
= doc
= create_document();
6182 doc_complete
= FALSE
;
6184 mem
= GlobalAlloc(0, len
);
6185 memcpy(mem
, str
, len
);
6186 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
6188 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
6190 IPersistStreamInit_Load(init
, stream
);
6191 IPersistStreamInit_Release(init
);
6192 IStream_Release(stream
);
6197 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
6199 IConnectionPointContainer
*container
;
6200 IConnectionPoint
*cp
;
6204 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
6205 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
6207 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
6208 IConnectionPointContainer_Release(container
);
6209 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
6211 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
6212 IConnectionPoint_Release(cp
);
6213 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
6216 typedef void (*domtest_t
)(IHTMLDocument2
*);
6218 static void run_domtest(const char *str
, domtest_t test
)
6220 IHTMLDocument2
*doc
;
6224 doc
= create_doc_with_string(str
);
6228 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
6230 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
6231 TranslateMessage(&msg
);
6232 DispatchMessage(&msg
);
6237 ref
= IHTMLDocument2_Release(doc
);
6239 ref
== 1, /* Vista */
6247 run_domtest(doc_str1
, test_doc_elem
);
6248 run_domtest(doc_str1
, test_get_set_attr
);
6249 run_domtest(range_test_str
, test_txtrange
);
6250 run_domtest(range_test2_str
, test_txtrange2
);
6251 if (winetest_interactive
|| ! is_ie_hardened()) {
6252 run_domtest(elem_test_str
, test_elems
);
6254 skip("IE running in Enhanced Security Configuration\n");
6256 run_domtest(elem_test2_str
, test_elems2
);
6257 run_domtest(doc_blank
, test_create_elems
);
6258 run_domtest(doc_blank
, test_defaults
);
6259 run_domtest(indent_test_str
, test_indent
);
6260 run_domtest(cond_comment_str
, test_cond_comment
);
6261 run_domtest(frameset_str
, test_frameset
);