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 int strcmp_wa(LPCWSTR strw
, const char *stra
)
36 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
37 return lstrcmpA(stra
, buf
);
40 static BOOL
wstr_contains(const WCHAR
*strw
, const char *stra
)
43 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
44 return strstr(buf
, stra
) != NULL
;
47 static BSTR
a2bstr(const char *str
)
55 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
56 ret
= SysAllocStringLen(NULL
, len
);
57 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
62 static const WCHAR
*strstr_wa(const WCHAR
*str
, const char *suba
)
65 const WCHAR
*ret
= NULL
;
69 const WCHAR
*p1
= str
, *p2
= sub
;
70 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
71 if (!*p2
) {ret
= str
; break;}
78 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
79 static void _test_var_bstr(unsigned line
, const VARIANT
*v
, const char *expect
)
81 ok_(__FILE__
,line
)(V_VT(v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(v
));
83 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(v
), expect
), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), expect
);
85 ok_(__FILE__
,line
)(!V_BSTR(v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v
)));
88 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
89 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
94 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
95 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
99 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
100 static IHTMLCurrentStyle2
*_get_current_style2_iface(unsigned line
, IUnknown
*unk
)
102 IHTMLCurrentStyle2
*current_style2
;
105 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
106 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
107 return current_style2
;
110 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
113 IHTMLDocument3
*doc3
;
114 IHTMLElement
*result
;
115 BSTR idW
= a2bstr(id
);
117 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
118 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
120 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
121 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
122 ok(result
!= NULL
, "result == NULL\n");
125 IHTMLDocument3_Release(doc3
);
129 #define get_current_style(e) _get_current_style(__LINE__,e)
130 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
132 IHTMLCurrentStyle
*cstyle
;
133 IHTMLElement2
*elem2
;
136 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
137 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
140 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
141 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
142 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
144 IHTMLElement2_Release(elem2
);
148 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
149 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
154 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
155 LOCALE_USER_DEFAULT
, &dispid
);
156 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
159 DISPPARAMS params
= {NULL
,NULL
,0,0};
160 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
165 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
166 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
167 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
170 params
.cNamedArgs
= 1;
171 params
.rgdispidNamedArgs
= &dispidNamed
;
172 V_VT(&arg
) = VT_BSTR
;
173 V_BSTR(&arg
) = a2bstr("none");
174 params
.rgvarg
= &arg
;
175 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
176 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
177 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
180 V_VT(&arg
) = VT_BSTR
;
181 V_BSTR(&arg
) = a2bstr("dotted");
182 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
183 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
184 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
187 V_VT(&arg
) = VT_BSTR
;
188 V_BSTR(&arg
) = a2bstr("dashed");
189 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
190 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
191 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
194 V_VT(&arg
) = VT_BSTR
;
195 V_BSTR(&arg
) = a2bstr("solid");
196 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
197 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
198 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
201 V_VT(&arg
) = VT_BSTR
;
202 V_BSTR(&arg
) = a2bstr("double");
203 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
204 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
205 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
208 V_VT(&arg
) = VT_BSTR
;
209 V_BSTR(&arg
) = a2bstr("groove");
210 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
211 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
212 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
215 V_VT(&arg
) = VT_BSTR
;
216 V_BSTR(&arg
) = a2bstr("ridge");
217 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
218 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
219 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
222 V_VT(&arg
) = VT_BSTR
;
223 V_BSTR(&arg
) = a2bstr("inset");
224 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
225 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
226 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
229 V_VT(&arg
) = VT_BSTR
;
230 V_BSTR(&arg
) = a2bstr("outset");
231 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
232 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
233 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
236 V_VT(&arg
) = VT_BSTR
;
237 V_BSTR(&arg
) = a2bstr("invalid");
238 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
239 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
240 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
243 params
.rgvarg
= &vDefault
;
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
, "default. ret: %08x\n", hres
);
247 VariantClear(&vDefault
);
251 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
252 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
254 BSTR text
= (void*)0xdeadbeef;
257 hres
= IHTMLStyle_get_cssText(style
, &text
);
258 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
260 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
262 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
267 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
268 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
274 hres
= IHTMLStyle_put_cssText(style
, tmp
);
275 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
279 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
280 static void _test_style_remove_attribute(unsigned line
, IHTMLStyle
*style
, const char *attr
, VARIANT_BOOL exb
)
282 BSTR str
= a2bstr(attr
);
283 VARIANT_BOOL b
= 100;
286 hres
= IHTMLStyle_removeAttribute(style
, str
, 1, &b
);
288 ok_(__FILE__
,line
)(hres
== S_OK
, "removeAttribute failed: %08x\n", hres
);
289 ok_(__FILE__
,line
)(b
== exb
, "removeAttribute returned %x, expected %x\n", b
, exb
);
292 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
293 static void _set_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *v
)
299 hres
= IHTMLStyle_put_textDecoration(style
, str
);
300 ok_(__FILE__
,line
)(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
304 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
305 static void _test_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *exdec
)
310 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
311 ok_(__FILE__
,line
)(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
313 ok_(__FILE__
,line
)(!strcmp_wa(str
, exdec
), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str
), exdec
);
315 ok_(__FILE__
,line
)(!str
, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str
));
319 static void test_set_csstext(IHTMLStyle
*style
)
324 test_style_set_csstext(style
, "background-color: black;");
326 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
327 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
328 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
329 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
333 static void test_style2(IHTMLStyle2
*style2
)
339 str
= (void*)0xdeadbeef;
340 hres
= IHTMLStyle2_get_position(style2
, &str
);
341 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
342 ok(!str
, "str != NULL\n");
344 str
= a2bstr("absolute");
345 hres
= IHTMLStyle2_put_position(style2
, str
);
346 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
350 hres
= IHTMLStyle2_get_position(style2
, &str
);
351 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
352 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
357 hres
= IHTMLStyle2_get_right(style2
, &v
);
358 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
359 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
360 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
364 V_BSTR(&v
) = a2bstr("3px");
365 hres
= IHTMLStyle2_put_right(style2
, v
);
366 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
370 hres
= IHTMLStyle2_get_right(style2
, &v
);
371 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
372 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
373 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
377 str
= (void*)0xdeadbeef;
378 hres
= IHTMLStyle2_get_direction(style2
, &str
);
379 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
380 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
383 hres
= IHTMLStyle2_put_direction(style2
, str
);
384 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
388 hres
= IHTMLStyle2_get_direction(style2
, &str
);
389 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
390 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
395 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
396 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
397 test_var_bstr(&v
, NULL
);
401 hres
= IHTMLStyle2_put_bottom(style2
, v
);
402 ok(hres
== S_OK
, "put_bottom failed: %08x\n", hres
);
405 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
406 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
407 test_var_bstr(&v
, "4px");
410 str
= (void*)0xdeadbeef;
411 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
412 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
413 ok(!str
, "overflowX = %s\n", wine_dbgstr_w(str
));
415 str
= a2bstr("hidden");
416 hres
= IHTMLStyle2_put_overflowX(style2
, str
);
417 ok(hres
== S_OK
, "put_overflowX failed: %08x\n", hres
);
421 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
422 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
423 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
426 str
= (void*)0xdeadbeef;
427 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
428 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
429 ok(!str
, "overflowY = %s\n", wine_dbgstr_w(str
));
431 str
= a2bstr("hidden");
432 hres
= IHTMLStyle2_put_overflowY(style2
, str
);
433 ok(hres
== S_OK
, "put_overflowY failed: %08x\n", hres
);
437 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
438 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
439 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
442 str
= a2bstr("fixed");
443 hres
= IHTMLStyle2_put_tableLayout(style2
, str
);
444 ok(hres
== S_OK
, "put_tableLayout failed: %08x\n", hres
);
447 str
= (void*)0xdeadbeef;
448 hres
= IHTMLStyle2_get_tableLayout(style2
, &str
);
449 ok(hres
== S_OK
, "get_tableLayout failed: %08x\n", hres
);
450 ok(!strcmp_wa(str
, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str
));
454 static void test_style3(IHTMLStyle3
*style3
)
459 str
= (void*)0xdeadbeef;
460 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
461 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
462 ok(!str
, "str != NULL\n");
464 str
= a2bstr("break-word");
465 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
466 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
470 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
471 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
472 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
476 static void test_style4(IHTMLStyle4
*style4
)
482 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
483 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
486 V_BSTR(&v
) = a2bstr("10px");
487 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
488 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
491 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
492 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
493 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
494 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
497 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
498 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
499 VariantClear(&vdefault
);
502 static void test_style5(IHTMLStyle5
*style5
)
509 hres
= IHTMLStyle5_get_minWidth(style5
, &vdefault
);
510 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
513 V_BSTR(&v
) = a2bstr("12px");
514 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
515 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
518 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
519 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
520 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
521 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
525 V_BSTR(&v
) = a2bstr("10%");
526 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
527 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
530 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
531 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
532 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
533 ok(!strcmp_wa(V_BSTR(&v
), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
537 V_BSTR(&v
) = a2bstr("10");
538 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
539 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
542 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
543 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
544 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
545 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
548 hres
= IHTMLStyle5_put_minWidth(style5
, vdefault
);
549 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
550 VariantClear(&vdefault
);
553 static void test_style6(IHTMLStyle6
*style
)
558 str
= (void*)0xdeadbeef;
559 hres
= IHTMLStyle6_get_outline(style
, &str
);
560 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
561 ok(str
&& !*str
, "outline = %s\n", wine_dbgstr_w(str
));
565 hres
= IHTMLStyle6_put_outline(style
, str
);
566 ok(hres
== S_OK
, "put_outline failed: %08x\n", hres
);
569 str
= (void*)0xdeadbeef;
570 hres
= IHTMLStyle6_get_outline(style
, &str
);
571 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
572 ok(wstr_contains(str
, "1px"), "outline = %s\n", wine_dbgstr_w(str
));
575 str
= (void*)0xdeadbeef;
576 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
577 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
578 ok(!str
, "boxSizing = %s\n", wine_dbgstr_w(str
));
581 str
= a2bstr("border-box");
582 hres
= IHTMLStyle6_put_boxSizing(style
, str
);
583 ok(hres
== S_OK
, "put_boxSizing failed: %08x\n", hres
);
587 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
588 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
589 ok(!strcmp_wa(str
, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str
));
593 static void test_body_style(IHTMLStyle
*style
)
605 BSTR sOverflowDefault
;
610 test_style_csstext(style
, NULL
);
612 hres
= IHTMLStyle_get_position(style
, &str
);
613 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
614 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
617 hres
= IHTMLStyle_get_marginRight(style
, &v
);
618 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
619 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
620 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
624 hres
= IHTMLStyle_put_marginRight(style
, v
);
625 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
628 hres
= IHTMLStyle_get_marginRight(style
, &v
);
629 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
630 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
631 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
634 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
635 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
636 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
637 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
641 hres
= IHTMLStyle_put_marginBottom(style
, v
);
642 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
645 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
646 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
647 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
648 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
651 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
652 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
653 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
654 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
658 hres
= IHTMLStyle_put_marginLeft(style
, v
);
659 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
662 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
663 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
664 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
665 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
667 str
= (void*)0xdeadbeef;
668 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
669 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
670 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
672 str
= (void*)0xdeadbeef;
673 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
674 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
675 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
677 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
678 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
680 str
= a2bstr("test");
681 hres
= IHTMLStyle_put_fontWeight(style
, str
);
682 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
685 str
= a2bstr("bold");
686 hres
= IHTMLStyle_put_fontWeight(style
, str
);
687 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
690 str
= a2bstr("bolder");
691 hres
= IHTMLStyle_put_fontWeight(style
, str
);
692 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
695 str
= a2bstr("lighter");
696 hres
= IHTMLStyle_put_fontWeight(style
, str
);
697 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
701 hres
= IHTMLStyle_put_fontWeight(style
, str
);
702 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
706 hres
= IHTMLStyle_put_fontWeight(style
, str
);
707 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
711 hres
= IHTMLStyle_put_fontWeight(style
, str
);
712 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
716 hres
= IHTMLStyle_put_fontWeight(style
, str
);
717 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
721 hres
= IHTMLStyle_put_fontWeight(style
, str
);
722 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
726 hres
= IHTMLStyle_put_fontWeight(style
, str
);
727 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
731 hres
= IHTMLStyle_put_fontWeight(style
, str
);
732 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
736 hres
= IHTMLStyle_put_fontWeight(style
, str
);
737 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
741 hres
= IHTMLStyle_put_fontWeight(style
, str
);
742 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
745 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
746 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
747 ok(!strcmp_wa(str
, "900"), "str != style900\n");
750 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
751 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
752 SysFreeString(sDefault
);
755 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
756 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
758 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
759 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
761 str
= a2bstr("test");
762 hres
= IHTMLStyle_put_fontVariant(style
, str
);
763 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
766 str
= a2bstr("small-caps");
767 hres
= IHTMLStyle_put_fontVariant(style
, str
);
768 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
771 str
= a2bstr("normal");
772 hres
= IHTMLStyle_put_fontVariant(style
, str
);
773 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
776 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
777 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
778 SysFreeString(sDefault
);
780 str
= (void*)0xdeadbeef;
781 hres
= IHTMLStyle_get_display(style
, &str
);
782 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
783 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
785 str
= (void*)0xdeadbeef;
786 hres
= IHTMLStyle_get_visibility(style
, &str
);
787 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
788 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
791 hres
= IHTMLStyle_get_fontSize(style
, &v
);
792 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
793 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
794 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
798 hres
= IHTMLStyle_put_fontSize(style
, v
);
799 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
802 hres
= IHTMLStyle_get_fontSize(style
, &v
);
803 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
804 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
805 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
808 hres
= IHTMLStyle_get_color(style
, &v
);
809 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
810 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
811 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
815 hres
= IHTMLStyle_put_color(style
, v
);
816 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
819 hres
= IHTMLStyle_get_color(style
, &v
);
820 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
821 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
823 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
827 hres
= IHTMLStyle_put_lineHeight(style
, v
);
828 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
830 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
831 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
832 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
833 ok(!strcmp_wa(V_BSTR(&v
), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
836 V_BSTR(&v
) = a2bstr("300%");
837 hres
= IHTMLStyle_put_lineHeight(style
, v
);
838 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
841 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
842 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
843 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
844 ok(!strcmp_wa(V_BSTR(&v
), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
848 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
849 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
850 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
852 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
853 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
855 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
856 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
857 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
859 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
860 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
863 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
864 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
865 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
867 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
868 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
870 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
871 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
872 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
874 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
875 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
878 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
879 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
880 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
882 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
883 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
885 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
886 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
887 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
889 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
890 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
893 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
894 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
895 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
897 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
898 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
900 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
901 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
902 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
904 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
905 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
908 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
909 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
910 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
912 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
913 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
915 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
916 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
917 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
919 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
920 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
922 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
923 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
925 str
= a2bstr("invalid");
926 hres
= IHTMLStyle_put_textDecoration(style
, str
);
927 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
930 set_text_decoration(style
, "none");
931 test_text_decoration(style
, "none");
932 set_text_decoration(style
, "underline");
933 set_text_decoration(style
, "overline");
934 set_text_decoration(style
, "line-through");
935 set_text_decoration(style
, "blink");
936 set_text_decoration(style
, "overline");
937 set_text_decoration(style
, "blink");
938 test_text_decoration(style
, "blink");
940 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
941 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
942 SysFreeString(sDefault
);
944 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
945 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
947 hres
= IHTMLStyle_get_posWidth(style
, &f
);
948 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
949 ok(f
== 0.0f
, "f = %f\n", f
);
952 hres
= IHTMLStyle_get_width(style
, &v
);
953 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
954 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
955 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
957 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
958 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
960 hres
= IHTMLStyle_get_posWidth(style
, &f
);
961 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
967 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
968 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
969 ok(l
== 2, "pixelWidth = %d\n", l
);
972 V_BSTR(&v
) = a2bstr("auto");
973 hres
= IHTMLStyle_put_width(style
, v
);
974 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
978 hres
= IHTMLStyle_get_width(style
, &v
);
979 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
980 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
981 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
986 hres
= IHTMLStyle_put_width(style
, v
);
987 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
990 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
991 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
992 ok(l
== 100, "pixelWidth = %d\n", l
);
995 hres
= IHTMLStyle_get_width(style
, &v
);
996 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
997 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
998 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1001 hres
= IHTMLStyle_put_pixelWidth(style
, 50);
1002 ok(hres
== S_OK
, "put_pixelWidth failed: %08x\n", hres
);
1005 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1006 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1007 ok(l
== 50, "pixelWidth = %d\n", l
);
1009 hres
= IHTMLStyle_get_pixelWidth(style
, NULL
);
1010 ok(hres
== E_POINTER
, "get_pixelWidth failed: %08x\n", hres
);
1012 V_VT(&v
) = VT_EMPTY
;
1013 hres
= IHTMLStyle_get_width(style
, &v
);
1014 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1015 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1016 ok(!strcmp_wa(V_BSTR(&v
), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1020 str
= (void*)0xdeadbeef;
1021 hres
= IHTMLStyle_get_margin(style
, &str
);
1022 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1023 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
1026 hres
= IHTMLStyle_put_margin(style
, str
);
1027 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1030 hres
= IHTMLStyle_get_margin(style
, &str
);
1031 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1032 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
1035 hres
= IHTMLStyle_put_margin(style
, NULL
);
1036 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1038 str
= (void*)0xdeadbeef;
1039 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1040 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1041 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1042 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1045 V_BSTR(&v
) = a2bstr("6px");
1046 hres
= IHTMLStyle_put_marginTop(style
, v
);
1047 SysFreeString(V_BSTR(&v
));
1048 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1050 str
= (void*)0xdeadbeef;
1051 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1052 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1053 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1054 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1059 hres
= IHTMLStyle_put_marginTop(style
, v
);
1060 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1062 str
= (void*)0xdeadbeef;
1063 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1064 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1065 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1066 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1070 hres
= IHTMLStyle_get_border(style
, &str
);
1071 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
1072 ok(!str
|| !*str
, "str is not empty\n");
1075 str
= a2bstr("1px");
1076 hres
= IHTMLStyle_put_border(style
, str
);
1077 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
1080 V_VT(&v
) = VT_EMPTY
;
1081 hres
= IHTMLStyle_get_left(style
, &v
);
1082 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1083 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1084 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1088 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1089 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1090 ok(!l
, "pixelLeft = %d\n", l
);
1093 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
1094 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
1097 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1098 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1099 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1101 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
1102 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
1104 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1105 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1107 f
== 4.9f
, /* IE8 */
1108 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1110 /* Ensure left is updated correctly. */
1111 V_VT(&v
) = VT_EMPTY
;
1112 hres
= IHTMLStyle_get_left(style
, &v
);
1113 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1114 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1115 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
1116 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
1117 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1122 V_BSTR(&v
) = a2bstr("3px");
1123 hres
= IHTMLStyle_put_left(style
, v
);
1124 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1127 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1128 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1129 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1132 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1133 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1134 ok(l
== 3, "pixelLeft = %d\n", l
);
1136 V_VT(&v
) = VT_EMPTY
;
1137 hres
= IHTMLStyle_get_left(style
, &v
);
1138 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1139 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1140 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1144 V_BSTR(&v
) = a2bstr("4.99");
1145 hres
= IHTMLStyle_put_left(style
, v
);
1146 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1150 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1151 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1152 ok(l
== 4, "pixelLeft = %d\n", l
);
1155 hres
= IHTMLStyle_put_left(style
, v
);
1156 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1158 V_VT(&v
) = VT_EMPTY
;
1159 hres
= IHTMLStyle_get_left(style
, &v
);
1160 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1161 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1162 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1165 V_VT(&v
) = VT_EMPTY
;
1166 hres
= IHTMLStyle_get_top(style
, &v
);
1167 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1168 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1169 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1173 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1174 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1175 ok(!l
, "pixelLeft = %d\n", l
);
1177 hres
= IHTMLStyle_put_pixelLeft(style
, 6);
1178 ok(hres
== S_OK
, "put_pixelLeft failed: %08x\n", hres
);
1181 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1182 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1183 ok(l
== 6, "pixelLeft = %d\n", l
);
1185 hres
= IHTMLStyle_get_pixelLeft(style
, NULL
);
1186 ok(hres
== E_POINTER
, "get_pixelLeft failed: %08x\n", hres
);
1188 V_VT(&v
) = VT_EMPTY
;
1189 hres
= IHTMLStyle_get_left(style
, &v
);
1190 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1191 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1192 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1196 hres
= IHTMLStyle_get_posTop(style
, NULL
);
1197 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
1200 hres
= IHTMLStyle_get_posTop(style
, &f
);
1201 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1202 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1204 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
1205 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
1207 hres
= IHTMLStyle_get_posTop(style
, &f
);
1208 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1210 f
== 4.9f
, /* IE8 */
1211 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1213 hres
= IHTMLStyle_put_pixelTop(style
, 6);
1214 ok(hres
== S_OK
, "put_pixelTop failed: %08x\n", hres
);
1217 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1218 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1219 ok(l
== 6, "pixelTop = %d\n", l
);
1221 hres
= IHTMLStyle_get_pixelTop(style
, NULL
);
1222 ok(hres
== E_POINTER
, "get_pixelTop failed: %08x\n", hres
);
1225 V_BSTR(&v
) = a2bstr("3px");
1226 hres
= IHTMLStyle_put_top(style
, v
);
1227 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1230 V_VT(&v
) = VT_EMPTY
;
1231 hres
= IHTMLStyle_get_top(style
, &v
);
1232 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1233 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1234 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1237 hres
= IHTMLStyle_get_posTop(style
, &f
);
1238 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1239 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1242 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1243 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1244 ok(l
== 3, "pixelTop = %d\n", l
);
1247 hres
= IHTMLStyle_put_top(style
, v
);
1248 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1250 V_VT(&v
) = VT_EMPTY
;
1251 hres
= IHTMLStyle_get_top(style
, &v
);
1252 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1253 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1254 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1258 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1259 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1260 ok(!l
, "pixelTop = %d\n", l
);
1262 /* Test posHeight */
1263 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1264 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1266 V_VT(&v
) = VT_EMPTY
;
1267 hres
= IHTMLStyle_get_height(style
, &v
);
1268 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1269 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1270 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1274 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1275 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1276 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1279 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1280 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1281 ok(!l
, "pixelHeight = %d\n", l
);
1283 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1284 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1286 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1287 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1289 f
== 4.9f
, /* IE8 */
1290 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1293 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1294 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1297 "pixelHeight = %d\n", l
);
1300 V_BSTR(&v
) = a2bstr("70px");
1301 hres
= IHTMLStyle_put_height(style
, v
);
1302 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1305 V_VT(&v
) = VT_EMPTY
;
1306 hres
= IHTMLStyle_get_height(style
, &v
);
1307 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1308 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1309 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1313 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1314 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1315 ok(l
== 70, "pixelHeight = %d\n", l
);
1319 hres
= IHTMLStyle_put_height(style
, v
);
1320 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1323 V_VT(&v
) = VT_EMPTY
;
1324 hres
= IHTMLStyle_get_height(style
, &v
);
1325 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1326 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1327 ok(!V_BSTR(&v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v
)));
1331 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1332 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1333 ok(!l
, "pixelHeight = %d\n", l
);
1335 hres
= IHTMLStyle_put_pixelHeight(style
, 50);
1336 ok(hres
== S_OK
, "put_pixelHeight failed: %08x\n", hres
);
1339 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1340 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1341 ok(l
== 50, "pixelHeight = %d\n", l
);
1343 hres
= IHTMLStyle_get_pixelHeight(style
, NULL
);
1344 ok(hres
== E_POINTER
, "get_pixelHeight failed: %08x\n", hres
);
1348 hres
= IHTMLStyle_put_height(style
, v
);
1349 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1351 V_VT(&v
) = VT_EMPTY
;
1352 hres
= IHTMLStyle_get_height(style
, &v
);
1353 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1354 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1355 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1358 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1359 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1360 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
1363 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1364 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1365 ok(l
== 64, "pixelHeight = %d\n", l
);
1367 str
= (void*)0xdeadbeef;
1368 hres
= IHTMLStyle_get_cursor(style
, &str
);
1369 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1370 ok(!str
, "get_cursor != NULL\n");
1373 str
= a2bstr("default");
1374 hres
= IHTMLStyle_put_cursor(style
, str
);
1375 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1379 hres
= IHTMLStyle_get_cursor(style
, &str
);
1380 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1381 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1384 V_VT(&v
) = VT_EMPTY
;
1385 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1386 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1387 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1388 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1392 V_BSTR(&v
) = a2bstr("middle");
1393 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1394 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1397 V_VT(&v
) = VT_EMPTY
;
1398 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1399 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1400 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1401 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1406 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1407 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1410 V_VT(&v
) = VT_EMPTY
;
1411 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1412 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1413 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1414 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1417 str
= (void*)0xdeadbeef;
1418 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1419 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1420 ok(!str
, "textAlign != NULL\n");
1422 str
= a2bstr("center");
1423 hres
= IHTMLStyle_put_textAlign(style
, str
);
1424 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1428 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1429 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1430 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1434 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1435 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1436 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1437 ok(!V_BSTR(&v
), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1441 hres
= IHTMLStyle_put_textIndent(style
, v
);
1442 ok(hres
== S_OK
, "put_textIndent failed: %08x\n", hres
);
1445 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1446 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1447 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1448 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1450 str
= (void*)0xdeadbeef;
1451 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1452 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1453 ok(!str
, "textTransform != NULL\n");
1455 str
= a2bstr("lowercase");
1456 hres
= IHTMLStyle_put_textTransform(style
, str
);
1457 ok(hres
== S_OK
, "put_textTransform failed: %08x\n", hres
);
1461 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1462 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1463 ok(!strcmp_wa(str
, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1466 str
= (void*)0xdeadbeef;
1467 hres
= IHTMLStyle_get_filter(style
, &str
);
1468 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1469 ok(!str
, "filter != NULL\n");
1471 str
= a2bstr("alpha(opacity=100)");
1472 hres
= IHTMLStyle_put_filter(style
, str
);
1473 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1476 V_VT(&v
) = VT_EMPTY
;
1477 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1478 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1479 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1480 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1484 V_BSTR(&v
) = a2bstr("1");
1485 hres
= IHTMLStyle_put_zIndex(style
, v
);
1486 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1489 V_VT(&v
) = VT_EMPTY
;
1490 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1491 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1492 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1493 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1497 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1498 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1500 str
= a2bstr("test");
1501 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1502 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1505 str
= a2bstr("italic");
1506 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1507 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1510 str
= a2bstr("oblique");
1511 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1512 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1515 str
= a2bstr("normal");
1516 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1517 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1520 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1521 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1522 SysFreeString(sDefault
);
1525 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1526 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1528 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1529 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1531 str
= a2bstr("test");
1532 hres
= IHTMLStyle_put_overflow(style
, str
);
1533 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1536 str
= a2bstr("visible");
1537 hres
= IHTMLStyle_put_overflow(style
, str
);
1538 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1541 str
= a2bstr("scroll");
1542 hres
= IHTMLStyle_put_overflow(style
, str
);
1543 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1546 str
= a2bstr("hidden");
1547 hres
= IHTMLStyle_put_overflow(style
, str
);
1548 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1551 str
= a2bstr("auto");
1552 hres
= IHTMLStyle_put_overflow(style
, str
);
1553 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1556 hres
= IHTMLStyle_get_overflow(style
, &str
);
1557 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1558 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1562 hres
= IHTMLStyle_put_overflow(style
, str
);
1563 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1566 hres
= IHTMLStyle_get_overflow(style
, &str
);
1567 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1568 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1571 /* restore overflow default */
1572 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1573 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1574 SysFreeString(sOverflowDefault
);
1576 /* Attribute Tests*/
1577 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1578 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1580 str
= a2bstr("position");
1581 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1582 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1584 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1585 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1586 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1589 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1590 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1593 V_BSTR(&v
) = a2bstr("absolute");
1594 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1595 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1598 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1599 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1600 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1601 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1606 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1607 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1612 str
= a2bstr("borderLeftStyle");
1613 test_border_styles(style
, str
);
1616 str
= a2bstr("borderbottomstyle");
1617 test_border_styles(style
, str
);
1620 str
= a2bstr("borderrightstyle");
1621 test_border_styles(style
, str
);
1624 str
= a2bstr("bordertopstyle");
1625 test_border_styles(style
, str
);
1628 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1629 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1631 str
= a2bstr("none dotted dashed solid");
1632 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1633 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1636 str
= a2bstr("none dotted dashed solid");
1637 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1638 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1639 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1640 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1643 str
= a2bstr("double groove ridge inset");
1644 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1645 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1648 str
= a2bstr("window-inset outset ridge inset");
1649 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1650 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1653 str
= a2bstr("window-inset");
1654 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1655 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1658 str
= a2bstr("none none none none none");
1659 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1660 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1663 str
= a2bstr("invalid none none none");
1664 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1665 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1668 str
= a2bstr("none invalid none none");
1669 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1670 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1673 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1674 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1675 SysFreeString(sDefault
);
1677 /* backgoundColor */
1678 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1679 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1680 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1681 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1685 V_BSTR(&v
) = a2bstr("red");
1686 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
1687 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
1690 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1691 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1692 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1693 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1696 str
= a2bstr("fixed");
1697 hres
= IHTMLStyle_put_backgroundAttachment(style
, str
);
1698 ok(hres
== S_OK
, "put_backgroundAttachment failed: %08x\n", hres
);
1701 hres
= IHTMLStyle_get_backgroundAttachment(style
, &str
);
1702 ok(hres
== S_OK
, "get_backgroundAttachment failed: %08x\n", hres
);
1703 ok(!strcmp_wa(str
, "fixed"), "ret = %s\n", wine_dbgstr_w(str
));
1707 hres
= IHTMLStyle_get_padding(style
, &str
);
1708 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1709 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1712 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1713 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1714 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1715 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1719 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1720 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1722 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1723 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1724 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1725 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1728 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1729 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1730 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1731 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1735 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1736 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1738 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1739 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1740 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1741 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1744 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1745 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1746 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1747 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1751 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
1752 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1754 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1755 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1756 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1757 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1761 hres
= IHTMLStyle_put_padding(style
, str
);
1762 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1765 hres
= IHTMLStyle_get_padding(style
, &str
);
1766 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1767 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1771 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1772 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1773 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1774 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1777 V_BSTR(&v
) = a2bstr("10");
1778 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1779 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1782 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1783 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1784 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1787 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1788 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1790 /* BackgroundRepeat */
1791 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1792 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1794 str
= a2bstr("invalid");
1795 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1796 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1799 str
= a2bstr("repeat");
1800 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1801 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1804 str
= a2bstr("no-repeat");
1805 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1806 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1809 str
= a2bstr("repeat-x");
1810 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1811 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1814 str
= a2bstr("repeat-y");
1815 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1816 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1819 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1820 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1821 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1824 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1825 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1826 SysFreeString(sDefault
);
1829 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1830 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1832 str
= a2bstr("red green red blue");
1833 hres
= IHTMLStyle_put_borderColor(style
, str
);
1834 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1837 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1838 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1839 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1842 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1843 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1844 SysFreeString(sDefault
);
1847 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1848 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1850 str
= a2bstr("thick dotted red");
1851 hres
= IHTMLStyle_put_borderRight(style
, str
);
1852 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1855 /* IHTMLStyle_get_borderRight appears to have a bug where
1856 it returns the first letter of the color. So we check
1857 each style individually.
1860 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1861 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1862 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1866 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1867 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1868 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1871 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1872 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1873 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1876 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1877 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1878 SysFreeString(sDefault
);
1881 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1882 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1884 str
= a2bstr("thick dotted red");
1885 hres
= IHTMLStyle_put_borderTop(style
, str
);
1886 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1889 /* IHTMLStyle_get_borderTop appears to have a bug where
1890 it returns the first letter of the color. So we check
1891 each style individually.
1894 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1895 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1896 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1900 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1901 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1902 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1905 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1906 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1907 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1910 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1911 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1912 SysFreeString(sDefault
);
1915 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1916 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1918 str
= a2bstr("thick dotted red");
1919 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1920 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1923 /* IHTMLStyle_get_borderBottom appears to have a bug where
1924 it returns the first letter of the color. So we check
1925 each style individually.
1928 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1929 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1930 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1934 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1935 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1936 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1939 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1940 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1941 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1944 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1945 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1946 SysFreeString(sDefault
);
1949 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1950 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1952 str
= a2bstr("thick dotted red");
1953 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1954 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1957 /* IHTMLStyle_get_borderLeft appears to have a bug where
1958 it returns the first letter of the color. So we check
1959 each style individually.
1962 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1963 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1964 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1968 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1969 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1970 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1973 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1974 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1975 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1978 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1979 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1980 SysFreeString(sDefault
);
1982 /* backgroundPositionX */
1983 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1984 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1985 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1986 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1990 V_BSTR(&v
) = a2bstr("10px");
1991 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1992 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1995 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1996 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1997 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1998 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2001 /* backgroundPositionY */
2002 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2003 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2004 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2008 V_BSTR(&v
) = a2bstr("15px");
2009 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
2010 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
2013 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2014 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2015 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2016 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2019 /* backgroundPosition */
2021 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2022 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2023 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2026 str
= a2bstr("center 20%");
2027 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
2028 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
2032 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2033 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2034 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2037 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2038 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2039 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2040 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2043 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2044 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2045 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2046 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2049 /* borderTopWidth */
2050 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
2051 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2054 V_BSTR(&v
) = a2bstr("10px");
2055 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
2056 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2059 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
2060 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2061 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2064 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
2065 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2066 VariantClear(&vDefault
);
2068 /* borderRightWidth */
2069 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
2070 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2073 V_BSTR(&v
) = a2bstr("10");
2074 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
2075 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2078 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
2079 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2080 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2083 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
2084 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2085 VariantClear(&vDefault
);
2087 /* borderBottomWidth */
2088 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
2089 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2092 V_BSTR(&v
) = a2bstr("10");
2093 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
2094 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2097 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2098 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2099 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2102 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
2103 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2104 VariantClear(&vDefault
);
2106 /* borderLeftWidth */
2107 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
2108 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2111 V_BSTR(&v
) = a2bstr("10");
2112 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
2113 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2116 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2117 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2118 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2121 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
2122 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2123 VariantClear(&vDefault
);
2126 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
2127 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2130 V_BSTR(&v
) = a2bstr("10");
2131 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
2132 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2135 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
2136 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2137 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2138 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2141 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
2142 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2143 VariantClear(&vDefault
);
2146 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
2147 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2150 V_BSTR(&v
) = a2bstr("11");
2151 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
2152 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2155 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
2156 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2157 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2158 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2161 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
2162 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2163 VariantClear(&vDefault
);
2165 /* borderTopColor */
2166 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
2167 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2170 V_BSTR(&v
) = a2bstr("red");
2171 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
2172 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2175 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2176 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2177 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2180 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
2181 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2183 /* borderRightColor */
2184 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
2185 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2188 V_BSTR(&v
) = a2bstr("blue");
2189 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
2190 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
2193 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
2194 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2195 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2198 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
2199 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
2201 /* borderBottomColor */
2202 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
2203 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2206 V_BSTR(&v
) = a2bstr("cyan");
2207 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
2208 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2211 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2212 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2213 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2216 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
2217 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2219 /* borderLeftColor */
2220 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
2221 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2224 V_BSTR(&v
) = a2bstr("cyan");
2225 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
2226 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2229 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2230 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2231 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2234 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
2235 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2238 hres
= IHTMLStyle_get_clip(style
, &str
);
2239 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2240 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
2242 str
= a2bstr("rect(0px 1px 500px 505px)");
2243 hres
= IHTMLStyle_put_clip(style
, str
);
2244 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
2247 hres
= IHTMLStyle_get_clip(style
, &str
);
2248 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2249 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
2253 hres
= IHTMLStyle_get_clear(style
, &str
);
2254 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2255 ok(!str
, "clear = %s\n", wine_dbgstr_w(str
));
2257 str
= a2bstr("both");
2258 hres
= IHTMLStyle_put_clear(style
, str
);
2259 ok(hres
== S_OK
, "put_clear failed: %08x\n", hres
);
2262 hres
= IHTMLStyle_get_clear(style
, &str
);
2263 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2264 ok(!strcmp_wa(str
, "both"), "clear = %s\n", wine_dbgstr_w(str
));
2267 /* pageBreakAfter */
2268 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2269 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2270 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2272 str
= a2bstr("always");
2273 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
2274 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2277 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2278 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2279 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2282 /* pageBreakBefore */
2283 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2284 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2285 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2287 str
= a2bstr("always");
2288 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
2289 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
2292 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2293 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2294 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2297 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
2298 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
2300 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2301 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2302 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2304 str
= (void*)0xdeadbeef;
2305 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2306 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2307 ok(!str
, "whiteSpace = %s\n", wine_dbgstr_w(str
));
2309 str
= a2bstr("nowrap");
2310 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2312 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2315 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2316 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2317 ok(!strcmp_wa(str
, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2321 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2322 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2323 ok(!str
, "listStyleType = %s\n", wine_dbgstr_w(str
));
2325 str
= a2bstr("square");
2326 hres
= IHTMLStyle_put_listStyleType(style
, str
);
2327 ok(hres
== S_OK
, "put_listStyleType failed: %08x\n", hres
);
2331 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2332 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2333 ok(!strcmp_wa(str
, "square"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2335 str
= a2bstr("inside");
2336 hres
= IHTMLStyle_put_listStylePosition(style
, str
);
2337 ok(hres
== S_OK
, "put_listStylePosition failed: %08x\n", hres
);
2340 hres
= IHTMLStyle_get_listStylePosition(style
, &str
);
2341 ok(hres
== S_OK
, "get_listStylePosition failed: %08x\n", hres
);
2342 ok(!strcmp_wa(str
, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2345 str
= a2bstr("decimal-leading-zero none inside");
2346 hres
= IHTMLStyle_put_listStyle(style
, str
);
2347 ok(hres
== S_OK
|| broken(hres
== E_INVALIDARG
), /* win 2000 */
2348 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str
), hres
);
2351 if (hres
!= E_INVALIDARG
) {
2352 hres
= IHTMLStyle_get_listStyle(style
, &str
);
2353 ok(hres
== S_OK
, "get_listStyle failed: %08x\n", hres
);
2354 ok(strstr_wa(str
, "decimal-leading-zero") == str
&&
2355 strstr_wa(str
, "none") != NULL
&&
2356 strstr_wa(str
, "inside") != NULL
,
2357 "listStyle = %s\n", wine_dbgstr_w(str
));
2360 win_skip("IHTMLStyle_put_listStyle already failed\n");
2363 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
2364 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
2365 if(SUCCEEDED(hres
)) {
2366 test_style2(style2
);
2367 IHTMLStyle2_Release(style2
);
2370 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
2371 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
2372 if(SUCCEEDED(hres
)) {
2373 test_style3(style3
);
2374 IHTMLStyle3_Release(style3
);
2377 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
2378 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
2379 if(SUCCEEDED(hres
)) {
2380 test_style4(style4
);
2381 IHTMLStyle4_Release(style4
);
2384 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle5
, (void**)&style5
);
2385 if(SUCCEEDED(hres
)) {
2386 test_style5(style5
);
2387 IHTMLStyle5_Release(style5
);
2389 win_skip("IHTMLStyle5 not available\n");
2392 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle6
, (void**)&style6
);
2393 if(SUCCEEDED(hres
)) {
2394 test_style6(style6
);
2395 IHTMLStyle6_Release(style6
);
2397 win_skip("IHTMLStyle6 not available\n");
2401 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2402 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
2407 str
= (void*)0xdeadbeef;
2408 hres
= IHTMLStyle_get_filter(style
, &str
);
2409 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2411 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2413 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2418 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2419 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
2424 str
= (void*)0xdeadbeef;
2425 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
2426 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2428 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2430 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2435 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2436 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
2438 BSTR str
= a2bstr(val
);
2441 hres
= IHTMLStyle_put_filter(style
, str
);
2442 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
2445 _test_style_filter(line
, style
, val
);
2448 static void test_style_filters(IHTMLElement
*elem
)
2450 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
2451 IHTMLCurrentStyle2
*current_style2
;
2452 IHTMLCurrentStyle
*current_style
;
2456 hres
= IHTMLElement_get_style(elem
, &style
);
2457 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2459 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
2460 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2462 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2464 test_style_filter(style
, NULL
);
2465 test_current_style_filter(current_style2
, NULL
);
2466 set_style_filter(style
, "alpha(opacity=50.0040)");
2467 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
2468 set_style_filter(style
, "alpha(opacity=100)");
2470 IHTMLStyle_Release(style
);
2472 hres
= IHTMLElement_get_style(elem
, &style
);
2473 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2475 test_style_filter(style
, "alpha(opacity=100)");
2476 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
2477 set_style_filter(style
, NULL
);
2478 set_style_filter(style
, "alpha(opacity=100)");
2479 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
2480 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
2481 test_style_filter(style
, NULL
);
2484 IHTMLCurrentStyle2_Release(current_style2
);
2485 IHTMLStyle_Release(style
);
2486 IHTMLElement2_Release(elem2
);
2489 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2491 IHTMLCurrentStyle2
*current_style2
;
2497 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2498 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2499 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2502 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2503 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2504 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2507 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2508 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2511 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2512 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2513 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2516 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2517 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2518 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2521 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2522 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2523 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2526 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2527 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2528 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
2531 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
2532 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2533 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
2536 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
2537 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2538 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
2541 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
2542 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2543 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
2546 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
2547 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
2548 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2551 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2552 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2553 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2556 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2557 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2558 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2561 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2562 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2563 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2566 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2567 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2570 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2571 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2574 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2575 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2578 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2579 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2582 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2583 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2586 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2587 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2590 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2591 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2594 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2595 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2596 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2597 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2600 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2601 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2602 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2605 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2606 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2607 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2610 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2611 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2612 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2615 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2616 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2617 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2620 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2621 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2622 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2625 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2626 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2627 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2630 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2631 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2632 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2633 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2636 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2637 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2638 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2639 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2642 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2643 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2644 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2647 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2648 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2649 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2652 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2653 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2654 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2658 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2659 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2660 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2663 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2664 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2665 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2668 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2669 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2670 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2673 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2674 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2675 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2678 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2679 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2680 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2683 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2684 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2685 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2688 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2689 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2690 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2693 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2694 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2695 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2698 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2699 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2700 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2703 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2704 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2705 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2708 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2709 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2710 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2713 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2714 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2715 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2718 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2719 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2720 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2723 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2724 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2725 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2728 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2729 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2730 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2733 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2734 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2735 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2738 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2739 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2740 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2743 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2744 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2745 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2748 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2749 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2750 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2753 hres
= IHTMLCurrentStyle_get_textTransform(current_style
, &str
);
2754 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
2757 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2760 hres
= IHTMLCurrentStyle2_get_hasLayout(current_style2
, &b
);
2761 ok(hres
== S_OK
, "get_hasLayout failed: %08x\n", hres
);
2762 ok(b
== VARIANT_TRUE
, "hasLayout = %x\n", b
);
2764 IHTMLCurrentStyle2_Release(current_style2
);
2767 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2769 static void basic_style_test(IHTMLDocument2
*doc
)
2771 IHTMLCurrentStyle
*cstyle
;
2776 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2777 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2779 hres
= IHTMLElement_get_style(elem
, &style
);
2780 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2782 test_body_style(style
);
2784 cstyle
= get_current_style(elem
);
2785 test_current_style(cstyle
);
2786 IHTMLCurrentStyle_Release(cstyle
);
2787 IHTMLElement_Release(elem
);
2789 elem
= get_element_by_id(doc
, "divid");
2790 test_style_filters(elem
);
2792 test_set_csstext(style
);
2793 IHTMLStyle_Release(style
);
2794 IHTMLElement_Release(elem
);
2797 static const char runtimestyle_test_str
[] =
2798 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2800 static void runtimestyle_test(IHTMLDocument2
*doc
)
2802 IHTMLStyle
*style
, *runtime_style
;
2803 IHTMLElement2
*elem2
;
2808 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2809 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2811 elem2
= get_elem2_iface((IUnknown
*)elem
);
2813 hres
= IHTMLElement2_get_runtimeStyle(elem2
, &runtime_style
);
2814 ok(hres
== S_OK
, "get_runtimeStyle failed: %08x\n", hres
);
2816 hres
= IHTMLElement_get_style(elem
, &style
);
2817 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2819 test_text_decoration(style
, NULL
);
2820 test_text_decoration(runtime_style
, NULL
);
2821 set_text_decoration(style
, "underline");
2822 test_text_decoration(style
, "underline");
2824 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2825 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2826 ok(broken(!str
) || !strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2829 set_text_decoration(runtime_style
, "blink");
2830 test_text_decoration(runtime_style
, "blink");
2832 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2833 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2835 ok(!strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2838 IHTMLStyle_Release(runtime_style
);
2839 IHTMLStyle_Release(style
);
2840 IHTMLElement2_Release(elem2
);
2841 IHTMLElement_Release(elem
);
2844 static IHTMLDocument2
*notif_doc
;
2845 static BOOL doc_complete
;
2847 static IHTMLDocument2
*create_document(void)
2849 IHTMLDocument2
*doc
;
2850 IHTMLDocument5
*doc5
;
2853 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2854 &IID_IHTMLDocument2
, (void**)&doc
);
2855 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2859 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2861 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2862 IHTMLDocument2_Release(doc
);
2866 IHTMLDocument5_Release(doc5
);
2870 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2871 REFIID riid
, void**ppv
)
2873 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2878 ok(0, "unexpected call\n");
2879 return E_NOINTERFACE
;
2882 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2887 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2892 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2894 if(dispID
== DISPID_READYSTATE
){
2898 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2899 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2901 if(!strcmp_wa(state
, "complete"))
2902 doc_complete
= TRUE
;
2904 SysFreeString(state
);
2910 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2912 ok(0, "unexpected call\n");
2916 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2917 PropertyNotifySink_QueryInterface
,
2918 PropertyNotifySink_AddRef
,
2919 PropertyNotifySink_Release
,
2920 PropertyNotifySink_OnChanged
,
2921 PropertyNotifySink_OnRequestEdit
2924 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2926 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2928 IPersistStreamInit
*init
;
2930 IHTMLDocument2
*doc
;
2934 notif_doc
= doc
= create_document();
2938 doc_complete
= FALSE
;
2940 mem
= GlobalAlloc(0, len
);
2941 memcpy(mem
, str
, len
);
2942 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2944 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2946 IPersistStreamInit_Load(init
, stream
);
2947 IPersistStreamInit_Release(init
);
2948 IStream_Release(stream
);
2953 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2955 IConnectionPointContainer
*container
;
2956 IConnectionPoint
*cp
;
2960 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2961 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2963 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2964 IConnectionPointContainer_Release(container
);
2965 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2967 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2968 IConnectionPoint_Release(cp
);
2969 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2972 typedef void (*style_test_t
)(IHTMLDocument2
*);
2974 static void run_test(const char *str
, style_test_t test
)
2976 IHTMLDocument2
*doc
;
2980 doc
= create_doc_with_string(str
);
2984 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2986 while(!doc_complete
&& GetMessageW(&msg
, NULL
, 0, 0)) {
2987 TranslateMessage(&msg
);
2988 DispatchMessageW(&msg
);
2993 ref
= IHTMLDocument2_Release(doc
);
2994 ok(!ref
|| broken(ref
== 1), /* Vista */
3003 run_test(basic_test_str
, basic_style_test
);
3004 run_test(runtimestyle_test_str
, runtimestyle_test
);