2 * Copyright 2007-2011 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>
33 static BOOL is_ie9plus
;
38 } compat_mode
= COMPAT_NONE
;
40 static const char doc_blank
[] =
43 static const char doc_blank_ie9
[] =
47 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
53 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
58 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
59 return lstrcmpA(stra
, buf
);
62 static BOOL
wstr_contains(const WCHAR
*strw
, const char *stra
)
65 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
66 return strstr(buf
, stra
) != NULL
;
69 static BSTR
a2bstr(const char *str
)
77 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
78 ret
= SysAllocStringLen(NULL
, len
);
79 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
84 static const WCHAR
*strstr_wa(const WCHAR
*str
, const char *suba
)
87 const WCHAR
*ret
= NULL
;
91 const WCHAR
*p1
= str
, *p2
= sub
;
92 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
93 if (!*p2
) {ret
= str
; break;}
100 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
101 static void _test_var_bstr(unsigned line
, const VARIANT
*v
, const char *expect
)
103 ok_(__FILE__
,line
)(V_VT(v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(v
));
105 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(v
), expect
), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), expect
);
107 ok_(__FILE__
,line
)(!V_BSTR(v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v
)));
110 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
111 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
116 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
117 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
121 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
122 static IHTMLCurrentStyle2
*_get_current_style2_iface(unsigned line
, IUnknown
*unk
)
124 IHTMLCurrentStyle2
*current_style2
;
127 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
128 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
129 return current_style2
;
132 #define elem_set_innerhtml(e,t) _elem_set_innerhtml(__LINE__,e,t)
133 static void _elem_set_innerhtml(unsigned line
, IHTMLElement
*elem
, const char *inner_html
)
138 html
= a2bstr(inner_html
);
139 hres
= IHTMLElement_put_innerHTML(elem
, html
);
140 ok_(__FILE__
,line
)(hres
== S_OK
, "put_innerHTML failed: %08x\n", hres
);
144 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
147 IHTMLDocument3
*doc3
;
148 IHTMLElement
*result
;
149 BSTR idW
= a2bstr(id
);
151 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
152 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
154 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
155 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
156 ok(result
!= NULL
, "result == NULL\n");
159 IHTMLDocument3_Release(doc3
);
163 #define get_current_style(e) _get_current_style(__LINE__,e)
164 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
166 IHTMLCurrentStyle
*cstyle
;
167 IHTMLElement2
*elem2
;
170 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
171 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
174 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
175 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
176 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
178 IHTMLElement2_Release(elem2
);
182 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
183 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
188 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
189 LOCALE_USER_DEFAULT
, &dispid
);
190 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
193 DISPPARAMS params
= {NULL
,NULL
,0,0};
194 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
199 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
200 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
201 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
204 params
.cNamedArgs
= 1;
205 params
.rgdispidNamedArgs
= &dispidNamed
;
206 V_VT(&arg
) = VT_BSTR
;
207 V_BSTR(&arg
) = a2bstr("none");
208 params
.rgvarg
= &arg
;
209 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
210 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
211 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
214 V_VT(&arg
) = VT_BSTR
;
215 V_BSTR(&arg
) = a2bstr("dotted");
216 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
217 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
218 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
221 V_VT(&arg
) = VT_BSTR
;
222 V_BSTR(&arg
) = a2bstr("dashed");
223 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
224 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
225 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
228 V_VT(&arg
) = VT_BSTR
;
229 V_BSTR(&arg
) = a2bstr("solid");
230 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
231 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
232 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
235 V_VT(&arg
) = VT_BSTR
;
236 V_BSTR(&arg
) = a2bstr("double");
237 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
238 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
239 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
242 V_VT(&arg
) = VT_BSTR
;
243 V_BSTR(&arg
) = a2bstr("groove");
244 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
245 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
246 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
249 V_VT(&arg
) = VT_BSTR
;
250 V_BSTR(&arg
) = a2bstr("ridge");
251 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
252 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
253 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
256 V_VT(&arg
) = VT_BSTR
;
257 V_BSTR(&arg
) = a2bstr("inset");
258 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
259 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
260 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
263 V_VT(&arg
) = VT_BSTR
;
264 V_BSTR(&arg
) = a2bstr("outset");
265 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
266 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
267 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
270 V_VT(&arg
) = VT_BSTR
;
271 V_BSTR(&arg
) = a2bstr("invalid");
272 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
273 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
274 if(compat_mode
< COMPAT_IE9
)
275 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
277 ok_(__FILE__
,line
) (hres
== S_OK
, "invalid value returned: %08x\n", hres
);
280 params
.rgvarg
= &vDefault
;
281 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
282 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
283 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
284 VariantClear(&vDefault
);
288 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
289 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
291 BSTR text
= (void*)0xdeadbeef;
294 hres
= IHTMLStyle_get_cssText(style
, &text
);
295 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
297 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
299 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
304 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
305 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
311 hres
= IHTMLStyle_put_cssText(style
, tmp
);
312 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
316 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
317 static void _test_style_remove_attribute(unsigned line
, IHTMLStyle
*style
, const char *attr
, VARIANT_BOOL exb
)
319 BSTR str
= a2bstr(attr
);
320 VARIANT_BOOL b
= 100;
323 hres
= IHTMLStyle_removeAttribute(style
, str
, 1, &b
);
325 ok_(__FILE__
,line
)(hres
== S_OK
, "removeAttribute failed: %08x\n", hres
);
326 ok_(__FILE__
,line
)(b
== exb
, "removeAttribute returned %x, expected %x\n", b
, exb
);
329 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
330 static void _set_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *v
)
336 hres
= IHTMLStyle_put_textDecoration(style
, str
);
337 ok_(__FILE__
,line
)(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
341 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
342 static void _test_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *exdec
)
347 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
348 ok_(__FILE__
,line
)(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
350 ok_(__FILE__
,line
)(!strcmp_wa(str
, exdec
), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str
), exdec
);
352 ok_(__FILE__
,line
)(!str
, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str
));
356 static void test_set_csstext(IHTMLStyle
*style
)
358 IHTMLCSSStyleDeclaration
*css_style
;
363 test_style_set_csstext(style
, "background-color: black;");
365 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
366 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
367 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
368 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
371 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLCSSStyleDeclaration
, (void**)&css_style
);
372 ok(hres
== S_OK
|| broken(!is_ie9plus
&& hres
== E_NOINTERFACE
),
373 "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres
);
377 str
= a2bstr("float: left;");
378 hres
= IHTMLCSSStyleDeclaration_put_cssText(css_style
, str
);
379 ok(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
382 hres
= IHTMLCSSStyleDeclaration_get_cssFloat(css_style
, &str
);
383 ok(hres
== S_OK
, "get_cssFloat failed: %08x\n", hres
);
384 ok(!strcmp_wa(str
, "left"), "cssFloat = %s\n", wine_dbgstr_w(str
));
387 hres
= IHTMLCSSStyleDeclaration_get_cssText(css_style
, &str
);
388 ok(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
389 todo_wine_if(compat_mode
< COMPAT_IE9
)
390 ok(!strcmp_wa(str
, compat_mode
>= COMPAT_IE9
? "float: left;" : "FLOAT: left"),
391 "cssFloat = %s\n", wine_dbgstr_w(str
));
394 hres
= IHTMLCSSStyleDeclaration_put_cssText(css_style
, NULL
);
395 ok(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
397 IHTMLCSSStyleDeclaration_Release(css_style
);
400 static void test_style2(IHTMLStyle2
*style2
)
406 str
= (void*)0xdeadbeef;
407 hres
= IHTMLStyle2_get_position(style2
, &str
);
408 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
409 ok(!str
, "str != NULL\n");
411 str
= a2bstr("absolute");
412 hres
= IHTMLStyle2_put_position(style2
, str
);
413 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
417 hres
= IHTMLStyle2_get_position(style2
, &str
);
418 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
419 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
424 hres
= IHTMLStyle2_get_right(style2
, &v
);
425 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
426 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
427 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
431 V_BSTR(&v
) = a2bstr("3px");
432 hres
= IHTMLStyle2_put_right(style2
, v
);
433 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
437 hres
= IHTMLStyle2_get_right(style2
, &v
);
438 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
439 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
440 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
444 str
= (void*)0xdeadbeef;
445 hres
= IHTMLStyle2_get_direction(style2
, &str
);
446 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
447 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
450 hres
= IHTMLStyle2_put_direction(style2
, str
);
451 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
455 hres
= IHTMLStyle2_get_direction(style2
, &str
);
456 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
457 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
462 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
463 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
464 test_var_bstr(&v
, NULL
);
468 hres
= IHTMLStyle2_put_bottom(style2
, v
);
469 ok(hres
== S_OK
, "put_bottom failed: %08x\n", hres
);
472 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
473 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
474 test_var_bstr(&v
, compat_mode
< COMPAT_IE9
? "4px" : NULL
);
477 str
= (void*)0xdeadbeef;
478 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
479 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
480 ok(!str
, "overflowX = %s\n", wine_dbgstr_w(str
));
482 str
= a2bstr("hidden");
483 hres
= IHTMLStyle2_put_overflowX(style2
, str
);
484 ok(hres
== S_OK
, "put_overflowX failed: %08x\n", hres
);
488 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
489 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
490 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
493 str
= (void*)0xdeadbeef;
494 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
495 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
496 ok(!str
, "overflowY = %s\n", wine_dbgstr_w(str
));
498 str
= a2bstr("hidden");
499 hres
= IHTMLStyle2_put_overflowY(style2
, str
);
500 ok(hres
== S_OK
, "put_overflowY failed: %08x\n", hres
);
504 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
505 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
506 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
509 str
= a2bstr("fixed");
510 hres
= IHTMLStyle2_put_tableLayout(style2
, str
);
511 ok(hres
== S_OK
, "put_tableLayout failed: %08x\n", hres
);
514 str
= (void*)0xdeadbeef;
515 hres
= IHTMLStyle2_get_tableLayout(style2
, &str
);
516 ok(hres
== S_OK
, "get_tableLayout failed: %08x\n", hres
);
517 ok(!strcmp_wa(str
, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str
));
521 static void test_style3(IHTMLStyle3
*style3
, IHTMLCSSStyleDeclaration
*css_style
)
527 str
= (void*)0xdeadbeef;
528 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
529 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
530 ok(!str
, "str != NULL\n");
532 str
= a2bstr("break-word");
533 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
534 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
538 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
539 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
540 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
544 hres
= IHTMLStyle3_get_zoom(style3
, &v
);
545 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
546 ok(V_VT(&v
) == VT_BSTR
, "V_VT(zoom) = %d\n", V_VT(&v
));
547 ok(!V_BSTR(&v
), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
551 V_BSTR(&v
) = a2bstr("100%");
552 hres
= IHTMLStyle3_put_zoom(style3
, v
);
553 ok(hres
== S_OK
, "put_zoom failed: %08x\n", hres
);
557 hres
= IHTMLStyle3_get_zoom(style3
, &v
);
558 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
559 ok(V_VT(&v
) == VT_BSTR
, "V_VT(zoom) = %d\n", V_VT(&v
));
560 ok(!strcmp_wa(V_BSTR(&v
), "100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
564 hres
= IHTMLCSSStyleDeclaration_get_zoom(css_style
, &v
);
565 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
566 test_var_bstr(&v
, "100%");
572 hres
= IHTMLStyle3_put_zoom(style3
, v
);
573 ok(hres
== S_OK
, "put_zoom failed: %08x\n", hres
);
576 hres
= IHTMLStyle3_get_zoom(style3
, &v
);
577 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
578 ok(V_VT(&v
) == VT_BSTR
, "V_VT(zoom) = %d\n", V_VT(&v
));
579 ok(!strcmp_wa(V_BSTR(&v
), "1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
584 V_BSTR(&v
) = a2bstr("100%");
585 hres
= IHTMLCSSStyleDeclaration_put_zoom(css_style
, v
);
586 ok(hres
== S_OK
, "put_zoom failed: %08x\n", hres
);
589 hres
= IHTMLCSSStyleDeclaration_get_zoom(css_style
, &v
);
590 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
591 test_var_bstr(&v
, "100%");
596 static void test_style4(IHTMLStyle4
*style4
)
602 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
603 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
606 V_BSTR(&v
) = a2bstr("10px");
607 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
608 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
611 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
612 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
613 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
614 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
617 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
618 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
619 VariantClear(&vdefault
);
622 static void test_style5(IHTMLStyle5
*style5
)
629 hres
= IHTMLStyle5_get_minWidth(style5
, &vdefault
);
630 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
633 V_BSTR(&v
) = a2bstr("12px");
634 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
635 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
638 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
639 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
640 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
641 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
645 V_BSTR(&v
) = a2bstr("10%");
646 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
647 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
650 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
651 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
652 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
653 ok(!strcmp_wa(V_BSTR(&v
), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
657 V_BSTR(&v
) = a2bstr("10");
658 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
659 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
662 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
663 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
664 test_var_bstr(&v
, compat_mode
< COMPAT_IE9
? "10px" : "10%");
667 hres
= IHTMLStyle5_put_minWidth(style5
, vdefault
);
668 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
669 VariantClear(&vdefault
);
672 hres
= IHTMLStyle5_get_maxWidth(style5
, &vdefault
);
673 ok(hres
== S_OK
, "get_maxWidth failed: %08x\n", hres
);
676 V_BSTR(&v
) = a2bstr("200px");
677 hres
= IHTMLStyle5_put_maxWidth(style5
, v
);
678 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
681 hres
= IHTMLStyle5_get_maxWidth(style5
, &v
);
682 ok(hres
== S_OK
, "get_maxWidth failed: %08x\n", hres
);
683 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n",V_VT(&v
));
684 ok(!strcmp_wa(V_BSTR(&v
), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
688 V_BSTR(&v
) = a2bstr("70%");
689 hres
= IHTMLStyle5_put_maxWidth(style5
, v
);
690 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
693 hres
= IHTMLStyle5_get_maxWidth(style5
, &v
);
694 ok(hres
== S_OK
, "get maxWidth failed: %08x\n", hres
);
695 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
696 ok(!strcmp_wa(V_BSTR(&v
), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
699 hres
= IHTMLStyle5_put_maxWidth(style5
,vdefault
);
700 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
701 VariantClear(&vdefault
);
704 hres
= IHTMLStyle5_get_maxHeight(style5
, &vdefault
);
705 ok(hres
== S_OK
, "get maxHeight failed: %08x\n", hres
);
708 V_BSTR(&v
) = a2bstr("200px");
709 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
710 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
713 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
714 ok(hres
== S_OK
, "get maxHeight failed: %08x\n", hres
);
715 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
716 ok(!strcmp_wa(V_BSTR(&v
), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
720 V_BSTR(&v
) = a2bstr("70%");
721 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
722 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
725 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
726 ok(hres
== S_OK
, "get_maxHeight failed: %08x\n", hres
);
727 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
728 ok(!strcmp_wa(V_BSTR(&v
), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
732 V_BSTR(&v
) = a2bstr("100");
733 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
734 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
737 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
738 ok(hres
== S_OK
, "get_maxHeight failed: %08x\n", hres
);
739 test_var_bstr(&v
, compat_mode
< COMPAT_IE9
? "100px" : "70%");
742 hres
= IHTMLStyle5_put_maxHeight(style5
, vdefault
);
743 ok(hres
== S_OK
, "put maxHeight failed:%08x\n", hres
);
744 VariantClear(&vdefault
);
747 static void test_style6(IHTMLStyle6
*style
)
752 str
= (void*)0xdeadbeef;
753 hres
= IHTMLStyle6_get_outline(style
, &str
);
754 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
755 if(compat_mode
< COMPAT_IE9
)
756 ok(str
&& !*str
, "outline = %s\n", wine_dbgstr_w(str
));
758 ok(!str
, "outline = %s\n", wine_dbgstr_w(str
));
762 hres
= IHTMLStyle6_put_outline(style
, str
);
763 ok(hres
== S_OK
, "put_outline failed: %08x\n", hres
);
766 str
= (void*)0xdeadbeef;
767 hres
= IHTMLStyle6_get_outline(style
, &str
);
768 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
769 ok(wstr_contains(str
, "1px"), "outline = %s\n", wine_dbgstr_w(str
));
772 str
= (void*)0xdeadbeef;
773 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
774 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
775 ok(!str
, "boxSizing = %s\n", wine_dbgstr_w(str
));
778 str
= a2bstr("border-box");
779 hres
= IHTMLStyle6_put_boxSizing(style
, str
);
780 ok(hres
== S_OK
, "put_boxSizing failed: %08x\n", hres
);
784 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
785 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
786 ok(!strcmp_wa(str
, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str
));
790 static void test_css_style_declaration(IHTMLCSSStyleDeclaration
*css_style
)
796 hres
= IHTMLCSSStyleDeclaration_get_backgroundClip(css_style
, &str
);
797 ok(hres
== S_OK
, "get_backgroundClip failed: %08x\n", hres
);
798 ok(!str
, "backgroundClip = %s\n", wine_dbgstr_w(str
));
800 str
= a2bstr("border-box");
801 hres
= IHTMLCSSStyleDeclaration_put_backgroundClip(css_style
, str
);
802 ok(hres
== S_OK
, "put_backgroundClip failed: %08x\n", hres
);
805 hres
= IHTMLCSSStyleDeclaration_get_backgroundClip(css_style
, &str
);
806 ok(hres
== S_OK
, "get_backgroundClip failed: %08x\n", hres
);
807 ok(!strcmp_wa(str
, "border-box"), "backgroundClip = %s\n", wine_dbgstr_w(str
));
810 hres
= IHTMLCSSStyleDeclaration_get_opacity(css_style
, &v
);
811 ok(hres
== S_OK
, "get_opacity failed: %08x\n", hres
);
812 test_var_bstr(&v
, NULL
);
816 hres
= IHTMLCSSStyleDeclaration_put_opacity(css_style
, v
);
817 ok(hres
== S_OK
, "put_opacity failed: %08x\n", hres
);
819 hres
= IHTMLCSSStyleDeclaration_get_opacity(css_style
, &v
);
820 ok(hres
== S_OK
, "get_opacity failed: %08x\n", hres
);
821 test_var_bstr(&v
, "0");
825 V_BSTR(&v
) = a2bstr("1");
826 hres
= IHTMLCSSStyleDeclaration_put_opacity(css_style
, v
);
827 ok(hres
== S_OK
, "put_opacity failed: %08x\n", hres
);
830 hres
= IHTMLCSSStyleDeclaration_get_opacity(css_style
, &v
);
831 ok(hres
== S_OK
, "get_opacity failed: %08x\n", hres
);
832 test_var_bstr(&v
, "1");
836 static void test_body_style(IHTMLStyle
*style
)
838 IHTMLCSSStyleDeclaration
*css_style
;
839 IHTMLCSSStyleDeclaration2
*css_style2
= NULL
;
850 BSTR sOverflowDefault
;
855 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLCSSStyleDeclaration
, (void**)&css_style
);
856 ok(hres
== S_OK
|| broken(!is_ie9plus
&& hres
== E_NOINTERFACE
),
857 "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres
);
860 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLCSSStyleDeclaration2
, (void**)&css_style2
);
861 ok(hres
== S_OK
|| broken(hres
== E_NOINTERFACE
),
862 "Could not get IHTMLCSSStyleDeclaration2 interface: %08x\n", hres
);
865 test_style_csstext(style
, NULL
);
867 hres
= IHTMLStyle_get_position(style
, &str
);
868 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
869 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
872 hres
= IHTMLStyle_get_marginRight(style
, &v
);
873 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
874 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
875 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
879 hres
= IHTMLStyle_put_marginRight(style
, v
);
880 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
883 hres
= IHTMLStyle_get_marginRight(style
, &v
);
884 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
885 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
886 if(compat_mode
< COMPAT_IE9
)
887 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
889 ok(!V_BSTR(&v
), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
893 hres
= IHTMLCSSStyleDeclaration_get_marginRight(css_style
, &v
);
894 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
895 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
896 if(compat_mode
< COMPAT_IE9
)
897 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n",
898 wine_dbgstr_w(V_BSTR(&v
)));
900 ok(!V_BSTR(&v
), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
904 hres
= IHTMLCSSStyleDeclaration_put_marginRight(css_style
, v
);
905 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
908 hres
= IHTMLCSSStyleDeclaration_get_marginRight(css_style
, &v
);
909 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
910 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
911 if(compat_mode
< COMPAT_IE9
)
912 ok(!strcmp_wa(V_BSTR(&v
), "7px"), "V_BSTR(marginRight) = %s\n",
913 wine_dbgstr_w(V_BSTR(&v
)));
915 ok(!V_BSTR(&v
), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
918 V_BSTR(&v
) = a2bstr("8");
919 hres
= IHTMLCSSStyleDeclaration_put_marginRight(css_style
, v
);
920 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
921 SysFreeString(V_BSTR(&v
));
924 hres
= IHTMLCSSStyleDeclaration_get_marginRight(css_style
, &v
);
925 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
926 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
927 if(compat_mode
< COMPAT_IE9
)
928 ok(!strcmp_wa(V_BSTR(&v
), "8px"), "V_BSTR(marginRight) = %s\n",
929 wine_dbgstr_w(V_BSTR(&v
)));
931 ok(!V_BSTR(&v
), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
934 V_BSTR(&v
) = a2bstr("9px");
935 hres
= IHTMLCSSStyleDeclaration_put_marginRight(css_style
, v
);
936 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
937 SysFreeString(V_BSTR(&v
));
940 hres
= IHTMLCSSStyleDeclaration_get_marginRight(css_style
, &v
);
941 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
942 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
943 ok(!strcmp_wa(V_BSTR(&v
), "9px"), "V_BSTR(marginRight) = %s\n",
944 wine_dbgstr_w(V_BSTR(&v
)));
945 SysFreeString(V_BSTR(&v
));
949 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
950 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
951 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
952 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
956 hres
= IHTMLStyle_put_marginBottom(style
, v
);
957 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
960 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
961 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
962 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
963 if(compat_mode
< COMPAT_IE9
)
964 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
966 ok(!V_BSTR(&v
), "mariginBottom = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
969 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
970 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
971 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
972 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
976 hres
= IHTMLStyle_put_marginLeft(style
, v
);
977 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
980 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
981 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
982 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
983 if(compat_mode
< COMPAT_IE9
)
984 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
986 ok(!V_BSTR(&v
), "mariginLeft = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
988 str
= (void*)0xdeadbeef;
989 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
990 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
991 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
993 str
= (void*)0xdeadbeef;
994 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
995 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
996 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
998 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
999 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
1001 str
= a2bstr("test");
1002 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1003 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
1004 "put_fontWeight failed: %08x\n", hres
);
1007 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
1008 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
1009 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
1012 str
= a2bstr("bold");
1013 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1014 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1017 str
= a2bstr("bolder");
1018 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1019 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1022 str
= a2bstr("lighter");
1023 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1024 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1027 str
= a2bstr("100");
1028 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1029 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1032 str
= a2bstr("200");
1033 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1034 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1037 str
= a2bstr("300");
1038 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1039 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1042 str
= a2bstr("400");
1043 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1044 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1047 str
= a2bstr("500");
1048 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1049 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1052 str
= a2bstr("600");
1053 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1054 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1057 str
= a2bstr("700");
1058 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1059 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1062 str
= a2bstr("800");
1063 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1064 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1067 str
= a2bstr("900");
1068 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1069 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1072 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
1073 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
1074 ok(!strcmp_wa(str
, "900"), "str != style900\n");
1078 hres
= IHTMLStyle_put_fontWeight(style
, str
);
1079 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1082 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
1083 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
1084 ok(!str
, "str != NULL\n");
1087 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
1088 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
1089 SysFreeString(sDefault
);
1092 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
1093 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
1095 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
1096 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
1098 str
= a2bstr("test");
1099 hres
= IHTMLStyle_put_fontVariant(style
, str
);
1100 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
1101 "fontVariant failed: %08x\n", hres
);
1104 str
= a2bstr("small-caps");
1105 hres
= IHTMLStyle_put_fontVariant(style
, str
);
1106 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
1109 str
= a2bstr("normal");
1110 hres
= IHTMLStyle_put_fontVariant(style
, str
);
1111 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
1114 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
1115 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
1116 SysFreeString(sDefault
);
1118 str
= (void*)0xdeadbeef;
1119 hres
= IHTMLStyle_get_display(style
, &str
);
1120 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
1121 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
1123 str
= (void*)0xdeadbeef;
1124 hres
= IHTMLStyle_get_visibility(style
, &str
);
1125 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
1126 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
1129 hres
= IHTMLStyle_get_fontSize(style
, &v
);
1130 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
1131 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
1132 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1136 hres
= IHTMLStyle_put_fontSize(style
, v
);
1137 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
1140 hres
= IHTMLStyle_get_fontSize(style
, &v
);
1141 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
1142 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
1143 if(compat_mode
< COMPAT_IE9
)
1144 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1146 ok(!V_BSTR(&v
), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1149 hres
= IHTMLStyle_get_color(style
, &v
);
1150 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
1151 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
1152 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1156 hres
= IHTMLStyle_put_color(style
, v
);
1157 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
1160 hres
= IHTMLStyle_get_color(style
, &v
);
1161 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
1162 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
1164 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1168 hres
= IHTMLStyle_put_lineHeight(style
, v
);
1169 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
1171 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
1172 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
1173 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
1174 ok(!strcmp_wa(V_BSTR(&v
), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1177 V_BSTR(&v
) = a2bstr("300%");
1178 hres
= IHTMLStyle_put_lineHeight(style
, v
);
1179 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
1182 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
1183 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
1184 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
1185 ok(!strcmp_wa(V_BSTR(&v
), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1189 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
1190 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
1191 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
1193 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
1194 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
1196 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
1197 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
1198 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
1200 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
1201 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
1204 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
1205 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
1206 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
1208 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
1209 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
1211 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
1212 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
1213 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
1215 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
1216 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
1219 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
1220 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
1221 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
1223 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
1224 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
1226 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
1227 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
1228 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
1230 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
1231 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
1234 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
1235 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
1236 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
1238 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
1239 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
1241 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
1242 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
1243 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
1245 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
1246 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
1249 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
1250 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
1251 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
1253 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
1254 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
1256 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
1257 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
1258 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
1260 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
1261 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
1263 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
1264 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
1266 str
= a2bstr("invalid");
1267 hres
= IHTMLStyle_put_textDecoration(style
, str
);
1268 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
1269 "put_textDecoration failed: %08x\n", hres
);
1272 set_text_decoration(style
, "none");
1273 test_text_decoration(style
, "none");
1274 set_text_decoration(style
, "underline");
1275 set_text_decoration(style
, "overline");
1276 set_text_decoration(style
, "line-through");
1277 set_text_decoration(style
, "blink");
1278 set_text_decoration(style
, "overline");
1279 set_text_decoration(style
, "blink");
1280 test_text_decoration(style
, "blink");
1282 str
= a2bstr("invalid");
1283 hres
= IHTMLStyle_put_textDecoration(style
, str
);
1284 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
1285 "put_textDecoration failed: %08x\n", hres
);
1287 test_text_decoration(style
, compat_mode
< COMPAT_IE9
? NULL
: "blink");
1289 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
1290 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
1291 SysFreeString(sDefault
);
1293 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
1294 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
1296 hres
= IHTMLStyle_get_posWidth(style
, &f
);
1297 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
1298 ok(f
== 0.0f
, "f = %f\n", f
);
1300 V_VT(&v
) = VT_EMPTY
;
1301 hres
= IHTMLStyle_get_width(style
, &v
);
1302 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1303 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1304 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
1306 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
1307 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
1309 hres
= IHTMLStyle_get_posWidth(style
, &f
);
1310 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
1312 f
== 2.2f
, /* IE8 */
1316 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1317 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1318 ok(l
== 2, "pixelWidth = %d\n", l
);
1321 V_BSTR(&v
) = a2bstr("auto");
1322 hres
= IHTMLStyle_put_width(style
, v
);
1323 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1326 V_VT(&v
) = VT_EMPTY
;
1327 hres
= IHTMLStyle_get_width(style
, &v
);
1328 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1329 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1330 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1334 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1335 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1336 ok(!l
, "pixelWidth = %d\n", l
);
1340 hres
= IHTMLStyle_put_width(style
, v
);
1341 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1343 hres
= IHTMLStyle_get_width(style
, &v
);
1344 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1345 test_var_bstr(&v
, compat_mode
< COMPAT_IE9
? "100px" : "auto");
1349 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1350 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1351 ok(l
== (compat_mode
< COMPAT_IE9
? 100 : 0), "pixelWidth = %d\n", l
);
1353 V_VT(&v
) = VT_EMPTY
;
1354 hres
= IHTMLStyle_get_width(style
, &v
);
1355 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1356 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1357 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "100px" : "auto"), "V_BSTR(v)=%s\n",
1358 wine_dbgstr_w(V_BSTR(&v
)));
1361 hres
= IHTMLStyle_put_pixelWidth(style
, 50);
1362 ok(hres
== S_OK
, "put_pixelWidth failed: %08x\n", hres
);
1365 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1366 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1367 ok(l
== 50, "pixelWidth = %d\n", l
);
1369 hres
= IHTMLStyle_get_pixelWidth(style
, NULL
);
1370 ok(hres
== E_POINTER
, "get_pixelWidth failed: %08x\n", hres
);
1372 V_VT(&v
) = VT_EMPTY
;
1373 hres
= IHTMLStyle_get_width(style
, &v
);
1374 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1375 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1376 ok(!strcmp_wa(V_BSTR(&v
), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1380 str
= (void*)0xdeadbeef;
1381 hres
= IHTMLStyle_get_margin(style
, &str
);
1382 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1383 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
1386 hres
= IHTMLStyle_put_margin(style
, str
);
1387 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1390 hres
= IHTMLStyle_get_margin(style
, &str
);
1391 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1392 if(compat_mode
< COMPAT_IE9
)
1393 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
1395 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
1398 str
= a2bstr("2px");
1399 hres
= IHTMLStyle_put_margin(style
, str
);
1400 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1403 hres
= IHTMLStyle_get_margin(style
, &str
);
1404 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1405 ok(!strcmp_wa(str
, "2px"), "margin = %s\n", wine_dbgstr_w(str
));
1408 hres
= IHTMLStyle_put_margin(style
, NULL
);
1409 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1411 str
= (void*)0xdeadbeef;
1412 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1413 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1414 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1415 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1418 V_BSTR(&v
) = a2bstr("6px");
1419 hres
= IHTMLStyle_put_marginTop(style
, v
);
1420 SysFreeString(V_BSTR(&v
));
1421 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1423 str
= (void*)0xdeadbeef;
1424 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1425 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1426 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1427 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1432 hres
= IHTMLStyle_put_marginTop(style
, v
);
1433 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1435 str
= (void*)0xdeadbeef;
1436 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1437 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1438 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1439 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "5px" : "6px"),
1440 "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1444 hres
= IHTMLStyle_get_border(style
, &str
);
1445 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
1446 ok(!str
|| !*str
, "str is not empty\n");
1449 str
= a2bstr("1px");
1450 hres
= IHTMLStyle_put_border(style
, str
);
1451 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
1454 V_VT(&v
) = VT_EMPTY
;
1455 hres
= IHTMLStyle_get_left(style
, &v
);
1456 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1457 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1458 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1462 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1463 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1464 ok(!l
, "pixelLeft = %d\n", l
);
1467 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
1468 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
1471 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1472 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1473 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1475 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
1476 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
1478 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1479 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1481 f
== 4.9f
, /* IE8 */
1482 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1484 /* Ensure left is updated correctly. */
1485 V_VT(&v
) = VT_EMPTY
;
1486 hres
= IHTMLStyle_get_left(style
, &v
);
1487 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1488 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1489 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
1490 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
1491 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1496 V_BSTR(&v
) = a2bstr("3px");
1497 hres
= IHTMLStyle_put_left(style
, v
);
1498 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1501 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1502 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1503 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1506 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1507 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1508 ok(l
== 3, "pixelLeft = %d\n", l
);
1510 V_VT(&v
) = VT_EMPTY
;
1511 hres
= IHTMLStyle_get_left(style
, &v
);
1512 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1513 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1514 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1518 V_BSTR(&v
) = a2bstr("4.99");
1519 hres
= IHTMLStyle_put_left(style
, v
);
1520 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1524 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1525 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1526 ok(l
== (compat_mode
< COMPAT_IE9
? 4 : 3), "pixelLeft = %d\n", l
);
1529 hres
= IHTMLStyle_put_left(style
, v
);
1530 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1532 V_VT(&v
) = VT_EMPTY
;
1533 hres
= IHTMLStyle_get_left(style
, &v
);
1534 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1535 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1536 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1539 V_VT(&v
) = VT_EMPTY
;
1540 hres
= IHTMLStyle_get_top(style
, &v
);
1541 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1542 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1543 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1547 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1548 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1549 ok(!l
, "pixelLeft = %d\n", l
);
1551 hres
= IHTMLStyle_put_pixelLeft(style
, 6);
1552 ok(hres
== S_OK
, "put_pixelLeft failed: %08x\n", hres
);
1555 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1556 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1557 ok(l
== 6, "pixelLeft = %d\n", l
);
1559 hres
= IHTMLStyle_get_pixelLeft(style
, NULL
);
1560 ok(hres
== E_POINTER
, "get_pixelLeft failed: %08x\n", hres
);
1562 V_VT(&v
) = VT_EMPTY
;
1563 hres
= IHTMLStyle_get_left(style
, &v
);
1564 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1565 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1566 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1570 hres
= IHTMLStyle_get_posTop(style
, NULL
);
1571 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
1574 hres
= IHTMLStyle_get_posTop(style
, &f
);
1575 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1576 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1578 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
1579 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
1581 hres
= IHTMLStyle_get_posTop(style
, &f
);
1582 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1584 f
== 4.9f
, /* IE8 */
1585 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1587 hres
= IHTMLStyle_put_pixelTop(style
, 6);
1588 ok(hres
== S_OK
, "put_pixelTop failed: %08x\n", hres
);
1591 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1592 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1593 ok(l
== 6, "pixelTop = %d\n", l
);
1595 hres
= IHTMLStyle_get_pixelTop(style
, NULL
);
1596 ok(hres
== E_POINTER
, "get_pixelTop failed: %08x\n", hres
);
1599 V_BSTR(&v
) = a2bstr("3px");
1600 hres
= IHTMLStyle_put_top(style
, v
);
1601 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1604 V_VT(&v
) = VT_EMPTY
;
1605 hres
= IHTMLStyle_get_top(style
, &v
);
1606 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1607 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1608 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1611 hres
= IHTMLStyle_get_posTop(style
, &f
);
1612 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1613 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1616 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1617 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1618 ok(l
== 3, "pixelTop = %d\n", l
);
1621 V_BSTR(&v
) = a2bstr("100%");
1622 hres
= IHTMLStyle_put_top(style
, v
);
1623 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1627 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1628 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1629 ok(!l
, "pixelTop = %d\n", l
);
1632 hres
= IHTMLStyle_put_top(style
, v
);
1633 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1635 V_VT(&v
) = VT_EMPTY
;
1636 hres
= IHTMLStyle_get_top(style
, &v
);
1637 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1638 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1639 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1643 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1644 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1645 ok(!l
, "pixelTop = %d\n", l
);
1647 /* Test posHeight */
1648 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1649 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1651 V_VT(&v
) = VT_EMPTY
;
1652 hres
= IHTMLStyle_get_height(style
, &v
);
1653 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1654 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1655 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1659 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1660 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1661 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1664 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1665 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1666 ok(!l
, "pixelHeight = %d\n", l
);
1668 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1669 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1671 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1672 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1674 f
== 4.9f
, /* IE8 */
1675 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1678 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1679 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1682 "pixelHeight = %d\n", l
);
1685 V_BSTR(&v
) = a2bstr("70px");
1686 hres
= IHTMLStyle_put_height(style
, v
);
1687 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1690 V_VT(&v
) = VT_EMPTY
;
1691 hres
= IHTMLStyle_get_height(style
, &v
);
1692 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1693 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1694 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1698 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1699 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1700 ok(l
== 70, "pixelHeight = %d\n", l
);
1703 V_BSTR(&v
) = a2bstr("50%");
1704 hres
= IHTMLStyle_put_height(style
, v
);
1705 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1709 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1710 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1711 ok(!l
, "pixelHeight = %d\n", l
);
1715 hres
= IHTMLStyle_put_height(style
, v
);
1716 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1719 V_VT(&v
) = VT_EMPTY
;
1720 hres
= IHTMLStyle_get_height(style
, &v
);
1721 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1722 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1723 ok(!V_BSTR(&v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v
)));
1727 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1728 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1729 ok(!l
, "pixelHeight = %d\n", l
);
1731 hres
= IHTMLStyle_put_pixelHeight(style
, 50);
1732 ok(hres
== S_OK
, "put_pixelHeight failed: %08x\n", hres
);
1735 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1736 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1737 ok(l
== 50, "pixelHeight = %d\n", l
);
1739 hres
= IHTMLStyle_get_pixelHeight(style
, NULL
);
1740 ok(hres
== E_POINTER
, "get_pixelHeight failed: %08x\n", hres
);
1744 hres
= IHTMLStyle_put_height(style
, v
);
1745 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1747 V_VT(&v
) = VT_EMPTY
;
1748 hres
= IHTMLStyle_get_height(style
, &v
);
1749 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1750 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1751 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "64px" : "50px"),
1752 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1755 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1756 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1757 ok(f
== (compat_mode
< COMPAT_IE9
? 64.0 : 50), "expected 64.0 got %f\n", f
);
1760 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1761 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1762 ok(l
== (compat_mode
< COMPAT_IE9
? 64 : 50), "pixelHeight = %d\n", l
);
1764 str
= (void*)0xdeadbeef;
1765 hres
= IHTMLStyle_get_cursor(style
, &str
);
1766 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1767 ok(!str
, "get_cursor != NULL\n");
1770 str
= a2bstr("default");
1771 hres
= IHTMLStyle_put_cursor(style
, str
);
1772 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1776 hres
= IHTMLStyle_get_cursor(style
, &str
);
1777 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1778 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1781 V_VT(&v
) = VT_EMPTY
;
1782 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1783 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1784 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1785 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1789 V_BSTR(&v
) = a2bstr("middle");
1790 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1791 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1794 V_VT(&v
) = VT_EMPTY
;
1795 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1796 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1797 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1798 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1803 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1804 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1807 V_VT(&v
) = VT_EMPTY
;
1808 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1809 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1810 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1811 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "100px" : "middle"),
1812 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1815 str
= (void*)0xdeadbeef;
1816 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1817 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1818 ok(!str
, "textAlign != NULL\n");
1820 str
= a2bstr("center");
1821 hres
= IHTMLStyle_put_textAlign(style
, str
);
1822 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1826 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1827 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1828 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1832 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1833 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1834 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1835 ok(!V_BSTR(&v
), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1839 hres
= IHTMLStyle_put_textIndent(style
, v
);
1840 ok(hres
== S_OK
, "put_textIndent failed: %08x\n", hres
);
1843 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1844 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1845 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1846 if(compat_mode
< COMPAT_IE9
)
1847 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1849 ok(!V_BSTR(&v
), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1851 str
= (void*)0xdeadbeef;
1852 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1853 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1854 ok(!str
, "textTransform != NULL\n");
1856 str
= a2bstr("lowercase");
1857 hres
= IHTMLStyle_put_textTransform(style
, str
);
1858 ok(hres
== S_OK
, "put_textTransform failed: %08x\n", hres
);
1862 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1863 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1864 ok(!strcmp_wa(str
, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1867 str
= (void*)0xdeadbeef;
1868 hres
= IHTMLStyle_get_filter(style
, &str
);
1869 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1870 ok(!str
, "filter != NULL\n");
1872 str
= a2bstr("alpha(opacity=100)");
1873 hres
= IHTMLStyle_put_filter(style
, str
);
1874 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1877 hres
= IHTMLStyle_put_filter(style
, NULL
);
1878 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1880 str
= (void*)0xdeadbeef;
1881 hres
= IHTMLStyle_get_filter(style
, &str
);
1882 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1883 ok(!str
, "filter != NULL\n");
1885 V_VT(&v
) = VT_EMPTY
;
1886 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1887 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1888 if(compat_mode
< COMPAT_IE9
) {
1889 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1890 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1892 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1893 ok(!V_BSTR(&v
), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1898 hres
= IHTMLCSSStyleDeclaration_get_zIndex(css_style
, &v
);
1899 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1900 if(compat_mode
< COMPAT_IE9
) {
1901 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1902 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1904 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1905 ok(!V_BSTR(&v
), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1910 V_BSTR(&v
) = a2bstr("1");
1911 hres
= IHTMLStyle_put_zIndex(style
, v
);
1912 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1915 V_VT(&v
) = VT_EMPTY
;
1916 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1917 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1918 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1919 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1923 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1924 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1926 str
= a2bstr("test");
1927 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1928 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
1929 "put_fontStyle failed: %08x\n", hres
);
1932 str
= a2bstr("italic");
1933 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1934 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1937 str
= a2bstr("oblique");
1938 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1939 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1942 str
= a2bstr("normal");
1943 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1944 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1947 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1948 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1949 SysFreeString(sDefault
);
1952 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1953 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1955 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1956 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1958 str
= a2bstr("test");
1959 hres
= IHTMLStyle_put_overflow(style
, str
);
1960 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
1961 "put_overflow failed: %08x\n", hres
);
1964 str
= a2bstr("visible");
1965 hres
= IHTMLStyle_put_overflow(style
, str
);
1966 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1969 str
= a2bstr("scroll");
1970 hres
= IHTMLStyle_put_overflow(style
, str
);
1971 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1974 str
= a2bstr("hidden");
1975 hres
= IHTMLStyle_put_overflow(style
, str
);
1976 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1979 str
= a2bstr("auto");
1980 hres
= IHTMLStyle_put_overflow(style
, str
);
1981 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1984 hres
= IHTMLStyle_get_overflow(style
, &str
);
1985 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1986 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1990 hres
= IHTMLStyle_put_overflow(style
, str
);
1991 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1994 hres
= IHTMLStyle_get_overflow(style
, &str
);
1995 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1996 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1999 /* restore overflow default */
2000 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
2001 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
2002 SysFreeString(sOverflowDefault
);
2004 /* Attribute Tests*/
2005 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
2006 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
2008 str
= a2bstr("position");
2009 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
2010 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
2012 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
2013 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
2014 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
2017 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
2018 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
2021 V_BSTR(&v
) = a2bstr("absolute");
2022 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
2023 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
2026 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
2027 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
2028 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
2029 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2034 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
2035 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
2040 str
= a2bstr("borderLeftStyle");
2041 test_border_styles(style
, str
);
2044 str
= a2bstr("borderbottomstyle");
2045 test_border_styles(style
, str
);
2048 str
= a2bstr("borderrightstyle");
2049 test_border_styles(style
, str
);
2052 str
= a2bstr("bordertopstyle");
2053 test_border_styles(style
, str
);
2056 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
2057 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2059 str
= a2bstr("none dotted dashed solid");
2060 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2061 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
2064 str
= a2bstr("none dotted dashed solid");
2065 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
2066 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2067 ok(!strcmp_wa(str
, "none dotted dashed solid"),
2068 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
2071 str
= a2bstr("double groove ridge inset");
2072 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2073 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
2076 str
= a2bstr("window-inset outset ridge inset");
2077 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2078 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
2081 str
= a2bstr("window-inset");
2082 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2083 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
2086 str
= a2bstr("none none none none none");
2087 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2088 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
2091 str
= a2bstr("invalid none none none");
2092 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2093 todo_wine_if(compat_mode
>= COMPAT_IE9
)
2094 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
2095 "put_borderStyle failed: %08x\n", hres
);
2098 str
= a2bstr("none invalid none none");
2099 hres
= IHTMLStyle_put_borderStyle(style
, str
);
2100 todo_wine_if(compat_mode
>= COMPAT_IE9
)
2101 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
2102 "put_borderStyle failed: %08x\n", hres
);
2105 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
2106 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
2107 SysFreeString(sDefault
);
2109 /* backgroundColor */
2110 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
2111 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
2112 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
2113 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2117 V_BSTR(&v
) = a2bstr("red");
2118 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
2119 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
2122 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
2123 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
2124 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
2125 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2128 str
= a2bstr("fixed");
2129 hres
= IHTMLStyle_put_backgroundAttachment(style
, str
);
2130 ok(hres
== S_OK
, "put_backgroundAttachment failed: %08x\n", hres
);
2133 hres
= IHTMLStyle_get_backgroundAttachment(style
, &str
);
2134 ok(hres
== S_OK
, "get_backgroundAttachment failed: %08x\n", hres
);
2135 ok(!strcmp_wa(str
, "fixed"), "ret = %s\n", wine_dbgstr_w(str
));
2139 hres
= IHTMLStyle_get_padding(style
, &str
);
2140 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2141 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
2144 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
2145 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
2146 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2147 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2151 hres
= IHTMLStyle_put_paddingTop(style
, v
);
2152 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
2154 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
2155 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
2156 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2157 if(compat_mode
< COMPAT_IE9
)
2158 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2160 ok(!V_BSTR(&v
), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2163 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
2164 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
2165 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2166 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2170 hres
= IHTMLStyle_put_paddingRight(style
, v
);
2171 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
2173 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
2174 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
2175 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2176 if(compat_mode
< COMPAT_IE9
)
2177 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2179 ok(!V_BSTR(&v
), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2182 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
2183 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
2184 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2185 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2189 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
2190 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
2192 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
2193 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
2194 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2195 if(compat_mode
< COMPAT_IE9
)
2196 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2198 ok(!V_BSTR(&v
), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2202 hres
= IHTMLStyle_put_padding(style
, str
);
2203 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
2206 hres
= IHTMLStyle_get_padding(style
, &str
);
2207 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2208 if(compat_mode
< COMPAT_IE9
)
2209 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
2211 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
2215 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
2216 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
2217 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
2218 if(compat_mode
< COMPAT_IE9
)
2219 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "paddingLeft = %s\n",
2220 wine_dbgstr_w(V_BSTR(&vDefault
)));
2222 ok(!V_BSTR(&vDefault
), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
2225 V_BSTR(&v
) = a2bstr("10");
2226 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
2227 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
2230 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
2231 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
2232 if(compat_mode
< COMPAT_IE9
)
2233 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2235 ok(!V_BSTR(&v
), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2238 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
2239 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
2241 /* BackgroundRepeat */
2242 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
2243 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2245 str
= a2bstr("invalid");
2246 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
2247 ok(hres
== (compat_mode
< COMPAT_IE9
? E_INVALIDARG
: S_OK
),
2248 "put_backgroundRepeat failed: %08x\n", hres
);
2251 str
= a2bstr("repeat");
2252 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
2253 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
2256 str
= a2bstr("no-repeat");
2257 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
2258 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
2261 str
= a2bstr("repeat-x");
2262 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
2263 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
2266 str
= a2bstr("repeat-y");
2267 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
2268 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
2271 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
2272 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2273 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
2276 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
2277 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
2278 SysFreeString(sDefault
);
2281 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
2282 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2284 str
= a2bstr("red green red blue");
2285 hres
= IHTMLStyle_put_borderColor(style
, str
);
2286 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
2289 hres
= IHTMLStyle_get_borderColor(style
, &str
);
2290 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2291 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
2294 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
2295 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
2296 SysFreeString(sDefault
);
2299 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
2300 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
2302 str
= a2bstr("thick dotted red");
2303 hres
= IHTMLStyle_put_borderRight(style
, str
);
2304 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
2307 /* IHTMLStyle_get_borderRight appears to have a bug where
2308 it returns the first letter of the color. So we check
2309 each style individually.
2312 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
2313 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2314 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2318 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
2319 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2320 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2323 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
2324 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2325 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2328 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
2329 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
2330 SysFreeString(sDefault
);
2333 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
2334 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
2336 str
= a2bstr("thick dotted red");
2337 hres
= IHTMLStyle_put_borderTop(style
, str
);
2338 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
2341 /* IHTMLStyle_get_borderTop appears to have a bug where
2342 it returns the first letter of the color. So we check
2343 each style individually.
2346 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2347 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2348 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2352 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
2353 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2354 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2357 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
2358 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2359 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2362 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
2363 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
2364 SysFreeString(sDefault
);
2367 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
2368 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
2370 str
= a2bstr("thick dotted red");
2371 hres
= IHTMLStyle_put_borderBottom(style
, str
);
2372 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
2375 /* IHTMLStyle_get_borderBottom appears to have a bug where
2376 it returns the first letter of the color. So we check
2377 each style individually.
2380 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2381 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2382 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2386 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2387 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2388 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2391 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
2392 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2393 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2396 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
2397 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
2398 SysFreeString(sDefault
);
2401 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
2402 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
2404 str
= a2bstr("thick dotted red");
2405 hres
= IHTMLStyle_put_borderLeft(style
, str
);
2406 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
2409 /* IHTMLStyle_get_borderLeft appears to have a bug where
2410 it returns the first letter of the color. So we check
2411 each style individually.
2414 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2415 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2416 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2420 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2421 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2422 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2425 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
2426 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2427 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2430 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
2431 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
2432 SysFreeString(sDefault
);
2434 /* backgroundPositionX */
2435 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2436 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2437 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2438 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2443 V_BSTR(&v
) = a2bstr("11px");
2444 hres
= IHTMLCSSStyleDeclaration_put_backgroundPositionX(css_style
, v
);
2445 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
2448 hres
= IHTMLCSSStyleDeclaration_get_backgroundPositionX(css_style
, &v
);
2449 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2450 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2451 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2456 V_BSTR(&v
) = a2bstr("10px");
2457 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
2458 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
2461 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2462 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2463 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2464 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2467 /* backgroundPositionY */
2468 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2469 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2470 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2474 V_BSTR(&v
) = a2bstr("15px");
2475 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
2476 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
2479 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2480 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2481 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2482 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2485 /* backgroundPosition */
2487 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2488 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2489 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2492 str
= a2bstr("center 20%");
2493 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
2494 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
2498 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2499 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2500 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2503 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2504 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2505 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2506 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2509 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2510 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2511 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2512 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2516 str
= a2bstr("left 21%");
2517 hres
= IHTMLCSSStyleDeclaration_put_backgroundPosition(css_style
, str
);
2518 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
2522 hres
= IHTMLCSSStyleDeclaration_get_backgroundPosition(css_style
, &str
);
2523 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2524 ok(!strcmp_wa(str
, "left 21%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2528 /* borderTopWidth */
2529 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
2530 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2533 V_BSTR(&v
) = a2bstr("10px");
2534 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
2535 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2538 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
2539 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2540 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2543 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
2544 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2545 VariantClear(&vDefault
);
2547 /* borderRightWidth */
2548 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
2549 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2552 V_BSTR(&v
) = a2bstr("10");
2553 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
2554 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2557 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
2558 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2559 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "10px" : "1px"),
2560 "borderRightWidth = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2563 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
2564 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2565 VariantClear(&vDefault
);
2567 /* borderBottomWidth */
2568 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
2569 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2572 V_BSTR(&v
) = a2bstr("10");
2573 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
2574 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2577 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2578 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2579 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "10px" : "1px"),
2580 "borderBottomWidth = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2583 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
2584 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2585 VariantClear(&vDefault
);
2587 /* borderLeftWidth */
2588 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
2589 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2592 V_BSTR(&v
) = a2bstr("10");
2593 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
2594 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2597 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2598 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2599 ok(!strcmp_wa(V_BSTR(&v
), compat_mode
< COMPAT_IE9
? "10px" : "1px"),
2600 "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2603 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
2604 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2605 VariantClear(&vDefault
);
2608 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
2609 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2612 V_BSTR(&v
) = a2bstr("10");
2613 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
2614 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2617 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
2618 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2619 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2620 if(compat_mode
< COMPAT_IE9
)
2621 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2623 ok(!V_BSTR(&v
), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2626 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
2627 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2628 VariantClear(&vDefault
);
2631 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
2632 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2635 V_BSTR(&v
) = a2bstr("11");
2636 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
2637 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2640 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
2641 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2642 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2643 if(compat_mode
< COMPAT_IE9
)
2644 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2646 ok(!V_BSTR(&v
), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2649 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
2650 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2651 VariantClear(&vDefault
);
2653 /* borderTopColor */
2654 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
2655 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2658 V_BSTR(&v
) = a2bstr("red");
2659 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
2660 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2663 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2664 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2665 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2668 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
2669 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2671 /* borderRightColor */
2672 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
2673 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2676 V_BSTR(&v
) = a2bstr("blue");
2677 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
2678 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
2681 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
2682 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2683 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2686 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
2687 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
2689 /* borderBottomColor */
2690 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
2691 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2694 V_BSTR(&v
) = a2bstr("cyan");
2695 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
2696 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2699 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2700 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2701 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2704 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
2705 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2707 /* borderLeftColor */
2708 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
2709 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2712 V_BSTR(&v
) = a2bstr("cyan");
2713 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
2714 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2717 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2718 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2719 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2722 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
2723 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2726 hres
= IHTMLStyle_get_clip(style
, &str
);
2727 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2728 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
2730 str
= a2bstr("rect(0px 1px 500px 505px)");
2731 hres
= IHTMLStyle_put_clip(style
, str
);
2732 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
2735 hres
= IHTMLStyle_get_clip(style
, &str
);
2736 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2737 ok(!strcmp_wa(str
, compat_mode
< COMPAT_IE9
? "rect(0px 1px 500px 505px)" : "rect(0px, 1px, 500px, 505px)"),
2738 "clip = %s\n", wine_dbgstr_w(str
));
2742 hres
= IHTMLStyle_get_clear(style
, &str
);
2743 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2744 ok(!str
, "clear = %s\n", wine_dbgstr_w(str
));
2746 str
= a2bstr("both");
2747 hres
= IHTMLStyle_put_clear(style
, str
);
2748 ok(hres
== S_OK
, "put_clear failed: %08x\n", hres
);
2751 hres
= IHTMLStyle_get_clear(style
, &str
);
2752 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2753 ok(!strcmp_wa(str
, "both"), "clear = %s\n", wine_dbgstr_w(str
));
2756 /* pageBreakAfter */
2757 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2758 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2759 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2762 str
= a2bstr("right");
2763 hres
= IHTMLCSSStyleDeclaration_put_pageBreakAfter(css_style
, str
);
2764 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2767 hres
= IHTMLCSSStyleDeclaration_get_pageBreakAfter(css_style
, &str
);
2768 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2769 ok(!strcmp_wa(str
, "right"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2773 str
= a2bstr("always");
2774 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
2775 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2778 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2779 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2780 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2783 /* pageBreakBefore */
2784 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2785 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2786 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2788 str
= a2bstr("always");
2789 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
2790 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
2793 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2794 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2795 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2798 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
2799 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
2801 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2802 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2803 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2805 str
= (void*)0xdeadbeef;
2806 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2807 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2808 ok(!str
, "whiteSpace = %s\n", wine_dbgstr_w(str
));
2810 str
= a2bstr("nowrap");
2811 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2813 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2816 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2817 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2818 ok(!strcmp_wa(str
, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2821 str
= a2bstr("normal");
2822 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2824 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2827 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2828 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2829 ok(!strcmp_wa(str
, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2833 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2834 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2835 ok(!str
, "listStyleType = %s\n", wine_dbgstr_w(str
));
2837 str
= a2bstr("square");
2838 hres
= IHTMLStyle_put_listStyleType(style
, str
);
2839 ok(hres
== S_OK
, "put_listStyleType failed: %08x\n", hres
);
2843 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2844 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2845 ok(!strcmp_wa(str
, "square"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2847 str
= a2bstr("inside");
2848 hres
= IHTMLStyle_put_listStylePosition(style
, str
);
2849 ok(hres
== S_OK
, "put_listStylePosition failed: %08x\n", hres
);
2852 hres
= IHTMLStyle_get_listStylePosition(style
, &str
);
2853 ok(hres
== S_OK
, "get_listStylePosition failed: %08x\n", hres
);
2854 ok(!strcmp_wa(str
, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2857 str
= a2bstr("decimal-leading-zero none inside");
2858 hres
= IHTMLStyle_put_listStyle(style
, str
);
2859 ok(hres
== S_OK
|| broken(hres
== E_INVALIDARG
), /* win 2000 */
2860 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str
), hres
);
2863 if (hres
!= E_INVALIDARG
) {
2864 hres
= IHTMLStyle_get_listStyle(style
, &str
);
2865 ok(hres
== S_OK
, "get_listStyle failed: %08x\n", hres
);
2866 ok(strstr_wa(str
, "decimal-leading-zero") &&
2867 strstr_wa(str
, "inside") != NULL
,
2868 "listStyle = %s\n", wine_dbgstr_w(str
));
2869 if(compat_mode
< COMPAT_IE9
)
2870 ok(strstr_wa(str
, "none") != NULL
, "listStyle = %s\n", wine_dbgstr_w(str
));
2873 ok(!strstr_wa(str
, "none"), "listStyle = %s\n", wine_dbgstr_w(str
));
2877 win_skip("IHTMLStyle_put_listStyle already failed\n");
2880 str
= (void*)0xdeadbeef;
2881 hres
= IHTMLStyle_get_styleFloat(style
, &str
);
2882 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
2883 ok(!str
, "styleFloat = %s\n", wine_dbgstr_w(str
));
2885 str
= a2bstr("left");
2886 hres
= IHTMLStyle_put_styleFloat(style
, str
);
2887 ok(hres
== S_OK
, "put_styleFloat failed: %08x\n", hres
);
2891 hres
= IHTMLStyle_get_styleFloat(style
, &str
);
2892 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
2893 ok(!strcmp_wa(str
, "left"), "styleFloat = %s\n", wine_dbgstr_w(str
));
2898 hres
= IHTMLCSSStyleDeclaration_get_cssFloat(css_style
, &str
);
2899 ok(hres
== S_OK
, "get_cssFloat failed: %08x\n", hres
);
2900 ok(!strcmp_wa(str
, "left"), "styleFloat = %s\n", wine_dbgstr_w(str
));
2903 str
= a2bstr("right");
2904 hres
= IHTMLCSSStyleDeclaration_put_cssFloat(css_style
, str
);
2905 ok(hres
== S_OK
, "put_styleFloat failed: %08x\n", hres
);
2909 hres
= IHTMLCSSStyleDeclaration_get_cssFloat(css_style
, &str
);
2910 ok(hres
== S_OK
, "get_cssFloat failed: %08x\n", hres
);
2911 ok(!strcmp_wa(str
, "right"), "styleFloat = %s\n", wine_dbgstr_w(str
));
2915 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
2916 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
2917 if(SUCCEEDED(hres
)) {
2918 test_style2(style2
);
2919 IHTMLStyle2_Release(style2
);
2922 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
2923 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
2924 if(SUCCEEDED(hres
)) {
2925 test_style3(style3
, css_style
);
2926 IHTMLStyle3_Release(style3
);
2929 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
2930 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
2931 if(SUCCEEDED(hres
)) {
2932 test_style4(style4
);
2933 IHTMLStyle4_Release(style4
);
2936 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle5
, (void**)&style5
);
2937 if(SUCCEEDED(hres
)) {
2938 test_style5(style5
);
2939 IHTMLStyle5_Release(style5
);
2941 win_skip("IHTMLStyle5 not available\n");
2944 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle6
, (void**)&style6
);
2945 if(SUCCEEDED(hres
)) {
2946 test_style6(style6
);
2947 IHTMLStyle6_Release(style6
);
2949 win_skip("IHTMLStyle6 not available\n");
2952 if(compat_mode
>= COMPAT_IE9
)
2953 test_css_style_declaration(css_style
);
2956 IHTMLCSSStyleDeclaration2_Release(css_style2
);
2958 IHTMLCSSStyleDeclaration_Release(css_style
);
2961 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2962 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
2967 str
= (void*)0xdeadbeef;
2968 hres
= IHTMLStyle_get_filter(style
, &str
);
2969 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2971 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2973 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2978 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2979 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
2984 str
= (void*)0xdeadbeef;
2985 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
2986 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2988 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2990 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2995 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2996 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
2998 BSTR str
= a2bstr(val
);
3001 hres
= IHTMLStyle_put_filter(style
, str
);
3002 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
3005 _test_style_filter(line
, style
, val
);
3008 static void test_style_filters(IHTMLElement
*elem
)
3010 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
3011 IHTMLCurrentStyle2
*current_style2
;
3012 IHTMLCurrentStyle
*current_style
;
3016 hres
= IHTMLElement_get_style(elem
, &style
);
3017 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
3019 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
3020 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
3022 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
3024 test_style_filter(style
, NULL
);
3025 test_current_style_filter(current_style2
, NULL
);
3026 set_style_filter(style
, "alpha(opacity=50.0040)");
3027 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
3028 set_style_filter(style
, "alpha(opacity=100)");
3030 IHTMLStyle_Release(style
);
3032 hres
= IHTMLElement_get_style(elem
, &style
);
3033 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
3035 test_style_filter(style
, "alpha(opacity=100)");
3036 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
3037 set_style_filter(style
, NULL
);
3038 set_style_filter(style
, "alpha(opacity=100)");
3039 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
3040 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
3041 test_style_filter(style
, NULL
);
3044 IHTMLCurrentStyle2_Release(current_style2
);
3045 IHTMLStyle_Release(style
);
3046 IHTMLElement2_Release(elem2
);
3049 static void test_current_style(IHTMLCurrentStyle
*current_style
)
3051 IHTMLCurrentStyle2
*current_style2
;
3052 IHTMLCurrentStyle3
*current_style3
;
3053 IHTMLCurrentStyle4
*current_style4
;
3059 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
3060 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
3061 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
3064 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
3065 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
3066 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
3069 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
3070 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
3073 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
3074 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
3075 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
3078 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
3079 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
3080 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
3083 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
3084 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
3085 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
3088 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
3089 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
3090 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
3093 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
3094 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
3095 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
3098 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
3099 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
3100 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
3103 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
3104 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
3105 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
3108 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
3109 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
3110 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
3113 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
3114 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3115 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
3118 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
3119 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
3120 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
3123 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
3124 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
3125 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
3128 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
3129 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
3132 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
3133 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
3136 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
3137 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
3140 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
3141 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
3144 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
3145 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
3148 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
3149 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
3152 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
3153 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
3156 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
3157 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
3158 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
3159 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
3162 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
3163 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
3164 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3167 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
3168 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
3169 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3172 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
3173 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
3174 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3177 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
3178 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
3179 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3182 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
3183 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
3184 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3187 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
3188 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
3189 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3192 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
3193 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
3194 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
3195 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
3198 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
3199 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
3200 test_var_bstr(&v
, compat_mode
< COMPAT_IE9
? "100px" : "middle");
3203 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
3204 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
3205 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3208 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
3209 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
3210 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3213 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
3214 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
3215 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3219 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
3220 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
3221 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3224 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
3225 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
3226 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3229 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
3230 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
3231 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3234 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
3235 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
3236 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3239 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
3240 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
3241 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3244 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
3245 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
3246 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3249 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
3250 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
3251 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3254 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
3255 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
3256 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3259 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
3260 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
3261 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3264 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
3265 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
3266 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3269 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
3270 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
3271 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3274 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
3275 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
3276 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3279 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
3280 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
3281 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3284 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
3285 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
3286 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3289 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
3290 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
3291 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3294 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
3295 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
3296 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3299 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
3300 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
3301 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3304 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
3305 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
3306 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3309 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
3310 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
3311 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
3314 hres
= IHTMLCurrentStyle_get_textTransform(current_style
, &str
);
3315 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
3318 hres
= IHTMLCurrentStyle_get_styleFloat(current_style
, &str
);
3319 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
3320 ok(!strcmp_wa(str
, "none"), "styleFloat = %s\n", wine_dbgstr_w(str
));
3323 hres
= IHTMLCurrentStyle_get_overflowX(current_style
, &str
);
3324 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
3325 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
3328 hres
= IHTMLCurrentStyle_get_overflowY(current_style
, &str
);
3329 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
3330 ok(!strcmp_wa(str
, "hidden"), "overflowY = %s\n", wine_dbgstr_w(str
));
3333 hres
= IHTMLCurrentStyle_get_direction(current_style
, &str
);
3334 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
3335 ok(!strcmp_wa(str
, "ltr"), "direction = %s\n", wine_dbgstr_w(str
));
3338 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
3341 hres
= IHTMLCurrentStyle2_get_hasLayout(current_style2
, &b
);
3342 ok(hres
== S_OK
, "get_hasLayout failed: %08x\n", hres
);
3343 ok(b
== VARIANT_TRUE
, "hasLayout = %x\n", b
);
3345 IHTMLCurrentStyle2_Release(current_style2
);
3347 hres
= IHTMLCurrentStyle_QueryInterface(current_style
, &IID_IHTMLCurrentStyle3
, (void**)¤t_style3
);
3348 ok(hres
== S_OK
, "Could not get IHTMLCurrentStyle3 iface: %08x\n", hres
);
3350 hres
= IHTMLCurrentStyle3_get_whiteSpace(current_style3
, &str
);
3351 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
3352 ok(!strcmp_wa(str
, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
3355 IHTMLCurrentStyle3_Release(current_style3
);
3357 hres
= IHTMLCurrentStyle_QueryInterface(current_style
, &IID_IHTMLCurrentStyle4
, (void**)¤t_style4
);
3358 ok(hres
== S_OK
|| broken(hres
== E_NOINTERFACE
), "Could not get IHTMLCurrentStyle4 iface: %08x\n", hres
);
3359 if(SUCCEEDED(hres
)) {
3360 hres
= IHTMLCurrentStyle4_get_minWidth(current_style4
, &v
);
3361 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
3362 ok(V_VT(&v
) == VT_BSTR
, "V_VT(minWidth) = %d\n", V_VT(&v
));
3365 IHTMLCurrentStyle4_Release(current_style4
);
3367 win_skip("IHTMLCurrentStyle4 not supported.\n");
3371 static void basic_style_test(IHTMLDocument2
*doc
)
3373 IHTMLCurrentStyle
*cstyle
;
3378 hres
= IHTMLDocument2_get_body(doc
, &elem
);
3379 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
3381 elem_set_innerhtml(elem
, "<div id=\"divid\"></div>");
3383 hres
= IHTMLElement_get_style(elem
, &style
);
3384 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
3386 test_body_style(style
);
3388 cstyle
= get_current_style(elem
);
3389 test_current_style(cstyle
);
3390 IHTMLCurrentStyle_Release(cstyle
);
3391 IHTMLElement_Release(elem
);
3393 elem
= get_element_by_id(doc
, "divid");
3394 test_style_filters(elem
);
3396 test_set_csstext(style
);
3397 IHTMLStyle_Release(style
);
3398 IHTMLElement_Release(elem
);
3401 static const char runtimestyle_test_str
[] =
3402 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
3404 static const char runtimestyle_ie9_test_str
[] =
3408 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
3409 " <style>body {text-decoration: auto}</style>"
3415 static void runtimestyle_test(IHTMLDocument2
*doc
)
3417 IHTMLStyle
*style
, *runtime_style
;
3418 IHTMLElement2
*elem2
;
3423 hres
= IHTMLDocument2_get_body(doc
, &elem
);
3424 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
3426 elem2
= get_elem2_iface((IUnknown
*)elem
);
3428 hres
= IHTMLElement2_get_runtimeStyle(elem2
, &runtime_style
);
3429 ok(hres
== S_OK
, "get_runtimeStyle failed: %08x\n", hres
);
3431 hres
= IHTMLElement_get_style(elem
, &style
);
3432 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
3434 test_text_decoration(style
, NULL
);
3435 test_text_decoration(runtime_style
, NULL
);
3436 set_text_decoration(style
, "underline");
3437 test_text_decoration(style
, "underline");
3439 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
3440 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3441 ok(broken(!str
) || !strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
3444 set_text_decoration(runtime_style
, "blink");
3445 test_text_decoration(runtime_style
, "blink");
3447 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
3448 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
3450 ok(!strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
3453 IHTMLStyle_Release(runtime_style
);
3454 IHTMLStyle_Release(style
);
3455 IHTMLElement2_Release(elem2
);
3456 IHTMLElement_Release(elem
);
3459 static IHTMLDocument2
*notif_doc
;
3460 static BOOL doc_complete
;
3462 static IHTMLDocument2
*create_document(void)
3464 IHTMLDocument2
*doc
;
3465 IHTMLDocument5
*doc5
;
3468 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
3469 &IID_IHTMLDocument2
, (void**)&doc
);
3470 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
3474 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
3476 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3477 IHTMLDocument2_Release(doc
);
3481 IHTMLDocument5_Release(doc5
);
3485 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
3486 REFIID riid
, void**ppv
)
3488 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
3493 ok(0, "unexpected call\n");
3494 return E_NOINTERFACE
;
3497 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
3502 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
3507 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
3509 if(dispID
== DISPID_READYSTATE
){
3513 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
3514 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3516 if(!strcmp_wa(state
, "complete"))
3517 doc_complete
= TRUE
;
3519 SysFreeString(state
);
3525 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
3527 ok(0, "unexpected call\n");
3531 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
3532 PropertyNotifySink_QueryInterface
,
3533 PropertyNotifySink_AddRef
,
3534 PropertyNotifySink_Release
,
3535 PropertyNotifySink_OnChanged
,
3536 PropertyNotifySink_OnRequestEdit
3539 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
3541 static IHTMLDocument2
*create_doc_with_string(const char *str
)
3543 IPersistStreamInit
*init
;
3545 IHTMLDocument2
*doc
;
3550 notif_doc
= doc
= create_document();
3554 doc_complete
= FALSE
;
3556 mem
= GlobalAlloc(0, len
);
3557 memcpy(mem
, str
, len
);
3558 hres
= CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
3559 ok(hres
== S_OK
, "Failed to create a stream, hr %#x.\n", hres
);
3561 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
3562 ok(hres
== S_OK
, "Failed to get IPersistStreamInit, hr %#x.\n", hres
);
3564 IPersistStreamInit_Load(init
, stream
);
3565 IPersistStreamInit_Release(init
);
3566 IStream_Release(stream
);
3571 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
3573 IConnectionPointContainer
*container
;
3574 IConnectionPoint
*cp
;
3578 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
3579 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
3581 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
3582 IConnectionPointContainer_Release(container
);
3583 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
3585 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
3586 IConnectionPoint_Release(cp
);
3587 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3590 typedef void (*style_test_t
)(IHTMLDocument2
*);
3592 static void run_test(const char *str
, style_test_t test
)
3594 IHTMLDocument2
*doc
;
3598 doc
= create_doc_with_string(str
);
3602 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
3604 while(!doc_complete
&& GetMessageW(&msg
, NULL
, 0, 0)) {
3605 TranslateMessage(&msg
);
3606 DispatchMessageW(&msg
);
3611 ref
= IHTMLDocument2_Release(doc
);
3612 ok(!ref
|| broken(ref
== 1), /* Vista */
3616 static BOOL
check_ie(void)
3618 IHTMLDocument2
*doc
;
3619 IHTMLDocument7
*doc7
;
3622 doc
= create_document();
3626 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument7
, (void**)&doc7
);
3627 if(SUCCEEDED(hres
)) {
3629 IHTMLDocument7_Release(doc7
);
3632 trace("is_ie9plus %x\n", is_ie9plus
);
3634 IHTMLDocument2_Release(doc
);
3643 trace("Running tests in quirks mode...\n");
3644 run_test(doc_blank
, basic_style_test
);
3645 run_test(runtimestyle_test_str
, runtimestyle_test
);
3647 trace("Running tests in IE9 mode...\n");
3648 compat_mode
= COMPAT_IE9
;
3649 run_test(doc_blank_ie9
, basic_style_test
);
3650 run_test(runtimestyle_ie9_test_str
, runtimestyle_test
);