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>"
55 static const char indent_test_str
[] =
56 "<html><head><title>test</title></head><body>abc<br /><a href=\"about:blank\">123</a></body></html>";
57 static const char cond_comment_str
[] =
58 "<html><head><title>test</title></head><body>"
59 "<!--[if gte IE 4]> <br> <![endif]-->"
62 static WCHAR characterW
[] = {'c','h','a','r','a','c','t','e','r',0};
63 static WCHAR texteditW
[] = {'t','e','x','t','e','d','i','t',0};
64 static WCHAR wordW
[] = {'w','o','r','d',0};
93 static const IID
* const none_iids
[] = {
98 static const IID
* const doc_node_iids
[] = {
107 &IID_IConnectionPointContainer
,
108 &IID_IInternetHostSecurityManager
,
112 static const IID
* const doc_obj_iids
[] = {
119 &IID_IConnectionPointContainer
,
124 static const IID
* const elem_iids
[] = {
131 &IID_IConnectionPointContainer
,
135 static const IID
* const body_iids
[] = {
141 &IID_IHTMLTextContainer
,
142 &IID_IHTMLBodyElement
,
144 &IID_IConnectionPointContainer
,
148 static const IID
* const anchor_iids
[] = {
154 &IID_IHTMLAnchorElement
,
156 &IID_IConnectionPointContainer
,
160 static const IID
* const input_iids
[] = {
166 &IID_IHTMLInputElement
,
167 &IID_IHTMLInputTextElement
,
169 &IID_IConnectionPointContainer
,
173 static const IID
* const select_iids
[] = {
179 &IID_IHTMLSelectElement
,
181 &IID_IConnectionPointContainer
,
185 static const IID
* const textarea_iids
[] = {
191 &IID_IHTMLTextAreaElement
,
193 &IID_IConnectionPointContainer
,
197 static const IID
* const option_iids
[] = {
203 &IID_IHTMLOptionElement
,
205 &IID_IConnectionPointContainer
,
209 static const IID
* const table_iids
[] = {
217 &IID_IConnectionPointContainer
,
221 static const IID
* const script_iids
[] = {
227 &IID_IHTMLScriptElement
,
229 &IID_IConnectionPointContainer
,
233 static const IID
* const text_iids
[] = {
236 &IID_IHTMLDOMTextNode
,
240 static const IID
* const location_iids
[] = {
246 static const IID
* const window_iids
[] = {
254 static const IID
* const comment_iids
[] = {
260 &IID_IHTMLCommentElement
,
262 &IID_IConnectionPointContainer
,
266 static const IID
* const img_iids
[] = {
273 &IID_IHTMLImgElement
,
274 &IID_IConnectionPointContainer
,
278 static const IID
* const tr_iids
[] = {
286 &IID_IConnectionPointContainer
,
290 static const IID
* const td_iids
[] = {
297 &IID_IConnectionPointContainer
,
301 static const IID
* const iframe_iids
[] = {
308 &IID_IHTMLFrameBase2
,
310 &IID_IConnectionPointContainer
,
314 static const IID
* const generic_iids
[] = {
320 &IID_IHTMLGenericElement
,
322 &IID_IConnectionPointContainer
,
326 static const IID
* const style_iids
[] = {
337 static const IID
* const cstyle_iids
[] = {
341 &IID_IHTMLCurrentStyle
,
345 static const IID
* const img_factory_iids
[] = {
349 &IID_IHTMLImageElementFactory
,
359 static const elem_type_info_t elem_type_infos
[] = {
360 {"", none_iids
, NULL
},
361 {"HTML", elem_iids
, NULL
},
362 {"HEAD", elem_iids
, NULL
},
363 {"TITLE", elem_iids
, NULL
},
364 {"BODY", body_iids
, &DIID_DispHTMLBody
},
365 {"A", anchor_iids
, &DIID_DispHTMLAnchorElement
},
366 {"INPUT", input_iids
, &DIID_DispHTMLInputElement
},
367 {"SELECT", select_iids
, &DIID_DispHTMLSelectElement
},
368 {"TEXTAREA", textarea_iids
, NULL
},
369 {"OPTION", option_iids
, &DIID_DispHTMLOptionElement
},
370 {"STYLE", elem_iids
, NULL
},
371 {"BLOCKQUOTE",elem_iids
, NULL
},
372 {"P", elem_iids
, NULL
},
373 {"BR", elem_iids
, NULL
},
374 {"TABLE", table_iids
, &DIID_DispHTMLTable
},
375 {"TBODY", elem_iids
, NULL
},
376 {"SCRIPT", script_iids
, NULL
},
377 {"TEST", elem_iids
, &DIID_DispHTMLUnknownElement
},
378 {"TEST", generic_iids
, &DIID_DispHTMLGenericElement
},
379 {"!", comment_iids
, &DIID_DispHTMLCommentElement
},
380 {"IMG", img_iids
, &DIID_DispHTMLImg
},
381 {"TR", tr_iids
, &DIID_DispHTMLTableRow
},
382 {"TD", td_iids
, NULL
},
383 {"IFRAME", iframe_iids
, &DIID_DispHTMLIFrame
}
386 static const char *dbgstr_guid(REFIID riid
)
390 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
391 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
392 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
393 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
398 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
401 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
402 return lstrcmpA(stra
, buf
);
405 static BSTR
a2bstr(const char *str
)
410 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
411 ret
= SysAllocStringLen(NULL
, len
);
412 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
417 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
419 IUnknown
*unk1
, *unk2
;
424 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
425 IUnknown_Release(unk1
);
426 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
427 IUnknown_Release(unk2
);
432 static IHTMLDocument2
*create_document(void)
435 IHTMLDocument5
*doc5
;
438 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
439 &IID_IHTMLDocument2
, (void**)&doc
);
440 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
444 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
446 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
447 IHTMLDocument2_Release(doc
);
451 IHTMLDocument5_Release(doc5
);
455 #define test_ifaces(i,ids) _test_ifaces(__LINE__,i,ids)
456 static void _test_ifaces(unsigned line
, IUnknown
*iface
, REFIID
*iids
)
458 const IID
* const *piid
;
462 for(piid
= iids
; *piid
; piid
++) {
463 hres
= IDispatch_QueryInterface(iface
, *piid
, (void**)&unk
);
464 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get %s interface: %08x\n", dbgstr_guid(*piid
), hres
);
466 IUnknown_Release(unk
);
470 #define test_get_dispid(u,id) _test_disp(__LINE__,u,id)
471 static BOOL
_test_get_dispid(unsigned line
, IUnknown
*unk
, IID
*iid
)
479 hres
= IUnknown_QueryInterface(unk
, &IID_IDispatchEx
, (void**)&dispex
);
480 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IDispatch: %08x\n", hres
);
485 hres
= IDispatchEx_GetTypeInfoCount(dispex
, &ticnt
);
486 ok_(__FILE__
,line
) (hres
== S_OK
, "GetTypeInfoCount failed: %08x\n", hres
);
487 ok_(__FILE__
,line
) (ticnt
== 1, "ticnt=%u\n", ticnt
);
489 hres
= IDispatchEx_GetTypeInfo(dispex
, 0, 0, &typeinfo
);
490 ok_(__FILE__
,line
) (hres
== S_OK
, "GetTypeInfo failed: %08x\n", hres
);
492 if(SUCCEEDED(hres
)) {
495 hres
= ITypeInfo_GetTypeAttr(typeinfo
, &type_attr
);
496 ok_(__FILE__
,line
) (hres
== S_OK
, "GetTypeAttr failed: %08x\n", hres
);
498 *iid
= type_attr
->guid
;
502 ITypeInfo_ReleaseTypeAttr(typeinfo
, type_attr
);
503 ITypeInfo_Release(typeinfo
);
506 IDispatchEx_Release(dispex
);
510 #define test_disp_value(u) _test_disp_value(__LINE__,u,v)
511 static void _test_disp_value(unsigned line
, IUnknown
*unk
, const char *val
)
513 DISPPARAMS dp
= {NULL
,NULL
,0,0};
519 hres
= IUnknown_QueryInterface(unk
, &IID_IDispatchEx
, (void**)&dispex
);
520 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IDispatchEx interface: %08x\n", hres
);
524 hres
= IDispatchEx_InvokeEx(dispex
, DISPID_VALUE
, 0, DISPATCH_PROPERTYGET
, &dp
, &var
, &ei
, NULL
);
525 IDispatchEx_Release(dispex
);
526 ok_(__FILE__
,line
)(hres
== S_OK
, "InvokeEx(DISPID_VALUE) returned: %08x\n", hres
);
528 ok_(__FILE__
,line
)(V_VT(&var
) == VT_BSTR
, "V_VT(value) = %d\n", V_VT(&var
));
529 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(&var
), val
), "value = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&var
)), val
);
533 #define test_disp(u,id,v) _test_disp(__LINE__,u,id,v)
534 static void _test_disp(unsigned line
, IUnknown
*unk
, const IID
*diid
, const char *val
)
538 if(_test_get_dispid(line
, unk
, &iid
))
539 ok_(__FILE__
,line
) (IsEqualGUID(&iid
, diid
), "unexpected guid %s\n", dbgstr_guid(&iid
));
542 _test_disp_value(line
, unk
, val
);
545 #define test_disp2(u,id,id2,v) _test_disp2(__LINE__,u,id,id2,v)
546 static void _test_disp2(unsigned line
, IUnknown
*unk
, const IID
*diid
, const IID
*diid2
, const char *val
)
550 if(_test_get_dispid(line
, unk
, &iid
))
551 ok_(__FILE__
,line
) (IsEqualGUID(&iid
, diid
) || broken(IsEqualGUID(&iid
, diid2
)),
552 "unexpected guid %s\n", dbgstr_guid(&iid
));
555 _test_disp_value(line
, unk
, val
);
558 #define get_elem_iface(u) _get_elem_iface(__LINE__,u)
559 static IHTMLElement
*_get_elem_iface(unsigned line
, IUnknown
*unk
)
564 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement
, (void**)&elem
);
565 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement: %08x\n", hres
);
569 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
570 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
575 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
576 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
580 #define get_elem3_iface(u) _get_elem3_iface(__LINE__,u)
581 static IHTMLElement3
*_get_elem3_iface(unsigned line
, IUnknown
*unk
)
586 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement3
, (void**)&elem
);
587 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement3: %08x\n", hres
);
591 #define get_node_iface(u) _get_node_iface(__LINE__,u)
592 static IHTMLDOMNode
*_get_node_iface(unsigned line
, IUnknown
*unk
)
597 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMNode
, (void**)&node
);
598 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMNode: %08x\n", hres
);
602 #define get_node2_iface(u) _get_node2_iface(__LINE__,u)
603 static IHTMLDOMNode2
*_get_node2_iface(unsigned line
, IUnknown
*unk
)
608 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMNode2
, (void**)&node
);
609 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMNode2: %08x\n", hres
);
613 #define get_img_iface(u) _get_img_iface(__LINE__,u)
614 static IHTMLImgElement
*_get_img_iface(unsigned line
, IUnknown
*unk
)
616 IHTMLImgElement
*img
;
619 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLImgElement
, (void**)&img
);
620 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLImgElement: %08x\n", hres
);
624 #define get_anchor_iface(u) _get_anchor_iface(__LINE__,u)
625 static IHTMLAnchorElement
*_get_anchor_iface(unsigned line
, IUnknown
*unk
)
627 IHTMLAnchorElement
*anchor
;
630 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLAnchorElement
, (void**)&anchor
);
631 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLAnchorElement: %08x\n", hres
);
635 #define test_node_name(u,n) _test_node_name(__LINE__,u,n)
636 static void _test_node_name(unsigned line
, IUnknown
*unk
, const char *exname
)
638 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
642 hres
= IHTMLDOMNode_get_nodeName(node
, &name
);
643 IHTMLDOMNode_Release(node
);
644 ok_(__FILE__
, line
) (hres
== S_OK
, "get_nodeName failed: %08x\n", hres
);
645 ok_(__FILE__
, line
) (!strcmp_wa(name
, exname
), "got name: %s, expected %s\n", wine_dbgstr_w(name
), exname
);
650 #define get_owner_doc(u) _get_owner_doc(__LINE__,u)
651 static IHTMLDocument2
*_get_owner_doc(unsigned line
, IUnknown
*unk
)
653 IHTMLDOMNode2
*node
= _get_node2_iface(line
, unk
);
654 IDispatch
*disp
= (void*)0xdeadbeef;
658 hres
= IHTMLDOMNode2_get_ownerDocument(node
, &disp
);
659 IHTMLDOMNode2_Release(node
);
660 ok_(__FILE__
,line
)(hres
== S_OK
, "get_ownerDocument failed: %08x\n", hres
);
661 ok_(__FILE__
,line
)(disp
!= NULL
, "disp = NULL\n");
663 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDocument2
, (void**)&doc
);
664 IDispatch_Release(disp
);
665 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IHTMLDocument2 iface: %08x\n", hres
);
670 #define get_doc_window(d) _get_doc_window(__LINE__,d)
671 static IHTMLWindow2
*_get_doc_window(unsigned line
, IHTMLDocument2
*doc
)
673 IHTMLWindow2
*window
;
677 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
678 ok_(__FILE__
,line
)(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
679 ok_(__FILE__
,line
)(window
!= NULL
, "window == NULL\n");
684 #define clone_node(n,d) _clone_node(__LINE__,n,d)
685 static IHTMLDOMNode
*_clone_node(unsigned line
, IUnknown
*unk
, VARIANT_BOOL deep
)
687 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
688 IHTMLDOMNode
*ret
= NULL
;
691 hres
= IHTMLDOMNode_cloneNode(node
, deep
, &ret
);
692 IHTMLDOMNode_Release(node
);
693 ok_(__FILE__
,line
)(hres
== S_OK
, "cloneNode failed: %08x\n", hres
);
694 ok_(__FILE__
,line
)(ret
!= NULL
, "ret == NULL\n");
700 #define test_elem_tag(u,n) _test_elem_tag(__LINE__,u,n)
701 static void _test_elem_tag(unsigned line
, IUnknown
*unk
, const char *extag
)
703 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
707 hres
= IHTMLElement_get_tagName(elem
, &tag
);
708 IHTMLElement_Release(elem
);
709 ok_(__FILE__
, line
) (hres
== S_OK
, "get_tagName failed: %08x\n", hres
);
710 ok_(__FILE__
, line
) (!strcmp_wa(tag
, extag
), "got tag: %s, expected %s\n", wine_dbgstr_w(tag
), extag
);
715 #define test_elem_type(ifc,t) _test_elem_type(__LINE__,ifc,t)
716 static void _test_elem_type(unsigned line
, IUnknown
*unk
, elem_type_t type
)
718 _test_elem_tag(line
, unk
, elem_type_infos
[type
].tag
);
719 _test_ifaces(line
, unk
, elem_type_infos
[type
].iids
);
721 if(elem_type_infos
[type
].dispiid
&& type
!= ET_A
)
722 _test_disp(line
, unk
, elem_type_infos
[type
].dispiid
, "[object]");
725 #define get_node_type(n) _get_node_type(__LINE__,n)
726 static LONG
_get_node_type(unsigned line
, IUnknown
*unk
)
728 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
732 hres
= IHTMLDOMNode_get_nodeType(node
, &type
);
733 ok(hres
== S_OK
, "get_nodeType failed: %08x\n", hres
);
735 IHTMLDOMNode_Release(node
);
740 #define get_child_nodes(u) _get_child_nodes(__LINE__,u)
741 static IHTMLDOMChildrenCollection
*_get_child_nodes(unsigned line
, IUnknown
*unk
)
743 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
744 IHTMLDOMChildrenCollection
*col
= NULL
;
748 hres
= IHTMLDOMNode_get_childNodes(node
, &disp
);
749 IHTMLDOMNode_Release(node
);
750 ok_(__FILE__
,line
) (hres
== S_OK
, "get_childNodes failed: %08x\n", hres
);
754 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDOMChildrenCollection
, (void**)&col
);
755 IDispatch_Release(disp
);
756 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDOMChildrenCollection: %08x\n", hres
);
761 #define get_child_item(c,i) _get_child_item(__LINE__,c,i)
762 static IHTMLDOMNode
*_get_child_item(unsigned line
, IHTMLDOMChildrenCollection
*col
, LONG idx
)
764 IHTMLDOMNode
*node
= NULL
;
768 hres
= IHTMLDOMChildrenCollection_item(col
, idx
, &disp
);
769 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
771 node
= _get_node_iface(line
, (IUnknown
*)disp
);
772 IDispatch_Release(disp
);
777 #define test_elem_attr(e,n,v) _test_elem_attr(__LINE__,e,n,v)
778 static void _test_elem_attr(unsigned line
, IHTMLElement
*elem
, const char *name
, const char *exval
)
787 hres
= IHTMLElement_getAttribute(elem
, tmp
, 0, &value
);
789 ok_(__FILE__
,line
) (hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
792 ok_(__FILE__
,line
) (V_VT(&value
) == VT_BSTR
, "vt=%d\n", V_VT(&value
));
793 ok_(__FILE__
,line
) (!strcmp_wa(V_BSTR(&value
), exval
), "unexpected value %s\n", wine_dbgstr_w(V_BSTR(&value
)));
795 ok_(__FILE__
,line
) (V_VT(&value
) == VT_NULL
, "vt=%d\n", V_VT(&value
));
798 VariantClear(&value
);
801 #define test_elem_offset(u) _test_elem_offset(__LINE__,u)
802 static void _test_elem_offset(unsigned line
, IUnknown
*unk
)
804 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
808 hres
= IHTMLElement_get_offsetTop(elem
, &l
);
809 ok_(__FILE__
,line
) (hres
== S_OK
, "get_offsetTop failed: %08x\n", hres
);
811 hres
= IHTMLElement_get_offsetHeight(elem
, &l
);
812 ok_(__FILE__
,line
) (hres
== S_OK
, "get_offsetHeight failed: %08x\n", hres
);
814 hres
= IHTMLElement_get_offsetWidth(elem
, &l
);
815 ok_(__FILE__
,line
) (hres
== S_OK
, "get_offsetWidth failed: %08x\n", hres
);
817 IHTMLElement_Release(elem
);
820 #define get_doc_node(d) _get_doc_node(__LINE__,d)
821 static IHTMLDocument2
*_get_doc_node(unsigned line
, IHTMLDocument2
*doc
)
823 IHTMLWindow2
*window
;
827 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
828 ok_(__FILE__
,line
)(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
830 hres
= IHTMLWindow2_get_document(window
, &ret
);
831 ok_(__FILE__
,line
)(hres
== S_OK
, "get_document failed: %08x\n", hres
);
832 ok_(__FILE__
,line
)(ret
!= NULL
, "document = NULL\n");
837 #define test_window_name(d,e) _test_window_name(__LINE__,d,e)
838 static void _test_window_name(unsigned line
, IHTMLWindow2
*window
, const char *exname
)
843 hres
= IHTMLWindow2_get_name(window
, &name
);
844 ok_(__FILE__
,line
)(hres
== S_OK
, "get_name failed: %08x\n", hres
);
846 ok_(__FILE__
,line
)(!strcmp_wa(name
, exname
), "name = %s\n", wine_dbgstr_w(name
));
848 ok_(__FILE__
,line
)(!name
, "name = %s\n", wine_dbgstr_w(name
));
851 #define set_window_name(w,n) _set_window_name(__LINE__,w,n)
852 static void _set_window_name(unsigned line
, IHTMLWindow2
*window
, const char *name
)
858 hres
= IHTMLWindow2_put_name(window
, str
);
860 ok_(__FILE__
,line
)(hres
== S_OK
, "put_name failed: %08x\n", hres
);
862 _test_window_name(line
, window
, name
);
865 #define test_window_length(w,l) _test_window_length(__LINE__,w,l)
866 static void _test_window_length(unsigned line
, IHTMLWindow2
*window
, LONG exlen
)
871 hres
= IHTMLWindow2_get_length(window
, &length
);
872 ok_(__FILE__
,line
)(hres
== S_OK
, "get_length failed: %08x\n", hres
);
873 ok_(__FILE__
,line
)(length
== exlen
, "length = %d, expected %d\n", length
, exlen
);
876 static void test_get_set_attr(IHTMLDocument2
*doc
)
879 IHTMLDocument3
*doc3
;
884 /* grab an element to test with */
885 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
886 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
888 hres
= IHTMLDocument3_get_documentElement(doc3
, &elem
);
889 IHTMLDocument3_Release(doc3
);
890 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
892 /* get a non-present attribute */
893 bstr
= a2bstr("notAnAttribute");
894 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
895 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
896 ok(V_VT(&val
) == VT_NULL
, "variant type should have been VT_NULL (0x%x), was: 0x%x\n", VT_NULL
, V_VT(&val
));
900 /* get a present attribute */
901 bstr
= a2bstr("scrollHeight");
902 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
903 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
904 ok(V_VT(&val
) == VT_I4
, "variant type should have been VT_I4 (0x%x), was: 0x%x\n", VT_I4
, V_VT(&val
));
908 /* create a new BSTR attribute */
909 bstr
= a2bstr("newAttribute");
911 V_VT(&val
) = VT_BSTR
;
912 V_BSTR(&val
) = a2bstr("the value");
913 hres
= IHTMLElement_setAttribute(elem
, bstr
, val
, 0);
914 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
917 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
918 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
919 ok(V_VT(&val
) == VT_BSTR
, "variant type should have been VT_BSTR (0x%x), was: 0x%x\n", VT_BSTR
, V_VT(&val
));
920 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
)));
923 /* overwrite the attribute with a BOOL */
924 V_VT(&val
) = VT_BOOL
;
925 V_BOOL(&val
) = VARIANT_TRUE
;
926 hres
= IHTMLElement_setAttribute(elem
, bstr
, val
, 0);
927 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
930 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
931 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
932 ok(V_VT(&val
) == VT_BOOL
, "variant type should have been VT_BOOL (0x%x), was: 0x%x\n", VT_BOOL
, V_VT(&val
));
933 ok(V_BOOL(&val
) == VARIANT_TRUE
, "variant value should have been VARIANT_TRUE (0x%x), was %d\n", VARIANT_TRUE
, V_BOOL(&val
));
938 /* case-insensitive */
939 bstr
= a2bstr("newattribute");
940 hres
= IHTMLElement_getAttribute(elem
, bstr
, 0, &val
);
941 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
942 todo_wine
ok(V_VT(&val
) == VT_BOOL
, "variant type should have been VT_BOOL (0x%x), was: 0x%x\n", VT_BOOL
, V_VT(&val
));
943 todo_wine
ok(V_BOOL(&val
) == VARIANT_TRUE
, "variant value should have been VARIANT_TRUE (0x%x), was %d\n", VARIANT_TRUE
, V_BOOL(&val
));
947 IHTMLElement_Release(elem
);
950 #define get_doc_elem(d) _get_doc_elem(__LINE__,d)
951 static IHTMLElement
*_get_doc_elem(unsigned line
, IHTMLDocument2
*doc
)
954 IHTMLDocument3
*doc3
;
957 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
958 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDocument3 interface: %08x\n", hres
);
959 hres
= IHTMLDocument3_get_documentElement(doc3
, &elem
);
960 ok_(__FILE__
,line
) (hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
961 IHTMLDocument3_Release(doc3
);
966 #define test_anchor_href(a,h) _test_anchor_href(__LINE__,a,h)
967 static void _test_anchor_href(unsigned line
, IUnknown
*unk
, const char *exhref
)
969 IHTMLAnchorElement
*anchor
= _get_anchor_iface(line
, unk
);
973 hres
= IHTMLAnchorElement_get_href(anchor
, &str
);
974 ok_(__FILE__
,line
)(hres
== S_OK
, "get_href failed: %08x\n", hres
);
975 ok_(__FILE__
,line
)(!strcmp_wa(str
, exhref
), "href = %s, expected %s\n", wine_dbgstr_w(str
), exhref
);
978 _test_disp_value(line
, unk
, exhref
);
981 #define test_option_text(o,t) _test_option_text(__LINE__,o,t)
982 static void _test_option_text(unsigned line
, IHTMLOptionElement
*option
, const char *text
)
987 hres
= IHTMLOptionElement_get_text(option
, &bstr
);
988 ok_(__FILE__
,line
) (hres
== S_OK
, "get_text failed: %08x\n", hres
);
989 ok_(__FILE__
,line
) (!strcmp_wa(bstr
, text
), "text=%s\n", wine_dbgstr_w(bstr
));
993 #define test_option_put_text(o,t) _test_option_put_text(__LINE__,o,t)
994 static void _test_option_put_text(unsigned line
, IHTMLOptionElement
*option
, const char *text
)
1000 hres
= IHTMLOptionElement_put_text(option
, bstr
);
1001 SysFreeString(bstr
);
1002 ok(hres
== S_OK
, "put_text failed: %08x\n", hres
);
1004 _test_option_text(line
, option
, text
);
1007 #define test_option_value(o,t) _test_option_value(__LINE__,o,t)
1008 static void _test_option_value(unsigned line
, IHTMLOptionElement
*option
, const char *value
)
1013 hres
= IHTMLOptionElement_get_value(option
, &bstr
);
1014 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
1015 ok_(__FILE__
,line
) (!strcmp_wa(bstr
, value
), "value=%s\n", wine_dbgstr_w(bstr
));
1016 SysFreeString(bstr
);
1019 #define test_option_put_value(o,t) _test_option_put_value(__LINE__,o,t)
1020 static void _test_option_put_value(unsigned line
, IHTMLOptionElement
*option
, const char *value
)
1025 bstr
= a2bstr(value
);
1026 hres
= IHTMLOptionElement_put_value(option
, bstr
);
1027 SysFreeString(bstr
);
1028 ok(hres
== S_OK
, "put_value failed: %08x\n", hres
);
1030 _test_option_value(line
, option
, value
);
1033 #define create_option_elem(d,t,v) _create_option_elem(__LINE__,d,t,v)
1034 static IHTMLOptionElement
*_create_option_elem(unsigned line
, IHTMLDocument2
*doc
,
1035 const char *txt
, const char *val
)
1037 IHTMLOptionElementFactory
*factory
;
1038 IHTMLOptionElement
*option
;
1039 IHTMLWindow2
*window
;
1040 VARIANT text
, value
, empty
;
1043 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
1044 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentElement failed: %08x\n", hres
);
1046 hres
= IHTMLWindow2_get_Option(window
, &factory
);
1047 IHTMLWindow2_Release(window
);
1048 ok_(__FILE__
,line
) (hres
== S_OK
, "get_Option failed: %08x\n", hres
);
1050 V_VT(&text
) = VT_BSTR
;
1051 V_BSTR(&text
) = a2bstr(txt
);
1052 V_VT(&value
) = VT_BSTR
;
1053 V_BSTR(&value
) = a2bstr(val
);
1054 V_VT(&empty
) = VT_EMPTY
;
1056 hres
= IHTMLOptionElementFactory_create(factory
, text
, value
, empty
, empty
, &option
);
1057 ok_(__FILE__
,line
) (hres
== S_OK
, "create failed: %08x\n", hres
);
1059 IHTMLOptionElementFactory_Release(factory
);
1060 VariantClear(&text
);
1061 VariantClear(&value
);
1063 _test_option_text(line
, option
, txt
);
1064 _test_option_value(line
, option
, val
);
1069 #define test_img_width(o,w) _test_img_width(__LINE__,o,w)
1070 static void _test_img_width(unsigned line
, IHTMLImgElement
*img
, const long exp
)
1075 hres
= IHTMLImgElement_get_width(img
, &found
);
1076 todo_wine
ok_(__FILE__
,line
) (hres
== S_OK
, "get_width failed: %08x\n", hres
);
1077 todo_wine
ok_(__FILE__
,line
) (found
== exp
, "width=%d\n", found
);
1080 #define test_img_put_width(o,w) _test_img_put_width(__LINE__,o,w)
1081 static void _test_img_put_width(unsigned line
, IHTMLImgElement
*img
, const long width
)
1085 hres
= IHTMLImgElement_put_width(img
, width
);
1086 todo_wine
ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1088 _test_img_width(line
, img
, width
);
1091 #define test_img_height(o,h) _test_img_height(__LINE__,o,h)
1092 static void _test_img_height(unsigned line
, IHTMLImgElement
*img
, const long exp
)
1097 hres
= IHTMLImgElement_get_height(img
, &found
);
1098 todo_wine
ok_(__FILE__
,line
) (hres
== S_OK
, "get_height failed: %08x\n", hres
);
1099 todo_wine
ok_(__FILE__
,line
) (found
== exp
, "height=%d\n", found
);
1102 #define test_img_put_height(o,w) _test_img_put_height(__LINE__,o,w)
1103 static void _test_img_put_height(unsigned line
, IHTMLImgElement
*img
, const long height
)
1107 hres
= IHTMLImgElement_put_height(img
, height
);
1108 todo_wine
ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1110 _test_img_height(line
, img
, height
);
1113 #define create_img_elem(d,t,v) _create_img_elem(__LINE__,d,t,v)
1114 static IHTMLImgElement
*_create_img_elem(unsigned line
, IHTMLDocument2
*doc
,
1115 LONG wdth
, LONG hght
)
1117 IHTMLImageElementFactory
*factory
;
1118 IHTMLImgElement
*img
;
1119 IHTMLWindow2
*window
;
1120 VARIANT width
, height
;
1124 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
1125 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentElement failed: %08x\n", hres
);
1127 hres
= IHTMLWindow2_get_Image(window
, &factory
);
1128 IHTMLWindow2_Release(window
);
1129 ok_(__FILE__
,line
) (hres
== S_OK
, "get_Image failed: %08x\n", hres
);
1131 test_ifaces((IUnknown
*)factory
, img_factory_iids
);
1132 test_disp((IUnknown
*)factory
, &IID_IHTMLImageElementFactory
, "[object]");
1135 snprintf(buf
, 16, "%d", wdth
);
1136 V_VT(&width
) = VT_BSTR
;
1137 V_BSTR(&width
) = a2bstr(buf
);
1139 V_VT(&width
) = VT_EMPTY
;
1144 snprintf(buf
, 16, "%d", hght
);
1145 V_VT(&height
) = VT_BSTR
;
1146 V_BSTR(&height
) = a2bstr(buf
);
1148 V_VT(&height
) = VT_EMPTY
;
1152 hres
= IHTMLImageElementFactory_create(factory
, width
, height
, &img
);
1153 ok_(__FILE__
,line
) (hres
== S_OK
, "create failed: %08x\n", hres
);
1155 IHTMLImageElementFactory_Release(factory
);
1156 VariantClear(&width
);
1157 VariantClear(&height
);
1159 if(SUCCEEDED(hres
)) {
1160 _test_img_width(line
, img
, wdth
);
1161 _test_img_height(line
, img
, hght
);
1168 #define test_select_length(s,l) _test_select_length(__LINE__,s,l)
1169 static void _test_select_length(unsigned line
, IHTMLSelectElement
*select
, LONG length
)
1171 LONG len
= 0xdeadbeef;
1174 hres
= IHTMLSelectElement_get_length(select
, &len
);
1175 ok_(__FILE__
,line
) (hres
== S_OK
, "get_length failed: %08x\n", hres
);
1176 ok_(__FILE__
,line
) (len
== length
, "len=%d, expected %d\n", len
, length
);
1179 #define test_select_selidx(s,i) _test_select_selidx(__LINE__,s,i)
1180 static void _test_select_selidx(unsigned line
, IHTMLSelectElement
*select
, LONG index
)
1182 LONG idx
= 0xdeadbeef;
1185 hres
= IHTMLSelectElement_get_selectedIndex(select
, &idx
);
1186 ok_(__FILE__
,line
) (hres
== S_OK
, "get_selectedIndex failed: %08x\n", hres
);
1187 ok_(__FILE__
,line
) (idx
== index
, "idx=%d, expected %d\n", idx
, index
);
1190 #define test_select_put_selidx(s,i) _test_select_put_selidx(__LINE__,s,i)
1191 static void _test_select_put_selidx(unsigned line
, IHTMLSelectElement
*select
, LONG index
)
1195 hres
= IHTMLSelectElement_put_selectedIndex(select
, index
);
1196 ok_(__FILE__
,line
) (hres
== S_OK
, "get_selectedIndex failed: %08x\n", hres
);
1197 _test_select_selidx(line
, select
, index
);
1200 #define test_select_value(s,v) _test_select_value(__LINE__,s,v)
1201 static void _test_select_value(unsigned line
, IHTMLSelectElement
*select
, const char *exval
)
1206 hres
= IHTMLSelectElement_get_value(select
, &val
);
1207 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
1209 ok_(__FILE__
,line
) (!strcmp_wa(val
, exval
), "unexpected value %s\n", wine_dbgstr_w(val
));
1211 ok_(__FILE__
,line
) (val
== NULL
, "val=%s, expected NULL\n", wine_dbgstr_w(val
));
1214 #define test_select_set_value(s,v) _test_select_set_value(__LINE__,s,v)
1215 static void _test_select_set_value(unsigned line
, IHTMLSelectElement
*select
, const char *val
)
1221 hres
= IHTMLSelectElement_put_value(select
, bstr
);
1222 SysFreeString(bstr
);
1223 ok_(__FILE__
,line
) (hres
== S_OK
, "put_value failed: %08x\n", hres
);
1226 #define test_select_type(s,t) _test_select_type(__LINE__,s,t)
1227 static void _test_select_type(unsigned line
, IHTMLSelectElement
*select
, const char *extype
)
1232 hres
= IHTMLSelectElement_get_type(select
, &type
);
1233 ok_(__FILE__
,line
) (hres
== S_OK
, "get_type failed: %08x\n", hres
);
1234 ok_(__FILE__
,line
) (!strcmp_wa(type
, extype
), "type=%s, expected %s\n", wine_dbgstr_w(type
), extype
);
1237 #define test_range_text(r,t) _test_range_text(__LINE__,r,t)
1238 static void _test_range_text(unsigned line
, IHTMLTxtRange
*range
, const char *extext
)
1243 hres
= IHTMLTxtRange_get_text(range
, &text
);
1244 ok_(__FILE__
, line
) (hres
== S_OK
, "get_text failed: %08x\n", hres
);
1247 ok_(__FILE__
, line
) (text
!= NULL
, "text == NULL\n");
1248 ok_(__FILE__
, line
) (!strcmp_wa(text
, extext
), "text=%s, expected %s\n", wine_dbgstr_w(text
), extext
);
1250 ok_(__FILE__
, line
) (text
== NULL
, "text=%s, expected NULL\n", wine_dbgstr_w(text
));
1253 SysFreeString(text
);
1257 #define test_range_collapse(r,b) _test_range_collapse(__LINE__,r,b)
1258 static void _test_range_collapse(unsigned line
, IHTMLTxtRange
*range
, BOOL b
)
1262 hres
= IHTMLTxtRange_collapse(range
, b
);
1263 ok_(__FILE__
, line
) (hres
== S_OK
, "collapse failed: %08x\n", hres
);
1264 _test_range_text(line
, range
, NULL
);
1267 #define test_range_expand(r,u,b,t) _test_range_expand(__LINE__,r,u,b,t)
1268 static void _test_range_expand(unsigned line
, IHTMLTxtRange
*range
, LPWSTR unit
,
1269 VARIANT_BOOL exb
, const char *extext
)
1271 VARIANT_BOOL b
= 0xe0e0;
1274 hres
= IHTMLTxtRange_expand(range
, unit
, &b
);
1275 ok_(__FILE__
,line
) (hres
== S_OK
, "expand failed: %08x\n", hres
);
1276 ok_(__FILE__
,line
) (b
== exb
, "b=%x, expected %x\n", b
, exb
);
1277 _test_range_text(line
, range
, extext
);
1280 #define test_range_move(r,u,c,e) _test_range_move(__LINE__,r,u,c,e)
1281 static void _test_range_move(unsigned line
, IHTMLTxtRange
*range
, LPWSTR unit
, LONG cnt
, LONG excnt
)
1283 LONG c
= 0xdeadbeef;
1286 hres
= IHTMLTxtRange_move(range
, unit
, cnt
, &c
);
1287 ok_(__FILE__
,line
) (hres
== S_OK
, "move failed: %08x\n", hres
);
1288 ok_(__FILE__
,line
) (c
== excnt
, "count=%d, expected %d\n", c
, excnt
);
1289 _test_range_text(line
, range
, NULL
);
1292 #define test_range_movestart(r,u,c,e) _test_range_movestart(__LINE__,r,u,c,e)
1293 static void _test_range_movestart(unsigned line
, IHTMLTxtRange
*range
,
1294 LPWSTR unit
, LONG cnt
, LONG excnt
)
1296 LONG c
= 0xdeadbeef;
1299 hres
= IHTMLTxtRange_moveStart(range
, unit
, cnt
, &c
);
1300 ok_(__FILE__
,line
) (hres
== S_OK
, "move failed: %08x\n", hres
);
1301 ok_(__FILE__
,line
) (c
== excnt
, "count=%d, expected %d\n", c
, excnt
);
1304 #define test_range_moveend(r,u,c,e) _test_range_moveend(__LINE__,r,u,c,e)
1305 static void _test_range_moveend(unsigned line
, IHTMLTxtRange
*range
, LPWSTR unit
, LONG cnt
, LONG excnt
)
1307 LONG c
= 0xdeadbeef;
1310 hres
= IHTMLTxtRange_moveEnd(range
, unit
, cnt
, &c
);
1311 ok_(__FILE__
,line
) (hres
== S_OK
, "move failed: %08x\n", hres
);
1312 ok_(__FILE__
,line
) (c
== excnt
, "count=%d, expected %d\n", c
, excnt
);
1315 #define test_range_put_text(r,t) _test_range_put_text(__LINE__,r,t)
1316 static void _test_range_put_text(unsigned line
, IHTMLTxtRange
*range
, const char *text
)
1319 BSTR bstr
= a2bstr(text
);
1321 hres
= IHTMLTxtRange_put_text(range
, bstr
);
1322 ok_(__FILE__
,line
) (hres
== S_OK
, "put_text failed: %08x\n", hres
);
1323 SysFreeString(bstr
);
1324 _test_range_text(line
, range
, NULL
);
1327 #define test_range_inrange(r1,r2,b) _test_range_inrange(__LINE__,r1,r2,b)
1328 static void _test_range_inrange(unsigned line
, IHTMLTxtRange
*range1
, IHTMLTxtRange
*range2
, VARIANT_BOOL exb
)
1334 hres
= IHTMLTxtRange_inRange(range1
, range2
, &b
);
1335 ok_(__FILE__
,line
) (hres
== S_OK
, "(1->2) isEqual failed: %08x\n", hres
);
1336 ok_(__FILE__
,line
) (b
== exb
, "(1->2) b=%x, expected %x\n", b
, exb
);
1339 #define test_range_isequal(r1,r2,b) _test_range_isequal(__LINE__,r1,r2,b)
1340 static void _test_range_isequal(unsigned line
, IHTMLTxtRange
*range1
, IHTMLTxtRange
*range2
, VARIANT_BOOL exb
)
1346 hres
= IHTMLTxtRange_isEqual(range1
, range2
, &b
);
1347 ok_(__FILE__
,line
) (hres
== S_OK
, "(1->2) isEqual failed: %08x\n", hres
);
1348 ok_(__FILE__
,line
) (b
== exb
, "(1->2) b=%x, expected %x\n", b
, exb
);
1351 hres
= IHTMLTxtRange_isEqual(range2
, range1
, &b
);
1352 ok_(__FILE__
,line
) (hres
== S_OK
, "(2->1) isEqual failed: %08x\n", hres
);
1353 ok_(__FILE__
,line
) (b
== exb
, "(2->1) b=%x, expected %x\n", b
, exb
);
1356 test_range_inrange(range1
, range2
, VARIANT_TRUE
);
1357 test_range_inrange(range2
, range1
, VARIANT_TRUE
);
1361 #define test_range_parent(r,t) _test_range_parent(__LINE__,r,t)
1362 static void _test_range_parent(unsigned line
, IHTMLTxtRange
*range
, elem_type_t type
)
1367 hres
= IHTMLTxtRange_parentElement(range
, &elem
);
1368 ok_(__FILE__
,line
) (hres
== S_OK
, "parentElement failed: %08x\n", hres
);
1370 _test_elem_type(line
, (IUnknown
*)elem
, type
);
1372 IHTMLElement_Release(elem
);
1375 #define test_elem_collection(c,t,l) _test_elem_collection(__LINE__,c,t,l)
1376 static void _test_elem_collection(unsigned line
, IUnknown
*unk
,
1377 const elem_type_t
*elem_types
, LONG exlen
)
1379 IHTMLElementCollection
*col
;
1382 VARIANT name
, index
;
1383 IDispatch
*disp
, *disp2
;
1386 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElementCollection
, (void**)&col
);
1387 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElementCollection: %08x\n", hres
);
1389 test_disp((IUnknown
*)col
, &DIID_DispHTMLElementCollection
, "[object]");
1391 hres
= IHTMLElementCollection_get_length(col
, &len
);
1392 ok_(__FILE__
,line
) (hres
== S_OK
, "get_length failed: %08x\n", hres
);
1393 ok_(__FILE__
,line
) (len
== exlen
, "len=%d, expected %d\n", len
, exlen
);
1398 V_VT(&index
) = VT_EMPTY
;
1400 for(i
=0; i
<len
; i
++) {
1401 V_VT(&name
) = VT_I4
;
1403 disp
= (void*)0xdeadbeef;
1404 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
1405 ok_(__FILE__
,line
) (hres
== S_OK
, "item(%d) failed: %08x\n", i
, hres
);
1406 ok_(__FILE__
,line
) (disp
!= NULL
, "item returned NULL\n");
1407 if(FAILED(hres
) || !disp
)
1410 _test_elem_type(line
, (IUnknown
*)disp
, elem_types
[i
]);
1413 V_VT(&name
) = VT_UINT
;
1415 disp2
= (void*)0xdeadbeef;
1416 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp2
);
1417 ok_(__FILE__
,line
) (hres
== S_OK
, "item(%d) failed: %08x\n", i
, hres
);
1418 ok_(__FILE__
,line
) (iface_cmp((IUnknown
*)disp
, (IUnknown
*)disp2
), "disp != disp2\n");
1420 IDispatch_Release(disp2
);
1423 IDispatch_Release(disp
);
1426 V_VT(&name
) = VT_I4
;
1428 disp
= (void*)0xdeadbeef;
1429 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
1430 ok_(__FILE__
,line
) (hres
== S_OK
, "item failed: %08x\n", hres
);
1431 ok_(__FILE__
,line
) (disp
== NULL
, "disp != NULL\n");
1433 V_VT(&name
) = VT_I4
;
1435 disp
= (void*)0xdeadbeef;
1436 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
1437 ok_(__FILE__
,line
) (hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
1438 ok_(__FILE__
,line
) (disp
== NULL
, "disp != NULL\n");
1440 IHTMLElementCollection_Release(col
);
1443 #define test_elem_all(c,t,l) _test_elem_all(__LINE__,c,t,l)
1444 static void _test_elem_all(unsigned line
, IUnknown
*unk
, const elem_type_t
*elem_types
, LONG exlen
)
1446 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1450 hres
= IHTMLElement_get_all(elem
, &disp
);
1451 IHTMLElement_Release(elem
);
1452 ok_(__FILE__
,line
)(hres
== S_OK
, "get_all failed: %08x\n", hres
);
1454 _test_elem_collection(line
, (IUnknown
*)disp
, elem_types
, exlen
);
1455 IDispatch_Release(disp
);
1458 #define test_elem_getelembytag(u,t,l) _test_elem_getelembytag(__LINE__,u,t,l)
1459 static void _test_elem_getelembytag(unsigned line
, IUnknown
*unk
, elem_type_t type
, LONG exlen
)
1461 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1462 IHTMLElementCollection
*col
= NULL
;
1463 elem_type_t
*types
= NULL
;
1468 tmp
= a2bstr(elem_type_infos
[type
].tag
);
1469 hres
= IHTMLElement2_getElementsByTagName(elem
, tmp
, &col
);
1471 IHTMLElement2_Release(elem
);
1472 ok_(__FILE__
,line
) (hres
== S_OK
, "getElementByTagName failed: %08x\n", hres
);
1473 ok_(__FILE__
,line
) (col
!= NULL
, "col == NULL\n");
1476 types
= HeapAlloc(GetProcessHeap(), 0, exlen
*sizeof(elem_type_t
));
1477 for(i
=0; i
<exlen
; i
++)
1481 _test_elem_collection(line
, (IUnknown
*)col
, types
, exlen
);
1483 HeapFree(GetProcessHeap(), 0, types
);
1486 #define test_elem_innertext(e,t) _test_elem_innertext(__LINE__,e,t)
1487 static void _test_elem_innertext(unsigned line
, IHTMLElement
*elem
, const char *extext
)
1492 hres
= IHTMLElement_get_innerText(elem
, &text
);
1493 ok_(__FILE__
,line
) (hres
== S_OK
, "get_innerText failed: %08x\n", hres
);
1494 ok_(__FILE__
,line
) (!strcmp_wa(text
, extext
), "get_innerText returned %s expected %s\n",
1495 wine_dbgstr_w(text
), extext
);
1496 SysFreeString(text
);
1499 #define test_elem_set_innertext(e,t) _test_elem_set_innertext(__LINE__,e,t)
1500 static void _test_elem_set_innertext(unsigned line
, IHTMLElement
*elem
, const char *text
)
1502 IHTMLDOMChildrenCollection
*col
;
1507 hres
= IHTMLElement_put_innerText(elem
, str
);
1508 ok_(__FILE__
,line
) (hres
== S_OK
, "put_innerText failed: %08x\n", hres
);
1511 _test_elem_innertext(line
, elem
, text
);
1514 col
= _get_child_nodes(line
, (IUnknown
*)elem
);
1515 ok(col
!= NULL
, "col == NULL\n");
1517 LONG length
= 0, type
;
1520 hres
= IHTMLDOMChildrenCollection_get_length(col
, &length
);
1521 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
1522 ok(length
== 1, "length = %d\n", length
);
1524 node
= _get_child_item(line
, col
, 0);
1525 ok(node
!= NULL
, "node == NULL\n");
1527 type
= _get_node_type(line
, (IUnknown
*)node
);
1528 ok(type
== 3, "type=%d\n", type
);
1529 IHTMLDOMNode_Release(node
);
1532 IHTMLDOMChildrenCollection_Release(col
);
1537 #define test_elem_innerhtml(e,t) _test_elem_innerhtml(__LINE__,e,t)
1538 static void _test_elem_innerhtml(unsigned line
, IUnknown
*unk
, const char *inner_html
)
1540 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1544 hres
= IHTMLElement_get_innerHTML(elem
, &html
);
1545 ok_(__FILE__
,line
)(hres
== S_OK
, "get_innerHTML failed: %08x\n", hres
);
1547 ok_(__FILE__
,line
)(!strcmp_wa(html
, inner_html
), "unexpected innerHTML: %s\n", wine_dbgstr_w(html
));
1549 ok_(__FILE__
,line
)(!html
, "innerHTML = %s\n", wine_dbgstr_w(html
));
1551 IHTMLElement_Release(elem
);
1552 SysFreeString(html
);
1555 #define test_elem_set_innerhtml(e,t) _test_elem_set_innerhtml(__LINE__,e,t)
1556 static void _test_elem_set_innerhtml(unsigned line
, IUnknown
*unk
, const char *inner_html
)
1558 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1562 html
= a2bstr(inner_html
);
1563 hres
= IHTMLElement_put_innerHTML(elem
, html
);
1564 ok_(__FILE__
,line
)(hres
== S_OK
, "put_innerHTML failed: %08x\n", hres
);
1566 IHTMLElement_Release(elem
);
1567 SysFreeString(html
);
1570 #define get_first_child(n) _get_first_child(__LINE__,n)
1571 static IHTMLDOMNode
*_get_first_child(unsigned line
, IUnknown
*unk
)
1573 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1574 IHTMLDOMNode
*child
= NULL
;
1577 hres
= IHTMLDOMNode_get_firstChild(node
, &child
);
1578 IHTMLDOMNode_Release(node
);
1579 ok_(__FILE__
,line
) (hres
== S_OK
, "get_firstChild failed: %08x\n", hres
);
1584 #define test_node_has_child(u,b) _test_node_has_child(__LINE__,u,b)
1585 static void _test_node_has_child(unsigned line
, IUnknown
*unk
, VARIANT_BOOL exb
)
1587 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1588 VARIANT_BOOL b
= 0xdead;
1591 hres
= IHTMLDOMNode_hasChildNodes(node
, &b
);
1592 ok_(__FILE__
,line
) (hres
== S_OK
, "hasChildNodes failed: %08x\n", hres
);
1593 ok_(__FILE__
,line
) (b
== exb
, "hasChildNodes=%x, expected %x\n", b
, exb
);
1595 IHTMLDOMNode_Release(node
);
1598 #define test_node_get_parent(u) _test_node_get_parent(__LINE__,u)
1599 static IHTMLDOMNode
*_test_node_get_parent(unsigned line
, IUnknown
*unk
)
1601 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1602 IHTMLDOMNode
*parent
;
1605 hres
= IHTMLDOMNode_get_parentNode(node
, &parent
);
1606 IHTMLDOMNode_Release(node
);
1607 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentNode failed: %08x\n", hres
);
1612 #define node_get_next(u) _node_get_next(__LINE__,u)
1613 static IHTMLDOMNode
*_node_get_next(unsigned line
, IUnknown
*unk
)
1615 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
1619 hres
= IHTMLDOMNode_get_nextSibling(node
, &next
);
1620 IHTMLDOMNode_Release(node
);
1621 ok_(__FILE__
,line
) (hres
== S_OK
, "get_nextSiblibg failed: %08x\n", hres
);
1626 #define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
1627 static IHTMLElement
*_test_elem_get_parent(unsigned line
, IUnknown
*unk
)
1629 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1630 IHTMLElement
*parent
;
1633 hres
= IHTMLElement_get_parentElement(elem
, &parent
);
1634 IHTMLElement_Release(elem
);
1635 ok_(__FILE__
,line
) (hres
== S_OK
, "get_parentElement failed: %08x\n", hres
);
1640 #define test_elem3_get_disabled(i,b) _test_elem3_get_disabled(__LINE__,i,b)
1641 static void _test_elem3_get_disabled(unsigned line
, IUnknown
*unk
, VARIANT_BOOL exb
)
1643 IHTMLElement3
*elem3
= _get_elem3_iface(line
, unk
);
1644 VARIANT_BOOL disabled
= 100;
1648 hres
= IHTMLElement3_get_disabled(elem3
, &disabled
);
1649 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1650 ok_(__FILE__
,line
) (disabled
== exb
, "disabled=%x, expected %x\n", disabled
, exb
);
1651 IHTMLElement3_Release(elem3
);
1654 #define test_elem3_set_disabled(i,b) _test_elem3_set_disabled(__LINE__,i,b)
1655 static void _test_elem3_set_disabled(unsigned line
, IUnknown
*unk
, VARIANT_BOOL b
)
1657 IHTMLElement3
*elem3
= _get_elem3_iface(line
, unk
);
1661 hres
= IHTMLElement3_put_disabled(elem3
, b
);
1662 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1664 IHTMLElement3_Release(elem3
);
1665 _test_elem3_get_disabled(line
, unk
, b
);
1668 #define test_select_get_disabled(i,b) _test_select_get_disabled(__LINE__,i,b)
1669 static void _test_select_get_disabled(unsigned line
, IHTMLSelectElement
*select
, VARIANT_BOOL exb
)
1671 VARIANT_BOOL disabled
= 100;
1674 hres
= IHTMLSelectElement_get_disabled(select
, &disabled
);
1675 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1676 ok_(__FILE__
,line
) (disabled
== exb
, "disabled=%x, expected %x\n", disabled
, exb
);
1678 _test_elem3_get_disabled(line
, (IUnknown
*)select
, exb
);
1681 #define test_select_set_disabled(i,b) _test_select_set_disabled(__LINE__,i,b)
1682 static void _test_select_set_disabled(unsigned line
, IHTMLSelectElement
*select
, VARIANT_BOOL b
)
1686 hres
= IHTMLSelectElement_put_disabled(select
, b
);
1687 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1689 _test_select_get_disabled(line
, select
, b
);
1692 #define elem_get_scroll_height(u) _elem_get_scroll_height(__LINE__,u)
1693 static LONG
_elem_get_scroll_height(unsigned line
, IUnknown
*unk
)
1695 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1696 IHTMLTextContainer
*txtcont
;
1697 LONG l
= -1, l2
= -1;
1700 hres
= IHTMLElement2_get_scrollHeight(elem
, &l
);
1701 ok_(__FILE__
,line
) (hres
== S_OK
, "get_scrollHeight failed: %08x\n", hres
);
1702 IHTMLElement2_Release(elem
);
1704 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1705 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1707 hres
= IHTMLTextContainer_get_scrollHeight(txtcont
, &l2
);
1708 IHTMLTextContainer_Release(txtcont
);
1709 ok_(__FILE__
,line
) (hres
== S_OK
, "IHTMLTextContainer::get_scrollHeight failed: %d\n", l2
);
1710 ok_(__FILE__
,line
) (l
== l2
, "unexpected height %d, expected %d\n", l2
, l
);
1715 #define elem_get_scroll_width(u) _elem_get_scroll_width(__LINE__,u)
1716 static LONG
_elem_get_scroll_width(unsigned line
, IUnknown
*unk
)
1718 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1719 IHTMLTextContainer
*txtcont
;
1720 LONG l
= -1, l2
= -1;
1723 hres
= IHTMLElement2_get_scrollWidth(elem
, &l
);
1724 ok_(__FILE__
,line
) (hres
== S_OK
, "get_scrollWidth failed: %08x\n", hres
);
1725 IHTMLElement2_Release(elem
);
1727 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1728 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1730 hres
= IHTMLTextContainer_get_scrollWidth(txtcont
, &l2
);
1731 IHTMLTextContainer_Release(txtcont
);
1732 ok_(__FILE__
,line
) (hres
== S_OK
, "IHTMLTextContainer::get_scrollWidth failed: %d\n", l2
);
1733 ok_(__FILE__
,line
) (l
== l2
, "unexpected width %d, expected %d\n", l2
, l
);
1738 #define elem_get_scroll_top(u) _elem_get_scroll_top(__LINE__,u)
1739 static LONG
_elem_get_scroll_top(unsigned line
, IUnknown
*unk
)
1741 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1742 IHTMLTextContainer
*txtcont
;
1743 LONG l
= -1, l2
= -1;
1746 hres
= IHTMLElement2_get_scrollTop(elem
, &l
);
1747 ok_(__FILE__
,line
) (hres
== S_OK
, "get_scrollTop failed: %08x\n", hres
);
1748 IHTMLElement2_Release(elem
);
1750 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1751 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1753 hres
= IHTMLTextContainer_get_scrollTop(txtcont
, &l2
);
1754 IHTMLTextContainer_Release(txtcont
);
1755 ok_(__FILE__
,line
) (hres
== S_OK
, "IHTMLTextContainer::get_scrollTop failed: %d\n", l2
);
1756 ok_(__FILE__
,line
) (l
== l2
, "unexpected top %d, expected %d\n", l2
, l
);
1761 #define elem_get_scroll_left(u) _elem_get_scroll_left(__LINE__,u)
1762 static void _elem_get_scroll_left(unsigned line
, IUnknown
*unk
)
1764 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
1765 IHTMLTextContainer
*txtcont
;
1766 LONG l
= -1, l2
= -1;
1769 hres
= IHTMLElement2_get_scrollLeft(elem
, NULL
);
1770 ok(hres
== E_INVALIDARG
, "expect E_INVALIDARG got 0x%08x\n", hres
);
1772 hres
= IHTMLElement2_get_scrollLeft(elem
, &l
);
1773 ok(hres
== S_OK
, "get_scrollTop failed: %08x\n", hres
);
1774 IHTMLElement2_Release(elem
);
1776 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLTextContainer
, (void**)&txtcont
);
1777 ok(hres
== S_OK
, "Could not get IHTMLTextContainer: %08x\n", hres
);
1779 hres
= IHTMLTextContainer_get_scrollLeft(txtcont
, &l2
);
1780 IHTMLTextContainer_Release(txtcont
);
1781 ok(hres
== S_OK
, "IHTMLTextContainer::get_scrollLeft failed: %d\n", l2
);
1782 ok(l
== l2
, "unexpected left %d, expected %d\n", l2
, l
);
1785 #define test_img_src(i,s) _test_img_src(__LINE__,i,s)
1786 static void _test_img_src(unsigned line
, IUnknown
*unk
, const char *exsrc
)
1788 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1792 hres
= IHTMLImgElement_get_src(img
, &src
);
1793 IHTMLImgElement_Release(img
);
1794 ok_(__FILE__
,line
) (hres
== S_OK
, "get_src failed: %08x\n", hres
);
1795 ok_(__FILE__
,line
) (!strcmp_wa(src
, exsrc
), "get_src returned %s expected %s\n", wine_dbgstr_w(src
), exsrc
);
1799 #define test_img_set_src(u,s) _test_img_set_src(__LINE__,u,s)
1800 static void _test_img_set_src(unsigned line
, IUnknown
*unk
, const char *src
)
1802 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1807 hres
= IHTMLImgElement_put_src(img
, tmp
);
1808 IHTMLImgElement_Release(img
);
1810 ok_(__FILE__
,line
) (hres
== S_OK
, "put_src failed: %08x\n", hres
);
1812 _test_img_src(line
, unk
, src
);
1815 #define test_img_alt(u,a) _test_img_alt(__LINE__,u,a)
1816 static void _test_img_alt(unsigned line
, IUnknown
*unk
, const char *exalt
)
1818 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1822 hres
= IHTMLImgElement_get_alt(img
, &alt
);
1823 ok_(__FILE__
,line
) (hres
== S_OK
, "get_alt failed: %08x\n", hres
);
1825 ok_(__FILE__
,line
) (!strcmp_wa(alt
, exalt
), "inexopected alt %s\n", wine_dbgstr_w(alt
));
1827 ok_(__FILE__
,line
) (!alt
, "alt != NULL\n");
1831 #define test_img_set_alt(u,a) _test_img_set_alt(__LINE__,u,a)
1832 static void _test_img_set_alt(unsigned line
, IUnknown
*unk
, const char *alt
)
1834 IHTMLImgElement
*img
= _get_img_iface(line
, unk
);
1839 hres
= IHTMLImgElement_put_alt(img
, tmp
);
1840 ok_(__FILE__
,line
) (hres
== S_OK
, "get_alt failed: %08x\n", hres
);
1843 _test_img_alt(line
, unk
, alt
);
1846 #define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b)
1847 static void _test_input_get_disabled(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL exb
)
1849 VARIANT_BOOL disabled
= 100;
1852 hres
= IHTMLInputElement_get_disabled(input
, &disabled
);
1853 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1854 ok_(__FILE__
,line
) (disabled
== exb
, "disabled=%x, expected %x\n", disabled
, exb
);
1856 _test_elem3_get_disabled(line
, (IUnknown
*)input
, exb
);
1859 #define test_input_set_disabled(i,b) _test_input_set_disabled(__LINE__,i,b)
1860 static void _test_input_set_disabled(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL b
)
1864 hres
= IHTMLInputElement_put_disabled(input
, b
);
1865 ok_(__FILE__
,line
) (hres
== S_OK
, "get_disabled failed: %08x\n", hres
);
1867 _test_input_get_disabled(line
, input
, b
);
1870 #define test_input_get_defaultchecked(i,b) _test_input_get_defaultchecked(__LINE__,i,b)
1871 static void _test_input_get_defaultchecked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL exb
)
1873 VARIANT_BOOL checked
= 100;
1876 hres
= IHTMLInputElement_get_defaultChecked(input
, &checked
);
1877 ok_(__FILE__
,line
) (hres
== S_OK
, "get_defaultChecked failed: %08x\n", hres
);
1878 ok_(__FILE__
,line
) (checked
== exb
, "checked=%x, expected %x\n", checked
, exb
);
1881 #define test_input_set_defaultchecked(i,b) _test_input_set_defaultchecked(__LINE__,i,b)
1882 static void _test_input_set_defaultchecked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL b
)
1886 hres
= IHTMLInputElement_put_defaultChecked(input
, b
);
1887 ok_(__FILE__
,line
) (hres
== S_OK
, "get_defaultChecked failed: %08x\n", hres
);
1889 _test_input_get_defaultchecked(line
, input
, b
);
1892 #define test_input_get_checked(i,b) _test_input_get_checked(__LINE__,i,b)
1893 static void _test_input_get_checked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL exb
)
1895 VARIANT_BOOL checked
= 100;
1898 hres
= IHTMLInputElement_get_checked(input
, &checked
);
1899 ok_(__FILE__
,line
) (hres
== S_OK
, "get_checked failed: %08x\n", hres
);
1900 ok_(__FILE__
,line
) (checked
== exb
, "checked=%x, expected %x\n", checked
, exb
);
1903 #define test_input_set_checked(i,b) _test_input_set_checked(__LINE__,i,b)
1904 static void _test_input_set_checked(unsigned line
, IHTMLInputElement
*input
, VARIANT_BOOL b
)
1908 hres
= IHTMLInputElement_put_checked(input
, b
);
1909 ok_(__FILE__
,line
) (hres
== S_OK
, "get_checked failed: %08x\n", hres
);
1911 _test_input_get_checked(line
, input
, b
);
1914 #define test_input_value(o,t) _test_input_value(__LINE__,o,t)
1915 static void _test_input_value(unsigned line
, IUnknown
*unk
, const char *exval
)
1917 IHTMLInputElement
*input
;
1921 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLInputElement
, (void**)&input
);
1922 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLInputElement: %08x\n", hres
);
1926 hres
= IHTMLInputElement_get_value(input
, &bstr
);
1927 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
1929 ok_(__FILE__
,line
) (!strcmp_wa(bstr
, exval
), "value=%s\n", wine_dbgstr_w(bstr
));
1931 ok_(__FILE__
,line
) (!exval
, "exval != NULL\n");
1932 SysFreeString(bstr
);
1933 IHTMLInputElement_Release(input
);
1936 #define test_input_put_value(o,v) _test_input_put_value(__LINE__,o,v)
1937 static void _test_input_put_value(unsigned line
, IUnknown
*unk
, const char *val
)
1939 IHTMLInputElement
*input
;
1943 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLInputElement
, (void**)&input
);
1944 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLInputElement: %08x\n", hres
);
1949 hres
= IHTMLInputElement_get_value(input
, &bstr
);
1950 ok_(__FILE__
,line
) (hres
== S_OK
, "get_value failed: %08x\n", hres
);
1951 SysFreeString(bstr
);
1952 IHTMLInputElement_Release(input
);
1955 #define test_input_src(i,s) _test_input_src(__LINE__,i,s)
1956 static void _test_input_src(unsigned line
, IHTMLInputElement
*input
, const char *exsrc
)
1961 hres
= IHTMLInputElement_get_src(input
, &src
);
1962 ok_(__FILE__
,line
) (hres
== S_OK
, "get_src failed: %08x\n", hres
);
1964 ok_(__FILE__
,line
) (!strcmp_wa(src
, exsrc
), "get_src returned %s expected %s\n", wine_dbgstr_w(src
), exsrc
);
1966 ok_(__FILE__
,line
) (!src
, "get_src returned %s expected NULL\n", wine_dbgstr_w(src
));
1970 #define test_input_set_src(u,s) _test_input_set_src(__LINE__,u,s)
1971 static void _test_input_set_src(unsigned line
, IHTMLInputElement
*input
, const char *src
)
1977 hres
= IHTMLInputElement_put_src(input
, tmp
);
1979 ok_(__FILE__
,line
) (hres
== S_OK
, "put_src failed: %08x\n", hres
);
1981 _test_input_src(line
, input
, src
);
1984 #define test_elem_class(u,c) _test_elem_class(__LINE__,u,c)
1985 static void _test_elem_class(unsigned line
, IUnknown
*unk
, const char *exclass
)
1987 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
1988 BSTR
class = (void*)0xdeadbeef;
1991 hres
= IHTMLElement_get_className(elem
, &class);
1992 IHTMLElement_Release(elem
);
1993 ok_(__FILE__
,line
) (hres
== S_OK
, "get_className failed: %08x\n", hres
);
1995 ok_(__FILE__
,line
) (!strcmp_wa(class, exclass
), "unexpected className %s\n", wine_dbgstr_w(class));
1997 ok_(__FILE__
,line
) (!class, "class != NULL\n");
1998 SysFreeString(class);
2001 #define test_elem_tabindex(u,i) _test_elem_tabindex(__LINE__,u,i)
2002 static void _test_elem_tabindex(unsigned line
, IUnknown
*unk
, short exindex
)
2004 IHTMLElement2
*elem2
= _get_elem2_iface(line
, unk
);
2008 hres
= IHTMLElement2_get_tabIndex(elem2
, &index
);
2009 IHTMLElement2_Release(elem2
);
2010 ok_(__FILE__
,line
) (hres
== S_OK
, "get_tabIndex failed: %08x\n", hres
);
2011 ok_(__FILE__
,line
) (index
== exindex
, "unexpected index %d\n", index
);
2014 #define test_elem_set_tabindex(u,i) _test_elem_set_tabindex(__LINE__,u,i)
2015 static void _test_elem_set_tabindex(unsigned line
, IUnknown
*unk
, short index
)
2017 IHTMLElement2
*elem2
= _get_elem2_iface(line
, unk
);
2020 hres
= IHTMLElement2_put_tabIndex(elem2
, index
);
2021 IHTMLElement2_Release(elem2
);
2022 ok_(__FILE__
,line
) (hres
== S_OK
, "get_tabIndex failed: %08x\n", hres
);
2024 _test_elem_tabindex(line
, unk
, index
);
2027 #define test_elem_set_class(u,c) _test_elem_set_class(__LINE__,u,c)
2028 static void _test_elem_set_class(unsigned line
, IUnknown
*unk
, const char *class)
2030 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2034 tmp
= class ? a2bstr(class) : NULL
;
2035 hres
= IHTMLElement_put_className(elem
, tmp
);
2036 IHTMLElement_Release(elem
);
2037 ok_(__FILE__
,line
) (hres
== S_OK
, "put_className failed: %08x\n", hres
);
2040 _test_elem_class(line
, unk
, class);
2043 #define test_elem_id(e,i) _test_elem_id(__LINE__,e,i)
2044 static void _test_elem_id(unsigned line
, IUnknown
*unk
, const char *exid
)
2046 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2047 BSTR id
= (void*)0xdeadbeef;
2050 hres
= IHTMLElement_get_id(elem
, &id
);
2051 IHTMLElement_Release(elem
);
2052 ok_(__FILE__
,line
) (hres
== S_OK
, "get_id failed: %08x\n", hres
);
2055 ok_(__FILE__
,line
) (!strcmp_wa(id
, exid
), "unexpected id %s\n", wine_dbgstr_w(id
));
2057 ok_(__FILE__
,line
) (!id
, "id=%s\n", wine_dbgstr_w(id
));
2062 #define test_elem_put_id(u,i) _test_elem_put_id(__LINE__,u,i)
2063 static void _test_elem_put_id(unsigned line
, IUnknown
*unk
, const char *new_id
)
2065 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2066 BSTR tmp
= a2bstr(new_id
);
2069 hres
= IHTMLElement_put_id(elem
, tmp
);
2070 IHTMLElement_Release(elem
);
2072 ok_(__FILE__
,line
) (hres
== S_OK
, "put_id failed: %08x\n", hres
);
2074 _test_elem_id(line
, unk
, new_id
);
2077 #define test_elem_title(u,t) _test_elem_title(__LINE__,u,t)
2078 static void _test_elem_title(unsigned line
, IUnknown
*unk
, const char *extitle
)
2080 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2084 hres
= IHTMLElement_get_title(elem
, &title
);
2085 IHTMLElement_Release(elem
);
2086 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2088 ok_(__FILE__
,line
) (!strcmp_wa(title
, extitle
), "unexpected title %s\n", wine_dbgstr_w(title
));
2090 ok_(__FILE__
,line
) (!title
, "title=%s, expected NULL\n", wine_dbgstr_w(title
));
2092 SysFreeString(title
);
2095 #define test_elem_set_title(u,t) _test_elem_set_title(__LINE__,u,t)
2096 static void _test_elem_set_title(unsigned line
, IUnknown
*unk
, const char *title
)
2098 IHTMLElement
*elem
= _get_elem_iface(line
, unk
);
2102 tmp
= a2bstr(title
);
2103 hres
= IHTMLElement_put_title(elem
, tmp
);
2104 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2106 IHTMLElement_Release(elem
);
2110 #define test_node_get_value_str(u,e) _test_node_get_value_str(__LINE__,u,e)
2111 static void _test_node_get_value_str(unsigned line
, IUnknown
*unk
, const char *exval
)
2113 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
2117 hres
= IHTMLDOMNode_get_nodeValue(node
, &var
);
2118 IHTMLDOMNode_Release(node
);
2119 ok_(__FILE__
,line
) (hres
== S_OK
, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres
);
2122 ok_(__FILE__
,line
) (V_VT(&var
) == VT_BSTR
, "vt=%d\n", V_VT(&var
));
2123 ok_(__FILE__
,line
) (!strcmp_wa(V_BSTR(&var
), exval
), "unexpected value %s\n", wine_dbgstr_w(V_BSTR(&var
)));
2125 ok_(__FILE__
,line
) (V_VT(&var
) == VT_NULL
, "vt=%d, expected VT_NULL\n", V_VT(&var
));
2131 #define test_node_put_value_str(u,v) _test_node_put_value_str(__LINE__,u,v)
2132 static void _test_node_put_value_str(unsigned line
, IUnknown
*unk
, const char *val
)
2134 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
2138 V_VT(&var
) = VT_BSTR
;
2139 V_BSTR(&var
) = a2bstr(val
);
2141 hres
= IHTMLDOMNode_put_nodeValue(node
, var
);
2142 ok_(__FILE__
,line
) (hres
== S_OK
, "get_nodeValue failed: %08x, expected VT_BSTR\n", hres
);
2143 IHTMLDOMNode_Release(node
);
2147 #define test_elem_client_size(u) _test_elem_client_size(__LINE__,u)
2148 static void _test_elem_client_size(unsigned line
, IUnknown
*unk
)
2150 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
2154 hres
= IHTMLElement2_get_clientWidth(elem
, &l
);
2155 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientWidth failed: %08x\n", hres
);
2156 hres
= IHTMLElement2_get_clientHeight(elem
, &l
);
2157 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientHeight failed: %08x\n", hres
);
2159 IHTMLElement2_Release(elem
);
2162 #define test_elem_client_rect(u) _test_elem_client_rect(__LINE__,u)
2163 static void _test_elem_client_rect(unsigned line
, IUnknown
*unk
)
2165 IHTMLElement2
*elem
= _get_elem2_iface(line
, unk
);
2169 hres
= IHTMLElement2_get_clientLeft(elem
, &l
);
2170 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientLeft failed: %08x\n", hres
);
2171 ok_(__FILE__
,line
) (!l
, "clientLeft = %d\n", l
);
2173 hres
= IHTMLElement2_get_clientTop(elem
, &l
);
2174 ok_(__FILE__
,line
) (hres
== S_OK
, "get_clientTop failed: %08x\n", hres
);
2175 ok_(__FILE__
,line
) (!l
, "clientTop = %d\n", l
);
2177 IHTMLElement2_Release(elem
);
2180 #define test_create_elem(d,t) _test_create_elem(__LINE__,d,t)
2181 static IHTMLElement
*_test_create_elem(unsigned line
, IHTMLDocument2
*doc
, const char *tag
)
2183 IHTMLElement
*elem
= NULL
;
2188 hres
= IHTMLDocument2_createElement(doc
, tmp
, &elem
);
2189 ok_(__FILE__
,line
) (hres
== S_OK
, "createElement failed: %08x\n", hres
);
2190 ok_(__FILE__
,line
) (elem
!= NULL
, "elem == NULL\n");
2195 #define test_create_text(d,t) _test_create_text(__LINE__,d,t)
2196 static IHTMLDOMNode
*_test_create_text(unsigned line
, IHTMLDocument2
*doc
, const char *text
)
2198 IHTMLDocument3
*doc3
;
2199 IHTMLDOMNode
*node
= NULL
;
2203 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
2204 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLDocument3: %08x\n", hres
);
2207 hres
= IHTMLDocument3_createTextNode(doc3
, tmp
, &node
);
2208 IHTMLDocument3_Release(doc3
);
2209 ok_(__FILE__
,line
) (hres
== S_OK
, "createElement failed: %08x\n", hres
);
2210 ok_(__FILE__
,line
) (node
!= NULL
, "node == NULL\n");
2215 #define test_node_append_child(n,c) _test_node_append_child(__LINE__,n,c)
2216 static IHTMLDOMNode
*_test_node_append_child(unsigned line
, IUnknown
*node_unk
, IUnknown
*child_unk
)
2218 IHTMLDOMNode
*node
= _get_node_iface(line
, node_unk
);
2219 IHTMLDOMNode
*child
= _get_node_iface(line
, child_unk
);
2220 IHTMLDOMNode
*new_child
= NULL
;
2223 hres
= IHTMLDOMNode_appendChild(node
, child
, &new_child
);
2224 ok_(__FILE__
,line
) (hres
== S_OK
, "appendChild failed: %08x\n", hres
);
2225 ok_(__FILE__
,line
) (new_child
!= NULL
, "new_child == NULL\n");
2226 /* TODO ok_(__FILE__,line) (new_child != child, "new_child == child\n"); */
2228 IHTMLDOMNode_Release(node
);
2229 IHTMLDOMNode_Release(child
);
2234 #define test_node_insertbefore(n,c,v) _test_node_insertbefore(__LINE__,n,c,v)
2235 static IHTMLDOMNode
*_test_node_insertbefore(unsigned line
, IUnknown
*node_unk
, IHTMLDOMNode
*child
, VARIANT
*var
)
2237 IHTMLDOMNode
*node
= _get_node_iface(line
, node_unk
);
2238 IHTMLDOMNode
*new_child
= NULL
;
2241 hres
= IHTMLDOMNode_insertBefore(node
, child
, *var
, &new_child
);
2242 ok_(__FILE__
,line
) (hres
== S_OK
, "insertBefore failed: %08x\n", hres
);
2243 ok_(__FILE__
,line
) (new_child
!= NULL
, "new_child == NULL\n");
2244 /* TODO ok_(__FILE__,line) (new_child != child, "new_child == child\n"); */
2246 IHTMLDOMNode_Release(node
);
2251 #define test_node_remove_child(n,c) _test_node_remove_child(__LINE__,n,c)
2252 static void _test_node_remove_child(unsigned line
, IUnknown
*unk
, IHTMLDOMNode
*child
)
2254 IHTMLDOMNode
*node
= _get_node_iface(line
, unk
);
2255 IHTMLDOMNode
*new_node
= NULL
;
2258 hres
= IHTMLDOMNode_removeChild(node
, child
, &new_node
);
2259 ok_(__FILE__
,line
) (hres
== S_OK
, "removeChild failed: %08x\n", hres
);
2260 ok_(__FILE__
,line
) (new_node
!= NULL
, "new_node == NULL\n");
2261 /* TODO ok_(__FILE__,line) (new_node != child, "new_node == child\n"); */
2263 IHTMLDOMNode_Release(node
);
2264 IHTMLDOMNode_Release(new_node
);
2267 #define test_doc_title(d,t) _test_doc_title(__LINE__,d,t)
2268 static void _test_doc_title(unsigned line
, IHTMLDocument2
*doc
, const char *extitle
)
2273 hres
= IHTMLDocument2_get_title(doc
, &title
);
2274 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2275 ok_(__FILE__
,line
) (!strcmp_wa(title
, extitle
), "unexpected title %s\n", wine_dbgstr_w(title
));
2276 SysFreeString(title
);
2279 #define test_doc_set_title(d,t) _test_doc_set_title(__LINE__,d,t)
2280 static void _test_doc_set_title(unsigned line
, IHTMLDocument2
*doc
, const char *title
)
2285 tmp
= a2bstr(title
);
2286 hres
= IHTMLDocument2_put_title(doc
, tmp
);
2287 ok_(__FILE__
,line
) (hres
== S_OK
, "get_title failed: %08x\n", hres
);
2291 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
2292 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
2297 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
2298 LOCALE_USER_DEFAULT
, &dispid
);
2299 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
2302 DISPPARAMS params
= {NULL
,NULL
,0,0};
2303 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
2308 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2309 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
2310 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
2313 params
.cNamedArgs
= 1;
2314 params
.rgdispidNamedArgs
= &dispidNamed
;
2315 V_VT(&arg
) = VT_BSTR
;
2316 V_BSTR(&arg
) = a2bstr("none");
2317 params
.rgvarg
= &arg
;
2318 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2319 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2320 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
2323 V_VT(&arg
) = VT_BSTR
;
2324 V_BSTR(&arg
) = a2bstr("dotted");
2325 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2326 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2327 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
2330 V_VT(&arg
) = VT_BSTR
;
2331 V_BSTR(&arg
) = a2bstr("dashed");
2332 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2333 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2334 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
2337 V_VT(&arg
) = VT_BSTR
;
2338 V_BSTR(&arg
) = a2bstr("solid");
2339 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2340 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2341 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
2344 V_VT(&arg
) = VT_BSTR
;
2345 V_BSTR(&arg
) = a2bstr("double");
2346 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2347 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2348 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
2351 V_VT(&arg
) = VT_BSTR
;
2352 V_BSTR(&arg
) = a2bstr("groove");
2353 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2354 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2355 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
2358 V_VT(&arg
) = VT_BSTR
;
2359 V_BSTR(&arg
) = a2bstr("ridge");
2360 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2361 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2362 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
2365 V_VT(&arg
) = VT_BSTR
;
2366 V_BSTR(&arg
) = a2bstr("inset");
2367 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2368 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2369 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
2372 V_VT(&arg
) = VT_BSTR
;
2373 V_BSTR(&arg
) = a2bstr("outset");
2374 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2375 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2376 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
2379 V_VT(&arg
) = VT_BSTR
;
2380 V_BSTR(&arg
) = a2bstr("invalid");
2381 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2382 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2383 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
2386 params
.rgvarg
= &vDefault
;
2387 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
2388 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
2389 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
2393 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
2394 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
2396 BSTR text
= (void*)0xdeadbeef;
2399 hres
= IHTMLStyle_get_cssText(style
, &text
);
2400 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
2402 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
2404 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
2406 SysFreeString(text
);
2409 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
2410 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
2416 hres
= IHTMLStyle_put_cssText(style
, tmp
);
2417 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
2421 static void test_elem_col_item(IHTMLElementCollection
*col
, const char *n
,
2422 const elem_type_t
*elem_types
, LONG len
)
2425 VARIANT name
, index
;
2429 V_VT(&index
) = VT_EMPTY
;
2430 V_VT(&name
) = VT_BSTR
;
2431 V_BSTR(&name
) = a2bstr(n
);
2433 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2434 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2436 test_elem_collection((IUnknown
*)disp
, elem_types
, len
);
2437 IDispatch_Release(disp
);
2438 ok(hres
== S_OK
, "Could not get IHTMLElementCollection interface: %08x\n", hres
);
2442 V_VT(&index
) = VT_I4
;
2444 for(i
=0; i
<len
; i
++) {
2446 disp
= (void*)0xdeadbeef;
2447 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2448 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2449 ok(disp
!= NULL
, "disp == NULL\n");
2450 if(FAILED(hres
) || !disp
)
2453 test_elem_type((IUnknown
*)disp
, elem_types
[i
]);
2455 IDispatch_Release(disp
);
2459 disp
= (void*)0xdeadbeef;
2460 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2461 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2462 ok(disp
== NULL
, "disp != NULL\n");
2465 disp
= (void*)0xdeadbeef;
2466 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2467 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
2468 ok(disp
== NULL
, "disp != NULL\n");
2471 SysFreeString(V_BSTR(&name
));
2474 static IHTMLElement
*get_elem_by_id(IHTMLDocument2
*doc
, const char *id
, BOOL expect_success
)
2476 IHTMLElementCollection
*col
;
2478 IDispatch
*disp
= (void*)0xdeadbeef;
2479 VARIANT name
, index
;
2482 hres
= IHTMLDocument2_get_all(doc
, &col
);
2483 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
2484 ok(col
!= NULL
, "col == NULL\n");
2485 if(FAILED(hres
) || !col
)
2488 V_VT(&index
) = VT_EMPTY
;
2489 V_VT(&name
) = VT_BSTR
;
2490 V_BSTR(&name
) = a2bstr(id
);
2492 hres
= IHTMLElementCollection_item(col
, name
, index
, &disp
);
2493 IHTMLElementCollection_Release(col
);
2494 SysFreeString(V_BSTR(&name
));
2495 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
2496 if(!expect_success
) {
2497 ok(disp
== NULL
, "disp != NULL\n");
2501 ok(disp
!= NULL
, "disp == NULL\n");
2505 elem
= get_elem_iface((IUnknown
*)disp
);
2506 IDispatch_Release(disp
);
2511 static IHTMLElement
*get_doc_elem_by_id(IHTMLDocument2
*doc
, const char *id
)
2513 IHTMLDocument3
*doc3
;
2518 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
2519 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
2522 hres
= IHTMLDocument3_getElementById(doc3
, tmp
, &elem
);
2524 ok(hres
== S_OK
, "getElementById(%s) failed: %08x\n", id
, hres
);
2526 IHTMLDocument3_Release(doc3
);
2531 static void test_select_elem(IHTMLSelectElement
*select
)
2533 test_select_type(select
, "select-one");
2534 test_select_length(select
, 2);
2535 test_select_selidx(select
, 0);
2536 test_select_put_selidx(select
, 1);
2538 test_select_set_value(select
, "val1");
2539 test_select_value(select
, "val1");
2541 test_select_get_disabled(select
, VARIANT_FALSE
);
2542 test_select_set_disabled(select
, VARIANT_TRUE
);
2543 test_select_set_disabled(select
, VARIANT_FALSE
);
2546 static void test_create_option_elem(IHTMLDocument2
*doc
)
2548 IHTMLOptionElement
*option
;
2550 option
= create_option_elem(doc
, "test text", "test value");
2552 test_option_put_text(option
, "new text");
2553 test_option_put_value(option
, "new value");
2555 IHTMLOptionElement_Release(option
);
2558 static void test_create_img_elem(IHTMLDocument2
*doc
)
2560 IHTMLImgElement
*img
;
2562 img
= create_img_elem(doc
, 10, 15);
2565 test_img_put_width(img
, 5);
2566 test_img_put_height(img
, 20);
2568 IHTMLImgElement_Release(img
);
2572 img
= create_img_elem(doc
, -1, -1);
2575 test_img_put_width(img
, 5);
2576 test_img_put_height(img
, 20);
2578 IHTMLImgElement_Release(img
);
2582 static IHTMLTxtRange
*test_create_body_range(IHTMLDocument2
*doc
)
2584 IHTMLBodyElement
*body
;
2585 IHTMLTxtRange
*range
;
2589 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2590 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2592 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLBodyElement
, (void**)&body
);
2593 IHTMLElement_Release(elem
);
2595 hres
= IHTMLBodyElement_createTextRange(body
, &range
);
2596 IHTMLBodyElement_Release(body
);
2597 ok(hres
== S_OK
, "createTextRange failed: %08x\n", hres
);
2602 static void test_txtrange(IHTMLDocument2
*doc
)
2604 IHTMLTxtRange
*body_range
, *range
, *range2
;
2605 IHTMLSelectionObject
*selection
;
2606 IDispatch
*disp_range
;
2609 body_range
= test_create_body_range(doc
);
2611 test_range_text(body_range
, "test abc 123\r\nit's text");
2613 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2614 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2616 hres
= IHTMLTxtRange_duplicate(body_range
, &range2
);
2617 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2618 test_range_isequal(range
, range2
, VARIANT_TRUE
);
2620 test_range_text(range
, "test abc 123\r\nit's text");
2621 test_range_text(body_range
, "test abc 123\r\nit's text");
2623 test_range_collapse(range
, TRUE
);
2624 test_range_isequal(range
, range2
, VARIANT_FALSE
);
2625 test_range_inrange(range
, range2
, VARIANT_FALSE
);
2626 test_range_inrange(range2
, range
, VARIANT_TRUE
);
2627 IHTMLTxtRange_Release(range2
);
2629 test_range_expand(range
, wordW
, VARIANT_TRUE
, "test ");
2630 test_range_expand(range
, wordW
, VARIANT_FALSE
, "test ");
2631 test_range_move(range
, characterW
, 2, 2);
2632 test_range_expand(range
, wordW
, VARIANT_TRUE
, "test ");
2634 test_range_collapse(range
, FALSE
);
2635 test_range_expand(range
, wordW
, VARIANT_TRUE
, "abc ");
2637 test_range_collapse(range
, FALSE
);
2638 test_range_expand(range
, wordW
, VARIANT_TRUE
, "123");
2639 test_range_expand(range
, wordW
, VARIANT_FALSE
, "123");
2640 test_range_move(range
, characterW
, 2, 2);
2641 test_range_expand(range
, wordW
, VARIANT_TRUE
, "123");
2642 test_range_moveend(range
, characterW
, -5, -5);
2643 test_range_text(range
, NULL
);
2644 test_range_moveend(range
, characterW
, 3, 3);
2645 test_range_text(range
, "c 1");
2646 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "test abc 123\r\nit's text");
2647 test_range_collapse(range
, TRUE
);
2648 test_range_move(range
, characterW
, 4, 4);
2649 test_range_moveend(range
, characterW
, 1, 1);
2650 test_range_text(range
, " ");
2651 test_range_move(range
, wordW
, 1, 1);
2652 test_range_moveend(range
, characterW
, 2, 2);
2653 test_range_text(range
, "ab");
2655 IHTMLTxtRange_Release(range
);
2657 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2658 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2660 test_range_text(range
, "test abc 123\r\nit's text");
2661 test_range_move(range
, characterW
, 3, 3);
2662 test_range_moveend(range
, characterW
, 1, 1);
2663 test_range_text(range
, "t");
2664 test_range_moveend(range
, characterW
, 3, 3);
2665 test_range_text(range
, "t ab");
2666 test_range_moveend(range
, characterW
, -2, -2);
2667 test_range_text(range
, "t ");
2668 test_range_move(range
, characterW
, 6, 6);
2669 test_range_moveend(range
, characterW
, 3, 3);
2670 test_range_text(range
, "123");
2671 test_range_moveend(range
, characterW
, 2, 2);
2672 test_range_text(range
, "123\r\ni");
2674 IHTMLTxtRange_Release(range
);
2676 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2677 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2679 test_range_move(range
, wordW
, 1, 1);
2680 test_range_moveend(range
, characterW
, 2, 2);
2681 test_range_text(range
, "ab");
2683 test_range_move(range
, characterW
, -2, -2);
2684 test_range_moveend(range
, characterW
, 2, 2);
2685 test_range_text(range
, "t ");
2687 test_range_move(range
, wordW
, 3, 3);
2688 test_range_move(range
, wordW
, -2, -2);
2689 test_range_moveend(range
, characterW
, 2, 2);
2690 test_range_text(range
, "ab");
2692 test_range_move(range
, characterW
, -6, -5);
2693 test_range_moveend(range
, characterW
, -1, 0);
2694 test_range_moveend(range
, characterW
, -6, 0);
2695 test_range_move(range
, characterW
, 2, 2);
2696 test_range_moveend(range
, characterW
, 2, 2);
2697 test_range_text(range
, "st");
2698 test_range_moveend(range
, characterW
, -6, -4);
2699 test_range_moveend(range
, characterW
, 2, 2);
2701 IHTMLTxtRange_Release(range
);
2703 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2704 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2706 test_range_move(range
, wordW
, 2, 2);
2707 test_range_moveend(range
, characterW
, 2, 2);
2708 test_range_text(range
, "12");
2710 test_range_move(range
, characterW
, 15, 14);
2711 test_range_move(range
, characterW
, -2, -2);
2712 test_range_moveend(range
, characterW
, 3, 2);
2713 test_range_text(range
, "t");
2714 test_range_moveend(range
, characterW
, -1, -1);
2715 test_range_text(range
, "t");
2716 test_range_expand(range
, wordW
, VARIANT_TRUE
, "text");
2717 test_range_move(range
, characterW
, -2, -2);
2718 test_range_moveend(range
, characterW
, 2, 2);
2719 test_range_text(range
, "s ");
2720 test_range_move(range
, characterW
, 100, 7);
2721 test_range_move(range
, wordW
, 1, 0);
2722 test_range_move(range
, characterW
, -2, -2);
2723 test_range_moveend(range
, characterW
, 3, 2);
2724 test_range_text(range
, "t");
2726 IHTMLTxtRange_Release(range
);
2728 hres
= IHTMLTxtRange_duplicate(body_range
, &range
);
2729 ok(hres
== S_OK
, "duplicate failed: %08x\n", hres
);
2731 test_range_collapse(range
, TRUE
);
2732 test_range_expand(range
, wordW
, VARIANT_TRUE
, "test ");
2733 test_range_put_text(range
, "word");
2734 test_range_text(body_range
, "wordabc 123\r\nit's text");
2735 test_range_text(range
, NULL
);
2736 test_range_moveend(range
, characterW
, 3, 3);
2737 test_range_text(range
, "abc");
2738 test_range_movestart(range
, characterW
, -2, -2);
2739 test_range_text(range
, "rdabc");
2740 test_range_movestart(range
, characterW
, 3, 3);
2741 test_range_text(range
, "bc");
2742 test_range_movestart(range
, characterW
, 4, 4);
2743 test_range_text(range
, NULL
);
2744 test_range_movestart(range
, characterW
, -3, -3);
2745 test_range_text(range
, "c 1");
2746 test_range_movestart(range
, characterW
, -7, -6);
2747 test_range_text(range
, "wordabc 1");
2748 test_range_movestart(range
, characterW
, 100, 22);
2749 test_range_text(range
, NULL
);
2751 IHTMLTxtRange_Release(range
);
2752 IHTMLTxtRange_Release(body_range
);
2754 hres
= IHTMLDocument2_get_selection(doc
, &selection
);
2755 ok(hres
== S_OK
, "IHTMLDocument2_get_selection failed: %08x\n", hres
);
2757 hres
= IHTMLSelectionObject_createRange(selection
, &disp_range
);
2758 ok(hres
== S_OK
, "IHTMLSelectionObject_createRange failed: %08x\n", hres
);
2759 IHTMLSelectionObject_Release(selection
);
2761 hres
= IDispatch_QueryInterface(disp_range
, &IID_IHTMLTxtRange
, (void **)&range
);
2762 ok(hres
== S_OK
, "Could not get IID_IHTMLTxtRange interface: 0x%08x\n", hres
);
2763 IDispatch_Release(disp_range
);
2765 test_range_text(range
, NULL
);
2766 test_range_moveend(range
, characterW
, 3, 3);
2767 test_range_text(range
, "wor");
2768 test_range_parent(range
, ET_BODY
);
2769 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "wordabc 123\r\nit's text");
2770 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "wordabc 123\r\nit's text");
2771 test_range_move(range
, characterW
, 3, 3);
2772 test_range_expand(range
, wordW
, VARIANT_TRUE
, "wordabc ");
2773 test_range_moveend(range
, characterW
, -4, -4);
2774 test_range_put_text(range
, "abc def ");
2775 test_range_expand(range
, texteditW
, VARIANT_TRUE
, "abc def abc 123\r\nit's text");
2776 test_range_move(range
, wordW
, 1, 1);
2777 test_range_movestart(range
, characterW
, -1, -1);
2778 test_range_text(range
, " ");
2779 test_range_move(range
, wordW
, 1, 1);
2780 test_range_moveend(range
, characterW
, 3, 3);
2781 test_range_text(range
, "def");
2782 test_range_put_text(range
, "xyz");
2783 test_range_moveend(range
, characterW
, 1, 1);
2784 test_range_move(range
, wordW
, 1, 1);
2785 test_range_moveend(range
, characterW
, 2, 2);
2786 test_range_text(range
, "ab");
2788 IHTMLTxtRange_Release(range
);
2791 static void test_txtrange2(IHTMLDocument2
*doc
)
2793 IHTMLTxtRange
*range
;
2795 range
= test_create_body_range(doc
);
2797 test_range_text(range
, "abc\r\n\r\n123\r\n\r\n\r\ndef");
2798 test_range_move(range
, characterW
, 5, 5);
2799 test_range_moveend(range
, characterW
, 1, 1);
2800 test_range_text(range
, "2");
2801 test_range_move(range
, characterW
, -3, -3);
2802 test_range_moveend(range
, characterW
, 3, 3);
2803 test_range_text(range
, "c\r\n\r\n1");
2804 test_range_collapse(range
, VARIANT_FALSE
);
2805 test_range_moveend(range
, characterW
, 4, 4);
2806 test_range_text(range
, "23");
2807 test_range_moveend(range
, characterW
, 1, 1);
2808 test_range_text(range
, "23\r\n\r\n\r\nd");
2809 test_range_moveend(range
, characterW
, -1, -1);
2810 test_range_text(range
, "23");
2811 test_range_moveend(range
, characterW
, -1, -1);
2812 test_range_text(range
, "23");
2813 test_range_moveend(range
, characterW
, -2, -2);
2814 test_range_text(range
, "2");
2816 IHTMLTxtRange_Release(range
);
2819 static void test_compatmode(IHTMLDocument2
*doc
)
2821 IHTMLDocument5
*doc5
;
2825 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2826 ok(hres
== S_OK
, "Could not get IHTMLDocument5 interface: %08x\n", hres
);
2830 hres
= IHTMLDocument5_get_compatMode(doc5
, &mode
);
2831 IHTMLDocument5_Release(doc5
);
2832 ok(hres
== S_OK
, "get_compatMode failed: %08x\n", hres
);
2833 ok(!strcmp_wa(mode
, "BackCompat"), "compatMode=%s\n", wine_dbgstr_w(mode
));
2834 SysFreeString(mode
);
2837 static void test_location(IHTMLDocument2
*doc
)
2839 IHTMLLocation
*location
, *location2
;
2840 IHTMLWindow2
*window
;
2845 hres
= IHTMLDocument2_get_location(doc
, &location
);
2846 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2848 hres
= IHTMLDocument2_get_location(doc
, &location2
);
2849 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2851 ok(location
== location2
, "location != location2\n");
2852 IHTMLLocation_Release(location2
);
2854 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
2855 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
2857 hres
= IHTMLWindow2_get_location(window
, &location2
);
2858 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2859 ok(location
== location2
, "location != location2\n");
2860 IHTMLLocation_Release(location2
);
2862 test_ifaces((IUnknown
*)location
, location_iids
);
2863 test_disp2((IUnknown
*)location
, &DIID_DispHTMLLocation
, &IID_IHTMLLocation
, "about:blank");
2865 hres
= IHTMLLocation_get_pathname(location
, &str
);
2866 ok(hres
== S_OK
, "get_pathname failed: %08x\n", hres
);
2867 ok(!strcmp_wa(str
, "blank"), "unexpected pathname %s\n", wine_dbgstr_w(str
));
2869 hres
= IHTMLLocation_get_href(location
, NULL
);
2870 ok(hres
== E_POINTER
, "get_href passed: %08x\n", hres
);
2872 hres
= IHTMLLocation_get_href(location
, &str
);
2873 ok(hres
== S_OK
, "get_href failed: %08x\n", hres
);
2874 ok(!strcmp_wa(str
, "about:blank"), "unexpected href %s\n", wine_dbgstr_w(str
));
2876 ref
= IHTMLLocation_Release(location
);
2877 ok(!ref
, "location chould be destroyed here\n");
2880 static void test_navigator(IHTMLDocument2
*doc
)
2882 IHTMLWindow2
*window
;
2883 IOmNavigator
*navigator
, *navigator2
;
2890 static const WCHAR v40
[] = {'4','.','0'};
2892 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
2893 ok(hres
== S_OK
, "parentWidnow failed: %08x\n", hres
);
2895 hres
= IHTMLWindow2_get_navigator(window
, &navigator
);
2896 ok(hres
== S_OK
, "get_navigator failed: %08x\n", hres
);
2897 ok(navigator
!= NULL
, "navigator == NULL\n");
2898 test_disp2((IUnknown
*)navigator
, &DIID_DispHTMLNavigator
, &IID_IOmNavigator
, "[object]");
2900 hres
= IHTMLWindow2_get_navigator(window
, &navigator2
);
2901 ok(hres
== S_OK
, "get_navigator failed: %08x\n", hres
);
2902 ok(navigator
!= navigator2
, "navigator2 != navihgator\n");
2904 IHTMLWindow2_Release(window
);
2905 IOmNavigator_Release(navigator2
);
2907 hres
= IOmNavigator_get_appCodeName(navigator
, &bstr
);
2908 ok(hres
== S_OK
, "get_appCodeName failed: %08x\n", hres
);
2909 ok(!strcmp_wa(bstr
, "Mozilla"), "Unexpected appCodeName %s\n", wine_dbgstr_w(bstr
));
2910 SysFreeString(bstr
);
2913 hres
= IOmNavigator_get_appName(navigator
, &bstr
);
2914 ok(hres
== S_OK
, "get_appName failed: %08x\n", hres
);
2915 ok(!strcmp_wa(bstr
, "Microsoft Internet Explorer"), "Unexpected appCodeName %s\n", wine_dbgstr_w(bstr
));
2916 SysFreeString(bstr
);
2919 hres
= IOmNavigator_get_platform(navigator
, &bstr
);
2920 ok(hres
== S_OK
, "get_platform failed: %08x\n", hres
);
2922 ok(!strcmp_wa(bstr
, "Win64"), "unexpected platform %s\n", wine_dbgstr_w(bstr
));
2924 ok(!strcmp_wa(bstr
, "Win32"), "unexpected platform %s\n", wine_dbgstr_w(bstr
));
2926 SysFreeString(bstr
);
2929 hres
= IOmNavigator_get_appVersion(navigator
, &bstr
);
2930 ok(hres
== S_OK
, "get_appVersion failed: %08x\n", hres
);
2931 ok(!memcmp(bstr
, v40
, sizeof(v40
)), "appVersion is %s\n", wine_dbgstr_w(bstr
));
2932 SysFreeString(bstr
);
2934 hres
= IOmNavigator_toString(navigator
, NULL
);
2935 ok(hres
== E_INVALIDARG
, "toString failed: %08x\n", hres
);
2938 hres
= IOmNavigator_toString(navigator
, &bstr
);
2939 ok(hres
== S_OK
, "toString failed: %08x\n", hres
);
2940 ok(!strcmp_wa(bstr
, "[object]"), "toString returned %s\n", wine_dbgstr_w(bstr
));
2941 SysFreeString(bstr
);
2944 hres
= ObtainUserAgentString(0, buf
, &size
);
2945 ok(hres
== S_OK
, "ObtainUserAgentString failed: %08x\n", hres
);
2948 hres
= IOmNavigator_get_userAgent(navigator
, &bstr
);
2949 ok(hres
== S_OK
, "get_userAgent failed: %08x\n", hres
);
2950 ok(!strcmp_wa(bstr
, buf
), "userAgent returned %s, expected \"%s\"\n", wine_dbgstr_w(bstr
), buf
);
2951 SysFreeString(bstr
);
2953 ref
= IOmNavigator_Release(navigator
);
2954 ok(!ref
, "navigator should be destroyed here\n");
2957 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2963 test_disp((IUnknown
*)current_style
, &DIID_DispHTMLCurrentStyle
, "[object]");
2964 test_ifaces((IUnknown
*)current_style
, cstyle_iids
);
2966 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2967 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2968 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2971 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2972 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2973 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2976 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2977 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2980 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2981 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2982 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2985 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2986 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2987 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2990 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2991 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2992 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2995 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2996 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2997 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
3000 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
3001 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
3002 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
3005 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
3006 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
3007 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
3010 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
3011 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
3012 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
3015 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
3016 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
3017 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
3020 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
3021 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3022 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
3025 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
3026 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3027 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
3030 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
3031 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
3032 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
3035 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
3036 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
3039 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
3040 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
3043 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
3044 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
3047 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
3048 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
3051 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
3052 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
3055 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
3056 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3059 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
3060 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3061 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
3062 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
3065 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
3066 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
3067 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3070 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
3071 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3072 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3075 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
3076 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3077 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3080 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
3081 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3082 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3085 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
3086 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3087 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3090 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
3091 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
3092 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3095 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
3096 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
3097 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
3098 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
3101 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
3102 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
3103 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3104 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3107 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
3108 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
3109 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3112 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
3113 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
3114 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3117 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
3118 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
3119 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3123 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
3124 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
3125 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3128 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
3129 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
3130 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3133 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
3134 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
3135 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3138 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
3139 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
3140 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3143 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
3144 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
3145 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3148 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
3149 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
3150 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3153 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
3154 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
3155 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3158 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
3159 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
3160 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3163 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
3164 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
3165 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3168 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
3169 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
3170 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3173 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
3174 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
3175 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3178 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
3179 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
3180 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3183 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
3184 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
3185 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3188 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
3189 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
3190 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3193 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
3194 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
3195 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3198 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
3199 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
3200 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3203 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
3204 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
3205 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3208 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
3209 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
3210 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3213 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
3214 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
3215 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3219 static void test_style2(IHTMLStyle2
*style2
)
3224 str
= (void*)0xdeadbeef;
3225 hres
= IHTMLStyle2_get_position(style2
, &str
);
3226 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3227 ok(!str
, "str != NULL\n");
3229 str
= a2bstr("absolute");
3230 hres
= IHTMLStyle2_put_position(style2
, str
);
3231 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
3235 hres
= IHTMLStyle2_get_position(style2
, &str
);
3236 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3237 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
3241 static void test_style3(IHTMLStyle3
*style3
)
3246 str
= (void*)0xdeadbeef;
3247 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
3248 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
3249 ok(!str
, "str != NULL\n");
3251 str
= a2bstr("break-word");
3252 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
3253 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
3257 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
3258 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
3259 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
3263 static void test_style4(IHTMLStyle4
*style4
)
3269 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
3270 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
3273 V_BSTR(&v
) = a2bstr("10px");
3274 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
3275 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
3278 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
3279 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
3280 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3281 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
3283 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
3284 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
3285 VariantClear(&vdefault
);
3288 static void test_default_style(IHTMLStyle
*style
)
3290 IHTMLStyle2
*style2
;
3291 IHTMLStyle3
*style3
;
3292 IHTMLStyle4
*style4
;
3298 BSTR sOverflowDefault
;
3302 test_disp((IUnknown
*)style
, &DIID_DispHTMLStyle
, "[object]");
3303 test_ifaces((IUnknown
*)style
, style_iids
);
3305 test_style_csstext(style
, NULL
);
3307 hres
= IHTMLStyle_get_position(style
, &str
);
3308 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3309 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
3312 hres
= IHTMLStyle_get_marginRight(style
, &v
);
3313 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
3314 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
3315 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3318 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
3319 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
3320 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
3321 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3323 str
= (void*)0xdeadbeef;
3324 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
3325 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
3326 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
3328 str
= (void*)0xdeadbeef;
3329 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
3330 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3331 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
3333 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
3334 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3336 str
= a2bstr("test");
3337 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3338 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
3341 str
= a2bstr("bold");
3342 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3343 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3346 str
= a2bstr("bolder");
3347 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3348 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3351 str
= a2bstr("lighter");
3352 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3353 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3356 str
= a2bstr("100");
3357 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3358 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3361 str
= a2bstr("200");
3362 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3363 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3366 str
= a2bstr("300");
3367 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3368 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3371 str
= a2bstr("400");
3372 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3373 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3376 str
= a2bstr("500");
3377 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3378 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3381 str
= a2bstr("600");
3382 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3383 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3386 str
= a2bstr("700");
3387 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3388 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3391 str
= a2bstr("800");
3392 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3393 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3396 str
= a2bstr("900");
3397 hres
= IHTMLStyle_put_fontWeight(style
, str
);
3398 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3401 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
3402 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3403 ok(!strcmp_wa(str
, "900"), "str != style900\n");
3406 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
3407 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
3408 SysFreeString(sDefault
);
3411 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
3412 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
3414 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
3415 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
3417 str
= a2bstr("test");
3418 hres
= IHTMLStyle_put_fontVariant(style
, str
);
3419 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
3422 str
= a2bstr("small-caps");
3423 hres
= IHTMLStyle_put_fontVariant(style
, str
);
3424 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
3427 str
= a2bstr("normal");
3428 hres
= IHTMLStyle_put_fontVariant(style
, str
);
3429 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
3432 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
3433 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
3434 SysFreeString(sDefault
);
3436 str
= (void*)0xdeadbeef;
3437 hres
= IHTMLStyle_get_display(style
, &str
);
3438 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
3439 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
3441 str
= (void*)0xdeadbeef;
3442 hres
= IHTMLStyle_get_visibility(style
, &str
);
3443 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
3444 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
3447 hres
= IHTMLStyle_get_fontSize(style
, &v
);
3448 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
3449 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
3450 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3453 hres
= IHTMLStyle_get_color(style
, &v
);
3454 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
3455 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
3456 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3459 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
3460 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
3461 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
3463 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
3464 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
3465 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
3467 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
3468 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
3469 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
3471 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
3472 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
3475 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
3476 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
3477 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
3479 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
3480 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
3481 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
3483 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
3484 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
3485 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
3487 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
3488 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
3491 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
3492 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
3493 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
3495 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
3496 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
3497 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
3499 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
3500 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
3501 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
3503 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
3504 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
3507 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
3508 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
3509 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
3511 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
3512 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
3513 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
3515 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
3516 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
3517 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
3519 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
3520 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
3523 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
3524 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
3525 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
3527 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
3528 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
3529 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
3531 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
3532 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
3533 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
3535 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
3536 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
3538 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
3539 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3541 str
= a2bstr("invalid");
3542 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3543 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
3546 str
= a2bstr("none");
3547 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3548 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3551 str
= a2bstr("underline");
3552 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3553 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3556 str
= a2bstr("overline");
3557 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3558 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3561 str
= a2bstr("line-through");
3562 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3563 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3566 str
= a2bstr("blink");
3567 hres
= IHTMLStyle_put_textDecoration(style
, str
);
3568 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3571 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
3572 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3573 ok(!strcmp_wa(str
, "blink"), "str != blink\n");
3576 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
3577 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
3578 SysFreeString(sDefault
);
3580 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
3581 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
3583 hres
= IHTMLStyle_get_posWidth(style
, &f
);
3584 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
3585 ok(f
== 0.0f
, "f = %f\n", f
);
3587 V_VT(&v
) = VT_EMPTY
;
3588 hres
= IHTMLStyle_get_width(style
, &v
);
3589 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3590 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3591 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
3593 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
3594 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
3596 hres
= IHTMLStyle_get_posWidth(style
, &f
);
3597 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
3599 f
== 2.2f
, /* IE8 */
3603 V_BSTR(&v
) = a2bstr("auto");
3604 hres
= IHTMLStyle_put_width(style
, v
);
3605 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
3608 V_VT(&v
) = VT_EMPTY
;
3609 hres
= IHTMLStyle_get_width(style
, &v
);
3610 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3611 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3612 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
3616 str
= (void*)0xdeadbeef;
3617 hres
= IHTMLStyle_get_margin(style
, &str
);
3618 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3619 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
3622 hres
= IHTMLStyle_put_margin(style
, str
);
3623 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
3626 hres
= IHTMLStyle_get_margin(style
, &str
);
3627 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3628 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
3630 hres
= IHTMLStyle_put_margin(style
, NULL
);
3631 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
3634 hres
= IHTMLStyle_get_border(style
, &str
);
3635 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
3636 ok(!str
|| !*str
, "str is not empty\n");
3639 str
= a2bstr("1px");
3640 hres
= IHTMLStyle_put_border(style
, str
);
3641 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
3644 V_VT(&v
) = VT_EMPTY
;
3645 hres
= IHTMLStyle_get_left(style
, &v
);
3646 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3647 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3648 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3652 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
3653 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
3656 hres
= IHTMLStyle_get_posLeft(style
, &f
);
3657 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
3658 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
3660 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
3661 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
3663 hres
= IHTMLStyle_get_posLeft(style
, &f
);
3664 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
3666 f
== 4.9f
, /* IE8 */
3667 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
3669 /* Ensure left is updated correctly. */
3670 V_VT(&v
) = VT_EMPTY
;
3671 hres
= IHTMLStyle_get_left(style
, &v
);
3672 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3673 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3674 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
3675 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
3676 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3681 V_BSTR(&v
) = a2bstr("3px");
3682 hres
= IHTMLStyle_put_left(style
, v
);
3683 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
3686 hres
= IHTMLStyle_get_posLeft(style
, &f
);
3687 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
3688 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
3690 V_VT(&v
) = VT_EMPTY
;
3691 hres
= IHTMLStyle_get_left(style
, &v
);
3692 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3693 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3694 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3698 hres
= IHTMLStyle_put_left(style
, v
);
3699 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
3701 V_VT(&v
) = VT_EMPTY
;
3702 hres
= IHTMLStyle_get_left(style
, &v
);
3703 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3704 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3705 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3708 V_VT(&v
) = VT_EMPTY
;
3709 hres
= IHTMLStyle_get_top(style
, &v
);
3710 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3711 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3712 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3716 hres
= IHTMLStyle_get_posTop(style
, NULL
);
3717 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
3720 hres
= IHTMLStyle_get_posTop(style
, &f
);
3721 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
3722 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
3724 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
3725 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
3727 hres
= IHTMLStyle_get_posTop(style
, &f
);
3728 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
3730 f
== 4.9f
, /* IE8 */
3731 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
3734 V_BSTR(&v
) = a2bstr("3px");
3735 hres
= IHTMLStyle_put_top(style
, v
);
3736 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
3739 V_VT(&v
) = VT_EMPTY
;
3740 hres
= IHTMLStyle_get_top(style
, &v
);
3741 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3742 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3743 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3746 hres
= IHTMLStyle_get_posTop(style
, &f
);
3747 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
3748 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
3751 hres
= IHTMLStyle_put_top(style
, v
);
3752 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
3754 V_VT(&v
) = VT_EMPTY
;
3755 hres
= IHTMLStyle_get_top(style
, &v
);
3756 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3757 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3758 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3761 /* Test posHeight */
3762 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
3763 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
3765 V_VT(&v
) = VT_EMPTY
;
3766 hres
= IHTMLStyle_get_height(style
, &v
);
3767 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3768 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3769 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3773 hres
= IHTMLStyle_get_posHeight(style
, &f
);
3774 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
3775 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
3777 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
3778 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
3780 hres
= IHTMLStyle_get_posHeight(style
, &f
);
3781 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
3783 f
== 4.9f
, /* IE8 */
3784 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
3787 V_BSTR(&v
) = a2bstr("64px");
3788 hres
= IHTMLStyle_put_height(style
, v
);
3789 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
3792 V_VT(&v
) = VT_EMPTY
;
3793 hres
= IHTMLStyle_get_height(style
, &v
);
3794 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3795 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3796 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3799 hres
= IHTMLStyle_get_posHeight(style
, &f
);
3800 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
3801 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
3803 str
= (void*)0xdeadbeef;
3804 hres
= IHTMLStyle_get_cursor(style
, &str
);
3805 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3806 ok(!str
, "get_cursor != NULL\n");
3809 str
= a2bstr("default");
3810 hres
= IHTMLStyle_put_cursor(style
, str
);
3811 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
3815 hres
= IHTMLStyle_get_cursor(style
, &str
);
3816 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3817 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
3820 V_VT(&v
) = VT_EMPTY
;
3821 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
3822 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
3823 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3824 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
3828 V_BSTR(&v
) = a2bstr("middle");
3829 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
3830 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
3833 V_VT(&v
) = VT_EMPTY
;
3834 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
3835 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
3836 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
3837 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3840 str
= (void*)0xdeadbeef;
3841 hres
= IHTMLStyle_get_textAlign(style
, &str
);
3842 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
3843 ok(!str
, "textAlign != NULL\n");
3845 str
= a2bstr("center");
3846 hres
= IHTMLStyle_put_textAlign(style
, str
);
3847 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
3851 hres
= IHTMLStyle_get_textAlign(style
, &str
);
3852 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
3853 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
3856 str
= (void*)0xdeadbeef;
3857 hres
= IHTMLStyle_get_filter(style
, &str
);
3858 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
3859 ok(!str
, "filter != NULL\n");
3861 str
= a2bstr("alpha(opacity=100)");
3862 hres
= IHTMLStyle_put_filter(style
, str
);
3863 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
3866 V_VT(&v
) = VT_EMPTY
;
3867 hres
= IHTMLStyle_get_zIndex(style
, &v
);
3868 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
3869 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
3870 ok(!V_I4(&v
), "V_I4(v) != 0\n");
3874 V_BSTR(&v
) = a2bstr("1");
3875 hres
= IHTMLStyle_put_zIndex(style
, v
);
3876 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
3879 V_VT(&v
) = VT_EMPTY
;
3880 hres
= IHTMLStyle_get_zIndex(style
, &v
);
3881 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
3882 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
3883 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
3887 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
3888 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
3890 str
= a2bstr("test");
3891 hres
= IHTMLStyle_put_fontStyle(style
, str
);
3892 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
3895 str
= a2bstr("italic");
3896 hres
= IHTMLStyle_put_fontStyle(style
, str
);
3897 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
3900 str
= a2bstr("oblique");
3901 hres
= IHTMLStyle_put_fontStyle(style
, str
);
3902 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
3905 str
= a2bstr("normal");
3906 hres
= IHTMLStyle_put_fontStyle(style
, str
);
3907 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
3910 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
3911 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
3912 SysFreeString(sDefault
);
3915 hres
= IHTMLStyle_get_overflow(style
, NULL
);
3916 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
3918 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
3919 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
3921 str
= a2bstr("test");
3922 hres
= IHTMLStyle_put_overflow(style
, str
);
3923 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
3926 str
= a2bstr("visible");
3927 hres
= IHTMLStyle_put_overflow(style
, str
);
3928 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
3931 str
= a2bstr("scroll");
3932 hres
= IHTMLStyle_put_overflow(style
, str
);
3933 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
3936 str
= a2bstr("hidden");
3937 hres
= IHTMLStyle_put_overflow(style
, str
);
3938 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
3941 str
= a2bstr("auto");
3942 hres
= IHTMLStyle_put_overflow(style
, str
);
3943 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
3946 hres
= IHTMLStyle_get_overflow(style
, &str
);
3947 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
3948 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
3952 hres
= IHTMLStyle_put_overflow(style
, str
);
3953 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
3956 hres
= IHTMLStyle_get_overflow(style
, &str
);
3957 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
3958 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
3961 /* restore overflow default */
3962 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
3963 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
3964 SysFreeString(sOverflowDefault
);
3966 /* Attribute Tests*/
3967 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
3968 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
3970 str
= a2bstr("position");
3971 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
3972 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
3974 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
3975 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
3976 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
3979 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
3980 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
3983 V_BSTR(&v
) = a2bstr("absolute");
3984 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
3985 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
3988 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
3989 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
3990 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
3991 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
3996 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
3997 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
4002 str
= a2bstr("borderLeftStyle");
4003 test_border_styles(style
, str
);
4006 str
= a2bstr("borderbottomstyle");
4007 test_border_styles(style
, str
);
4010 str
= a2bstr("borderrightstyle");
4011 test_border_styles(style
, str
);
4014 str
= a2bstr("bordertopstyle");
4015 test_border_styles(style
, str
);
4018 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
4019 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
4021 str
= a2bstr("none dotted dashed solid");
4022 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4023 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4026 str
= a2bstr("none dotted dashed solid");
4027 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
4028 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
4029 ok(!strcmp_wa(str
, "none dotted dashed solid"),
4030 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
4033 str
= a2bstr("double groove ridge inset");
4034 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4035 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4038 str
= a2bstr("window-inset outset ridge inset");
4039 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4040 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4043 str
= a2bstr("window-inset");
4044 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4045 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4048 str
= a2bstr("none none none none none");
4049 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4050 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4053 str
= a2bstr("invalid none none none");
4054 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4055 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
4058 str
= a2bstr("none invalid none none");
4059 hres
= IHTMLStyle_put_borderStyle(style
, str
);
4060 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
4063 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
4064 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
4065 SysFreeString(sDefault
);
4067 /* backgoundColor */
4068 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
4069 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
4070 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
4071 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4075 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
4076 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
4079 V_BSTR(&v
) = a2bstr("10");
4080 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
4081 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
4084 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
4085 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
4086 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4088 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
4089 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
4091 /* BackgroundRepeat */
4092 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
4093 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
4095 str
= a2bstr("invalid");
4096 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4097 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
4100 str
= a2bstr("repeat");
4101 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4102 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4105 str
= a2bstr("no-repeat");
4106 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4107 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4110 str
= a2bstr("repeat-x");
4111 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4112 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4115 str
= a2bstr("repeat-y");
4116 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
4117 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4120 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
4121 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
4122 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
4125 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
4126 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
4127 SysFreeString(sDefault
);
4130 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
4131 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
4133 str
= a2bstr("red green red blue");
4134 hres
= IHTMLStyle_put_borderColor(style
, str
);
4135 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
4138 hres
= IHTMLStyle_get_borderColor(style
, &str
);
4139 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
4140 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
4143 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
4144 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
4145 SysFreeString(sDefault
);
4148 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
4149 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
4151 str
= a2bstr("thick dotted red");
4152 hres
= IHTMLStyle_put_borderLeft(style
, str
);
4153 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
4156 /* IHTMLStyle_get_borderLeft appears to have a bug where
4157 it returns the first letter of the color. So we check
4158 each style individually.
4161 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
4162 todo_wine
ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
4163 todo_wine
ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4167 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
4168 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
4169 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4172 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
4173 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
4174 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
4177 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
4178 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
4179 SysFreeString(sDefault
);
4181 /* backgroundPositionX */
4182 hres
= IHTMLStyle_get_backgroundPositionX(style
, &vDefault
);
4183 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
4186 V_BSTR(&v
) = a2bstr("10px");
4187 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
4188 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
4191 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
4192 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
4193 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4196 hres
= IHTMLStyle_put_backgroundPositionX(style
, vDefault
);
4197 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
4198 VariantClear(&vDefault
);
4200 /* backgroundPositionY */
4201 hres
= IHTMLStyle_get_backgroundPositionY(style
, &vDefault
);
4202 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
4205 V_BSTR(&v
) = a2bstr("10px");
4206 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
4207 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
4210 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
4211 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
4212 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4215 hres
= IHTMLStyle_put_backgroundPositionY(style
, vDefault
);
4216 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
4217 VariantClear(&vDefault
);
4219 /* borderTopWidth */
4220 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
4221 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
4224 V_BSTR(&v
) = a2bstr("10px");
4225 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
4226 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
4229 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
4230 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
4231 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4234 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
4235 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
4236 VariantClear(&vDefault
);
4238 /* borderRightWidth */
4239 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
4240 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
4243 V_BSTR(&v
) = a2bstr("10");
4244 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
4245 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
4248 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
4249 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
4250 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4253 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
4254 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
4255 VariantClear(&vDefault
);
4257 /* borderBottomWidth */
4258 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
4259 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
4262 V_BSTR(&v
) = a2bstr("10");
4263 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
4264 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
4267 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
4268 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
4269 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4272 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
4273 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
4274 VariantClear(&vDefault
);
4276 /* borderLeftWidth */
4277 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
4278 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
4281 V_BSTR(&v
) = a2bstr("10");
4282 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
4283 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
4286 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
4287 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
4288 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4291 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
4292 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
4293 VariantClear(&vDefault
);
4296 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
4297 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
4300 V_BSTR(&v
) = a2bstr("10");
4301 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
4302 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
4305 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
4306 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
4307 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4308 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4311 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
4312 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
4313 VariantClear(&vDefault
);
4316 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
4317 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
4320 V_BSTR(&v
) = a2bstr("11");
4321 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
4322 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
4325 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
4326 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
4327 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
4328 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
4331 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
4332 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
4333 VariantClear(&vDefault
);
4335 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
4336 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
4337 if(SUCCEEDED(hres
)) {
4338 test_style2(style2
);
4339 IHTMLStyle2_Release(style2
);
4342 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
4343 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
4344 if(SUCCEEDED(hres
)) {
4345 test_style3(style3
);
4346 IHTMLStyle3_Release(style3
);
4349 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
4350 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
4351 if(SUCCEEDED(hres
)) {
4352 test_style4(style4
);
4353 IHTMLStyle4_Release(style4
);
4357 static void test_set_csstext(IHTMLStyle
*style
)
4362 test_style_set_csstext(style
, "background-color: black;");
4364 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
4365 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
4366 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
4367 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
4371 static void test_default_selection(IHTMLDocument2
*doc
)
4373 IHTMLSelectionObject
*selection
;
4374 IHTMLTxtRange
*range
;
4379 hres
= IHTMLDocument2_get_selection(doc
, &selection
);
4380 ok(hres
== S_OK
, "get_selection failed: %08x\n", hres
);
4382 hres
= IHTMLSelectionObject_get_type(selection
, &str
);
4383 ok(hres
== S_OK
, "get_type failed: %08x\n", hres
);
4384 ok(!strcmp_wa(str
, "None"), "type = %s\n", wine_dbgstr_w(str
));
4387 hres
= IHTMLSelectionObject_createRange(selection
, &disp
);
4388 IHTMLSelectionObject_Release(selection
);
4389 ok(hres
== S_OK
, "createRange failed: %08x\n", hres
);
4391 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLTxtRange
, (void**)&range
);
4392 IDispatch_Release(disp
);
4393 ok(hres
== S_OK
, "Could not get IHTMLTxtRange interface: %08x\n", hres
);
4395 test_range_text(range
, NULL
);
4396 IHTMLTxtRange_Release(range
);
4399 static void test_doc_elem(IHTMLDocument2
*doc
)
4401 IHTMLDocument2
*doc_node
, *owner_doc
;
4403 IHTMLDocument3
*doc3
;
4406 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
4407 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
4409 hres
= IHTMLDocument3_get_documentElement(doc3
, &elem
);
4410 IHTMLDocument3_Release(doc3
);
4411 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
4413 test_node_name((IUnknown
*)elem
, "HTML");
4414 test_elem_tag((IUnknown
*)elem
, "HTML");
4416 doc_node
= get_doc_node(doc
);
4417 owner_doc
= get_owner_doc((IUnknown
*)elem
);
4418 ok(iface_cmp((IUnknown
*)doc_node
, (IUnknown
*)owner_doc
), "doc_node != owner_doc\n");
4419 IHTMLDocument2_Release(doc_node
);
4420 IHTMLDocument2_Release(owner_doc
);
4422 test_elem_client_rect((IUnknown
*)elem
);
4424 IHTMLElement_Release(elem
);
4427 static void test_default_body(IHTMLBodyElement
*body
)
4433 WCHAR sBodyText
[] = {'#','F','F','0','0','0','0',0};
4434 WCHAR sTextInvalid
[] = {'I','n','v','a','l','i','d',0};
4436 bstr
= (void*)0xdeadbeef;
4437 hres
= IHTMLBodyElement_get_background(body
, &bstr
);
4438 ok(hres
== S_OK
, "get_background failed: %08x\n", hres
);
4439 ok(bstr
== NULL
, "bstr != NULL\n");
4441 l
= elem_get_scroll_height((IUnknown
*)body
);
4442 ok(l
!= -1, "scrollHeight == -1\n");
4443 l
= elem_get_scroll_width((IUnknown
*)body
);
4444 ok(l
!= -1, "scrollWidth == -1\n");
4445 l
= elem_get_scroll_top((IUnknown
*)body
);
4446 ok(!l
, "scrollTop = %d\n", l
);
4447 elem_get_scroll_left((IUnknown
*)body
);
4449 /* get_text tests */
4450 hres
= IHTMLBodyElement_get_text(body
, &v
);
4451 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4452 ok(V_VT(&v
) == VT_BSTR
, "Expected VT_BSTR got %d\n", V_VT(&v
));
4453 ok(bstr
== NULL
, "bstr != NULL\n");
4456 /* get_text - Invalid Text */
4458 V_BSTR(&v
) = SysAllocString(sTextInvalid
);
4459 hres
= IHTMLBodyElement_put_text(body
, v
);
4460 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4464 hres
= IHTMLBodyElement_get_text(body
, &v
);
4465 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4466 ok(V_VT(&v
) == VT_BSTR
, "Expected VT_BSTR got %d\n", V_VT(&v
));
4467 ok(!strcmp_wa(V_BSTR(&v
), "#00a0d0"), "v != '#00a0d0'\n");
4470 /* get_text - Valid Text */
4472 V_BSTR(&v
) = SysAllocString(sBodyText
);
4473 hres
= IHTMLBodyElement_put_text(body
, v
);
4474 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4478 hres
= IHTMLBodyElement_get_text(body
, &v
);
4479 ok(hres
== S_OK
, "expect S_OK got 0x%08d\n", hres
);
4480 ok(V_VT(&v
) == VT_BSTR
, "Expected VT_BSTR got %d\n", V_VT(&v
));
4481 ok(!strcmp_wa(V_BSTR(&v
), "#ff0000"), "v != '#ff0000'\n");
4485 static void test_body_funs(IHTMLBodyElement
*body
)
4487 static WCHAR sRed
[] = {'r','e','d',0};
4492 hres
= IHTMLBodyElement_get_bgColor(body
, &vDefaultbg
);
4493 ok(hres
== S_OK
, "get_bgColor failed: %08x\n", hres
);
4494 ok(V_VT(&vDefaultbg
) == VT_BSTR
, "bstr != NULL\n");
4496 V_VT(&vbg
) = VT_BSTR
;
4497 V_BSTR(&vbg
) = SysAllocString(sRed
);
4498 hres
= IHTMLBodyElement_put_bgColor(body
, vbg
);
4499 ok(hres
== S_OK
, "put_bgColor failed: %08x\n", hres
);
4502 hres
= IHTMLBodyElement_get_bgColor(body
, &vbg
);
4503 ok(hres
== S_OK
, "get_bgColor failed: %08x\n", hres
);
4504 ok(V_VT(&vDefaultbg
) == VT_BSTR
, "V_VT(&vDefaultbg) != VT_BSTR\n");
4505 ok(!strcmp_wa(V_BSTR(&vbg
), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg
)));
4508 /* Restore Originial */
4509 hres
= IHTMLBodyElement_put_bgColor(body
, vDefaultbg
);
4510 ok(hres
== S_OK
, "put_bgColor failed: %08x\n", hres
);
4511 VariantClear(&vDefaultbg
);
4514 static void test_window(IHTMLDocument2
*doc
)
4516 IHTMLWindow2
*window
, *window2
, *self
;
4517 IHTMLDocument2
*doc2
= NULL
;
4523 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
4524 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
4525 test_ifaces((IUnknown
*)window
, window_iids
);
4526 test_disp((IUnknown
*)window
, &DIID_DispHTMLWindow2
, "[object]");
4528 hres
= IHTMLWindow2_get_document(window
, &doc2
);
4529 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
4530 ok(doc2
!= NULL
, "doc2 == NULL\n");
4532 test_ifaces((IUnknown
*)doc2
, doc_node_iids
);
4533 test_disp((IUnknown
*)doc2
, &DIID_DispHTMLDocument
, "[object]");
4535 test_ifaces((IUnknown
*)doc
, doc_obj_iids
);
4536 test_disp((IUnknown
*)doc2
, &DIID_DispHTMLDocument
, "[object]");
4538 unk
= (void*)0xdeadbeef;
4539 hres
= IHTMLDocument2_QueryInterface(doc2
, &IID_ICustomDoc
, (void**)&unk
);
4540 ok(hres
== E_NOINTERFACE
, "QueryInterface(IID_ICustomDoc) returned: %08x\n", hres
);
4541 ok(!unk
, "unk = %p\n", unk
);
4543 IHTMLDocument_Release(doc2
);
4545 hres
= IHTMLWindow2_get_window(window
, &window2
);
4546 ok(hres
== S_OK
, "get_window failed: %08x\n", hres
);
4547 ok(window2
!= NULL
, "window2 == NULL\n");
4549 hres
= IHTMLWindow2_get_self(window
, &self
);
4550 ok(hres
== S_OK
, "get_self failed: %08x\n", hres
);
4551 ok(window2
!= NULL
, "self == NULL\n");
4553 ok(self
== window2
, "self != window2\n");
4555 IHTMLWindow2_Release(window2
);
4556 IHTMLWindow2_Release(self
);
4559 hres
= IHTMLDocument2_get_Script(doc
, &disp
);
4560 ok(hres
== S_OK
, "get_Script failed: %08x\n", hres
);
4561 ok(disp
== (void*)window
, "disp != window\n");
4562 IDispatch_Release(disp
);
4564 hres
= IHTMLWindow2_toString(window
, NULL
);
4565 ok(hres
== E_INVALIDARG
, "toString failed: %08x\n", hres
);
4568 hres
= IHTMLWindow2_toString(window
, &str
);
4569 ok(hres
== S_OK
, "toString failed: %08x\n", hres
);
4570 ok(!strcmp_wa(str
, "[object]"), "toString returned %s\n", wine_dbgstr_w(str
));
4573 test_window_name(window
, NULL
);
4574 set_window_name(window
, "test");
4575 test_window_length(window
, 0);
4577 IHTMLWindow2_Release(window
);
4580 static void test_defaults(IHTMLDocument2
*doc
)
4582 IHTMLStyleSheetsCollection
*stylesheetcol
;
4583 IHTMLCurrentStyle
*cstyle
;
4584 IHTMLBodyElement
*body
;
4585 IHTMLElement2
*elem2
;
4590 IHTMLElementCollection
*collection
;
4592 hres
= IHTMLDocument2_get_body(doc
, &elem
);
4593 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
4595 hres
= IHTMLDocument2_get_images(doc
, NULL
);
4596 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4598 hres
= IHTMLDocument2_get_images(doc
, &collection
);
4599 ok(hres
== S_OK
, "get_images failed: %08x\n", hres
);
4602 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4603 IHTMLElementCollection_Release(collection
);
4606 hres
= IHTMLDocument2_get_applets(doc
, NULL
);
4607 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4609 hres
= IHTMLDocument2_get_applets(doc
, &collection
);
4610 ok(hres
== S_OK
, "get_applets failed: %08x\n", hres
);
4613 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4614 IHTMLElementCollection_Release(collection
);
4617 hres
= IHTMLDocument2_get_links(doc
, NULL
);
4618 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4620 hres
= IHTMLDocument2_get_links(doc
, &collection
);
4621 ok(hres
== S_OK
, "get_links failed: %08x\n", hres
);
4624 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4625 IHTMLElementCollection_Release(collection
);
4628 hres
= IHTMLDocument2_get_forms(doc
, NULL
);
4629 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4631 hres
= IHTMLDocument2_get_forms(doc
, &collection
);
4632 ok(hres
== S_OK
, "get_forms failed: %08x\n", hres
);
4635 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4636 IHTMLElementCollection_Release(collection
);
4639 hres
= IHTMLDocument2_get_anchors(doc
, NULL
);
4640 ok(hres
== E_INVALIDARG
, "hres %08x\n", hres
);
4642 hres
= IHTMLDocument2_get_anchors(doc
, &collection
);
4643 ok(hres
== S_OK
, "get_anchors failed: %08x\n", hres
);
4646 test_elem_collection((IUnknown
*)collection
, NULL
, 0);
4647 IHTMLElementCollection_Release(collection
);
4650 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLBodyElement
, (void**)&body
);
4651 ok(hres
== S_OK
, "Could not get IHTMBodyElement: %08x\n", hres
);
4652 test_default_body(body
);
4653 test_body_funs(body
);
4654 IHTMLBodyElement_Release(body
);
4656 hres
= IHTMLElement_get_style(elem
, &style
);
4657 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
4659 test_default_style(style
);
4661 test_compatmode(doc
);
4663 test_navigator(doc
);
4665 elem2
= get_elem2_iface((IUnknown
*)elem
);
4666 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
4667 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
4668 if(SUCCEEDED(hres
)) {
4669 test_current_style(cstyle
);
4670 IHTMLCurrentStyle_Release(cstyle
);
4672 IHTMLElement2_Release(elem2
);
4674 IHTMLElement_Release(elem
);
4676 test_set_csstext(style
);
4677 IHTMLStyle_Release(style
);
4679 hres
= IHTMLDocument2_get_styleSheets(doc
, &stylesheetcol
);
4680 ok(hres
== S_OK
, "get_styleSheets failed: %08x\n", hres
);
4683 hres
= IHTMLStyleSheetsCollection_get_length(stylesheetcol
, &l
);
4684 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
4685 ok(l
== 0, "length = %d\n", l
);
4687 IHTMLStyleSheetsCollection_Release(stylesheetcol
);
4689 test_default_selection(doc
);
4690 test_doc_title(doc
, "");
4693 static void test_tr_elem(IHTMLElement
*elem
)
4695 IHTMLElementCollection
*col
;
4699 static const elem_type_t cell_types
[] = {ET_TD
,ET_TD
};
4701 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLTableRow
, (void**)&row
);
4702 ok(hres
== S_OK
, "Could not get IHTMLTableRow iface: %08x\n", hres
);
4707 hres
= IHTMLTableRow_get_cells(row
, &col
);
4708 ok(hres
== S_OK
, "get_cells failed: %08x\n", hres
);
4709 ok(col
!= NULL
, "get_cells returned NULL\n");
4711 test_elem_collection((IUnknown
*)col
, cell_types
, sizeof(cell_types
)/sizeof(*cell_types
));
4712 IHTMLElementCollection_Release(col
);
4714 IHTMLTable_Release(row
);
4717 static void test_table_elem(IHTMLElement
*elem
)
4719 IHTMLElementCollection
*col
;
4724 static const elem_type_t row_types
[] = {ET_TR
,ET_TR
};
4725 static const elem_type_t all_types
[] = {ET_TBODY
,ET_TR
,ET_TR
,ET_TD
,ET_TD
};
4727 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLTable
, (void**)&table
);
4728 ok(hres
== S_OK
, "Could not get IHTMLTable iface: %08x\n", hres
);
4733 hres
= IHTMLTable_get_rows(table
, &col
);
4734 ok(hres
== S_OK
, "get_rows failed: %08x\n", hres
);
4735 ok(col
!= NULL
, "get_ros returned NULL\n");
4737 test_elem_collection((IUnknown
*)col
, row_types
, sizeof(row_types
)/sizeof(*row_types
));
4738 IHTMLElementCollection_Release(col
);
4740 test_elem_all((IUnknown
*)table
, all_types
, sizeof(all_types
)/sizeof(*all_types
));
4742 node
= clone_node((IUnknown
*)table
, VARIANT_TRUE
);
4743 test_elem_tag((IUnknown
*)node
, "TABLE");
4744 test_elem_all((IUnknown
*)node
, all_types
, sizeof(all_types
)/sizeof(*all_types
));
4745 IHTMLDOMNode_Release(node
);
4747 node
= clone_node((IUnknown
*)table
, VARIANT_FALSE
);
4748 test_elem_tag((IUnknown
*)node
, "TABLE");
4749 test_elem_all((IUnknown
*)node
, NULL
, 0);
4750 IHTMLDOMNode_Release(node
);
4752 IHTMLTable_Release(table
);
4755 static void doc_write(IHTMLDocument2
*doc
, BOOL ln
, const char *text
)
4765 sa
= SafeArrayCreate(VT_VARIANT
, 1, &dim
);
4766 SafeArrayAccessData(sa
, (void**)&var
);
4767 V_VT(var
) = VT_BSTR
;
4768 V_BSTR(var
) = str
= a2bstr(text
);
4769 SafeArrayUnaccessData(sa
);
4772 hres
= IHTMLDocument2_writeln(doc
, sa
);
4774 hres
= IHTMLDocument2_write(doc
, sa
);
4775 ok(hres
== S_OK
, "write failed: %08x\n", hres
);
4778 SafeArrayDestroy(sa
);
4781 static void test_iframe_elem(IHTMLElement
*elem
)
4783 IHTMLElementCollection
*col
;
4784 IHTMLDocument2
*content_doc
;
4785 IHTMLWindow2
*content_window
;
4786 IHTMLFrameBase2
*base2
;
4792 static const elem_type_t all_types
[] = {
4800 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLFrameBase2
, (void**)&base2
);
4801 ok(hres
== S_OK
, "Could not get IHTMFrameBase2 iface: %08x\n", hres
);
4804 content_window
= NULL
;
4805 hres
= IHTMLFrameBase2_get_contentWindow(base2
, &content_window
);
4806 IHTMLFrameBase2_Release(base2
);
4807 ok(hres
== S_OK
, "get_contentWindow failed: %08x\n", hres
);
4808 ok(content_window
!= NULL
, "contentWindow = NULL\n");
4810 test_window_length(content_window
, 0);
4813 hres
= IHTMLWindow2_get_document(content_window
, &content_doc
);
4814 IHTMLWindow2_Release(content_window
);
4815 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
4816 ok(content_doc
!= NULL
, "content_doc = NULL\n");
4818 str
= a2bstr("text/html");
4819 V_VT(&errv
) = VT_ERROR
;
4821 hres
= IHTMLDocument2_open(content_doc
, str
, errv
, errv
, errv
, &disp
);
4823 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
4824 ok(disp
!= NULL
, "disp == NULL\n");
4825 ok(iface_cmp((IUnknown
*)disp
, (IUnknown
*)content_window
), "disp != content_window\n");
4826 IDispatch_Release(disp
);
4828 doc_write(content_doc
, FALSE
, "<html><head><title>test</title></head><body><br /></body>");
4829 doc_write(content_doc
, TRUE
, "</html>");
4831 hres
= IHTMLDocument2_get_all(content_doc
, &col
);
4832 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
4833 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
4834 IHTMLElementCollection_Release(col
);
4836 hres
= IHTMLDocument2_close(content_doc
);
4837 ok(hres
== S_OK
, "close failed: %08x\n", hres
);
4839 IHTMLDocument2_Release(content_doc
);
4842 static void test_stylesheet(IDispatch
*disp
)
4844 IHTMLStyleSheetRulesCollection
*col
= NULL
;
4845 IHTMLStyleSheet
*stylesheet
;
4848 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLStyleSheet
, (void**)&stylesheet
);
4849 ok(hres
== S_OK
, "Could not get IHTMLStyleSheet: %08x\n", hres
);
4851 hres
= IHTMLStyleSheet_get_rules(stylesheet
, &col
);
4852 ok(hres
== S_OK
, "get_rules failed: %08x\n", hres
);
4853 ok(col
!= NULL
, "col == NULL\n");
4855 IHTMLStyleSheetRulesCollection_Release(col
);
4856 IHTMLStyleSheet_Release(stylesheet
);
4859 static void test_stylesheets(IHTMLDocument2
*doc
)
4861 IHTMLStyleSheetsCollection
*col
= NULL
;
4866 hres
= IHTMLDocument2_get_styleSheets(doc
, &col
);
4867 ok(hres
== S_OK
, "get_styleSheets failed: %08x\n", hres
);
4868 ok(col
!= NULL
, "col == NULL\n");
4870 hres
= IHTMLStyleSheetsCollection_get_length(col
, &len
);
4871 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
4872 ok(len
== 1, "len=%d\n", len
);
4878 hres
= IHTMLStyleSheetsCollection_item(col
, &idx
, &res
);
4879 ok(hres
== S_OK
, "item failed: %08x\n", hres
);
4880 ok(V_VT(&res
) == VT_DISPATCH
, "V_VT(res) = %d\n", V_VT(&res
));
4881 ok(V_DISPATCH(&res
) != NULL
, "V_DISPATCH(&res) == NULL\n");
4882 test_stylesheet(V_DISPATCH(&res
));
4889 hres
= IHTMLStyleSheetsCollection_item(col
, &idx
, &res
);
4890 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
4891 ok(V_VT(&res
) == VT_EMPTY
, "V_VT(res) = %d\n", V_VT(&res
));
4892 ok(V_DISPATCH(&res
) != NULL
, "V_DISPATCH(&res) == NULL\n");
4895 IHTMLStyleSheetsCollection_Release(col
);
4898 static void test_child_col_disp(IHTMLDOMChildrenCollection
*col
)
4900 IDispatchEx
*dispex
;
4902 DISPPARAMS dp
= {NULL
, NULL
, 0, 0};
4910 static const WCHAR w0
[] = {'0',0};
4911 static const WCHAR w100
[] = {'1','0','0',0};
4913 hres
= IHTMLDOMChildrenCollection_QueryInterface(col
, &IID_IDispatchEx
, (void**)&dispex
);
4914 ok(hres
== S_OK
, "Could not get IDispatchEx: %08x\n", hres
);
4916 bstr
= SysAllocString(w0
);
4917 hres
= IDispatchEx_GetDispID(dispex
, bstr
, fdexNameCaseSensitive
, &id
);
4918 ok(hres
== S_OK
, "GetDispID failed: %08x\n", hres
);
4919 SysFreeString(bstr
);
4922 hres
= IDispatchEx_InvokeEx(dispex
, id
, LOCALE_NEUTRAL
, INVOKE_PROPERTYGET
, &dp
, &var
, &ei
, NULL
);
4923 ok(hres
== S_OK
, "InvokeEx failed: %08x\n", hres
);
4924 ok(V_VT(&var
) == VT_DISPATCH
, "V_VT(var)=%d\n", V_VT(&var
));
4925 ok(V_DISPATCH(&var
) != NULL
, "V_DISPATCH(var) == NULL\n");
4926 node
= get_node_iface((IUnknown
*)V_DISPATCH(&var
));
4927 type
= get_node_type((IUnknown
*)node
);
4928 ok(type
== 3, "type=%d\n", type
);
4929 IHTMLDOMNode_Release(node
);
4932 bstr
= SysAllocString(w100
);
4933 hres
= IDispatchEx_GetDispID(dispex
, bstr
, fdexNameCaseSensitive
, &id
);
4934 ok(hres
== DISP_E_UNKNOWNNAME
, "GetDispID failed: %08x, expected DISP_E_UNKNOWNNAME\n", hres
);
4935 SysFreeString(bstr
);
4937 IDispatchEx_Release(dispex
);
4942 static void test_elems(IHTMLDocument2
*doc
)
4944 IHTMLElementCollection
*col
;
4945 IHTMLDOMChildrenCollection
*child_col
;
4946 IHTMLElement
*elem
, *elem2
, *elem3
;
4947 IHTMLDOMNode
*node
, *node2
;
4948 IHTMLWindow2
*window
;
4952 IHTMLElementCollection
*collection
;
4953 IHTMLDocument3
*doc3
;
4956 static const elem_type_t all_types
[] = {
4981 static const elem_type_t item_types
[] = {
4987 hres
= IHTMLDocument2_get_all(doc
, &col
);
4988 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
4989 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
4990 test_elem_col_item(col
, "x", item_types
, sizeof(item_types
)/sizeof(item_types
[0]));
4991 IHTMLElementCollection_Release(col
);
4993 hres
= IHTMLDocument2_get_images(doc
, &collection
);
4994 ok(hres
== S_OK
, "get_images failed: %08x\n", hres
);
4997 static const elem_type_t images_types
[] = {ET_IMG
};
4998 test_elem_collection((IUnknown
*)collection
, images_types
, 1);
5000 IHTMLElementCollection_Release(collection
);
5003 hres
= IHTMLDocument2_get_links(doc
, &collection
);
5004 ok(hres
== S_OK
, "get_links failed: %08x\n", hres
);
5007 static const elem_type_t images_types
[] = {ET_A
};
5008 test_elem_collection((IUnknown
*)collection
, images_types
, 1);
5010 IHTMLElementCollection_Release(collection
);
5013 hres
= IHTMLDocument2_get_anchors(doc
, &collection
);
5014 ok(hres
== S_OK
, "get_anchors failed: %08x\n", hres
);
5017 static const elem_type_t anchor_types
[] = {ET_A
};
5018 test_elem_collection((IUnknown
*)collection
, anchor_types
, 1);
5020 IHTMLElementCollection_Release(collection
);
5023 elem
= get_doc_elem(doc
);
5024 test_elem_all((IUnknown
*)elem
, all_types
+1, sizeof(all_types
)/sizeof(all_types
[0])-1);
5025 IHTMLElement_Release(elem
);
5027 get_elem_by_id(doc
, "xxx", FALSE
);
5028 elem
= get_doc_elem_by_id(doc
, "xxx");
5029 ok(!elem
, "elem != NULL\n");
5031 elem
= get_doc_elem_by_id(doc
, "s");
5032 ok(elem
!= NULL
, "elem == NULL\n");
5034 test_elem_type((IUnknown
*)elem
, ET_SELECT
);
5035 test_elem_attr(elem
, "xxx", NULL
);
5036 test_elem_attr(elem
, "id", "s");
5037 test_elem_class((IUnknown
*)elem
, NULL
);
5038 test_elem_set_class((IUnknown
*)elem
, "cl");
5039 test_elem_set_class((IUnknown
*)elem
, NULL
);
5040 test_elem_tabindex((IUnknown
*)elem
, 0);
5041 test_elem_set_tabindex((IUnknown
*)elem
, 1);
5043 node
= test_node_get_parent((IUnknown
*)elem
);
5044 ok(node
!= NULL
, "node == NULL\n");
5045 test_node_name((IUnknown
*)node
, "BODY");
5046 node2
= test_node_get_parent((IUnknown
*)node
);
5047 IHTMLDOMNode_Release(node
);
5048 ok(node2
!= NULL
, "node == NULL\n");
5049 test_node_name((IUnknown
*)node2
, "HTML");
5050 node
= test_node_get_parent((IUnknown
*)node2
);
5051 IHTMLDOMNode_Release(node2
);
5052 ok(node
!= NULL
, "node == NULL\n");
5055 test_node_name((IUnknown
*)node
, "#document");
5056 type
= get_node_type((IUnknown
*)node
);
5057 ok(type
== 9, "type=%d, expected 9\n", type
);
5058 node2
= test_node_get_parent((IUnknown
*)node
);
5059 IHTMLDOMNode_Release(node
);
5060 ok(node2
== NULL
, "node != NULL\n");
5063 elem2
= test_elem_get_parent((IUnknown
*)elem
);
5064 ok(elem2
!= NULL
, "elem2 == NULL\n");
5065 test_node_name((IUnknown
*)elem2
, "BODY");
5066 elem3
= test_elem_get_parent((IUnknown
*)elem2
);
5067 IHTMLElement_Release(elem2
);
5068 ok(elem3
!= NULL
, "elem3 == NULL\n");
5069 test_node_name((IUnknown
*)elem3
, "HTML");
5070 elem2
= test_elem_get_parent((IUnknown
*)elem3
);
5071 IHTMLElement_Release(elem3
);
5072 ok(elem2
== NULL
, "elem2 != NULL\n");
5074 test_elem_getelembytag((IUnknown
*)elem
, ET_OPTION
, 2);
5075 test_elem_getelembytag((IUnknown
*)elem
, ET_SELECT
, 0);
5076 test_elem_getelembytag((IUnknown
*)elem
, ET_HTML
, 0);
5078 test_elem_innertext(elem
, "opt1opt2");
5080 IHTMLElement_Release(elem
);
5083 elem
= get_elem_by_id(doc
, "s", TRUE
);
5085 IHTMLSelectElement
*select
;
5086 IHTMLDocument2
*doc_node
;
5088 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLSelectElement
, (void**)&select
);
5089 ok(hres
== S_OK
, "Could not get IHTMLSelectElement interface: %08x\n", hres
);
5091 test_select_elem(select
);
5093 test_elem_title((IUnknown
*)select
, NULL
);
5094 test_elem_set_title((IUnknown
*)select
, "Title");
5095 test_elem_title((IUnknown
*)select
, "Title");
5096 test_elem_offset((IUnknown
*)select
);
5098 node
= get_first_child((IUnknown
*)select
);
5099 ok(node
!= NULL
, "node == NULL\n");
5101 test_elem_type((IUnknown
*)node
, ET_OPTION
);
5102 IHTMLDOMNode_Release(node
);
5105 type
= get_node_type((IUnknown
*)select
);
5106 ok(type
== 1, "type=%d\n", type
);
5108 IHTMLSelectElement_Release(select
);
5110 hres
= IHTMLElement_get_document(elem
, &disp
);
5111 ok(hres
== S_OK
, "get_document failed: %08x\n", hres
);
5113 doc_node
= get_doc_node(doc
);
5114 ok(iface_cmp((IUnknown
*)disp
, (IUnknown
*)doc_node
), "disp != doc\n");
5115 IHTMLDocument2_Release(doc_node
);
5117 IHTMLElement_Release(elem
);
5120 elem
= get_elem_by_id(doc
, "sc", TRUE
);
5122 IHTMLScriptElement
*script
;
5125 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLScriptElement
, (void**)&script
);
5126 ok(hres
== S_OK
, "Could not get IHTMLScriptElement interface: %08x\n", hres
);
5132 hres
= IHTMLScriptElement_get_type(script
, &type
);
5133 ok(hres
== S_OK
, "get_type failed: %08x\n", hres
);
5134 ok(!strcmp_wa(type
, "text/javascript"), "Unexpected type %s\n", wine_dbgstr_w(type
));
5135 SysFreeString(type
);
5138 hres
= IHTMLScriptElement_put_defer(script
, VARIANT_TRUE
);
5139 ok(hres
== S_OK
, "put_defer failed: %08x\n", hres
);
5141 hres
= IHTMLScriptElement_get_defer(script
, &vb
);
5142 ok(hres
== S_OK
, "get_defer failed: %08x\n", hres
);
5143 ok(vb
== VARIANT_TRUE
, "get_defer result is %08x\n", hres
);
5145 hres
= IHTMLScriptElement_put_defer(script
, VARIANT_FALSE
);
5146 ok(hres
== S_OK
, "put_defer failed: %08x\n", hres
);
5149 IHTMLScriptElement_Release(script
);
5152 elem
= get_elem_by_id(doc
, "in", TRUE
);
5154 IHTMLInputElement
*input
;
5156 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLInputElement
, (void**)&input
);
5157 ok(hres
== S_OK
, "Could not get IHTMLInputElement: %08x\n", hres
);
5159 test_elem_id((IUnknown
*)elem
, "in");
5160 test_elem_put_id((IUnknown
*)elem
, "newin");
5161 test_input_get_disabled(input
, VARIANT_FALSE
);
5162 test_input_set_disabled(input
, VARIANT_TRUE
);
5163 test_input_set_disabled(input
, VARIANT_FALSE
);
5164 test_elem3_set_disabled((IUnknown
*)input
, VARIANT_TRUE
);
5165 test_input_get_disabled(input
, VARIANT_TRUE
);
5166 test_elem3_set_disabled((IUnknown
*)input
, VARIANT_FALSE
);
5167 test_input_get_disabled(input
, VARIANT_FALSE
);
5168 test_elem_client_size((IUnknown
*)elem
);
5170 test_node_get_value_str((IUnknown
*)elem
, NULL
);
5171 test_node_put_value_str((IUnknown
*)elem
, "test");
5172 test_node_get_value_str((IUnknown
*)elem
, NULL
);
5173 test_input_value((IUnknown
*)elem
, NULL
);
5174 test_input_put_value((IUnknown
*)elem
, "test");
5175 test_input_value((IUnknown
*)elem
, NULL
);
5176 test_elem_class((IUnknown
*)elem
, "testclass");
5177 test_elem_tabindex((IUnknown
*)elem
, 2);
5178 test_elem_set_tabindex((IUnknown
*)elem
, 3);
5179 test_elem_title((IUnknown
*)elem
, "test title");
5181 test_input_get_defaultchecked(input
, VARIANT_FALSE
);
5182 test_input_set_defaultchecked(input
, VARIANT_TRUE
);
5183 test_input_set_defaultchecked(input
, VARIANT_FALSE
);
5185 test_input_get_checked(input
, VARIANT_FALSE
);
5186 test_input_set_checked(input
, VARIANT_TRUE
);
5187 test_input_set_checked(input
, VARIANT_FALSE
);
5189 test_input_src(input
, NULL
);
5190 test_input_set_src(input
, "about:blank");
5192 IHTMLInputElement_Release(input
);
5193 IHTMLElement_Release(elem
);
5196 elem
= get_elem_by_id(doc
, "imgid", TRUE
);
5198 test_img_src((IUnknown
*)elem
, "");
5199 test_img_set_src((IUnknown
*)elem
, "about:blank");
5200 test_img_alt((IUnknown
*)elem
, NULL
);
5201 test_img_set_alt((IUnknown
*)elem
, "alt test");
5202 IHTMLElement_Release(elem
);
5205 elem
= get_doc_elem_by_id(doc
, "tbl");
5206 ok(elem
!= NULL
, "elem == NULL\n");
5208 test_table_elem(elem
);
5209 IHTMLElement_Release(elem
);
5212 elem
= get_doc_elem_by_id(doc
, "row2");
5213 ok(elem
!= NULL
, "elem == NULL\n");
5216 IHTMLElement_Release(elem
);
5219 elem
= get_doc_elem_by_id(doc
, "ifr");
5220 ok(elem
!= NULL
, "elem == NULL\n");
5222 test_iframe_elem(elem
);
5223 IHTMLElement_Release(elem
);
5226 elem
= get_elem_by_id(doc
, "a", TRUE
);
5228 test_anchor_href((IUnknown
*)elem
, "http://test/");
5229 IHTMLElement_Release(elem
);
5232 hres
= IHTMLDocument2_get_body(doc
, &elem
);
5233 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
5235 node
= get_first_child((IUnknown
*)elem
);
5236 ok(node
!= NULL
, "node == NULL\n");
5238 test_ifaces((IUnknown
*)node
, text_iids
);
5239 test_disp((IUnknown
*)node
, &DIID_DispHTMLDOMTextNode
, "[object]");
5241 node2
= get_first_child((IUnknown
*)node
);
5242 ok(!node2
, "node2 != NULL\n");
5244 type
= get_node_type((IUnknown
*)node
);
5245 ok(type
== 3, "type=%d\n", type
);
5247 test_node_get_value_str((IUnknown
*)node
, "text test");
5248 test_node_put_value_str((IUnknown
*)elem
, "test text");
5249 test_node_get_value_str((IUnknown
*)node
, "text test");
5251 IHTMLDOMNode_Release(node
);
5254 child_col
= get_child_nodes((IUnknown
*)elem
);
5255 ok(child_col
!= NULL
, "child_coll == NULL\n");
5259 test_disp((IUnknown
*)child_col
, &DIID_DispDOMChildrenCollection
, "[object]");
5261 hres
= IHTMLDOMChildrenCollection_get_length(child_col
, &length
);
5262 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
5263 ok(length
, "length=0\n");
5266 node
= get_child_item(child_col
, 0);
5267 ok(node
!= NULL
, "node == NULL\n");
5269 type
= get_node_type((IUnknown
*)node
);
5270 ok(type
== 3, "type=%d\n", type
);
5271 node2
= node_get_next((IUnknown
*)node
);
5272 IHTMLDOMNode_Release(node
);
5275 node
= get_child_item(child_col
, 1);
5276 ok(node
!= NULL
, "node == NULL\n");
5278 type
= get_node_type((IUnknown
*)node
);
5279 ok(type
== 8, "type=%d\n", type
);
5281 test_elem_id((IUnknown
*)node
, NULL
);
5282 ok(iface_cmp((IUnknown
*)node2
, (IUnknown
*)node
), "node2 != node\n");
5283 IHTMLDOMNode_Release(node2
);
5284 IHTMLDOMNode_Release(node
);
5287 hres
= IHTMLDOMChildrenCollection_item(child_col
, length
- 1, NULL
);
5288 ok(hres
== E_POINTER
, "item failed: %08x, expected E_POINTER\n", hres
);
5290 hres
= IHTMLDOMChildrenCollection_item(child_col
, length
, NULL
);
5291 ok(hres
== E_POINTER
, "item failed: %08x, expected E_POINTER\n", hres
);
5293 hres
= IHTMLDOMChildrenCollection_item(child_col
, 6000, &disp
);
5294 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
5296 hres
= IHTMLDOMChildrenCollection_item(child_col
, length
, &disp
);
5297 ok(hres
== E_INVALIDARG
, "item failed: %08x, expected E_INVALIDARG\n", hres
);
5299 test_child_col_disp(child_col
);
5301 IHTMLDOMChildrenCollection_Release(child_col
);
5304 test_elem3_get_disabled((IUnknown
*)elem
, VARIANT_FALSE
);
5305 test_elem3_set_disabled((IUnknown
*)elem
, VARIANT_TRUE
);
5306 test_elem3_set_disabled((IUnknown
*)elem
, VARIANT_FALSE
);
5308 IHTMLElement_Release(elem
);
5310 test_stylesheets(doc
);
5311 test_create_option_elem(doc
);
5312 test_create_img_elem(doc
);
5314 elem
= get_doc_elem_by_id(doc
, "tbl");
5315 ok(elem
!= NULL
, "elem = NULL\n");
5316 test_elem_set_innertext(elem
, "inner text");
5317 IHTMLElement_Release(elem
);
5319 test_doc_title(doc
, "test");
5320 test_doc_set_title(doc
, "test title");
5321 test_doc_title(doc
, "test title");
5324 hres
= IHTMLDocument2_get_Script(doc
, &disp
);
5325 ok(hres
== S_OK
, "get_Script failed: %08x\n", hres
);
5328 IDispatchEx
*dispex
;
5329 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&dispex
);
5330 ok(hres
== S_OK
, "IDispatch_QueryInterface failed: %08x\n", hres
);
5334 BSTR str
= a2bstr("Testing");
5335 hres
= IDispatchEx_GetDispID(dispex
, str
, 1, &pid
);
5336 ok(hres
== S_OK
, "GetDispID failed: %08x\n", hres
);
5337 ok(pid
!= -1, "pid == -1\n");
5339 IDispatchEx_Release(dispex
);
5342 IDispatch_Release(disp
);
5344 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
5345 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
5347 str
= a2bstr("img");
5348 hres
= IHTMLDocument3_getElementsByTagName(doc3
, str
, &col
);
5349 ok(hres
== S_OK
, "getElementsByTagName(%s) failed: %08x\n", wine_dbgstr_w(str
), hres
);
5353 static const elem_type_t img_types
[] = { ET_IMG
};
5355 test_elem_collection((IUnknown
*)col
, img_types
, sizeof(img_types
)/sizeof(img_types
[0]));
5356 IHTMLElementCollection_Release(col
);
5359 elem
= get_doc_elem_by_id(doc
, "y");
5360 test_elem_set_innerhtml((IUnknown
*)elem
, "inner html");
5361 test_elem_innerhtml((IUnknown
*)elem
, "inner html");
5362 test_elem_set_innerhtml((IUnknown
*)elem
, "");
5363 test_elem_innerhtml((IUnknown
*)elem
, NULL
);
5364 node
= node_get_next((IUnknown
*)elem
);
5365 ok(!node
, "node = %p\n", node
);
5367 elem2
= get_doc_elem_by_id(doc
, "x");
5368 node
= node_get_next((IUnknown
*)elem2
);
5369 IHTMLDOMNode_Release(node
);
5370 IHTMLElement_Release(elem2
);
5371 IHTMLElement_Release(elem
);
5373 IHTMLDocument3_Release(doc3
);
5375 window
= get_doc_window(doc
);
5376 test_window_name(window
, NULL
);
5377 set_window_name(window
, "test name");
5378 test_window_length(window
, 1);
5379 IHTMLWindow2_Release(window
);
5382 static void test_create_elems(IHTMLDocument2
*doc
)
5384 IHTMLElement
*elem
, *body
, *elem2
;
5385 IHTMLDOMNode
*node
, *node2
, *node3
, *comment
;
5386 IHTMLDocument5
*doc5
;
5393 static const elem_type_t types1
[] = { ET_TESTG
};
5395 elem
= test_create_elem(doc
, "TEST");
5396 test_elem_tag((IUnknown
*)elem
, "TEST");
5397 type
= get_node_type((IUnknown
*)elem
);
5398 ok(type
== 1, "type=%d\n", type
);
5399 test_ifaces((IUnknown
*)elem
, elem_iids
);
5400 test_disp((IUnknown
*)elem
, &DIID_DispHTMLGenericElement
, "[object]");
5402 hres
= IHTMLDocument2_get_body(doc
, &body
);
5403 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
5404 test_node_has_child((IUnknown
*)body
, VARIANT_FALSE
);
5406 node
= test_node_append_child((IUnknown
*)body
, (IUnknown
*)elem
);
5407 test_node_has_child((IUnknown
*)body
, VARIANT_TRUE
);
5408 elem2
= get_elem_iface((IUnknown
*)node
);
5409 IHTMLElement_Release(elem2
);
5411 hres
= IHTMLElement_get_all(body
, &disp
);
5412 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5413 test_elem_collection((IUnknown
*)disp
, types1
, sizeof(types1
)/sizeof(types1
[0]));
5414 IDispatch_Release(disp
);
5416 test_node_remove_child((IUnknown
*)body
, node
);
5418 hres
= IHTMLElement_get_all(body
, &disp
);
5419 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5420 test_elem_collection((IUnknown
*)disp
, NULL
, 0);
5421 IDispatch_Release(disp
);
5422 test_node_has_child((IUnknown
*)body
, VARIANT_FALSE
);
5424 IHTMLElement_Release(elem
);
5425 IHTMLDOMNode_Release(node
);
5427 node
= test_create_text(doc
, "test");
5428 test_ifaces((IUnknown
*)node
, text_iids
);
5429 test_disp((IUnknown
*)node
, &DIID_DispHTMLDOMTextNode
, "[object]");
5431 V_VT(&var
) = VT_NULL
;
5432 node2
= test_node_insertbefore((IUnknown
*)body
, node
, &var
);
5433 IHTMLDOMNode_Release(node
);
5435 node
= test_create_text(doc
, "insert ");
5437 V_VT(&var
) = VT_DISPATCH
;
5438 V_DISPATCH(&var
) = (IDispatch
*)node2
;
5439 node3
= test_node_insertbefore((IUnknown
*)body
, node
, &var
);
5440 IHTMLDOMNode_Release(node
);
5441 IHTMLDOMNode_Release(node2
);
5442 IHTMLDOMNode_Release(node3
);
5444 test_elem_innertext(body
, "insert test");
5445 test_elem_innerhtml((IUnknown
*)body
, "insert test");
5447 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
5450 str
= a2bstr("testing");
5451 hres
= IHTMLDocument5_createComment(doc5
, str
, &comment
);
5453 ok(hres
== S_OK
, "createComment failed: %08x\n", hres
);
5456 type
= get_node_type((IUnknown
*)comment
);
5457 ok(type
== 8, "type=%d, expected 8\n", type
);
5459 test_node_get_value_str((IUnknown
*)comment
, "testing");
5461 IHTMLDOMNode_Release(comment
);
5464 IHTMLDocument5_Release(doc5
);
5467 IHTMLElement_Release(body
);
5470 static void test_exec(IUnknown
*unk
, const GUID
*grpid
, DWORD cmdid
, VARIANT
*in
, VARIANT
*out
)
5472 IOleCommandTarget
*cmdtrg
;
5475 hres
= IHTMLTxtRange_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5476 ok(hres
== S_OK
, "Could not get IOleCommandTarget interface: %08x\n", hres
);
5478 hres
= IOleCommandTarget_Exec(cmdtrg
, grpid
, cmdid
, 0, in
, out
);
5479 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
5481 IOleCommandTarget_Release(cmdtrg
);
5484 static void test_indent(IHTMLDocument2
*doc
)
5486 IHTMLElementCollection
*col
;
5487 IHTMLTxtRange
*range
;
5490 static const elem_type_t all_types
[] = {
5499 static const elem_type_t indent_types
[] = {
5510 hres
= IHTMLDocument2_get_all(doc
, &col
);
5511 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5512 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
5513 IHTMLElementCollection_Release(col
);
5515 range
= test_create_body_range(doc
);
5516 test_exec((IUnknown
*)range
, &CGID_MSHTML
, IDM_INDENT
, NULL
, NULL
);
5517 IHTMLTxtRange_Release(range
);
5519 hres
= IHTMLDocument2_get_all(doc
, &col
);
5520 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5521 test_elem_collection((IUnknown
*)col
, indent_types
, sizeof(indent_types
)/sizeof(indent_types
[0]));
5522 IHTMLElementCollection_Release(col
);
5525 static void test_cond_comment(IHTMLDocument2
*doc
)
5527 IHTMLElementCollection
*col
;
5530 static const elem_type_t all_types
[] = {
5538 hres
= IHTMLDocument2_get_all(doc
, &col
);
5539 ok(hres
== S_OK
, "get_all failed: %08x\n", hres
);
5540 test_elem_collection((IUnknown
*)col
, all_types
, sizeof(all_types
)/sizeof(all_types
[0]));
5541 IHTMLElementCollection_Release(col
);
5544 static IHTMLDocument2
*notif_doc
;
5545 static BOOL doc_complete
;
5547 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
5548 REFIID riid
, void**ppv
)
5550 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
5555 ok(0, "unexpected call\n");
5556 return E_NOINTERFACE
;
5559 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
5564 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
5569 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
5571 if(dispID
== DISPID_READYSTATE
){
5575 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
5576 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
5578 if(!strcmp_wa(state
, "complete"))
5579 doc_complete
= TRUE
;
5581 SysFreeString(state
);
5587 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
5589 ok(0, "unexpected call\n");
5593 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
5594 PropertyNotifySink_QueryInterface
,
5595 PropertyNotifySink_AddRef
,
5596 PropertyNotifySink_Release
,
5597 PropertyNotifySink_OnChanged
,
5598 PropertyNotifySink_OnRequestEdit
5601 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
5603 static IHTMLDocument2
*create_doc_with_string(const char *str
)
5605 IPersistStreamInit
*init
;
5607 IHTMLDocument2
*doc
;
5611 notif_doc
= doc
= create_document();
5615 doc_complete
= FALSE
;
5617 mem
= GlobalAlloc(0, len
);
5618 memcpy(mem
, str
, len
);
5619 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
5621 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
5623 IPersistStreamInit_Load(init
, stream
);
5624 IPersistStreamInit_Release(init
);
5625 IStream_Release(stream
);
5630 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
5632 IConnectionPointContainer
*container
;
5633 IConnectionPoint
*cp
;
5637 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
5638 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
5640 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
5641 IConnectionPointContainer_Release(container
);
5642 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
5644 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
5645 IConnectionPoint_Release(cp
);
5646 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5649 typedef void (*domtest_t
)(IHTMLDocument2
*);
5651 static void run_domtest(const char *str
, domtest_t test
)
5653 IHTMLDocument2
*doc
;
5654 IHTMLElement
*body
= NULL
;
5659 doc
= create_doc_with_string(str
);
5663 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
5665 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
5666 TranslateMessage(&msg
);
5667 DispatchMessage(&msg
);
5670 hres
= IHTMLDocument2_get_body(doc
, &body
);
5671 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
5674 IHTMLElement_Release(body
);
5677 skip("Could not get document body. Assuming no Gecko installed.\n");
5680 ref
= IHTMLDocument2_Release(doc
);
5682 ref
== 1, /* Vista */
5686 static void gecko_installer_workaround(BOOL disable
)
5691 static BOOL has_url
= FALSE
;
5692 static char url
[2048];
5694 if(!disable
&& !has_url
)
5697 res
= RegOpenKey(HKEY_CURRENT_USER
, "Software\\Wine\\MSHTML", &hkey
);
5698 if(res
!= ERROR_SUCCESS
)
5702 DWORD type
, size
= sizeof(url
);
5704 res
= RegQueryValueEx(hkey
, "GeckoUrl", NULL
, &type
, (PVOID
)url
, &size
);
5705 if(res
== ERROR_SUCCESS
&& type
== REG_SZ
)
5708 RegDeleteValue(hkey
, "GeckoUrl");
5710 RegSetValueEx(hkey
, "GeckoUrl", 0, REG_SZ
, (PVOID
)url
, lstrlenA(url
)+1);
5718 gecko_installer_workaround(TRUE
);
5721 run_domtest(doc_str1
, test_doc_elem
);
5722 run_domtest(doc_str1
, test_get_set_attr
);
5723 run_domtest(range_test_str
, test_txtrange
);
5724 run_domtest(range_test2_str
, test_txtrange2
);
5725 if (winetest_interactive
|| ! is_ie_hardened()) {
5726 run_domtest(elem_test_str
, test_elems
);
5728 skip("IE running in Enhanced Security Configuration\n");
5730 run_domtest(doc_blank
, test_create_elems
);
5731 run_domtest(doc_blank
, test_defaults
);
5732 run_domtest(indent_test_str
, test_indent
);
5733 run_domtest(cond_comment_str
, test_cond_comment
);
5736 gecko_installer_workaround(FALSE
);