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
)
460 str
= (void*)0xdeadbeef;
461 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
462 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
463 ok(!str
, "str != NULL\n");
465 str
= a2bstr("break-word");
466 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
467 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
471 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
472 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
473 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
477 hres
= IHTMLStyle3_get_zoom(style3
, &v
);
478 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
479 ok(V_VT(&v
) == VT_BSTR
, "V_VT(zoom) = %d\n", V_VT(&v
));
480 ok(!V_BSTR(&v
), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
484 V_BSTR(&v
) = a2bstr("100%");
485 hres
= IHTMLStyle3_put_zoom(style3
, v
);
486 ok(hres
== S_OK
, "put_zoom failed: %08x\n", hres
);
489 hres
= IHTMLStyle3_get_zoom(style3
, &v
);
490 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
491 ok(V_VT(&v
) == VT_BSTR
, "V_VT(zoom) = %d\n", V_VT(&v
));
492 ok(!strcmp_wa(V_BSTR(&v
), "100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
497 hres
= IHTMLStyle3_put_zoom(style3
, v
);
498 ok(hres
== S_OK
, "put_zoom failed: %08x\n", hres
);
501 hres
= IHTMLStyle3_get_zoom(style3
, &v
);
502 ok(hres
== S_OK
, "get_zoom failed: %08x\n", hres
);
503 ok(V_VT(&v
) == VT_BSTR
, "V_VT(zoom) = %d\n", V_VT(&v
));
504 ok(!strcmp_wa(V_BSTR(&v
), "1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
508 static void test_style4(IHTMLStyle4
*style4
)
514 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
515 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
518 V_BSTR(&v
) = a2bstr("10px");
519 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
520 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
523 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
524 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
525 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
526 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
529 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
530 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
531 VariantClear(&vdefault
);
534 static void test_style5(IHTMLStyle5
*style5
)
541 hres
= IHTMLStyle5_get_minWidth(style5
, &vdefault
);
542 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
545 V_BSTR(&v
) = a2bstr("12px");
546 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
547 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
550 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
551 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
552 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
553 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
557 V_BSTR(&v
) = a2bstr("10%");
558 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
559 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
562 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
563 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
564 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
565 ok(!strcmp_wa(V_BSTR(&v
), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
569 V_BSTR(&v
) = a2bstr("10");
570 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
571 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
574 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
575 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
576 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
577 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
580 hres
= IHTMLStyle5_put_minWidth(style5
, vdefault
);
581 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
582 VariantClear(&vdefault
);
585 hres
= IHTMLStyle5_get_maxWidth(style5
, &vdefault
);
586 ok(hres
== S_OK
, "get_maxWidth failed: %08x\n", hres
);
589 V_BSTR(&v
) = a2bstr("200px");
590 hres
= IHTMLStyle5_put_maxWidth(style5
, v
);
591 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
594 hres
= IHTMLStyle5_get_maxWidth(style5
, &v
);
595 ok(hres
== S_OK
, "get_maxWidth failed: %08x\n", hres
);
596 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n",V_VT(&v
));
597 ok(!strcmp_wa(V_BSTR(&v
), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
601 V_BSTR(&v
) = a2bstr("70%");
602 hres
= IHTMLStyle5_put_maxWidth(style5
, v
);
603 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
606 hres
= IHTMLStyle5_get_maxWidth(style5
, &v
);
607 ok(hres
== S_OK
, "get maxWidth failed: %08x\n", hres
);
608 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
609 ok(!strcmp_wa(V_BSTR(&v
), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
612 hres
= IHTMLStyle5_put_maxWidth(style5
,vdefault
);
613 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
614 VariantClear(&vdefault
);
617 hres
= IHTMLStyle5_get_maxHeight(style5
, &vdefault
);
618 ok(hres
== S_OK
, "get maxHeight failed: %08x\n", hres
);
621 V_BSTR(&v
) = a2bstr("200px");
622 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
623 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
626 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
627 ok(hres
== S_OK
, "get maxHeight failed: %08x\n", hres
);
628 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
629 ok(!strcmp_wa(V_BSTR(&v
), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
633 V_BSTR(&v
) = a2bstr("70%");
634 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
635 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
638 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
639 ok(hres
== S_OK
, "get_maxHeight failed: %08x\n", hres
);
640 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
641 ok(!strcmp_wa(V_BSTR(&v
), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
645 V_BSTR(&v
) = a2bstr("100");
646 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
647 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
650 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
651 ok(hres
== S_OK
, "get_maxHeight failed: %08x\n", hres
);
652 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
653 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "expect 100 got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
656 hres
= IHTMLStyle5_put_maxHeight(style5
, vdefault
);
657 ok(hres
== S_OK
, "put maxHeight failed:%08x\n", hres
);
658 VariantClear(&vdefault
);
661 static void test_style6(IHTMLStyle6
*style
)
666 str
= (void*)0xdeadbeef;
667 hres
= IHTMLStyle6_get_outline(style
, &str
);
668 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
669 ok(str
&& !*str
, "outline = %s\n", wine_dbgstr_w(str
));
673 hres
= IHTMLStyle6_put_outline(style
, str
);
674 ok(hres
== S_OK
, "put_outline failed: %08x\n", hres
);
677 str
= (void*)0xdeadbeef;
678 hres
= IHTMLStyle6_get_outline(style
, &str
);
679 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
680 ok(wstr_contains(str
, "1px"), "outline = %s\n", wine_dbgstr_w(str
));
683 str
= (void*)0xdeadbeef;
684 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
685 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
686 ok(!str
, "boxSizing = %s\n", wine_dbgstr_w(str
));
689 str
= a2bstr("border-box");
690 hres
= IHTMLStyle6_put_boxSizing(style
, str
);
691 ok(hres
== S_OK
, "put_boxSizing failed: %08x\n", hres
);
695 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
696 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
697 ok(!strcmp_wa(str
, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str
));
701 static void test_body_style(IHTMLStyle
*style
)
713 BSTR sOverflowDefault
;
718 test_style_csstext(style
, NULL
);
720 hres
= IHTMLStyle_get_position(style
, &str
);
721 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
722 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
725 hres
= IHTMLStyle_get_marginRight(style
, &v
);
726 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
727 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
728 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
732 hres
= IHTMLStyle_put_marginRight(style
, v
);
733 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
736 hres
= IHTMLStyle_get_marginRight(style
, &v
);
737 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
738 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
739 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
742 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
743 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
744 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
745 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
749 hres
= IHTMLStyle_put_marginBottom(style
, v
);
750 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
753 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
754 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
755 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
756 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
759 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
760 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
761 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
762 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
766 hres
= IHTMLStyle_put_marginLeft(style
, v
);
767 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
770 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
771 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
772 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
773 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
775 str
= (void*)0xdeadbeef;
776 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
777 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
778 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
780 str
= (void*)0xdeadbeef;
781 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
782 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
783 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
785 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
786 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
788 str
= a2bstr("test");
789 hres
= IHTMLStyle_put_fontWeight(style
, str
);
790 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
793 str
= a2bstr("bold");
794 hres
= IHTMLStyle_put_fontWeight(style
, str
);
795 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
798 str
= a2bstr("bolder");
799 hres
= IHTMLStyle_put_fontWeight(style
, str
);
800 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
803 str
= a2bstr("lighter");
804 hres
= IHTMLStyle_put_fontWeight(style
, str
);
805 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
809 hres
= IHTMLStyle_put_fontWeight(style
, str
);
810 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
814 hres
= IHTMLStyle_put_fontWeight(style
, str
);
815 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
819 hres
= IHTMLStyle_put_fontWeight(style
, str
);
820 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
824 hres
= IHTMLStyle_put_fontWeight(style
, str
);
825 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
829 hres
= IHTMLStyle_put_fontWeight(style
, str
);
830 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
834 hres
= IHTMLStyle_put_fontWeight(style
, str
);
835 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
839 hres
= IHTMLStyle_put_fontWeight(style
, str
);
840 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
844 hres
= IHTMLStyle_put_fontWeight(style
, str
);
845 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
849 hres
= IHTMLStyle_put_fontWeight(style
, str
);
850 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
853 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
854 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
855 ok(!strcmp_wa(str
, "900"), "str != style900\n");
859 hres
= IHTMLStyle_put_fontWeight(style
, str
);
860 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
863 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
864 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
865 ok(!str
, "str != NULL\n");
868 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
869 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
870 SysFreeString(sDefault
);
873 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
874 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
876 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
877 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
879 str
= a2bstr("test");
880 hres
= IHTMLStyle_put_fontVariant(style
, str
);
881 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
884 str
= a2bstr("small-caps");
885 hres
= IHTMLStyle_put_fontVariant(style
, str
);
886 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
889 str
= a2bstr("normal");
890 hres
= IHTMLStyle_put_fontVariant(style
, str
);
891 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
894 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
895 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
896 SysFreeString(sDefault
);
898 str
= (void*)0xdeadbeef;
899 hres
= IHTMLStyle_get_display(style
, &str
);
900 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
901 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
903 str
= (void*)0xdeadbeef;
904 hres
= IHTMLStyle_get_visibility(style
, &str
);
905 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
906 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
909 hres
= IHTMLStyle_get_fontSize(style
, &v
);
910 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
911 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
912 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
916 hres
= IHTMLStyle_put_fontSize(style
, v
);
917 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
920 hres
= IHTMLStyle_get_fontSize(style
, &v
);
921 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
922 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
923 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
926 hres
= IHTMLStyle_get_color(style
, &v
);
927 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
928 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
929 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
933 hres
= IHTMLStyle_put_color(style
, v
);
934 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
937 hres
= IHTMLStyle_get_color(style
, &v
);
938 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
939 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
941 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
945 hres
= IHTMLStyle_put_lineHeight(style
, v
);
946 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
948 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
949 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
950 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
951 ok(!strcmp_wa(V_BSTR(&v
), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
954 V_BSTR(&v
) = a2bstr("300%");
955 hres
= IHTMLStyle_put_lineHeight(style
, v
);
956 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
959 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
960 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
961 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
962 ok(!strcmp_wa(V_BSTR(&v
), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
966 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
967 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
968 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
970 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
971 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
973 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
974 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
975 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
977 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
978 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
981 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
982 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
983 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
985 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
986 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
988 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
989 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
990 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
992 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
993 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
996 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
997 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
998 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
1000 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
1001 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
1003 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
1004 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
1005 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
1007 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
1008 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
1011 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
1012 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
1013 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
1015 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
1016 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
1018 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
1019 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
1020 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
1022 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
1023 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
1026 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
1027 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
1028 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
1030 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
1031 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
1033 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
1034 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
1035 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
1037 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
1038 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
1040 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
1041 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
1043 str
= a2bstr("invalid");
1044 hres
= IHTMLStyle_put_textDecoration(style
, str
);
1045 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
1048 set_text_decoration(style
, "none");
1049 test_text_decoration(style
, "none");
1050 set_text_decoration(style
, "underline");
1051 set_text_decoration(style
, "overline");
1052 set_text_decoration(style
, "line-through");
1053 set_text_decoration(style
, "blink");
1054 set_text_decoration(style
, "overline");
1055 set_text_decoration(style
, "blink");
1056 test_text_decoration(style
, "blink");
1058 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
1059 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
1060 SysFreeString(sDefault
);
1062 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
1063 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
1065 hres
= IHTMLStyle_get_posWidth(style
, &f
);
1066 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
1067 ok(f
== 0.0f
, "f = %f\n", f
);
1069 V_VT(&v
) = VT_EMPTY
;
1070 hres
= IHTMLStyle_get_width(style
, &v
);
1071 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1072 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1073 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
1075 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
1076 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
1078 hres
= IHTMLStyle_get_posWidth(style
, &f
);
1079 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
1081 f
== 2.2f
, /* IE8 */
1085 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1086 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1087 ok(l
== 2, "pixelWidth = %d\n", l
);
1090 V_BSTR(&v
) = a2bstr("auto");
1091 hres
= IHTMLStyle_put_width(style
, v
);
1092 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1095 V_VT(&v
) = VT_EMPTY
;
1096 hres
= IHTMLStyle_get_width(style
, &v
);
1097 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1098 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1099 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1104 hres
= IHTMLStyle_put_width(style
, v
);
1105 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1108 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1109 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1110 ok(l
== 100, "pixelWidth = %d\n", l
);
1112 V_VT(&v
) = VT_EMPTY
;
1113 hres
= IHTMLStyle_get_width(style
, &v
);
1114 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1115 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1116 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1119 hres
= IHTMLStyle_put_pixelWidth(style
, 50);
1120 ok(hres
== S_OK
, "put_pixelWidth failed: %08x\n", hres
);
1123 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1124 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1125 ok(l
== 50, "pixelWidth = %d\n", l
);
1127 hres
= IHTMLStyle_get_pixelWidth(style
, NULL
);
1128 ok(hres
== E_POINTER
, "get_pixelWidth failed: %08x\n", hres
);
1130 V_VT(&v
) = VT_EMPTY
;
1131 hres
= IHTMLStyle_get_width(style
, &v
);
1132 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1133 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1134 ok(!strcmp_wa(V_BSTR(&v
), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1138 str
= (void*)0xdeadbeef;
1139 hres
= IHTMLStyle_get_margin(style
, &str
);
1140 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1141 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
1144 hres
= IHTMLStyle_put_margin(style
, str
);
1145 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1148 hres
= IHTMLStyle_get_margin(style
, &str
);
1149 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1150 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
1153 hres
= IHTMLStyle_put_margin(style
, NULL
);
1154 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1156 str
= (void*)0xdeadbeef;
1157 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1158 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1159 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1160 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1163 V_BSTR(&v
) = a2bstr("6px");
1164 hres
= IHTMLStyle_put_marginTop(style
, v
);
1165 SysFreeString(V_BSTR(&v
));
1166 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1168 str
= (void*)0xdeadbeef;
1169 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1170 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1171 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1172 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1177 hres
= IHTMLStyle_put_marginTop(style
, v
);
1178 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1180 str
= (void*)0xdeadbeef;
1181 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1182 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1183 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1184 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1188 hres
= IHTMLStyle_get_border(style
, &str
);
1189 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
1190 ok(!str
|| !*str
, "str is not empty\n");
1193 str
= a2bstr("1px");
1194 hres
= IHTMLStyle_put_border(style
, str
);
1195 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
1198 V_VT(&v
) = VT_EMPTY
;
1199 hres
= IHTMLStyle_get_left(style
, &v
);
1200 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1201 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1202 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1206 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1207 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1208 ok(!l
, "pixelLeft = %d\n", l
);
1211 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
1212 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
1215 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1216 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1217 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1219 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
1220 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
1222 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1223 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1225 f
== 4.9f
, /* IE8 */
1226 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1228 /* Ensure left is updated correctly. */
1229 V_VT(&v
) = VT_EMPTY
;
1230 hres
= IHTMLStyle_get_left(style
, &v
);
1231 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1232 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1233 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
1234 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
1235 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1240 V_BSTR(&v
) = a2bstr("3px");
1241 hres
= IHTMLStyle_put_left(style
, v
);
1242 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1245 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1246 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1247 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1250 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1251 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1252 ok(l
== 3, "pixelLeft = %d\n", l
);
1254 V_VT(&v
) = VT_EMPTY
;
1255 hres
= IHTMLStyle_get_left(style
, &v
);
1256 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1257 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1258 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1262 V_BSTR(&v
) = a2bstr("4.99");
1263 hres
= IHTMLStyle_put_left(style
, v
);
1264 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1268 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1269 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1270 ok(l
== 4, "pixelLeft = %d\n", l
);
1273 hres
= IHTMLStyle_put_left(style
, v
);
1274 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1276 V_VT(&v
) = VT_EMPTY
;
1277 hres
= IHTMLStyle_get_left(style
, &v
);
1278 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1279 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1280 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1283 V_VT(&v
) = VT_EMPTY
;
1284 hres
= IHTMLStyle_get_top(style
, &v
);
1285 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1286 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1287 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1291 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1292 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1293 ok(!l
, "pixelLeft = %d\n", l
);
1295 hres
= IHTMLStyle_put_pixelLeft(style
, 6);
1296 ok(hres
== S_OK
, "put_pixelLeft failed: %08x\n", hres
);
1299 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1300 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1301 ok(l
== 6, "pixelLeft = %d\n", l
);
1303 hres
= IHTMLStyle_get_pixelLeft(style
, NULL
);
1304 ok(hres
== E_POINTER
, "get_pixelLeft failed: %08x\n", hres
);
1306 V_VT(&v
) = VT_EMPTY
;
1307 hres
= IHTMLStyle_get_left(style
, &v
);
1308 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1309 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1310 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1314 hres
= IHTMLStyle_get_posTop(style
, NULL
);
1315 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
1318 hres
= IHTMLStyle_get_posTop(style
, &f
);
1319 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1320 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1322 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
1323 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
1325 hres
= IHTMLStyle_get_posTop(style
, &f
);
1326 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1328 f
== 4.9f
, /* IE8 */
1329 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1331 hres
= IHTMLStyle_put_pixelTop(style
, 6);
1332 ok(hres
== S_OK
, "put_pixelTop failed: %08x\n", hres
);
1335 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1336 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1337 ok(l
== 6, "pixelTop = %d\n", l
);
1339 hres
= IHTMLStyle_get_pixelTop(style
, NULL
);
1340 ok(hres
== E_POINTER
, "get_pixelTop failed: %08x\n", hres
);
1343 V_BSTR(&v
) = a2bstr("3px");
1344 hres
= IHTMLStyle_put_top(style
, v
);
1345 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1348 V_VT(&v
) = VT_EMPTY
;
1349 hres
= IHTMLStyle_get_top(style
, &v
);
1350 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1351 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1352 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1355 hres
= IHTMLStyle_get_posTop(style
, &f
);
1356 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1357 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1360 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1361 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1362 ok(l
== 3, "pixelTop = %d\n", l
);
1365 hres
= IHTMLStyle_put_top(style
, v
);
1366 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1368 V_VT(&v
) = VT_EMPTY
;
1369 hres
= IHTMLStyle_get_top(style
, &v
);
1370 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1371 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1372 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1376 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1377 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1378 ok(!l
, "pixelTop = %d\n", l
);
1380 /* Test posHeight */
1381 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1382 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1384 V_VT(&v
) = VT_EMPTY
;
1385 hres
= IHTMLStyle_get_height(style
, &v
);
1386 ok(hres
== S_OK
, "get_height 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 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1393 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1394 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1397 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1398 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1399 ok(!l
, "pixelHeight = %d\n", l
);
1401 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1402 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1404 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1405 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1407 f
== 4.9f
, /* IE8 */
1408 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1411 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1412 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1415 "pixelHeight = %d\n", l
);
1418 V_BSTR(&v
) = a2bstr("70px");
1419 hres
= IHTMLStyle_put_height(style
, v
);
1420 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1423 V_VT(&v
) = VT_EMPTY
;
1424 hres
= IHTMLStyle_get_height(style
, &v
);
1425 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1426 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1427 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1431 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1432 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1433 ok(l
== 70, "pixelHeight = %d\n", l
);
1437 hres
= IHTMLStyle_put_height(style
, v
);
1438 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1441 V_VT(&v
) = VT_EMPTY
;
1442 hres
= IHTMLStyle_get_height(style
, &v
);
1443 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1444 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1445 ok(!V_BSTR(&v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v
)));
1449 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1450 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1451 ok(!l
, "pixelHeight = %d\n", l
);
1453 hres
= IHTMLStyle_put_pixelHeight(style
, 50);
1454 ok(hres
== S_OK
, "put_pixelHeight failed: %08x\n", hres
);
1457 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1458 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1459 ok(l
== 50, "pixelHeight = %d\n", l
);
1461 hres
= IHTMLStyle_get_pixelHeight(style
, NULL
);
1462 ok(hres
== E_POINTER
, "get_pixelHeight failed: %08x\n", hres
);
1466 hres
= IHTMLStyle_put_height(style
, v
);
1467 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1469 V_VT(&v
) = VT_EMPTY
;
1470 hres
= IHTMLStyle_get_height(style
, &v
);
1471 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1472 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1473 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1476 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1477 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1478 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
1481 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1482 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1483 ok(l
== 64, "pixelHeight = %d\n", l
);
1485 str
= (void*)0xdeadbeef;
1486 hres
= IHTMLStyle_get_cursor(style
, &str
);
1487 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1488 ok(!str
, "get_cursor != NULL\n");
1491 str
= a2bstr("default");
1492 hres
= IHTMLStyle_put_cursor(style
, str
);
1493 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1497 hres
= IHTMLStyle_get_cursor(style
, &str
);
1498 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1499 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1502 V_VT(&v
) = VT_EMPTY
;
1503 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1504 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1505 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1506 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1510 V_BSTR(&v
) = a2bstr("middle");
1511 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1512 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1515 V_VT(&v
) = VT_EMPTY
;
1516 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1517 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1518 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1519 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1524 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1525 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1528 V_VT(&v
) = VT_EMPTY
;
1529 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1530 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1531 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1532 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1535 str
= (void*)0xdeadbeef;
1536 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1537 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1538 ok(!str
, "textAlign != NULL\n");
1540 str
= a2bstr("center");
1541 hres
= IHTMLStyle_put_textAlign(style
, str
);
1542 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1546 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1547 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1548 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1552 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1553 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1554 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1555 ok(!V_BSTR(&v
), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1559 hres
= IHTMLStyle_put_textIndent(style
, v
);
1560 ok(hres
== S_OK
, "put_textIndent failed: %08x\n", hres
);
1563 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1564 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1565 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1566 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1568 str
= (void*)0xdeadbeef;
1569 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1570 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1571 ok(!str
, "textTransform != NULL\n");
1573 str
= a2bstr("lowercase");
1574 hres
= IHTMLStyle_put_textTransform(style
, str
);
1575 ok(hres
== S_OK
, "put_textTransform failed: %08x\n", hres
);
1579 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1580 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1581 ok(!strcmp_wa(str
, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1584 str
= (void*)0xdeadbeef;
1585 hres
= IHTMLStyle_get_filter(style
, &str
);
1586 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1587 ok(!str
, "filter != NULL\n");
1589 str
= a2bstr("alpha(opacity=100)");
1590 hres
= IHTMLStyle_put_filter(style
, str
);
1591 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1594 V_VT(&v
) = VT_EMPTY
;
1595 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1596 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1597 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1598 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1602 V_BSTR(&v
) = a2bstr("1");
1603 hres
= IHTMLStyle_put_zIndex(style
, v
);
1604 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1607 V_VT(&v
) = VT_EMPTY
;
1608 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1609 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1610 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1611 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1615 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1616 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1618 str
= a2bstr("test");
1619 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1620 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1623 str
= a2bstr("italic");
1624 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1625 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1628 str
= a2bstr("oblique");
1629 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1630 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1633 str
= a2bstr("normal");
1634 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1635 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1638 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1639 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1640 SysFreeString(sDefault
);
1643 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1644 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1646 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1647 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1649 str
= a2bstr("test");
1650 hres
= IHTMLStyle_put_overflow(style
, str
);
1651 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1654 str
= a2bstr("visible");
1655 hres
= IHTMLStyle_put_overflow(style
, str
);
1656 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1659 str
= a2bstr("scroll");
1660 hres
= IHTMLStyle_put_overflow(style
, str
);
1661 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1664 str
= a2bstr("hidden");
1665 hres
= IHTMLStyle_put_overflow(style
, str
);
1666 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1669 str
= a2bstr("auto");
1670 hres
= IHTMLStyle_put_overflow(style
, str
);
1671 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1674 hres
= IHTMLStyle_get_overflow(style
, &str
);
1675 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1676 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1680 hres
= IHTMLStyle_put_overflow(style
, str
);
1681 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1684 hres
= IHTMLStyle_get_overflow(style
, &str
);
1685 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1686 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1689 /* restore overflow default */
1690 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1691 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1692 SysFreeString(sOverflowDefault
);
1694 /* Attribute Tests*/
1695 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1696 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1698 str
= a2bstr("position");
1699 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1700 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1702 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1703 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1704 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1707 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1708 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1711 V_BSTR(&v
) = a2bstr("absolute");
1712 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1713 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1716 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1717 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1718 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1719 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1724 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1725 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1730 str
= a2bstr("borderLeftStyle");
1731 test_border_styles(style
, str
);
1734 str
= a2bstr("borderbottomstyle");
1735 test_border_styles(style
, str
);
1738 str
= a2bstr("borderrightstyle");
1739 test_border_styles(style
, str
);
1742 str
= a2bstr("bordertopstyle");
1743 test_border_styles(style
, str
);
1746 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1747 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1749 str
= a2bstr("none dotted dashed solid");
1750 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1751 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1754 str
= a2bstr("none dotted dashed solid");
1755 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1756 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1757 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1758 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1761 str
= a2bstr("double groove ridge inset");
1762 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1763 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1766 str
= a2bstr("window-inset outset ridge inset");
1767 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1768 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1771 str
= a2bstr("window-inset");
1772 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1773 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1776 str
= a2bstr("none none none none none");
1777 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1778 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1781 str
= a2bstr("invalid none none none");
1782 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1783 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1786 str
= a2bstr("none invalid none none");
1787 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1788 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1791 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1792 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1793 SysFreeString(sDefault
);
1795 /* backgoundColor */
1796 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1797 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1798 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1799 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1803 V_BSTR(&v
) = a2bstr("red");
1804 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
1805 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
1808 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1809 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1810 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1811 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1814 str
= a2bstr("fixed");
1815 hres
= IHTMLStyle_put_backgroundAttachment(style
, str
);
1816 ok(hres
== S_OK
, "put_backgroundAttachment failed: %08x\n", hres
);
1819 hres
= IHTMLStyle_get_backgroundAttachment(style
, &str
);
1820 ok(hres
== S_OK
, "get_backgroundAttachment failed: %08x\n", hres
);
1821 ok(!strcmp_wa(str
, "fixed"), "ret = %s\n", wine_dbgstr_w(str
));
1825 hres
= IHTMLStyle_get_padding(style
, &str
);
1826 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1827 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1830 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1831 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1832 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1833 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1837 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1838 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1840 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1841 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1842 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1843 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1846 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1847 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1848 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1849 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1853 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1854 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1856 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1857 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1858 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1859 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1862 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1863 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1864 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1865 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1869 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
1870 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1872 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1873 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1874 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1875 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1879 hres
= IHTMLStyle_put_padding(style
, str
);
1880 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1883 hres
= IHTMLStyle_get_padding(style
, &str
);
1884 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1885 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1889 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1890 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1891 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1892 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1895 V_BSTR(&v
) = a2bstr("10");
1896 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1897 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1900 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1901 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1902 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1905 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1906 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1908 /* BackgroundRepeat */
1909 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1910 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1912 str
= a2bstr("invalid");
1913 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1914 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1917 str
= a2bstr("repeat");
1918 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1919 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1922 str
= a2bstr("no-repeat");
1923 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1924 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1927 str
= a2bstr("repeat-x");
1928 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1929 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1932 str
= a2bstr("repeat-y");
1933 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1934 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1937 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1938 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1939 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1942 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1943 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1944 SysFreeString(sDefault
);
1947 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1948 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1950 str
= a2bstr("red green red blue");
1951 hres
= IHTMLStyle_put_borderColor(style
, str
);
1952 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1955 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1956 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1957 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1960 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1961 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1962 SysFreeString(sDefault
);
1965 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1966 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1968 str
= a2bstr("thick dotted red");
1969 hres
= IHTMLStyle_put_borderRight(style
, str
);
1970 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1973 /* IHTMLStyle_get_borderRight appears to have a bug where
1974 it returns the first letter of the color. So we check
1975 each style individually.
1978 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1979 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1980 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1984 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1985 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1986 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1989 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1990 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1991 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1994 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1995 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1996 SysFreeString(sDefault
);
1999 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
2000 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
2002 str
= a2bstr("thick dotted red");
2003 hres
= IHTMLStyle_put_borderTop(style
, str
);
2004 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
2007 /* IHTMLStyle_get_borderTop appears to have a bug where
2008 it returns the first letter of the color. So we check
2009 each style individually.
2012 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2013 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2014 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2018 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
2019 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2020 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2023 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
2024 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2025 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2028 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
2029 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
2030 SysFreeString(sDefault
);
2033 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
2034 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
2036 str
= a2bstr("thick dotted red");
2037 hres
= IHTMLStyle_put_borderBottom(style
, str
);
2038 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
2041 /* IHTMLStyle_get_borderBottom appears to have a bug where
2042 it returns the first letter of the color. So we check
2043 each style individually.
2046 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2047 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2048 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2052 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2053 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2054 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2057 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
2058 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2059 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2062 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
2063 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
2064 SysFreeString(sDefault
);
2067 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
2068 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
2070 str
= a2bstr("thick dotted red");
2071 hres
= IHTMLStyle_put_borderLeft(style
, str
);
2072 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
2075 /* IHTMLStyle_get_borderLeft appears to have a bug where
2076 it returns the first letter of the color. So we check
2077 each style individually.
2080 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2081 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2082 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2086 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2087 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2088 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2091 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
2092 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2093 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2096 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
2097 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
2098 SysFreeString(sDefault
);
2100 /* backgroundPositionX */
2101 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2102 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2103 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2104 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2108 V_BSTR(&v
) = a2bstr("10px");
2109 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
2110 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
2113 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2114 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2115 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2116 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2119 /* backgroundPositionY */
2120 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2121 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2122 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2126 V_BSTR(&v
) = a2bstr("15px");
2127 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
2128 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
2131 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2132 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2133 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2134 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2137 /* backgroundPosition */
2139 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2140 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2141 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2144 str
= a2bstr("center 20%");
2145 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
2146 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
2150 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2151 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2152 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2155 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2156 ok(hres
== S_OK
, "get_backgroundPositionX failed: %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
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2161 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2162 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2163 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2164 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2167 /* borderTopWidth */
2168 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
2169 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2172 V_BSTR(&v
) = a2bstr("10px");
2173 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
2174 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2177 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
2178 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2179 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2182 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
2183 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2184 VariantClear(&vDefault
);
2186 /* borderRightWidth */
2187 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
2188 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2191 V_BSTR(&v
) = a2bstr("10");
2192 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
2193 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2196 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
2197 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2198 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2201 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
2202 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2203 VariantClear(&vDefault
);
2205 /* borderBottomWidth */
2206 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
2207 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2210 V_BSTR(&v
) = a2bstr("10");
2211 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
2212 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2215 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2216 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2217 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2220 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
2221 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2222 VariantClear(&vDefault
);
2224 /* borderLeftWidth */
2225 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
2226 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2229 V_BSTR(&v
) = a2bstr("10");
2230 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
2231 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2234 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2235 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2236 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2239 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
2240 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2241 VariantClear(&vDefault
);
2244 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
2245 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2248 V_BSTR(&v
) = a2bstr("10");
2249 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
2250 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2253 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
2254 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2255 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2256 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2259 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
2260 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2261 VariantClear(&vDefault
);
2264 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
2265 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2268 V_BSTR(&v
) = a2bstr("11");
2269 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
2270 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2273 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
2274 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2275 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2276 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2279 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
2280 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2281 VariantClear(&vDefault
);
2283 /* borderTopColor */
2284 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
2285 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2288 V_BSTR(&v
) = a2bstr("red");
2289 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
2290 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2293 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2294 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2295 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2298 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
2299 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2301 /* borderRightColor */
2302 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
2303 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2306 V_BSTR(&v
) = a2bstr("blue");
2307 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
2308 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
2311 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
2312 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2313 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2316 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
2317 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
2319 /* borderBottomColor */
2320 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
2321 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2324 V_BSTR(&v
) = a2bstr("cyan");
2325 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
2326 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2329 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2330 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2331 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2334 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
2335 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2337 /* borderLeftColor */
2338 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
2339 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2342 V_BSTR(&v
) = a2bstr("cyan");
2343 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
2344 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2347 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2348 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2349 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2352 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
2353 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2356 hres
= IHTMLStyle_get_clip(style
, &str
);
2357 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2358 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
2360 str
= a2bstr("rect(0px 1px 500px 505px)");
2361 hres
= IHTMLStyle_put_clip(style
, str
);
2362 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
2365 hres
= IHTMLStyle_get_clip(style
, &str
);
2366 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2367 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
2371 hres
= IHTMLStyle_get_clear(style
, &str
);
2372 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2373 ok(!str
, "clear = %s\n", wine_dbgstr_w(str
));
2375 str
= a2bstr("both");
2376 hres
= IHTMLStyle_put_clear(style
, str
);
2377 ok(hres
== S_OK
, "put_clear failed: %08x\n", hres
);
2380 hres
= IHTMLStyle_get_clear(style
, &str
);
2381 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2382 ok(!strcmp_wa(str
, "both"), "clear = %s\n", wine_dbgstr_w(str
));
2385 /* pageBreakAfter */
2386 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2387 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2388 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2390 str
= a2bstr("always");
2391 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
2392 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2395 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2396 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2397 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2400 /* pageBreakBefore */
2401 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2402 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2403 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2405 str
= a2bstr("always");
2406 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
2407 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
2410 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2411 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2412 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2415 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
2416 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
2418 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2419 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2420 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2422 str
= (void*)0xdeadbeef;
2423 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2424 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2425 ok(!str
, "whiteSpace = %s\n", wine_dbgstr_w(str
));
2427 str
= a2bstr("nowrap");
2428 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2430 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2433 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2434 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2435 ok(!strcmp_wa(str
, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2439 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2440 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2441 ok(!str
, "listStyleType = %s\n", wine_dbgstr_w(str
));
2443 str
= a2bstr("square");
2444 hres
= IHTMLStyle_put_listStyleType(style
, str
);
2445 ok(hres
== S_OK
, "put_listStyleType failed: %08x\n", hres
);
2449 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2450 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2451 ok(!strcmp_wa(str
, "square"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2453 str
= a2bstr("inside");
2454 hres
= IHTMLStyle_put_listStylePosition(style
, str
);
2455 ok(hres
== S_OK
, "put_listStylePosition failed: %08x\n", hres
);
2458 hres
= IHTMLStyle_get_listStylePosition(style
, &str
);
2459 ok(hres
== S_OK
, "get_listStylePosition failed: %08x\n", hres
);
2460 ok(!strcmp_wa(str
, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2463 str
= a2bstr("decimal-leading-zero none inside");
2464 hres
= IHTMLStyle_put_listStyle(style
, str
);
2465 ok(hres
== S_OK
|| broken(hres
== E_INVALIDARG
), /* win 2000 */
2466 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str
), hres
);
2469 if (hres
!= E_INVALIDARG
) {
2470 hres
= IHTMLStyle_get_listStyle(style
, &str
);
2471 ok(hres
== S_OK
, "get_listStyle failed: %08x\n", hres
);
2472 ok(strstr_wa(str
, "decimal-leading-zero") &&
2473 strstr_wa(str
, "none") != NULL
&&
2474 strstr_wa(str
, "inside") != NULL
,
2475 "listStyle = %s\n", wine_dbgstr_w(str
));
2478 win_skip("IHTMLStyle_put_listStyle already failed\n");
2481 str
= (void*)0xdeadbeef;
2482 hres
= IHTMLStyle_get_styleFloat(style
, &str
);
2483 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
2484 ok(!str
, "styleFloat = %s\n", wine_dbgstr_w(str
));
2486 str
= a2bstr("left");
2487 hres
= IHTMLStyle_put_styleFloat(style
, str
);
2488 ok(hres
== S_OK
, "put_styleFloat failed: %08x\n", hres
);
2492 hres
= IHTMLStyle_get_styleFloat(style
, &str
);
2493 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
2494 ok(!strcmp_wa(str
, "left"), "styleFloat = %s\n", wine_dbgstr_w(str
));
2496 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
2497 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
2498 if(SUCCEEDED(hres
)) {
2499 test_style2(style2
);
2500 IHTMLStyle2_Release(style2
);
2503 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
2504 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
2505 if(SUCCEEDED(hres
)) {
2506 test_style3(style3
);
2507 IHTMLStyle3_Release(style3
);
2510 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
2511 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
2512 if(SUCCEEDED(hres
)) {
2513 test_style4(style4
);
2514 IHTMLStyle4_Release(style4
);
2517 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle5
, (void**)&style5
);
2518 if(SUCCEEDED(hres
)) {
2519 test_style5(style5
);
2520 IHTMLStyle5_Release(style5
);
2522 win_skip("IHTMLStyle5 not available\n");
2525 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle6
, (void**)&style6
);
2526 if(SUCCEEDED(hres
)) {
2527 test_style6(style6
);
2528 IHTMLStyle6_Release(style6
);
2530 win_skip("IHTMLStyle6 not available\n");
2534 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2535 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
2540 str
= (void*)0xdeadbeef;
2541 hres
= IHTMLStyle_get_filter(style
, &str
);
2542 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2544 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2546 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2551 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2552 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
2557 str
= (void*)0xdeadbeef;
2558 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
2559 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2561 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2563 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2568 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2569 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
2571 BSTR str
= a2bstr(val
);
2574 hres
= IHTMLStyle_put_filter(style
, str
);
2575 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
2578 _test_style_filter(line
, style
, val
);
2581 static void test_style_filters(IHTMLElement
*elem
)
2583 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
2584 IHTMLCurrentStyle2
*current_style2
;
2585 IHTMLCurrentStyle
*current_style
;
2589 hres
= IHTMLElement_get_style(elem
, &style
);
2590 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2592 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
2593 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2595 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2597 test_style_filter(style
, NULL
);
2598 test_current_style_filter(current_style2
, NULL
);
2599 set_style_filter(style
, "alpha(opacity=50.0040)");
2600 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
2601 set_style_filter(style
, "alpha(opacity=100)");
2603 IHTMLStyle_Release(style
);
2605 hres
= IHTMLElement_get_style(elem
, &style
);
2606 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2608 test_style_filter(style
, "alpha(opacity=100)");
2609 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
2610 set_style_filter(style
, NULL
);
2611 set_style_filter(style
, "alpha(opacity=100)");
2612 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
2613 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
2614 test_style_filter(style
, NULL
);
2617 IHTMLCurrentStyle2_Release(current_style2
);
2618 IHTMLStyle_Release(style
);
2619 IHTMLElement2_Release(elem2
);
2622 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2624 IHTMLCurrentStyle2
*current_style2
;
2630 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2631 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2632 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2635 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2636 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2637 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2640 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2641 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2644 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2645 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2646 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2649 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2650 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2651 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2654 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2655 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2656 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2659 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2660 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2661 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
2664 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
2665 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2666 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
2669 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
2670 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2671 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
2674 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
2675 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2676 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
2679 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
2680 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
2681 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2684 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2685 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2686 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2689 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2690 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2691 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2694 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2695 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2696 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2699 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2700 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2703 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2704 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2707 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2708 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2711 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2712 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2715 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2716 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2719 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2720 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2723 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2724 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2727 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2728 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2729 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2730 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2733 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2734 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2735 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2738 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2739 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2740 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2743 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2744 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2745 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2748 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2749 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2750 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2753 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2754 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2755 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2758 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2759 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2760 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2763 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2764 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2765 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2766 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2769 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2770 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2771 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2772 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2775 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2776 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2777 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2780 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2781 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2782 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2785 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2786 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2787 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2791 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2792 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2793 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2796 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2797 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2798 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2801 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2802 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2803 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2806 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2807 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2808 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2811 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2812 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2813 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2816 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2817 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2818 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2821 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2822 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2823 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2826 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2827 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2828 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2831 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2832 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2833 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2836 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2837 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2838 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2841 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2842 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2843 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2846 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2847 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2848 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2851 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2852 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2853 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2856 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2857 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2858 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2861 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2862 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2863 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2866 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2867 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2868 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2871 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2872 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2873 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2876 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2877 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2878 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2881 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2882 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2883 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2886 hres
= IHTMLCurrentStyle_get_textTransform(current_style
, &str
);
2887 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
2890 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2893 hres
= IHTMLCurrentStyle2_get_hasLayout(current_style2
, &b
);
2894 ok(hres
== S_OK
, "get_hasLayout failed: %08x\n", hres
);
2895 ok(b
== VARIANT_TRUE
, "hasLayout = %x\n", b
);
2897 IHTMLCurrentStyle2_Release(current_style2
);
2900 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2902 static void basic_style_test(IHTMLDocument2
*doc
)
2904 IHTMLCurrentStyle
*cstyle
;
2909 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2910 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2912 hres
= IHTMLElement_get_style(elem
, &style
);
2913 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2915 test_body_style(style
);
2917 cstyle
= get_current_style(elem
);
2918 test_current_style(cstyle
);
2919 IHTMLCurrentStyle_Release(cstyle
);
2920 IHTMLElement_Release(elem
);
2922 elem
= get_element_by_id(doc
, "divid");
2923 test_style_filters(elem
);
2925 test_set_csstext(style
);
2926 IHTMLStyle_Release(style
);
2927 IHTMLElement_Release(elem
);
2930 static const char runtimestyle_test_str
[] =
2931 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2933 static void runtimestyle_test(IHTMLDocument2
*doc
)
2935 IHTMLStyle
*style
, *runtime_style
;
2936 IHTMLElement2
*elem2
;
2941 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2942 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2944 elem2
= get_elem2_iface((IUnknown
*)elem
);
2946 hres
= IHTMLElement2_get_runtimeStyle(elem2
, &runtime_style
);
2947 ok(hres
== S_OK
, "get_runtimeStyle failed: %08x\n", hres
);
2949 hres
= IHTMLElement_get_style(elem
, &style
);
2950 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2952 test_text_decoration(style
, NULL
);
2953 test_text_decoration(runtime_style
, NULL
);
2954 set_text_decoration(style
, "underline");
2955 test_text_decoration(style
, "underline");
2957 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2958 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2959 ok(broken(!str
) || !strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2962 set_text_decoration(runtime_style
, "blink");
2963 test_text_decoration(runtime_style
, "blink");
2965 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2966 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2968 ok(!strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2971 IHTMLStyle_Release(runtime_style
);
2972 IHTMLStyle_Release(style
);
2973 IHTMLElement2_Release(elem2
);
2974 IHTMLElement_Release(elem
);
2977 static IHTMLDocument2
*notif_doc
;
2978 static BOOL doc_complete
;
2980 static IHTMLDocument2
*create_document(void)
2982 IHTMLDocument2
*doc
;
2983 IHTMLDocument5
*doc5
;
2986 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2987 &IID_IHTMLDocument2
, (void**)&doc
);
2988 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2992 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2994 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2995 IHTMLDocument2_Release(doc
);
2999 IHTMLDocument5_Release(doc5
);
3003 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
3004 REFIID riid
, void**ppv
)
3006 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
3011 ok(0, "unexpected call\n");
3012 return E_NOINTERFACE
;
3015 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
3020 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
3025 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
3027 if(dispID
== DISPID_READYSTATE
){
3031 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
3032 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3034 if(!strcmp_wa(state
, "complete"))
3035 doc_complete
= TRUE
;
3037 SysFreeString(state
);
3043 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
3045 ok(0, "unexpected call\n");
3049 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
3050 PropertyNotifySink_QueryInterface
,
3051 PropertyNotifySink_AddRef
,
3052 PropertyNotifySink_Release
,
3053 PropertyNotifySink_OnChanged
,
3054 PropertyNotifySink_OnRequestEdit
3057 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
3059 static IHTMLDocument2
*create_doc_with_string(const char *str
)
3061 IPersistStreamInit
*init
;
3063 IHTMLDocument2
*doc
;
3067 notif_doc
= doc
= create_document();
3071 doc_complete
= FALSE
;
3073 mem
= GlobalAlloc(0, len
);
3074 memcpy(mem
, str
, len
);
3075 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
3077 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
3079 IPersistStreamInit_Load(init
, stream
);
3080 IPersistStreamInit_Release(init
);
3081 IStream_Release(stream
);
3086 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
3088 IConnectionPointContainer
*container
;
3089 IConnectionPoint
*cp
;
3093 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
3094 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
3096 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
3097 IConnectionPointContainer_Release(container
);
3098 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
3100 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
3101 IConnectionPoint_Release(cp
);
3102 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3105 typedef void (*style_test_t
)(IHTMLDocument2
*);
3107 static void run_test(const char *str
, style_test_t test
)
3109 IHTMLDocument2
*doc
;
3113 doc
= create_doc_with_string(str
);
3117 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
3119 while(!doc_complete
&& GetMessageW(&msg
, NULL
, 0, 0)) {
3120 TranslateMessage(&msg
);
3121 DispatchMessageW(&msg
);
3126 ref
= IHTMLDocument2_Release(doc
);
3127 ok(!ref
|| broken(ref
== 1), /* Vista */
3136 run_test(basic_test_str
, basic_style_test
);
3137 run_test(runtimestyle_test_str
, runtimestyle_test
);