2 * Copyright 2007-2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
33 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
36 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
37 return lstrcmpA(stra
, buf
);
40 static BOOL
wstr_contains(const WCHAR
*strw
, const char *stra
)
43 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
44 return strstr(buf
, stra
) != NULL
;
47 static BSTR
a2bstr(const char *str
)
55 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
56 ret
= SysAllocStringLen(NULL
, len
);
57 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
62 static const WCHAR
*strstr_wa(const WCHAR
*str
, const char *suba
)
65 const WCHAR
*ret
= NULL
;
69 const WCHAR
*p1
= str
, *p2
= sub
;
70 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
71 if (!*p2
) {ret
= str
; break;}
78 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
79 static void _test_var_bstr(unsigned line
, const VARIANT
*v
, const char *expect
)
81 ok_(__FILE__
,line
)(V_VT(v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(v
));
83 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(v
), expect
), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), expect
);
85 ok_(__FILE__
,line
)(!V_BSTR(v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v
)));
88 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
89 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
94 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
95 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
99 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
100 static IHTMLCurrentStyle2
*_get_current_style2_iface(unsigned line
, IUnknown
*unk
)
102 IHTMLCurrentStyle2
*current_style2
;
105 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
106 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
107 return current_style2
;
110 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
113 IHTMLDocument3
*doc3
;
114 IHTMLElement
*result
;
115 BSTR idW
= a2bstr(id
);
117 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
118 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
120 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
121 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
122 ok(result
!= NULL
, "result == NULL\n");
125 IHTMLDocument3_Release(doc3
);
129 #define get_current_style(e) _get_current_style(__LINE__,e)
130 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
132 IHTMLCurrentStyle
*cstyle
;
133 IHTMLElement2
*elem2
;
136 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
137 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
140 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
141 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
142 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
144 IHTMLElement2_Release(elem2
);
148 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
149 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
154 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
155 LOCALE_USER_DEFAULT
, &dispid
);
156 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
159 DISPPARAMS params
= {NULL
,NULL
,0,0};
160 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
165 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
166 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
167 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
170 params
.cNamedArgs
= 1;
171 params
.rgdispidNamedArgs
= &dispidNamed
;
172 V_VT(&arg
) = VT_BSTR
;
173 V_BSTR(&arg
) = a2bstr("none");
174 params
.rgvarg
= &arg
;
175 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
176 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
177 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
180 V_VT(&arg
) = VT_BSTR
;
181 V_BSTR(&arg
) = a2bstr("dotted");
182 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
183 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
184 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
187 V_VT(&arg
) = VT_BSTR
;
188 V_BSTR(&arg
) = a2bstr("dashed");
189 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
190 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
191 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
194 V_VT(&arg
) = VT_BSTR
;
195 V_BSTR(&arg
) = a2bstr("solid");
196 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
197 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
198 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
201 V_VT(&arg
) = VT_BSTR
;
202 V_BSTR(&arg
) = a2bstr("double");
203 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
204 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
205 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
208 V_VT(&arg
) = VT_BSTR
;
209 V_BSTR(&arg
) = a2bstr("groove");
210 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
211 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
212 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
215 V_VT(&arg
) = VT_BSTR
;
216 V_BSTR(&arg
) = a2bstr("ridge");
217 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
218 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
219 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
222 V_VT(&arg
) = VT_BSTR
;
223 V_BSTR(&arg
) = a2bstr("inset");
224 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
225 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
226 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
229 V_VT(&arg
) = VT_BSTR
;
230 V_BSTR(&arg
) = a2bstr("outset");
231 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
232 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
233 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
236 V_VT(&arg
) = VT_BSTR
;
237 V_BSTR(&arg
) = a2bstr("invalid");
238 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
239 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
240 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
243 params
.rgvarg
= &vDefault
;
244 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
245 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
246 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
247 VariantClear(&vDefault
);
251 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
252 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
254 BSTR text
= (void*)0xdeadbeef;
257 hres
= IHTMLStyle_get_cssText(style
, &text
);
258 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
260 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
262 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
267 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
268 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
274 hres
= IHTMLStyle_put_cssText(style
, tmp
);
275 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
279 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
280 static void _test_style_remove_attribute(unsigned line
, IHTMLStyle
*style
, const char *attr
, VARIANT_BOOL exb
)
282 BSTR str
= a2bstr(attr
);
283 VARIANT_BOOL b
= 100;
286 hres
= IHTMLStyle_removeAttribute(style
, str
, 1, &b
);
288 ok_(__FILE__
,line
)(hres
== S_OK
, "removeAttribute failed: %08x\n", hres
);
289 ok_(__FILE__
,line
)(b
== exb
, "removeAttribute returned %x, expected %x\n", b
, exb
);
292 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
293 static void _set_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *v
)
299 hres
= IHTMLStyle_put_textDecoration(style
, str
);
300 ok_(__FILE__
,line
)(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
304 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
305 static void _test_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *exdec
)
310 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
311 ok_(__FILE__
,line
)(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
313 ok_(__FILE__
,line
)(!strcmp_wa(str
, exdec
), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str
), exdec
);
315 ok_(__FILE__
,line
)(!str
, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str
));
319 static void test_set_csstext(IHTMLStyle
*style
)
324 test_style_set_csstext(style
, "background-color: black;");
326 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
327 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
328 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
329 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
333 static void test_style2(IHTMLStyle2
*style2
)
339 str
= (void*)0xdeadbeef;
340 hres
= IHTMLStyle2_get_position(style2
, &str
);
341 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
342 ok(!str
, "str != NULL\n");
344 str
= a2bstr("absolute");
345 hres
= IHTMLStyle2_put_position(style2
, str
);
346 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
350 hres
= IHTMLStyle2_get_position(style2
, &str
);
351 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
352 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
357 hres
= IHTMLStyle2_get_right(style2
, &v
);
358 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
359 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
360 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
364 V_BSTR(&v
) = a2bstr("3px");
365 hres
= IHTMLStyle2_put_right(style2
, v
);
366 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
370 hres
= IHTMLStyle2_get_right(style2
, &v
);
371 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
372 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
373 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
377 str
= (void*)0xdeadbeef;
378 hres
= IHTMLStyle2_get_direction(style2
, &str
);
379 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
380 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
383 hres
= IHTMLStyle2_put_direction(style2
, str
);
384 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
388 hres
= IHTMLStyle2_get_direction(style2
, &str
);
389 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
390 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
395 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
396 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
397 test_var_bstr(&v
, NULL
);
401 hres
= IHTMLStyle2_put_bottom(style2
, v
);
402 ok(hres
== S_OK
, "put_bottom failed: %08x\n", hres
);
405 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
406 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
407 test_var_bstr(&v
, "4px");
410 str
= (void*)0xdeadbeef;
411 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
412 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
413 ok(!str
, "overflowX = %s\n", wine_dbgstr_w(str
));
415 str
= a2bstr("hidden");
416 hres
= IHTMLStyle2_put_overflowX(style2
, str
);
417 ok(hres
== S_OK
, "put_overflowX failed: %08x\n", hres
);
421 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
422 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
423 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
426 str
= (void*)0xdeadbeef;
427 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
428 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
429 ok(!str
, "overflowY = %s\n", wine_dbgstr_w(str
));
431 str
= a2bstr("hidden");
432 hres
= IHTMLStyle2_put_overflowY(style2
, str
);
433 ok(hres
== S_OK
, "put_overflowY failed: %08x\n", hres
);
437 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
438 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
439 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
442 str
= a2bstr("fixed");
443 hres
= IHTMLStyle2_put_tableLayout(style2
, str
);
444 ok(hres
== S_OK
, "put_tableLayout failed: %08x\n", hres
);
447 str
= (void*)0xdeadbeef;
448 hres
= IHTMLStyle2_get_tableLayout(style2
, &str
);
449 ok(hres
== S_OK
, "get_tableLayout failed: %08x\n", hres
);
450 ok(!strcmp_wa(str
, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str
));
454 static void test_style3(IHTMLStyle3
*style3
)
459 str
= (void*)0xdeadbeef;
460 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
461 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
462 ok(!str
, "str != NULL\n");
464 str
= a2bstr("break-word");
465 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
466 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
470 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
471 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
472 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
476 static void test_style4(IHTMLStyle4
*style4
)
482 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
483 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
486 V_BSTR(&v
) = a2bstr("10px");
487 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
488 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
491 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
492 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
493 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
494 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
497 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
498 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
499 VariantClear(&vdefault
);
502 static void test_style5(IHTMLStyle5
*style5
)
509 hres
= IHTMLStyle5_get_minWidth(style5
, &vdefault
);
510 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
513 V_BSTR(&v
) = a2bstr("12px");
514 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
515 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
518 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
519 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
520 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
521 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
525 V_BSTR(&v
) = a2bstr("10%");
526 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
527 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
530 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
531 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
532 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
533 ok(!strcmp_wa(V_BSTR(&v
), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
537 V_BSTR(&v
) = a2bstr("10");
538 hres
= IHTMLStyle5_put_minWidth(style5
, v
);
539 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
542 hres
= IHTMLStyle5_get_minWidth(style5
, &v
);
543 ok(hres
== S_OK
, "get_minWidth failed: %08x\n", hres
);
544 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
545 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
548 hres
= IHTMLStyle5_put_minWidth(style5
, vdefault
);
549 ok(hres
== S_OK
, "put_minWidth failed: %08x\n", hres
);
550 VariantClear(&vdefault
);
553 hres
= IHTMLStyle5_get_maxWidth(style5
, &vdefault
);
554 ok(hres
== S_OK
, "get_maxWidth failed: %08x\n", hres
);
557 V_BSTR(&v
) = a2bstr("200px");
558 hres
= IHTMLStyle5_put_maxWidth(style5
, v
);
559 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
562 hres
= IHTMLStyle5_get_maxWidth(style5
, &v
);
563 ok(hres
== S_OK
, "get_maxWidth 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
), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
569 V_BSTR(&v
) = a2bstr("70%");
570 hres
= IHTMLStyle5_put_maxWidth(style5
, v
);
571 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
574 hres
= IHTMLStyle5_get_maxWidth(style5
, &v
);
575 ok(hres
== S_OK
, "get maxWidth 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
), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
580 hres
= IHTMLStyle5_put_maxWidth(style5
,vdefault
);
581 ok(hres
== S_OK
, "put_maxWidth failed: %08x\n", hres
);
582 VariantClear(&vdefault
);
585 hres
= IHTMLStyle5_get_maxHeight(style5
, &vdefault
);
586 ok(hres
== S_OK
, "get maxHeight failed: %08x\n", hres
);
589 V_BSTR(&v
) = a2bstr("200px");
590 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
591 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
594 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
595 ok(hres
== S_OK
, "get maxHeight 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_maxHeight(style5
, v
);
603 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
606 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
607 ok(hres
== S_OK
, "get_maxHeight 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
)));
613 V_BSTR(&v
) = a2bstr("100");
614 hres
= IHTMLStyle5_put_maxHeight(style5
, v
);
615 ok(hres
== S_OK
, "put maxHeight failed: %08x\n", hres
);
618 hres
= IHTMLStyle5_get_maxHeight(style5
, &v
);
619 ok(hres
== S_OK
, "get_maxHeight failed: %08x\n", hres
);
620 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
621 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "expect 100 got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
624 hres
= IHTMLStyle5_put_maxHeight(style5
, vdefault
);
625 ok(hres
== S_OK
, "put maxHeight failed:%08x\n", hres
);
626 VariantClear(&vdefault
);
629 static void test_style6(IHTMLStyle6
*style
)
634 str
= (void*)0xdeadbeef;
635 hres
= IHTMLStyle6_get_outline(style
, &str
);
636 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
637 ok(str
&& !*str
, "outline = %s\n", wine_dbgstr_w(str
));
641 hres
= IHTMLStyle6_put_outline(style
, str
);
642 ok(hres
== S_OK
, "put_outline failed: %08x\n", hres
);
645 str
= (void*)0xdeadbeef;
646 hres
= IHTMLStyle6_get_outline(style
, &str
);
647 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
648 ok(wstr_contains(str
, "1px"), "outline = %s\n", wine_dbgstr_w(str
));
651 str
= (void*)0xdeadbeef;
652 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
653 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
654 ok(!str
, "boxSizing = %s\n", wine_dbgstr_w(str
));
657 str
= a2bstr("border-box");
658 hres
= IHTMLStyle6_put_boxSizing(style
, str
);
659 ok(hres
== S_OK
, "put_boxSizing failed: %08x\n", hres
);
663 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
664 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
665 ok(!strcmp_wa(str
, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str
));
669 static void test_body_style(IHTMLStyle
*style
)
681 BSTR sOverflowDefault
;
686 test_style_csstext(style
, NULL
);
688 hres
= IHTMLStyle_get_position(style
, &str
);
689 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
690 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
693 hres
= IHTMLStyle_get_marginRight(style
, &v
);
694 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
695 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
696 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
700 hres
= IHTMLStyle_put_marginRight(style
, v
);
701 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
704 hres
= IHTMLStyle_get_marginRight(style
, &v
);
705 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
706 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
707 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
710 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
711 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
712 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
713 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
717 hres
= IHTMLStyle_put_marginBottom(style
, v
);
718 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
721 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
722 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
723 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
724 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
727 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
728 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
729 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
730 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
734 hres
= IHTMLStyle_put_marginLeft(style
, v
);
735 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
738 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
739 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
740 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
741 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
743 str
= (void*)0xdeadbeef;
744 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
745 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
746 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
748 str
= (void*)0xdeadbeef;
749 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
750 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
751 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
753 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
754 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
756 str
= a2bstr("test");
757 hres
= IHTMLStyle_put_fontWeight(style
, str
);
758 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
761 str
= a2bstr("bold");
762 hres
= IHTMLStyle_put_fontWeight(style
, str
);
763 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
766 str
= a2bstr("bolder");
767 hres
= IHTMLStyle_put_fontWeight(style
, str
);
768 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
771 str
= a2bstr("lighter");
772 hres
= IHTMLStyle_put_fontWeight(style
, str
);
773 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
777 hres
= IHTMLStyle_put_fontWeight(style
, str
);
778 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
782 hres
= IHTMLStyle_put_fontWeight(style
, str
);
783 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
787 hres
= IHTMLStyle_put_fontWeight(style
, str
);
788 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
792 hres
= IHTMLStyle_put_fontWeight(style
, str
);
793 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
797 hres
= IHTMLStyle_put_fontWeight(style
, str
);
798 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
802 hres
= IHTMLStyle_put_fontWeight(style
, str
);
803 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
807 hres
= IHTMLStyle_put_fontWeight(style
, str
);
808 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
812 hres
= IHTMLStyle_put_fontWeight(style
, str
);
813 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
817 hres
= IHTMLStyle_put_fontWeight(style
, str
);
818 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
821 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
822 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
823 ok(!strcmp_wa(str
, "900"), "str != style900\n");
827 hres
= IHTMLStyle_put_fontWeight(style
, str
);
828 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
831 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
832 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
833 ok(!str
, "str != NULL\n");
836 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
837 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
838 SysFreeString(sDefault
);
841 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
842 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
844 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
845 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
847 str
= a2bstr("test");
848 hres
= IHTMLStyle_put_fontVariant(style
, str
);
849 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
852 str
= a2bstr("small-caps");
853 hres
= IHTMLStyle_put_fontVariant(style
, str
);
854 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
857 str
= a2bstr("normal");
858 hres
= IHTMLStyle_put_fontVariant(style
, str
);
859 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
862 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
863 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
864 SysFreeString(sDefault
);
866 str
= (void*)0xdeadbeef;
867 hres
= IHTMLStyle_get_display(style
, &str
);
868 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
869 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
871 str
= (void*)0xdeadbeef;
872 hres
= IHTMLStyle_get_visibility(style
, &str
);
873 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
874 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
877 hres
= IHTMLStyle_get_fontSize(style
, &v
);
878 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
879 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
880 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
884 hres
= IHTMLStyle_put_fontSize(style
, v
);
885 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
888 hres
= IHTMLStyle_get_fontSize(style
, &v
);
889 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
890 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
891 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
894 hres
= IHTMLStyle_get_color(style
, &v
);
895 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
896 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
897 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
901 hres
= IHTMLStyle_put_color(style
, v
);
902 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
905 hres
= IHTMLStyle_get_color(style
, &v
);
906 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
907 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
909 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
913 hres
= IHTMLStyle_put_lineHeight(style
, v
);
914 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
916 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
917 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
918 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
919 ok(!strcmp_wa(V_BSTR(&v
), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
922 V_BSTR(&v
) = a2bstr("300%");
923 hres
= IHTMLStyle_put_lineHeight(style
, v
);
924 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
927 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
928 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
929 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
930 ok(!strcmp_wa(V_BSTR(&v
), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
934 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
935 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
936 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
938 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
939 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
941 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
942 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
943 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
945 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
946 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
949 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
950 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
951 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
953 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
954 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
956 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
957 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
958 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
960 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
961 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
964 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
965 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
966 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
968 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
969 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
971 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
972 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
973 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
975 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
976 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
979 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
980 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
981 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
983 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
984 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
986 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
987 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
988 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
990 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
991 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
994 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
995 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
996 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
998 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
999 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
1001 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
1002 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
1003 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
1005 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
1006 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
1008 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
1009 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
1011 str
= a2bstr("invalid");
1012 hres
= IHTMLStyle_put_textDecoration(style
, str
);
1013 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
1016 set_text_decoration(style
, "none");
1017 test_text_decoration(style
, "none");
1018 set_text_decoration(style
, "underline");
1019 set_text_decoration(style
, "overline");
1020 set_text_decoration(style
, "line-through");
1021 set_text_decoration(style
, "blink");
1022 set_text_decoration(style
, "overline");
1023 set_text_decoration(style
, "blink");
1024 test_text_decoration(style
, "blink");
1026 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
1027 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
1028 SysFreeString(sDefault
);
1030 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
1031 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
1033 hres
= IHTMLStyle_get_posWidth(style
, &f
);
1034 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
1035 ok(f
== 0.0f
, "f = %f\n", f
);
1037 V_VT(&v
) = VT_EMPTY
;
1038 hres
= IHTMLStyle_get_width(style
, &v
);
1039 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1040 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1041 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
1043 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
1044 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
1046 hres
= IHTMLStyle_get_posWidth(style
, &f
);
1047 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
1049 f
== 2.2f
, /* IE8 */
1053 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1054 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1055 ok(l
== 2, "pixelWidth = %d\n", l
);
1058 V_BSTR(&v
) = a2bstr("auto");
1059 hres
= IHTMLStyle_put_width(style
, v
);
1060 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1063 V_VT(&v
) = VT_EMPTY
;
1064 hres
= IHTMLStyle_get_width(style
, &v
);
1065 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1066 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1067 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1072 hres
= IHTMLStyle_put_width(style
, v
);
1073 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
1076 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1077 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1078 ok(l
== 100, "pixelWidth = %d\n", l
);
1080 V_VT(&v
) = VT_EMPTY
;
1081 hres
= IHTMLStyle_get_width(style
, &v
);
1082 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1083 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1084 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1087 hres
= IHTMLStyle_put_pixelWidth(style
, 50);
1088 ok(hres
== S_OK
, "put_pixelWidth failed: %08x\n", hres
);
1091 hres
= IHTMLStyle_get_pixelWidth(style
, &l
);
1092 ok(hres
== S_OK
, "get_pixelWidth failed: %08x\n", hres
);
1093 ok(l
== 50, "pixelWidth = %d\n", l
);
1095 hres
= IHTMLStyle_get_pixelWidth(style
, NULL
);
1096 ok(hres
== E_POINTER
, "get_pixelWidth failed: %08x\n", hres
);
1098 V_VT(&v
) = VT_EMPTY
;
1099 hres
= IHTMLStyle_get_width(style
, &v
);
1100 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1101 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1102 ok(!strcmp_wa(V_BSTR(&v
), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1106 str
= (void*)0xdeadbeef;
1107 hres
= IHTMLStyle_get_margin(style
, &str
);
1108 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1109 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
1112 hres
= IHTMLStyle_put_margin(style
, str
);
1113 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1116 hres
= IHTMLStyle_get_margin(style
, &str
);
1117 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1118 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
1121 hres
= IHTMLStyle_put_margin(style
, NULL
);
1122 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
1124 str
= (void*)0xdeadbeef;
1125 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1126 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1127 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1128 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1131 V_BSTR(&v
) = a2bstr("6px");
1132 hres
= IHTMLStyle_put_marginTop(style
, v
);
1133 SysFreeString(V_BSTR(&v
));
1134 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1136 str
= (void*)0xdeadbeef;
1137 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1138 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1139 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1140 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1145 hres
= IHTMLStyle_put_marginTop(style
, v
);
1146 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
1148 str
= (void*)0xdeadbeef;
1149 hres
= IHTMLStyle_get_marginTop(style
, &v
);
1150 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1151 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
1152 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1156 hres
= IHTMLStyle_get_border(style
, &str
);
1157 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
1158 ok(!str
|| !*str
, "str is not empty\n");
1161 str
= a2bstr("1px");
1162 hres
= IHTMLStyle_put_border(style
, str
);
1163 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
1166 V_VT(&v
) = VT_EMPTY
;
1167 hres
= IHTMLStyle_get_left(style
, &v
);
1168 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1169 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1170 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1174 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1175 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1176 ok(!l
, "pixelLeft = %d\n", l
);
1179 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
1180 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
1183 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1184 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1185 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1187 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
1188 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
1190 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1191 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1193 f
== 4.9f
, /* IE8 */
1194 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1196 /* Ensure left is updated correctly. */
1197 V_VT(&v
) = VT_EMPTY
;
1198 hres
= IHTMLStyle_get_left(style
, &v
);
1199 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1200 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1201 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
1202 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
1203 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1208 V_BSTR(&v
) = a2bstr("3px");
1209 hres
= IHTMLStyle_put_left(style
, v
);
1210 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1213 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1214 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1215 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1218 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1219 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1220 ok(l
== 3, "pixelLeft = %d\n", l
);
1222 V_VT(&v
) = VT_EMPTY
;
1223 hres
= IHTMLStyle_get_left(style
, &v
);
1224 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1225 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1226 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1230 V_BSTR(&v
) = a2bstr("4.99");
1231 hres
= IHTMLStyle_put_left(style
, v
);
1232 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1236 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1237 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1238 ok(l
== 4, "pixelLeft = %d\n", l
);
1241 hres
= IHTMLStyle_put_left(style
, v
);
1242 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1244 V_VT(&v
) = VT_EMPTY
;
1245 hres
= IHTMLStyle_get_left(style
, &v
);
1246 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1247 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1248 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1251 V_VT(&v
) = VT_EMPTY
;
1252 hres
= IHTMLStyle_get_top(style
, &v
);
1253 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1254 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1255 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1259 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1260 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1261 ok(!l
, "pixelLeft = %d\n", l
);
1263 hres
= IHTMLStyle_put_pixelLeft(style
, 6);
1264 ok(hres
== S_OK
, "put_pixelLeft failed: %08x\n", hres
);
1267 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1268 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1269 ok(l
== 6, "pixelLeft = %d\n", l
);
1271 hres
= IHTMLStyle_get_pixelLeft(style
, NULL
);
1272 ok(hres
== E_POINTER
, "get_pixelLeft failed: %08x\n", hres
);
1274 V_VT(&v
) = VT_EMPTY
;
1275 hres
= IHTMLStyle_get_left(style
, &v
);
1276 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1277 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1278 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1282 hres
= IHTMLStyle_get_posTop(style
, NULL
);
1283 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
1286 hres
= IHTMLStyle_get_posTop(style
, &f
);
1287 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1288 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1290 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
1291 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
1293 hres
= IHTMLStyle_get_posTop(style
, &f
);
1294 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1296 f
== 4.9f
, /* IE8 */
1297 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1299 hres
= IHTMLStyle_put_pixelTop(style
, 6);
1300 ok(hres
== S_OK
, "put_pixelTop failed: %08x\n", hres
);
1303 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1304 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1305 ok(l
== 6, "pixelTop = %d\n", l
);
1307 hres
= IHTMLStyle_get_pixelTop(style
, NULL
);
1308 ok(hres
== E_POINTER
, "get_pixelTop failed: %08x\n", hres
);
1311 V_BSTR(&v
) = a2bstr("3px");
1312 hres
= IHTMLStyle_put_top(style
, v
);
1313 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1316 V_VT(&v
) = VT_EMPTY
;
1317 hres
= IHTMLStyle_get_top(style
, &v
);
1318 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1319 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1320 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1323 hres
= IHTMLStyle_get_posTop(style
, &f
);
1324 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1325 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1328 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1329 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1330 ok(l
== 3, "pixelTop = %d\n", l
);
1333 hres
= IHTMLStyle_put_top(style
, v
);
1334 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1336 V_VT(&v
) = VT_EMPTY
;
1337 hres
= IHTMLStyle_get_top(style
, &v
);
1338 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1339 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1340 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1344 hres
= IHTMLStyle_get_pixelTop(style
, &l
);
1345 ok(hres
== S_OK
, "get_pixelTop failed: %08x\n", hres
);
1346 ok(!l
, "pixelTop = %d\n", l
);
1348 /* Test posHeight */
1349 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1350 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1352 V_VT(&v
) = VT_EMPTY
;
1353 hres
= IHTMLStyle_get_height(style
, &v
);
1354 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1355 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1356 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1360 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1361 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1362 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1365 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1366 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1367 ok(!l
, "pixelHeight = %d\n", l
);
1369 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1370 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1372 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1373 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1375 f
== 4.9f
, /* IE8 */
1376 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1379 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1380 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1383 "pixelHeight = %d\n", l
);
1386 V_BSTR(&v
) = a2bstr("70px");
1387 hres
= IHTMLStyle_put_height(style
, v
);
1388 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1391 V_VT(&v
) = VT_EMPTY
;
1392 hres
= IHTMLStyle_get_height(style
, &v
);
1393 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1394 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1395 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1399 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1400 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1401 ok(l
== 70, "pixelHeight = %d\n", l
);
1405 hres
= IHTMLStyle_put_height(style
, v
);
1406 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1409 V_VT(&v
) = VT_EMPTY
;
1410 hres
= IHTMLStyle_get_height(style
, &v
);
1411 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1412 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1413 ok(!V_BSTR(&v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v
)));
1417 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1418 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1419 ok(!l
, "pixelHeight = %d\n", l
);
1421 hres
= IHTMLStyle_put_pixelHeight(style
, 50);
1422 ok(hres
== S_OK
, "put_pixelHeight failed: %08x\n", hres
);
1425 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1426 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1427 ok(l
== 50, "pixelHeight = %d\n", l
);
1429 hres
= IHTMLStyle_get_pixelHeight(style
, NULL
);
1430 ok(hres
== E_POINTER
, "get_pixelHeight failed: %08x\n", hres
);
1434 hres
= IHTMLStyle_put_height(style
, v
);
1435 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1437 V_VT(&v
) = VT_EMPTY
;
1438 hres
= IHTMLStyle_get_height(style
, &v
);
1439 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1440 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1441 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1444 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1445 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1446 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
1449 hres
= IHTMLStyle_get_pixelHeight(style
, &l
);
1450 ok(hres
== S_OK
, "get_pixelHeight failed: %08x\n", hres
);
1451 ok(l
== 64, "pixelHeight = %d\n", l
);
1453 str
= (void*)0xdeadbeef;
1454 hres
= IHTMLStyle_get_cursor(style
, &str
);
1455 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1456 ok(!str
, "get_cursor != NULL\n");
1459 str
= a2bstr("default");
1460 hres
= IHTMLStyle_put_cursor(style
, str
);
1461 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1465 hres
= IHTMLStyle_get_cursor(style
, &str
);
1466 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1467 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1470 V_VT(&v
) = VT_EMPTY
;
1471 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1472 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1473 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1474 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1478 V_BSTR(&v
) = a2bstr("middle");
1479 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1480 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1483 V_VT(&v
) = VT_EMPTY
;
1484 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1485 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1486 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1487 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1492 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1493 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1496 V_VT(&v
) = VT_EMPTY
;
1497 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1498 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1499 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1500 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1503 str
= (void*)0xdeadbeef;
1504 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1505 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1506 ok(!str
, "textAlign != NULL\n");
1508 str
= a2bstr("center");
1509 hres
= IHTMLStyle_put_textAlign(style
, str
);
1510 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1514 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1515 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1516 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1520 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1521 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1522 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1523 ok(!V_BSTR(&v
), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1527 hres
= IHTMLStyle_put_textIndent(style
, v
);
1528 ok(hres
== S_OK
, "put_textIndent failed: %08x\n", hres
);
1531 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1532 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1533 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1534 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1536 str
= (void*)0xdeadbeef;
1537 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1538 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1539 ok(!str
, "textTransform != NULL\n");
1541 str
= a2bstr("lowercase");
1542 hres
= IHTMLStyle_put_textTransform(style
, str
);
1543 ok(hres
== S_OK
, "put_textTransform failed: %08x\n", hres
);
1547 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1548 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1549 ok(!strcmp_wa(str
, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1552 str
= (void*)0xdeadbeef;
1553 hres
= IHTMLStyle_get_filter(style
, &str
);
1554 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1555 ok(!str
, "filter != NULL\n");
1557 str
= a2bstr("alpha(opacity=100)");
1558 hres
= IHTMLStyle_put_filter(style
, str
);
1559 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1562 V_VT(&v
) = VT_EMPTY
;
1563 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1564 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1565 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1566 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1570 V_BSTR(&v
) = a2bstr("1");
1571 hres
= IHTMLStyle_put_zIndex(style
, v
);
1572 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1575 V_VT(&v
) = VT_EMPTY
;
1576 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1577 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1578 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1579 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1583 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1584 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1586 str
= a2bstr("test");
1587 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1588 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1591 str
= a2bstr("italic");
1592 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1593 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1596 str
= a2bstr("oblique");
1597 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1598 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1601 str
= a2bstr("normal");
1602 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1603 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1606 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1607 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1608 SysFreeString(sDefault
);
1611 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1612 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1614 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1615 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1617 str
= a2bstr("test");
1618 hres
= IHTMLStyle_put_overflow(style
, str
);
1619 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1622 str
= a2bstr("visible");
1623 hres
= IHTMLStyle_put_overflow(style
, str
);
1624 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1627 str
= a2bstr("scroll");
1628 hres
= IHTMLStyle_put_overflow(style
, str
);
1629 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1632 str
= a2bstr("hidden");
1633 hres
= IHTMLStyle_put_overflow(style
, str
);
1634 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1637 str
= a2bstr("auto");
1638 hres
= IHTMLStyle_put_overflow(style
, str
);
1639 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1642 hres
= IHTMLStyle_get_overflow(style
, &str
);
1643 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1644 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1648 hres
= IHTMLStyle_put_overflow(style
, str
);
1649 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1652 hres
= IHTMLStyle_get_overflow(style
, &str
);
1653 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1654 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1657 /* restore overflow default */
1658 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1659 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1660 SysFreeString(sOverflowDefault
);
1662 /* Attribute Tests*/
1663 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1664 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1666 str
= a2bstr("position");
1667 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1668 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1670 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1671 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1672 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1675 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1676 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1679 V_BSTR(&v
) = a2bstr("absolute");
1680 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1681 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1684 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1685 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1686 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1687 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1692 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1693 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1698 str
= a2bstr("borderLeftStyle");
1699 test_border_styles(style
, str
);
1702 str
= a2bstr("borderbottomstyle");
1703 test_border_styles(style
, str
);
1706 str
= a2bstr("borderrightstyle");
1707 test_border_styles(style
, str
);
1710 str
= a2bstr("bordertopstyle");
1711 test_border_styles(style
, str
);
1714 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1715 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1717 str
= a2bstr("none dotted dashed solid");
1718 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1719 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1722 str
= a2bstr("none dotted dashed solid");
1723 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1724 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1725 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1726 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1729 str
= a2bstr("double groove ridge inset");
1730 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1731 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1734 str
= a2bstr("window-inset outset ridge inset");
1735 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1736 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1739 str
= a2bstr("window-inset");
1740 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1741 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1744 str
= a2bstr("none none none none none");
1745 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1746 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1749 str
= a2bstr("invalid none none none");
1750 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1751 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1754 str
= a2bstr("none invalid none none");
1755 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1756 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1759 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1760 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1761 SysFreeString(sDefault
);
1763 /* backgoundColor */
1764 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1765 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1766 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1767 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1771 V_BSTR(&v
) = a2bstr("red");
1772 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
1773 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
1776 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1777 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1778 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1779 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1782 str
= a2bstr("fixed");
1783 hres
= IHTMLStyle_put_backgroundAttachment(style
, str
);
1784 ok(hres
== S_OK
, "put_backgroundAttachment failed: %08x\n", hres
);
1787 hres
= IHTMLStyle_get_backgroundAttachment(style
, &str
);
1788 ok(hres
== S_OK
, "get_backgroundAttachment failed: %08x\n", hres
);
1789 ok(!strcmp_wa(str
, "fixed"), "ret = %s\n", wine_dbgstr_w(str
));
1793 hres
= IHTMLStyle_get_padding(style
, &str
);
1794 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1795 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1798 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1799 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1800 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1801 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1805 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1806 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1808 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1809 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1810 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1811 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1814 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1815 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1816 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1817 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1821 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1822 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1824 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1825 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1826 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1827 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1830 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1831 ok(hres
== S_OK
, "get_paddingBottom: %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_paddingBottom(style
, v
);
1838 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1840 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1841 ok(hres
== S_OK
, "get_paddingBottom: %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
)));
1847 hres
= IHTMLStyle_put_padding(style
, str
);
1848 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1851 hres
= IHTMLStyle_get_padding(style
, &str
);
1852 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1853 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1857 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1858 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1859 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1860 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1863 V_BSTR(&v
) = a2bstr("10");
1864 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1865 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1868 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1869 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1870 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1873 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1874 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1876 /* BackgroundRepeat */
1877 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1878 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1880 str
= a2bstr("invalid");
1881 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1882 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1885 str
= a2bstr("repeat");
1886 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1887 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1890 str
= a2bstr("no-repeat");
1891 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1892 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1895 str
= a2bstr("repeat-x");
1896 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1897 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1900 str
= a2bstr("repeat-y");
1901 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1902 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1905 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1906 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1907 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1910 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1911 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1912 SysFreeString(sDefault
);
1915 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1916 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1918 str
= a2bstr("red green red blue");
1919 hres
= IHTMLStyle_put_borderColor(style
, str
);
1920 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1923 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1924 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1925 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1928 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1929 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1930 SysFreeString(sDefault
);
1933 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1934 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1936 str
= a2bstr("thick dotted red");
1937 hres
= IHTMLStyle_put_borderRight(style
, str
);
1938 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1941 /* IHTMLStyle_get_borderRight appears to have a bug where
1942 it returns the first letter of the color. So we check
1943 each style individually.
1946 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1947 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1948 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1952 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1953 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1954 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1957 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1958 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1959 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1962 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1963 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1964 SysFreeString(sDefault
);
1967 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1968 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1970 str
= a2bstr("thick dotted red");
1971 hres
= IHTMLStyle_put_borderTop(style
, str
);
1972 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1975 /* IHTMLStyle_get_borderTop appears to have a bug where
1976 it returns the first letter of the color. So we check
1977 each style individually.
1980 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1981 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1982 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1986 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1987 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1988 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1991 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1992 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1993 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1996 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1997 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1998 SysFreeString(sDefault
);
2001 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
2002 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
2004 str
= a2bstr("thick dotted red");
2005 hres
= IHTMLStyle_put_borderBottom(style
, str
);
2006 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
2009 /* IHTMLStyle_get_borderBottom appears to have a bug where
2010 it returns the first letter of the color. So we check
2011 each style individually.
2014 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2015 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2016 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2020 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2021 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2022 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2025 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
2026 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2027 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2030 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
2031 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
2032 SysFreeString(sDefault
);
2035 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
2036 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
2038 str
= a2bstr("thick dotted red");
2039 hres
= IHTMLStyle_put_borderLeft(style
, str
);
2040 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
2043 /* IHTMLStyle_get_borderLeft appears to have a bug where
2044 it returns the first letter of the color. So we check
2045 each style individually.
2048 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2049 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2050 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2054 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2055 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2056 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
2059 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
2060 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2061 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
2064 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
2065 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
2066 SysFreeString(sDefault
);
2068 /* backgroundPositionX */
2069 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2070 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2071 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2072 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2076 V_BSTR(&v
) = a2bstr("10px");
2077 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
2078 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
2081 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2082 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2083 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2084 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2087 /* backgroundPositionY */
2088 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2089 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2090 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2094 V_BSTR(&v
) = a2bstr("15px");
2095 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
2096 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
2099 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2100 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2101 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2102 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2105 /* backgroundPosition */
2107 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2108 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2109 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2112 str
= a2bstr("center 20%");
2113 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
2114 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
2118 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
2119 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
2120 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
2123 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
2124 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
2125 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2126 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2129 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
2130 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
2131 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2132 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2135 /* borderTopWidth */
2136 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
2137 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2140 V_BSTR(&v
) = a2bstr("10px");
2141 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
2142 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2145 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
2146 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
2147 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2150 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
2151 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
2152 VariantClear(&vDefault
);
2154 /* borderRightWidth */
2155 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
2156 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2159 V_BSTR(&v
) = a2bstr("10");
2160 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
2161 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2164 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
2165 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
2166 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2169 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
2170 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
2171 VariantClear(&vDefault
);
2173 /* borderBottomWidth */
2174 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
2175 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2178 V_BSTR(&v
) = a2bstr("10");
2179 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
2180 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2183 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
2184 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
2185 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2188 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
2189 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
2190 VariantClear(&vDefault
);
2192 /* borderLeftWidth */
2193 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
2194 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2197 V_BSTR(&v
) = a2bstr("10");
2198 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
2199 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2202 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
2203 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
2204 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2207 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
2208 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
2209 VariantClear(&vDefault
);
2212 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
2213 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2216 V_BSTR(&v
) = a2bstr("10");
2217 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
2218 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2221 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
2222 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
2223 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2224 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2227 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
2228 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
2229 VariantClear(&vDefault
);
2232 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
2233 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2236 V_BSTR(&v
) = a2bstr("11");
2237 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
2238 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2241 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
2242 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
2243 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2244 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2247 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
2248 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2249 VariantClear(&vDefault
);
2251 /* borderTopColor */
2252 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
2253 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2256 V_BSTR(&v
) = a2bstr("red");
2257 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
2258 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2261 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2262 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2263 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2266 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
2267 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2269 /* borderRightColor */
2270 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
2271 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2274 V_BSTR(&v
) = a2bstr("blue");
2275 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
2276 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
2279 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
2280 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2281 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2284 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
2285 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
2287 /* borderBottomColor */
2288 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
2289 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2292 V_BSTR(&v
) = a2bstr("cyan");
2293 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
2294 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2297 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2298 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2299 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2302 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
2303 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2305 /* borderLeftColor */
2306 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
2307 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2310 V_BSTR(&v
) = a2bstr("cyan");
2311 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
2312 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2315 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2316 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2317 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2320 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
2321 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2324 hres
= IHTMLStyle_get_clip(style
, &str
);
2325 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2326 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
2328 str
= a2bstr("rect(0px 1px 500px 505px)");
2329 hres
= IHTMLStyle_put_clip(style
, str
);
2330 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
2333 hres
= IHTMLStyle_get_clip(style
, &str
);
2334 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2335 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
2339 hres
= IHTMLStyle_get_clear(style
, &str
);
2340 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2341 ok(!str
, "clear = %s\n", wine_dbgstr_w(str
));
2343 str
= a2bstr("both");
2344 hres
= IHTMLStyle_put_clear(style
, str
);
2345 ok(hres
== S_OK
, "put_clear failed: %08x\n", hres
);
2348 hres
= IHTMLStyle_get_clear(style
, &str
);
2349 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2350 ok(!strcmp_wa(str
, "both"), "clear = %s\n", wine_dbgstr_w(str
));
2353 /* pageBreakAfter */
2354 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2355 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2356 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2358 str
= a2bstr("always");
2359 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
2360 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2363 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2364 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2365 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2368 /* pageBreakBefore */
2369 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2370 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2371 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2373 str
= a2bstr("always");
2374 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
2375 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
2378 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2379 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2380 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2383 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
2384 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
2386 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2387 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2388 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2390 str
= (void*)0xdeadbeef;
2391 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2392 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2393 ok(!str
, "whiteSpace = %s\n", wine_dbgstr_w(str
));
2395 str
= a2bstr("nowrap");
2396 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2398 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2401 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2402 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2403 ok(!strcmp_wa(str
, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2407 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2408 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2409 ok(!str
, "listStyleType = %s\n", wine_dbgstr_w(str
));
2411 str
= a2bstr("square");
2412 hres
= IHTMLStyle_put_listStyleType(style
, str
);
2413 ok(hres
== S_OK
, "put_listStyleType failed: %08x\n", hres
);
2417 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2418 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2419 ok(!strcmp_wa(str
, "square"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2421 str
= a2bstr("inside");
2422 hres
= IHTMLStyle_put_listStylePosition(style
, str
);
2423 ok(hres
== S_OK
, "put_listStylePosition failed: %08x\n", hres
);
2426 hres
= IHTMLStyle_get_listStylePosition(style
, &str
);
2427 ok(hres
== S_OK
, "get_listStylePosition failed: %08x\n", hres
);
2428 ok(!strcmp_wa(str
, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2431 str
= a2bstr("decimal-leading-zero none inside");
2432 hres
= IHTMLStyle_put_listStyle(style
, str
);
2433 ok(hres
== S_OK
|| broken(hres
== E_INVALIDARG
), /* win 2000 */
2434 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str
), hres
);
2437 if (hres
!= E_INVALIDARG
) {
2438 hres
= IHTMLStyle_get_listStyle(style
, &str
);
2439 ok(hres
== S_OK
, "get_listStyle failed: %08x\n", hres
);
2440 ok(strstr_wa(str
, "decimal-leading-zero") &&
2441 strstr_wa(str
, "none") != NULL
&&
2442 strstr_wa(str
, "inside") != NULL
,
2443 "listStyle = %s\n", wine_dbgstr_w(str
));
2446 win_skip("IHTMLStyle_put_listStyle already failed\n");
2449 str
= (void*)0xdeadbeef;
2450 hres
= IHTMLStyle_get_styleFloat(style
, &str
);
2451 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
2452 ok(!str
, "styleFloat = %s\n", wine_dbgstr_w(str
));
2454 str
= a2bstr("left");
2455 hres
= IHTMLStyle_put_styleFloat(style
, str
);
2456 ok(hres
== S_OK
, "put_styleFloat failed: %08x\n", hres
);
2460 hres
= IHTMLStyle_get_styleFloat(style
, &str
);
2461 ok(hres
== S_OK
, "get_styleFloat failed: %08x\n", hres
);
2462 ok(!strcmp_wa(str
, "left"), "styleFloat = %s\n", wine_dbgstr_w(str
));
2464 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
2465 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
2466 if(SUCCEEDED(hres
)) {
2467 test_style2(style2
);
2468 IHTMLStyle2_Release(style2
);
2471 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
2472 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
2473 if(SUCCEEDED(hres
)) {
2474 test_style3(style3
);
2475 IHTMLStyle3_Release(style3
);
2478 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
2479 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
2480 if(SUCCEEDED(hres
)) {
2481 test_style4(style4
);
2482 IHTMLStyle4_Release(style4
);
2485 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle5
, (void**)&style5
);
2486 if(SUCCEEDED(hres
)) {
2487 test_style5(style5
);
2488 IHTMLStyle5_Release(style5
);
2490 win_skip("IHTMLStyle5 not available\n");
2493 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle6
, (void**)&style6
);
2494 if(SUCCEEDED(hres
)) {
2495 test_style6(style6
);
2496 IHTMLStyle6_Release(style6
);
2498 win_skip("IHTMLStyle6 not available\n");
2502 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2503 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
2508 str
= (void*)0xdeadbeef;
2509 hres
= IHTMLStyle_get_filter(style
, &str
);
2510 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2512 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2514 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2519 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2520 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
2525 str
= (void*)0xdeadbeef;
2526 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
2527 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2529 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2531 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2536 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2537 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
2539 BSTR str
= a2bstr(val
);
2542 hres
= IHTMLStyle_put_filter(style
, str
);
2543 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
2546 _test_style_filter(line
, style
, val
);
2549 static void test_style_filters(IHTMLElement
*elem
)
2551 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
2552 IHTMLCurrentStyle2
*current_style2
;
2553 IHTMLCurrentStyle
*current_style
;
2557 hres
= IHTMLElement_get_style(elem
, &style
);
2558 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2560 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
2561 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2563 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2565 test_style_filter(style
, NULL
);
2566 test_current_style_filter(current_style2
, NULL
);
2567 set_style_filter(style
, "alpha(opacity=50.0040)");
2568 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
2569 set_style_filter(style
, "alpha(opacity=100)");
2571 IHTMLStyle_Release(style
);
2573 hres
= IHTMLElement_get_style(elem
, &style
);
2574 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2576 test_style_filter(style
, "alpha(opacity=100)");
2577 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
2578 set_style_filter(style
, NULL
);
2579 set_style_filter(style
, "alpha(opacity=100)");
2580 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
2581 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
2582 test_style_filter(style
, NULL
);
2585 IHTMLCurrentStyle2_Release(current_style2
);
2586 IHTMLStyle_Release(style
);
2587 IHTMLElement2_Release(elem2
);
2590 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2592 IHTMLCurrentStyle2
*current_style2
;
2598 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2599 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2600 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2603 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2604 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2605 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2608 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2609 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2612 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2613 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2614 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2617 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2618 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2619 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2622 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2623 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2624 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2627 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2628 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2629 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
2632 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
2633 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2634 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
2637 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
2638 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2639 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
2642 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
2643 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2644 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
2647 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
2648 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
2649 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2652 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2653 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2654 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2657 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2658 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2659 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2662 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2663 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2664 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2667 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2668 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2671 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2672 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2675 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2676 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2679 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2680 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2683 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2684 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2687 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2688 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2691 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2692 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2695 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2696 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2697 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2698 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2701 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2702 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2703 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2706 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2707 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2708 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2711 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2712 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2713 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2716 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2717 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2718 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2721 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2722 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2723 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2726 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2727 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2728 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2731 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2732 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2733 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2734 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2737 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2738 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2739 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2740 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2743 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2744 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2745 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2748 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2749 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2750 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2753 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2754 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2755 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2759 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2760 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2761 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2764 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2765 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2766 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2769 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2770 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2771 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2774 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2775 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2776 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2779 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2780 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2781 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2784 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2785 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2786 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2789 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2790 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2791 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2794 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2795 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2796 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2799 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2800 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2801 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2804 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2805 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2806 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2809 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2810 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2811 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2814 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2815 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2816 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2819 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2820 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2821 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2824 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2825 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2826 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2829 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2830 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2831 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2834 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2835 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2836 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2839 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2840 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2841 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2844 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2845 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2846 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2849 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2850 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2851 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2854 hres
= IHTMLCurrentStyle_get_textTransform(current_style
, &str
);
2855 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
2858 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2861 hres
= IHTMLCurrentStyle2_get_hasLayout(current_style2
, &b
);
2862 ok(hres
== S_OK
, "get_hasLayout failed: %08x\n", hres
);
2863 ok(b
== VARIANT_TRUE
, "hasLayout = %x\n", b
);
2865 IHTMLCurrentStyle2_Release(current_style2
);
2868 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2870 static void basic_style_test(IHTMLDocument2
*doc
)
2872 IHTMLCurrentStyle
*cstyle
;
2877 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2878 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2880 hres
= IHTMLElement_get_style(elem
, &style
);
2881 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2883 test_body_style(style
);
2885 cstyle
= get_current_style(elem
);
2886 test_current_style(cstyle
);
2887 IHTMLCurrentStyle_Release(cstyle
);
2888 IHTMLElement_Release(elem
);
2890 elem
= get_element_by_id(doc
, "divid");
2891 test_style_filters(elem
);
2893 test_set_csstext(style
);
2894 IHTMLStyle_Release(style
);
2895 IHTMLElement_Release(elem
);
2898 static const char runtimestyle_test_str
[] =
2899 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2901 static void runtimestyle_test(IHTMLDocument2
*doc
)
2903 IHTMLStyle
*style
, *runtime_style
;
2904 IHTMLElement2
*elem2
;
2909 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2910 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2912 elem2
= get_elem2_iface((IUnknown
*)elem
);
2914 hres
= IHTMLElement2_get_runtimeStyle(elem2
, &runtime_style
);
2915 ok(hres
== S_OK
, "get_runtimeStyle failed: %08x\n", hres
);
2917 hres
= IHTMLElement_get_style(elem
, &style
);
2918 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2920 test_text_decoration(style
, NULL
);
2921 test_text_decoration(runtime_style
, NULL
);
2922 set_text_decoration(style
, "underline");
2923 test_text_decoration(style
, "underline");
2925 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2926 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2927 ok(broken(!str
) || !strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2930 set_text_decoration(runtime_style
, "blink");
2931 test_text_decoration(runtime_style
, "blink");
2933 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2934 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2936 ok(!strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2939 IHTMLStyle_Release(runtime_style
);
2940 IHTMLStyle_Release(style
);
2941 IHTMLElement2_Release(elem2
);
2942 IHTMLElement_Release(elem
);
2945 static IHTMLDocument2
*notif_doc
;
2946 static BOOL doc_complete
;
2948 static IHTMLDocument2
*create_document(void)
2950 IHTMLDocument2
*doc
;
2951 IHTMLDocument5
*doc5
;
2954 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2955 &IID_IHTMLDocument2
, (void**)&doc
);
2956 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2960 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2962 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2963 IHTMLDocument2_Release(doc
);
2967 IHTMLDocument5_Release(doc5
);
2971 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2972 REFIID riid
, void**ppv
)
2974 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2979 ok(0, "unexpected call\n");
2980 return E_NOINTERFACE
;
2983 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2988 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2993 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2995 if(dispID
== DISPID_READYSTATE
){
2999 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
3000 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3002 if(!strcmp_wa(state
, "complete"))
3003 doc_complete
= TRUE
;
3005 SysFreeString(state
);
3011 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
3013 ok(0, "unexpected call\n");
3017 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
3018 PropertyNotifySink_QueryInterface
,
3019 PropertyNotifySink_AddRef
,
3020 PropertyNotifySink_Release
,
3021 PropertyNotifySink_OnChanged
,
3022 PropertyNotifySink_OnRequestEdit
3025 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
3027 static IHTMLDocument2
*create_doc_with_string(const char *str
)
3029 IPersistStreamInit
*init
;
3031 IHTMLDocument2
*doc
;
3035 notif_doc
= doc
= create_document();
3039 doc_complete
= FALSE
;
3041 mem
= GlobalAlloc(0, len
);
3042 memcpy(mem
, str
, len
);
3043 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
3045 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
3047 IPersistStreamInit_Load(init
, stream
);
3048 IPersistStreamInit_Release(init
);
3049 IStream_Release(stream
);
3054 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
3056 IConnectionPointContainer
*container
;
3057 IConnectionPoint
*cp
;
3061 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
3062 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
3064 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
3065 IConnectionPointContainer_Release(container
);
3066 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
3068 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
3069 IConnectionPoint_Release(cp
);
3070 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3073 typedef void (*style_test_t
)(IHTMLDocument2
*);
3075 static void run_test(const char *str
, style_test_t test
)
3077 IHTMLDocument2
*doc
;
3081 doc
= create_doc_with_string(str
);
3085 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
3087 while(!doc_complete
&& GetMessageW(&msg
, NULL
, 0, 0)) {
3088 TranslateMessage(&msg
);
3089 DispatchMessageW(&msg
);
3094 ref
= IHTMLDocument2_Release(doc
);
3095 ok(!ref
|| broken(ref
== 1), /* Vista */
3104 run_test(basic_test_str
, basic_style_test
);
3105 run_test(runtimestyle_test_str
, runtimestyle_test
);