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 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
63 static void _test_var_bstr(unsigned line
, const VARIANT
*v
, const char *expect
)
65 ok_(__FILE__
,line
)(V_VT(v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(v
));
67 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(v
), expect
), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), expect
);
69 ok_(__FILE__
,line
)(!V_BSTR(v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v
)));
72 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
73 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
78 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
79 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
83 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
84 static IHTMLCurrentStyle2
*_get_current_style2_iface(unsigned line
, IUnknown
*unk
)
86 IHTMLCurrentStyle2
*current_style2
;
89 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
90 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
91 return current_style2
;
94 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
99 BSTR idW
= a2bstr(id
);
101 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
102 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
104 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
105 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
106 ok(result
!= NULL
, "result == NULL\n");
109 IHTMLDocument3_Release(doc3
);
113 #define get_current_style(e) _get_current_style(__LINE__,e)
114 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
116 IHTMLCurrentStyle
*cstyle
;
117 IHTMLElement2
*elem2
;
120 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
121 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
124 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
125 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
126 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
128 IHTMLElement2_Release(elem2
);
132 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
133 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
138 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
139 LOCALE_USER_DEFAULT
, &dispid
);
140 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
143 DISPPARAMS params
= {NULL
,NULL
,0,0};
144 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
149 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
150 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
151 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
154 params
.cNamedArgs
= 1;
155 params
.rgdispidNamedArgs
= &dispidNamed
;
156 V_VT(&arg
) = VT_BSTR
;
157 V_BSTR(&arg
) = a2bstr("none");
158 params
.rgvarg
= &arg
;
159 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
160 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
161 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
164 V_VT(&arg
) = VT_BSTR
;
165 V_BSTR(&arg
) = a2bstr("dotted");
166 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
167 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
168 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
171 V_VT(&arg
) = VT_BSTR
;
172 V_BSTR(&arg
) = a2bstr("dashed");
173 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
174 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
175 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
178 V_VT(&arg
) = VT_BSTR
;
179 V_BSTR(&arg
) = a2bstr("solid");
180 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
181 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
182 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
185 V_VT(&arg
) = VT_BSTR
;
186 V_BSTR(&arg
) = a2bstr("double");
187 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
188 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
189 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
192 V_VT(&arg
) = VT_BSTR
;
193 V_BSTR(&arg
) = a2bstr("groove");
194 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
195 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
196 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
199 V_VT(&arg
) = VT_BSTR
;
200 V_BSTR(&arg
) = a2bstr("ridge");
201 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
202 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
203 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
206 V_VT(&arg
) = VT_BSTR
;
207 V_BSTR(&arg
) = a2bstr("inset");
208 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
209 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
210 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
213 V_VT(&arg
) = VT_BSTR
;
214 V_BSTR(&arg
) = a2bstr("outset");
215 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
216 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
217 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
220 V_VT(&arg
) = VT_BSTR
;
221 V_BSTR(&arg
) = a2bstr("invalid");
222 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
223 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
224 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
227 params
.rgvarg
= &vDefault
;
228 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
229 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
230 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
231 VariantClear(&vDefault
);
235 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
236 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
238 BSTR text
= (void*)0xdeadbeef;
241 hres
= IHTMLStyle_get_cssText(style
, &text
);
242 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
244 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
246 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
251 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
252 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
258 hres
= IHTMLStyle_put_cssText(style
, tmp
);
259 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
263 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
264 static void _test_style_remove_attribute(unsigned line
, IHTMLStyle
*style
, const char *attr
, VARIANT_BOOL exb
)
266 BSTR str
= a2bstr(attr
);
267 VARIANT_BOOL b
= 100;
270 hres
= IHTMLStyle_removeAttribute(style
, str
, 1, &b
);
272 ok_(__FILE__
,line
)(hres
== S_OK
, "removeAttribute failed: %08x\n", hres
);
273 ok_(__FILE__
,line
)(b
== exb
, "removeAttribute returned %x, expected %x\n", b
, exb
);
276 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
277 static void _set_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *v
)
283 hres
= IHTMLStyle_put_textDecoration(style
, str
);
284 ok_(__FILE__
,line
)(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
288 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
289 static void _test_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *exdec
)
294 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
295 ok_(__FILE__
,line
)(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
297 ok_(__FILE__
,line
)(!strcmp_wa(str
, exdec
), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str
), exdec
);
299 ok_(__FILE__
,line
)(!str
, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str
));
303 static void test_set_csstext(IHTMLStyle
*style
)
308 test_style_set_csstext(style
, "background-color: black;");
310 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
311 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
312 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
313 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
317 static void test_style2(IHTMLStyle2
*style2
)
323 str
= (void*)0xdeadbeef;
324 hres
= IHTMLStyle2_get_position(style2
, &str
);
325 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
326 ok(!str
, "str != NULL\n");
328 str
= a2bstr("absolute");
329 hres
= IHTMLStyle2_put_position(style2
, str
);
330 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
334 hres
= IHTMLStyle2_get_position(style2
, &str
);
335 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
336 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
341 hres
= IHTMLStyle2_get_right(style2
, &v
);
342 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
343 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
344 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
348 V_BSTR(&v
) = a2bstr("3px");
349 hres
= IHTMLStyle2_put_right(style2
, v
);
350 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
354 hres
= IHTMLStyle2_get_right(style2
, &v
);
355 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
356 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
357 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
361 str
= (void*)0xdeadbeef;
362 hres
= IHTMLStyle2_get_direction(style2
, &str
);
363 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
364 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
367 hres
= IHTMLStyle2_put_direction(style2
, str
);
368 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
372 hres
= IHTMLStyle2_get_direction(style2
, &str
);
373 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
374 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
379 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
380 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
381 test_var_bstr(&v
, NULL
);
385 hres
= IHTMLStyle2_put_bottom(style2
, v
);
386 ok(hres
== S_OK
, "put_bottom failed: %08x\n", hres
);
389 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
390 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
391 test_var_bstr(&v
, "4px");
394 str
= (void*)0xdeadbeef;
395 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
396 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
397 ok(!str
, "overflowX = %s\n", wine_dbgstr_w(str
));
399 str
= a2bstr("hidden");
400 hres
= IHTMLStyle2_put_overflowX(style2
, str
);
401 ok(hres
== S_OK
, "put_overflowX failed: %08x\n", hres
);
405 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
406 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
407 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
410 str
= (void*)0xdeadbeef;
411 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
412 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
413 ok(!str
, "overflowY = %s\n", wine_dbgstr_w(str
));
415 str
= a2bstr("hidden");
416 hres
= IHTMLStyle2_put_overflowY(style2
, str
);
417 ok(hres
== S_OK
, "put_overflowY failed: %08x\n", hres
);
421 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
422 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
423 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
426 str
= a2bstr("fixed");
427 hres
= IHTMLStyle2_put_tableLayout(style2
, str
);
428 ok(hres
== S_OK
, "put_tableLayout failed: %08x\n", hres
);
431 str
= (void*)0xdeadbeef;
432 hres
= IHTMLStyle2_get_tableLayout(style2
, &str
);
433 ok(hres
== S_OK
, "get_tableLayout failed: %08x\n", hres
);
434 ok(!strcmp_wa(str
, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str
));
438 static void test_style3(IHTMLStyle3
*style3
)
443 str
= (void*)0xdeadbeef;
444 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
445 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
446 ok(!str
, "str != NULL\n");
448 str
= a2bstr("break-word");
449 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
450 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
454 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
455 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
456 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
460 static void test_style4(IHTMLStyle4
*style4
)
466 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
467 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
470 V_BSTR(&v
) = a2bstr("10px");
471 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
472 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
475 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
476 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
477 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
478 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
481 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
482 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
483 VariantClear(&vdefault
);
486 static void test_style6(IHTMLStyle6
*style
)
491 str
= (void*)0xdeadbeef;
492 hres
= IHTMLStyle6_get_outline(style
, &str
);
493 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
494 ok(str
&& !*str
, "outline = %s\n", wine_dbgstr_w(str
));
498 hres
= IHTMLStyle6_put_outline(style
, str
);
499 ok(hres
== S_OK
, "put_outline failed: %08x\n", hres
);
502 str
= (void*)0xdeadbeef;
503 hres
= IHTMLStyle6_get_outline(style
, &str
);
504 ok(hres
== S_OK
, "get_outline failed: %08x\n", hres
);
505 ok(wstr_contains(str
, "1px"), "outline = %s\n", wine_dbgstr_w(str
));
508 str
= (void*)0xdeadbeef;
509 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
510 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
511 ok(!str
, "boxSizing = %s\n", wine_dbgstr_w(str
));
514 str
= a2bstr("border-box");
515 hres
= IHTMLStyle6_put_boxSizing(style
, str
);
516 ok(hres
== S_OK
, "put_boxSizing failed: %08x\n", hres
);
520 hres
= IHTMLStyle6_get_boxSizing(style
, &str
);
521 ok(hres
== S_OK
, "get_boxSizing failed: %08x\n", hres
);
522 ok(!strcmp_wa(str
, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str
));
526 static void test_body_style(IHTMLStyle
*style
)
537 BSTR sOverflowDefault
;
542 test_style_csstext(style
, NULL
);
544 hres
= IHTMLStyle_get_position(style
, &str
);
545 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
546 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
549 hres
= IHTMLStyle_get_marginRight(style
, &v
);
550 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
551 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
552 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
556 hres
= IHTMLStyle_put_marginRight(style
, v
);
557 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
560 hres
= IHTMLStyle_get_marginRight(style
, &v
);
561 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
562 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
563 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
566 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
567 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
568 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
569 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
573 hres
= IHTMLStyle_put_marginBottom(style
, v
);
574 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
577 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
578 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
579 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
580 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
583 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
584 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
585 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
586 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
590 hres
= IHTMLStyle_put_marginLeft(style
, v
);
591 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
594 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
595 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
596 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
597 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
599 str
= (void*)0xdeadbeef;
600 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
601 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
602 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
604 str
= (void*)0xdeadbeef;
605 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
606 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
607 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
609 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
610 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
612 str
= a2bstr("test");
613 hres
= IHTMLStyle_put_fontWeight(style
, str
);
614 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
617 str
= a2bstr("bold");
618 hres
= IHTMLStyle_put_fontWeight(style
, str
);
619 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
622 str
= a2bstr("bolder");
623 hres
= IHTMLStyle_put_fontWeight(style
, str
);
624 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
627 str
= a2bstr("lighter");
628 hres
= IHTMLStyle_put_fontWeight(style
, str
);
629 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
633 hres
= IHTMLStyle_put_fontWeight(style
, str
);
634 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
638 hres
= IHTMLStyle_put_fontWeight(style
, str
);
639 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
643 hres
= IHTMLStyle_put_fontWeight(style
, str
);
644 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
648 hres
= IHTMLStyle_put_fontWeight(style
, str
);
649 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
653 hres
= IHTMLStyle_put_fontWeight(style
, str
);
654 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
658 hres
= IHTMLStyle_put_fontWeight(style
, str
);
659 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
663 hres
= IHTMLStyle_put_fontWeight(style
, str
);
664 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
668 hres
= IHTMLStyle_put_fontWeight(style
, str
);
669 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
673 hres
= IHTMLStyle_put_fontWeight(style
, str
);
674 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
677 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
678 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
679 ok(!strcmp_wa(str
, "900"), "str != style900\n");
682 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
683 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
684 SysFreeString(sDefault
);
687 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
688 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
690 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
691 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
693 str
= a2bstr("test");
694 hres
= IHTMLStyle_put_fontVariant(style
, str
);
695 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
698 str
= a2bstr("small-caps");
699 hres
= IHTMLStyle_put_fontVariant(style
, str
);
700 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
703 str
= a2bstr("normal");
704 hres
= IHTMLStyle_put_fontVariant(style
, str
);
705 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
708 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
709 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
710 SysFreeString(sDefault
);
712 str
= (void*)0xdeadbeef;
713 hres
= IHTMLStyle_get_display(style
, &str
);
714 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
715 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
717 str
= (void*)0xdeadbeef;
718 hres
= IHTMLStyle_get_visibility(style
, &str
);
719 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
720 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
723 hres
= IHTMLStyle_get_fontSize(style
, &v
);
724 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
725 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
726 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
730 hres
= IHTMLStyle_put_fontSize(style
, v
);
731 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
734 hres
= IHTMLStyle_get_fontSize(style
, &v
);
735 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
736 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
737 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
740 hres
= IHTMLStyle_get_color(style
, &v
);
741 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
742 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
743 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
747 hres
= IHTMLStyle_put_color(style
, v
);
748 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
751 hres
= IHTMLStyle_get_color(style
, &v
);
752 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
753 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
755 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
759 hres
= IHTMLStyle_put_lineHeight(style
, v
);
760 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
762 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
763 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
764 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
765 ok(!strcmp_wa(V_BSTR(&v
), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
768 V_BSTR(&v
) = a2bstr("300%");
769 hres
= IHTMLStyle_put_lineHeight(style
, v
);
770 ok(hres
== S_OK
, "put_lineHeight failed: %08x\n", hres
);
773 hres
= IHTMLStyle_get_lineHeight(style
, &v
);
774 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
775 ok(V_VT(&v
) == VT_BSTR
, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v
));
776 ok(!strcmp_wa(V_BSTR(&v
), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
780 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
781 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
782 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
784 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
785 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
787 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
788 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
789 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
791 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
792 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
795 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
796 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
797 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
799 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
800 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
802 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
803 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
804 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
806 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
807 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
810 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
811 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
812 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
814 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
815 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
817 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
818 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
819 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
821 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
822 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
825 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
826 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
827 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
829 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
830 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
832 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
833 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
834 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
836 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
837 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
840 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
841 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
842 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
844 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
845 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
847 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
848 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
849 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
851 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
852 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
854 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
855 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
857 str
= a2bstr("invalid");
858 hres
= IHTMLStyle_put_textDecoration(style
, str
);
859 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
862 set_text_decoration(style
, "none");
863 test_text_decoration(style
, "none");
864 set_text_decoration(style
, "underline");
865 set_text_decoration(style
, "overline");
866 set_text_decoration(style
, "line-through");
867 set_text_decoration(style
, "blink");
868 set_text_decoration(style
, "overline");
869 set_text_decoration(style
, "blink");
870 test_text_decoration(style
, "blink");
872 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
873 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
874 SysFreeString(sDefault
);
876 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
877 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
879 hres
= IHTMLStyle_get_posWidth(style
, &f
);
880 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
881 ok(f
== 0.0f
, "f = %f\n", f
);
884 hres
= IHTMLStyle_get_width(style
, &v
);
885 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
886 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
887 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
889 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
890 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
892 hres
= IHTMLStyle_get_posWidth(style
, &f
);
893 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
899 V_BSTR(&v
) = a2bstr("auto");
900 hres
= IHTMLStyle_put_width(style
, v
);
901 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
905 hres
= IHTMLStyle_get_width(style
, &v
);
906 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
907 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
908 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
913 hres
= IHTMLStyle_put_width(style
, v
);
914 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
917 hres
= IHTMLStyle_get_width(style
, &v
);
918 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
919 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
920 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
923 hres
= IHTMLStyle_put_pixelWidth(style
, 50);
924 ok(hres
== S_OK
, "put_pixelWidth failed: %08x\n", hres
);
927 hres
= IHTMLStyle_get_width(style
, &v
);
928 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
929 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
930 ok(!strcmp_wa(V_BSTR(&v
), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
934 str
= (void*)0xdeadbeef;
935 hres
= IHTMLStyle_get_margin(style
, &str
);
936 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
937 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
940 hres
= IHTMLStyle_put_margin(style
, str
);
941 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
944 hres
= IHTMLStyle_get_margin(style
, &str
);
945 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
946 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
949 hres
= IHTMLStyle_put_margin(style
, NULL
);
950 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
952 str
= (void*)0xdeadbeef;
953 hres
= IHTMLStyle_get_marginTop(style
, &v
);
954 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
955 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
956 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
959 V_BSTR(&v
) = a2bstr("6px");
960 hres
= IHTMLStyle_put_marginTop(style
, v
);
961 SysFreeString(V_BSTR(&v
));
962 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
964 str
= (void*)0xdeadbeef;
965 hres
= IHTMLStyle_get_marginTop(style
, &v
);
966 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
967 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
968 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
973 hres
= IHTMLStyle_put_marginTop(style
, v
);
974 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
976 str
= (void*)0xdeadbeef;
977 hres
= IHTMLStyle_get_marginTop(style
, &v
);
978 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
979 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
980 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
984 hres
= IHTMLStyle_get_border(style
, &str
);
985 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
986 ok(!str
|| !*str
, "str is not empty\n");
990 hres
= IHTMLStyle_put_border(style
, str
);
991 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
995 hres
= IHTMLStyle_get_left(style
, &v
);
996 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
997 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
998 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1002 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1003 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1004 ok(!l
, "pixelLeft = %d\n", l
);
1007 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
1008 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
1011 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1012 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1013 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1015 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
1016 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
1018 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1019 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1021 f
== 4.9f
, /* IE8 */
1022 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1024 /* Ensure left is updated correctly. */
1025 V_VT(&v
) = VT_EMPTY
;
1026 hres
= IHTMLStyle_get_left(style
, &v
);
1027 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1028 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1029 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
1030 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
1031 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1036 V_BSTR(&v
) = a2bstr("3px");
1037 hres
= IHTMLStyle_put_left(style
, v
);
1038 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1041 hres
= IHTMLStyle_get_posLeft(style
, &f
);
1042 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
1043 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1046 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1047 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1048 ok(l
== 3, "pixelLeft = %d\n", l
);
1050 V_VT(&v
) = VT_EMPTY
;
1051 hres
= IHTMLStyle_get_left(style
, &v
);
1052 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1053 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1054 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1058 V_BSTR(&v
) = a2bstr("4.99");
1059 hres
= IHTMLStyle_put_left(style
, v
);
1060 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1064 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1065 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1066 ok(l
== 4, "pixelLeft = %d\n", l
);
1069 hres
= IHTMLStyle_put_left(style
, v
);
1070 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
1072 V_VT(&v
) = VT_EMPTY
;
1073 hres
= IHTMLStyle_get_left(style
, &v
);
1074 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1075 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1076 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1079 V_VT(&v
) = VT_EMPTY
;
1080 hres
= IHTMLStyle_get_top(style
, &v
);
1081 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1082 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1083 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1087 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1088 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1089 ok(!l
, "pixelLeft = %d\n", l
);
1091 hres
= IHTMLStyle_put_pixelLeft(style
, 6);
1092 ok(hres
== S_OK
, "put_pixelLeft failed: %08x\n", hres
);
1095 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1096 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1097 ok(l
== 6, "pixelLeft = %d\n", l
);
1099 V_VT(&v
) = VT_EMPTY
;
1100 hres
= IHTMLStyle_get_left(style
, &v
);
1101 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1102 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1103 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1107 hres
= IHTMLStyle_get_posTop(style
, NULL
);
1108 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
1111 hres
= IHTMLStyle_get_posTop(style
, &f
);
1112 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1113 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1115 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
1116 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
1118 hres
= IHTMLStyle_get_posTop(style
, &f
);
1119 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1121 f
== 4.9f
, /* IE8 */
1122 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1125 V_BSTR(&v
) = a2bstr("3px");
1126 hres
= IHTMLStyle_put_top(style
, v
);
1127 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1130 V_VT(&v
) = VT_EMPTY
;
1131 hres
= IHTMLStyle_get_top(style
, &v
);
1132 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1133 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1134 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1137 hres
= IHTMLStyle_get_posTop(style
, &f
);
1138 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1139 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1142 hres
= IHTMLStyle_put_top(style
, v
);
1143 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1145 V_VT(&v
) = VT_EMPTY
;
1146 hres
= IHTMLStyle_get_top(style
, &v
);
1147 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1148 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1149 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1152 /* Test posHeight */
1153 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1154 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1156 V_VT(&v
) = VT_EMPTY
;
1157 hres
= IHTMLStyle_get_height(style
, &v
);
1158 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1159 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1160 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1164 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1165 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1166 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1168 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1169 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1171 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1172 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1174 f
== 4.9f
, /* IE8 */
1175 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1178 V_BSTR(&v
) = a2bstr("70px");
1179 hres
= IHTMLStyle_put_height(style
, v
);
1180 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1183 V_VT(&v
) = VT_EMPTY
;
1184 hres
= IHTMLStyle_get_height(style
, &v
);
1185 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1186 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1187 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1192 hres
= IHTMLStyle_put_height(style
, v
);
1193 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1196 V_VT(&v
) = VT_EMPTY
;
1197 hres
= IHTMLStyle_get_height(style
, &v
);
1198 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1199 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1200 ok(!V_BSTR(&v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v
)));
1205 hres
= IHTMLStyle_put_height(style
, v
);
1206 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1208 V_VT(&v
) = VT_EMPTY
;
1209 hres
= IHTMLStyle_get_height(style
, &v
);
1210 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1211 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1212 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1215 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1216 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1217 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
1219 str
= (void*)0xdeadbeef;
1220 hres
= IHTMLStyle_get_cursor(style
, &str
);
1221 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1222 ok(!str
, "get_cursor != NULL\n");
1225 str
= a2bstr("default");
1226 hres
= IHTMLStyle_put_cursor(style
, str
);
1227 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1231 hres
= IHTMLStyle_get_cursor(style
, &str
);
1232 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1233 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1236 V_VT(&v
) = VT_EMPTY
;
1237 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1238 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1239 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1240 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1244 V_BSTR(&v
) = a2bstr("middle");
1245 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1246 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1249 V_VT(&v
) = VT_EMPTY
;
1250 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1251 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1252 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1253 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1258 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1259 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1262 V_VT(&v
) = VT_EMPTY
;
1263 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1264 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1265 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1266 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1269 str
= (void*)0xdeadbeef;
1270 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1271 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1272 ok(!str
, "textAlign != NULL\n");
1274 str
= a2bstr("center");
1275 hres
= IHTMLStyle_put_textAlign(style
, str
);
1276 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1280 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1281 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1282 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1286 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1287 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1288 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1289 ok(!V_BSTR(&v
), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1293 hres
= IHTMLStyle_put_textIndent(style
, v
);
1294 ok(hres
== S_OK
, "put_textIndent failed: %08x\n", hres
);
1297 hres
= IHTMLStyle_get_textIndent(style
, &v
);
1298 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
1299 ok(V_VT(&v
) == VT_BSTR
, "V_VT(textIndent) = %d\n", V_VT(&v
));
1300 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1302 str
= (void*)0xdeadbeef;
1303 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1304 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1305 ok(!str
, "textTransform != NULL\n");
1307 str
= a2bstr("lowercase");
1308 hres
= IHTMLStyle_put_textTransform(style
, str
);
1309 ok(hres
== S_OK
, "put_textTransform failed: %08x\n", hres
);
1313 hres
= IHTMLStyle_get_textTransform(style
, &str
);
1314 ok(hres
== S_OK
, "get_textTransform failed: %08x\n", hres
);
1315 ok(!strcmp_wa(str
, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1318 str
= (void*)0xdeadbeef;
1319 hres
= IHTMLStyle_get_filter(style
, &str
);
1320 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1321 ok(!str
, "filter != NULL\n");
1323 str
= a2bstr("alpha(opacity=100)");
1324 hres
= IHTMLStyle_put_filter(style
, str
);
1325 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1328 V_VT(&v
) = VT_EMPTY
;
1329 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1330 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1331 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1332 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1336 V_BSTR(&v
) = a2bstr("1");
1337 hres
= IHTMLStyle_put_zIndex(style
, v
);
1338 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1341 V_VT(&v
) = VT_EMPTY
;
1342 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1343 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1344 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1345 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1349 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1350 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1352 str
= a2bstr("test");
1353 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1354 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1357 str
= a2bstr("italic");
1358 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1359 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1362 str
= a2bstr("oblique");
1363 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1364 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1367 str
= a2bstr("normal");
1368 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1369 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1372 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1373 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1374 SysFreeString(sDefault
);
1377 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1378 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1380 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1381 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1383 str
= a2bstr("test");
1384 hres
= IHTMLStyle_put_overflow(style
, str
);
1385 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1388 str
= a2bstr("visible");
1389 hres
= IHTMLStyle_put_overflow(style
, str
);
1390 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1393 str
= a2bstr("scroll");
1394 hres
= IHTMLStyle_put_overflow(style
, str
);
1395 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1398 str
= a2bstr("hidden");
1399 hres
= IHTMLStyle_put_overflow(style
, str
);
1400 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1403 str
= a2bstr("auto");
1404 hres
= IHTMLStyle_put_overflow(style
, str
);
1405 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1408 hres
= IHTMLStyle_get_overflow(style
, &str
);
1409 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1410 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1414 hres
= IHTMLStyle_put_overflow(style
, str
);
1415 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1418 hres
= IHTMLStyle_get_overflow(style
, &str
);
1419 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1420 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1423 /* restore overflow default */
1424 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1425 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1426 SysFreeString(sOverflowDefault
);
1428 /* Attribute Tests*/
1429 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1430 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1432 str
= a2bstr("position");
1433 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1434 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1436 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1437 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1438 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1441 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1442 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1445 V_BSTR(&v
) = a2bstr("absolute");
1446 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1447 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1450 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1451 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1452 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1453 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1458 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1459 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1464 str
= a2bstr("borderLeftStyle");
1465 test_border_styles(style
, str
);
1468 str
= a2bstr("borderbottomstyle");
1469 test_border_styles(style
, str
);
1472 str
= a2bstr("borderrightstyle");
1473 test_border_styles(style
, str
);
1476 str
= a2bstr("bordertopstyle");
1477 test_border_styles(style
, str
);
1480 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1481 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1483 str
= a2bstr("none dotted dashed solid");
1484 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1485 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1488 str
= a2bstr("none dotted dashed solid");
1489 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1490 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1491 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1492 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1495 str
= a2bstr("double groove ridge inset");
1496 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1497 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1500 str
= a2bstr("window-inset outset ridge inset");
1501 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1502 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1505 str
= a2bstr("window-inset");
1506 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1507 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1510 str
= a2bstr("none none none none none");
1511 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1512 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1515 str
= a2bstr("invalid none none none");
1516 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1517 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1520 str
= a2bstr("none invalid none none");
1521 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1522 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1525 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1526 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1527 SysFreeString(sDefault
);
1529 /* backgoundColor */
1530 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1531 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1532 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1533 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1537 V_BSTR(&v
) = a2bstr("red");
1538 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
1539 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
1542 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1543 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1544 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1545 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1549 hres
= IHTMLStyle_get_padding(style
, &str
);
1550 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1551 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1554 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1555 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1556 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1557 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1561 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1562 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1564 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1565 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1566 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1567 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1570 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1571 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1572 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1573 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1577 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1578 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1580 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1581 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1582 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1583 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1586 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1587 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1588 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1589 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1593 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
1594 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1596 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1597 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1598 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1599 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1603 hres
= IHTMLStyle_put_padding(style
, str
);
1604 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1607 hres
= IHTMLStyle_get_padding(style
, &str
);
1608 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1609 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1613 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1614 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1615 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1616 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1619 V_BSTR(&v
) = a2bstr("10");
1620 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1621 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1624 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1625 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1626 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1629 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1630 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1632 /* BackgroundRepeat */
1633 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1634 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1636 str
= a2bstr("invalid");
1637 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1638 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1641 str
= a2bstr("repeat");
1642 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1643 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1646 str
= a2bstr("no-repeat");
1647 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1648 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1651 str
= a2bstr("repeat-x");
1652 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1653 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1656 str
= a2bstr("repeat-y");
1657 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1658 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1661 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1662 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1663 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1666 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1667 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1668 SysFreeString(sDefault
);
1671 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1672 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1674 str
= a2bstr("red green red blue");
1675 hres
= IHTMLStyle_put_borderColor(style
, str
);
1676 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1679 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1680 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1681 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1684 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1685 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1686 SysFreeString(sDefault
);
1689 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1690 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1692 str
= a2bstr("thick dotted red");
1693 hres
= IHTMLStyle_put_borderRight(style
, str
);
1694 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1697 /* IHTMLStyle_get_borderRight appears to have a bug where
1698 it returns the first letter of the color. So we check
1699 each style individually.
1702 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1703 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1704 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1708 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1709 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1710 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1713 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1714 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1715 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1718 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1719 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1720 SysFreeString(sDefault
);
1723 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1724 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1726 str
= a2bstr("thick dotted red");
1727 hres
= IHTMLStyle_put_borderTop(style
, str
);
1728 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1731 /* IHTMLStyle_get_borderTop appears to have a bug where
1732 it returns the first letter of the color. So we check
1733 each style individually.
1736 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1737 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1738 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1742 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1743 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1744 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1747 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1748 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1749 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1752 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1753 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1754 SysFreeString(sDefault
);
1757 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1758 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1760 str
= a2bstr("thick dotted red");
1761 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1762 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1765 /* IHTMLStyle_get_borderBottom appears to have a bug where
1766 it returns the first letter of the color. So we check
1767 each style individually.
1770 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1771 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1772 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1776 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1777 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1778 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1781 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1782 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1783 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1786 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1787 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1788 SysFreeString(sDefault
);
1791 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1792 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1794 str
= a2bstr("thick dotted red");
1795 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1796 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1799 /* IHTMLStyle_get_borderLeft appears to have a bug where
1800 it returns the first letter of the color. So we check
1801 each style individually.
1804 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1805 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1806 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1810 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1811 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1812 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1815 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1816 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1817 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1820 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1821 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1822 SysFreeString(sDefault
);
1824 /* backgroundPositionX */
1825 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1826 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1827 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1828 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1832 V_BSTR(&v
) = a2bstr("10px");
1833 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1834 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1837 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1838 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1839 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1840 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1843 /* backgroundPositionY */
1844 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1845 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1846 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1850 V_BSTR(&v
) = a2bstr("15px");
1851 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
1852 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
1855 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1856 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1857 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1858 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1861 /* backgroundPosition */
1863 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1864 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1865 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1868 str
= a2bstr("center 20%");
1869 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
1870 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
1874 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1875 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1876 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1879 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1880 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1881 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1882 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1885 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1886 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1887 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1888 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1891 /* borderTopWidth */
1892 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
1893 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1896 V_BSTR(&v
) = a2bstr("10px");
1897 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
1898 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1901 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1902 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1903 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1906 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
1907 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1908 VariantClear(&vDefault
);
1910 /* borderRightWidth */
1911 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
1912 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1915 V_BSTR(&v
) = a2bstr("10");
1916 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
1917 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1920 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1921 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1922 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1925 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
1926 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1927 VariantClear(&vDefault
);
1929 /* borderBottomWidth */
1930 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
1931 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1934 V_BSTR(&v
) = a2bstr("10");
1935 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
1936 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1939 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1940 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1941 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1944 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
1945 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1946 VariantClear(&vDefault
);
1948 /* borderLeftWidth */
1949 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
1950 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1953 V_BSTR(&v
) = a2bstr("10");
1954 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
1955 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1958 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1959 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1960 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1963 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
1964 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1965 VariantClear(&vDefault
);
1968 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
1969 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1972 V_BSTR(&v
) = a2bstr("10");
1973 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
1974 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1977 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
1978 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1979 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1980 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1983 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
1984 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1985 VariantClear(&vDefault
);
1988 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
1989 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1992 V_BSTR(&v
) = a2bstr("11");
1993 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
1994 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1997 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
1998 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1999 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
2000 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2003 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
2004 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
2005 VariantClear(&vDefault
);
2007 /* borderTopColor */
2008 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
2009 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2012 V_BSTR(&v
) = a2bstr("red");
2013 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
2014 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2017 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
2018 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
2019 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2022 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
2023 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
2025 /* borderRightColor */
2026 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
2027 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2030 V_BSTR(&v
) = a2bstr("blue");
2031 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
2032 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
2035 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
2036 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
2037 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2040 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
2041 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
2043 /* borderBottomColor */
2044 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
2045 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2048 V_BSTR(&v
) = a2bstr("cyan");
2049 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
2050 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2053 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
2054 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
2055 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2058 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
2059 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
2061 /* borderLeftColor */
2062 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
2063 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2066 V_BSTR(&v
) = a2bstr("cyan");
2067 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
2068 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2071 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
2072 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
2073 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2076 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
2077 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
2080 hres
= IHTMLStyle_get_clip(style
, &str
);
2081 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2082 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
2084 str
= a2bstr("rect(0px 1px 500px 505px)");
2085 hres
= IHTMLStyle_put_clip(style
, str
);
2086 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
2089 hres
= IHTMLStyle_get_clip(style
, &str
);
2090 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
2091 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
2095 hres
= IHTMLStyle_get_clear(style
, &str
);
2096 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2097 ok(!str
, "clear = %s\n", wine_dbgstr_w(str
));
2099 str
= a2bstr("both");
2100 hres
= IHTMLStyle_put_clear(style
, str
);
2101 ok(hres
== S_OK
, "put_clear failed: %08x\n", hres
);
2104 hres
= IHTMLStyle_get_clear(style
, &str
);
2105 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
2106 ok(!strcmp_wa(str
, "both"), "clear = %s\n", wine_dbgstr_w(str
));
2109 /* pageBreakAfter */
2110 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2111 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2112 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2114 str
= a2bstr("always");
2115 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
2116 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2119 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2120 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2121 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2124 /* pageBreakBefore */
2125 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2126 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2127 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2129 str
= a2bstr("always");
2130 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
2131 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
2134 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2135 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2136 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2139 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
2140 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
2142 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2143 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2144 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2146 str
= (void*)0xdeadbeef;
2147 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2148 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2149 ok(!str
, "whiteSpace = %s\n", wine_dbgstr_w(str
));
2151 str
= a2bstr("nowrap");
2152 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2154 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2157 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2158 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2159 ok(!strcmp_wa(str
, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2163 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2164 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2165 ok(!str
, "listStyleType = %s\n", wine_dbgstr_w(str
));
2167 str
= a2bstr("square");
2168 hres
= IHTMLStyle_put_listStyleType(style
, str
);
2169 ok(hres
== S_OK
, "put_listStyleType failed: %08x\n", hres
);
2173 hres
= IHTMLStyle_get_listStyleType(style
, &str
);
2174 ok(hres
== S_OK
, "get_listStyleType failed: %08x\n", hres
);
2175 ok(!strcmp_wa(str
, "square"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2177 str
= a2bstr("inside");
2178 hres
= IHTMLStyle_put_listStylePosition(style
, str
);
2179 ok(hres
== S_OK
, "put_listStylePosition failed: %08x\n", hres
);
2182 hres
= IHTMLStyle_get_listStylePosition(style
, &str
);
2183 ok(hres
== S_OK
, "get_listStylePosition failed: %08x\n", hres
);
2184 ok(!strcmp_wa(str
, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str
));
2187 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
2188 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
2189 if(SUCCEEDED(hres
)) {
2190 test_style2(style2
);
2191 IHTMLStyle2_Release(style2
);
2194 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
2195 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
2196 if(SUCCEEDED(hres
)) {
2197 test_style3(style3
);
2198 IHTMLStyle3_Release(style3
);
2201 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
2202 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
2203 if(SUCCEEDED(hres
)) {
2204 test_style4(style4
);
2205 IHTMLStyle4_Release(style4
);
2208 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle6
, (void**)&style6
);
2209 if(SUCCEEDED(hres
)) {
2210 test_style6(style6
);
2211 IHTMLStyle6_Release(style6
);
2213 win_skip("IHTMLStyle6 not available\n");
2217 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2218 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
2223 str
= (void*)0xdeadbeef;
2224 hres
= IHTMLStyle_get_filter(style
, &str
);
2225 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2227 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2229 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2234 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2235 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
2240 str
= (void*)0xdeadbeef;
2241 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
2242 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2244 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2246 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2251 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2252 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
2254 BSTR str
= a2bstr(val
);
2257 hres
= IHTMLStyle_put_filter(style
, str
);
2258 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
2261 _test_style_filter(line
, style
, val
);
2264 static void test_style_filters(IHTMLElement
*elem
)
2266 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
2267 IHTMLCurrentStyle2
*current_style2
;
2268 IHTMLCurrentStyle
*current_style
;
2272 hres
= IHTMLElement_get_style(elem
, &style
);
2273 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2275 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
2276 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2278 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2280 test_style_filter(style
, NULL
);
2281 test_current_style_filter(current_style2
, NULL
);
2282 set_style_filter(style
, "alpha(opacity=50.0040)");
2283 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
2284 set_style_filter(style
, "alpha(opacity=100)");
2286 IHTMLStyle_Release(style
);
2288 hres
= IHTMLElement_get_style(elem
, &style
);
2289 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2291 test_style_filter(style
, "alpha(opacity=100)");
2292 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
2293 set_style_filter(style
, NULL
);
2294 set_style_filter(style
, "alpha(opacity=100)");
2295 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
2296 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
2297 test_style_filter(style
, NULL
);
2300 IHTMLCurrentStyle2_Release(current_style2
);
2301 IHTMLStyle_Release(style
);
2302 IHTMLElement2_Release(elem2
);
2305 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2307 IHTMLCurrentStyle2
*current_style2
;
2313 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2314 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2315 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2318 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2319 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2320 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2323 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2324 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2327 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2328 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2329 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2332 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2333 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2334 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2337 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2338 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2339 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2342 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2343 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2344 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
2347 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
2348 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2349 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
2352 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
2353 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2354 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
2357 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
2358 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2359 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
2362 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
2363 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
2364 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2367 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2368 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2369 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2372 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2373 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2374 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2377 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2378 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2379 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2382 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2383 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2386 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2387 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2390 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2391 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2394 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2395 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2398 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2399 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2402 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2403 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2406 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2407 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2410 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2411 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2412 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2413 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2416 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2417 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2418 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2421 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2422 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2423 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2426 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2427 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2428 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2431 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2432 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2433 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2436 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2437 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2438 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2441 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2442 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2443 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2446 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2447 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2448 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2449 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2452 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2453 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2454 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2455 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2458 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2459 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2460 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2463 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2464 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2465 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2468 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2469 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2470 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2474 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2475 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2476 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2479 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2480 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2481 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2484 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2485 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2486 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2489 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2490 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2491 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2494 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2495 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2496 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2499 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2500 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2501 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2504 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2505 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2506 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2509 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2510 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2511 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2514 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2515 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2516 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2519 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2520 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2521 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2524 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2525 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2526 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2529 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2530 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2531 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2534 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2535 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2536 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2539 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2540 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2541 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2544 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2545 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2546 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2549 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2550 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2551 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2554 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2555 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2556 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2559 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2560 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2561 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2564 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2565 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2566 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2569 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2572 hres
= IHTMLCurrentStyle2_get_hasLayout(current_style2
, &b
);
2573 ok(hres
== S_OK
, "get_hasLayout failed: %08x\n", hres
);
2574 ok(b
== VARIANT_TRUE
, "hasLayout = %x\n", b
);
2576 IHTMLCurrentStyle2_Release(current_style2
);
2579 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2581 static void basic_style_test(IHTMLDocument2
*doc
)
2583 IHTMLCurrentStyle
*cstyle
;
2588 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2589 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2591 hres
= IHTMLElement_get_style(elem
, &style
);
2592 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2594 test_body_style(style
);
2596 cstyle
= get_current_style(elem
);
2597 test_current_style(cstyle
);
2598 IHTMLCurrentStyle_Release(cstyle
);
2599 IHTMLElement_Release(elem
);
2601 elem
= get_element_by_id(doc
, "divid");
2602 test_style_filters(elem
);
2604 test_set_csstext(style
);
2605 IHTMLStyle_Release(style
);
2606 IHTMLElement_Release(elem
);
2609 static const char runtimestyle_test_str
[] =
2610 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2612 static void runtimestyle_test(IHTMLDocument2
*doc
)
2614 IHTMLStyle
*style
, *runtime_style
;
2615 IHTMLElement2
*elem2
;
2620 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2621 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2623 elem2
= get_elem2_iface((IUnknown
*)elem
);
2625 hres
= IHTMLElement2_get_runtimeStyle(elem2
, &runtime_style
);
2626 ok(hres
== S_OK
, "get_runtimeStyle failed: %08x\n", hres
);
2628 hres
= IHTMLElement_get_style(elem
, &style
);
2629 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2631 test_text_decoration(style
, NULL
);
2632 test_text_decoration(runtime_style
, NULL
);
2633 set_text_decoration(style
, "underline");
2634 test_text_decoration(style
, "underline");
2636 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2637 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2638 ok(broken(!str
) || !strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2641 set_text_decoration(runtime_style
, "blink");
2642 test_text_decoration(runtime_style
, "blink");
2644 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2645 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2647 ok(!strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2650 IHTMLStyle_Release(runtime_style
);
2651 IHTMLStyle_Release(style
);
2652 IHTMLElement2_Release(elem2
);
2653 IHTMLElement_Release(elem
);
2656 static IHTMLDocument2
*notif_doc
;
2657 static BOOL doc_complete
;
2659 static IHTMLDocument2
*create_document(void)
2661 IHTMLDocument2
*doc
;
2662 IHTMLDocument5
*doc5
;
2665 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2666 &IID_IHTMLDocument2
, (void**)&doc
);
2667 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2671 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2673 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2674 IHTMLDocument2_Release(doc
);
2678 IHTMLDocument5_Release(doc5
);
2682 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2683 REFIID riid
, void**ppv
)
2685 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2690 ok(0, "unexpected call\n");
2691 return E_NOINTERFACE
;
2694 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2699 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2704 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2706 if(dispID
== DISPID_READYSTATE
){
2710 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2711 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2713 if(!strcmp_wa(state
, "complete"))
2714 doc_complete
= TRUE
;
2716 SysFreeString(state
);
2722 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2724 ok(0, "unexpected call\n");
2728 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2729 PropertyNotifySink_QueryInterface
,
2730 PropertyNotifySink_AddRef
,
2731 PropertyNotifySink_Release
,
2732 PropertyNotifySink_OnChanged
,
2733 PropertyNotifySink_OnRequestEdit
2736 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2738 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2740 IPersistStreamInit
*init
;
2742 IHTMLDocument2
*doc
;
2746 notif_doc
= doc
= create_document();
2750 doc_complete
= FALSE
;
2752 mem
= GlobalAlloc(0, len
);
2753 memcpy(mem
, str
, len
);
2754 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2756 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2758 IPersistStreamInit_Load(init
, stream
);
2759 IPersistStreamInit_Release(init
);
2760 IStream_Release(stream
);
2765 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2767 IConnectionPointContainer
*container
;
2768 IConnectionPoint
*cp
;
2772 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2773 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2775 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2776 IConnectionPointContainer_Release(container
);
2777 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2779 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2780 IConnectionPoint_Release(cp
);
2781 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2784 typedef void (*style_test_t
)(IHTMLDocument2
*);
2786 static void run_test(const char *str
, style_test_t test
)
2788 IHTMLDocument2
*doc
;
2792 doc
= create_doc_with_string(str
);
2796 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2798 while(!doc_complete
&& GetMessageW(&msg
, NULL
, 0, 0)) {
2799 TranslateMessage(&msg
);
2800 DispatchMessageW(&msg
);
2805 ref
= IHTMLDocument2_Release(doc
);
2806 ok(!ref
|| broken(ref
== 1), /* Vista */
2815 run_test(basic_test_str
, basic_style_test
);
2816 run_test(runtimestyle_test_str
, runtimestyle_test
);