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 BSTR
a2bstr(const char *str
)
48 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
49 ret
= SysAllocStringLen(NULL
, len
);
50 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
55 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
56 static void _test_var_bstr(unsigned line
, const VARIANT
*v
, const char *expect
)
58 ok_(__FILE__
,line
)(V_VT(v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(v
));
60 ok_(__FILE__
,line
)(!strcmp_wa(V_BSTR(v
), expect
), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), expect
);
62 ok_(__FILE__
,line
)(!V_BSTR(v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v
)));
65 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
66 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
71 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
72 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
76 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
77 static IHTMLCurrentStyle2
*_get_current_style2_iface(unsigned line
, IUnknown
*unk
)
79 IHTMLCurrentStyle2
*current_style2
;
82 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
83 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
84 return current_style2
;
87 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
92 BSTR idW
= a2bstr(id
);
94 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
95 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
97 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
98 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
99 ok(result
!= NULL
, "result == NULL\n");
102 IHTMLDocument3_Release(doc3
);
106 #define get_current_style(e) _get_current_style(__LINE__,e)
107 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
109 IHTMLCurrentStyle
*cstyle
;
110 IHTMLElement2
*elem2
;
113 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
114 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
117 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
118 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
119 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
121 IHTMLElement2_Release(elem2
);
125 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
126 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
131 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
132 LOCALE_USER_DEFAULT
, &dispid
);
133 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
136 DISPPARAMS params
= {NULL
,NULL
,0,0};
137 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
142 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
143 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
144 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
147 params
.cNamedArgs
= 1;
148 params
.rgdispidNamedArgs
= &dispidNamed
;
149 V_VT(&arg
) = VT_BSTR
;
150 V_BSTR(&arg
) = a2bstr("none");
151 params
.rgvarg
= &arg
;
152 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
153 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
154 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
157 V_VT(&arg
) = VT_BSTR
;
158 V_BSTR(&arg
) = a2bstr("dotted");
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
, "dotted. ret: %08x\n", hres
);
164 V_VT(&arg
) = VT_BSTR
;
165 V_BSTR(&arg
) = a2bstr("dashed");
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
, "dashed. ret: %08x\n", hres
);
171 V_VT(&arg
) = VT_BSTR
;
172 V_BSTR(&arg
) = a2bstr("solid");
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
, "solid. ret: %08x\n", hres
);
178 V_VT(&arg
) = VT_BSTR
;
179 V_BSTR(&arg
) = a2bstr("double");
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
, "double. ret: %08x\n", hres
);
185 V_VT(&arg
) = VT_BSTR
;
186 V_BSTR(&arg
) = a2bstr("groove");
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
, "groove. ret: %08x\n", hres
);
192 V_VT(&arg
) = VT_BSTR
;
193 V_BSTR(&arg
) = a2bstr("ridge");
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
, "ridge. ret: %08x\n", hres
);
199 V_VT(&arg
) = VT_BSTR
;
200 V_BSTR(&arg
) = a2bstr("inset");
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
, "inset. ret: %08x\n", hres
);
206 V_VT(&arg
) = VT_BSTR
;
207 V_BSTR(&arg
) = a2bstr("outset");
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
, "outset. ret: %08x\n", hres
);
213 V_VT(&arg
) = VT_BSTR
;
214 V_BSTR(&arg
) = a2bstr("invalid");
215 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
216 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
217 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
220 params
.rgvarg
= &vDefault
;
221 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
222 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
223 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
224 VariantClear(&vDefault
);
228 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
229 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
231 BSTR text
= (void*)0xdeadbeef;
234 hres
= IHTMLStyle_get_cssText(style
, &text
);
235 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
237 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
239 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
244 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
245 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
251 hres
= IHTMLStyle_put_cssText(style
, tmp
);
252 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
256 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
257 static void _test_style_remove_attribute(unsigned line
, IHTMLStyle
*style
, const char *attr
, VARIANT_BOOL exb
)
259 BSTR str
= a2bstr(attr
);
260 VARIANT_BOOL b
= 100;
263 hres
= IHTMLStyle_removeAttribute(style
, str
, 1, &b
);
265 ok_(__FILE__
,line
)(hres
== S_OK
, "removeAttribute failed: %08x\n", hres
);
266 ok_(__FILE__
,line
)(b
== exb
, "removeAttribute returned %x, expected %x\n", b
, exb
);
269 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
270 static void _set_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *v
)
276 hres
= IHTMLStyle_put_textDecoration(style
, str
);
277 ok_(__FILE__
,line
)(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
281 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
282 static void _test_text_decoration(unsigned line
, IHTMLStyle
*style
, const char *exdec
)
287 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
288 ok_(__FILE__
,line
)(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
290 ok_(__FILE__
,line
)(!strcmp_wa(str
, exdec
), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str
), exdec
);
292 ok_(__FILE__
,line
)(!str
, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str
));
296 static void test_set_csstext(IHTMLStyle
*style
)
301 test_style_set_csstext(style
, "background-color: black;");
303 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
304 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
305 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
306 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
310 static void test_style2(IHTMLStyle2
*style2
)
316 str
= (void*)0xdeadbeef;
317 hres
= IHTMLStyle2_get_position(style2
, &str
);
318 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
319 ok(!str
, "str != NULL\n");
321 str
= a2bstr("absolute");
322 hres
= IHTMLStyle2_put_position(style2
, str
);
323 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
327 hres
= IHTMLStyle2_get_position(style2
, &str
);
328 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
329 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
334 hres
= IHTMLStyle2_get_right(style2
, &v
);
335 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
336 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
337 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
341 V_BSTR(&v
) = a2bstr("3px");
342 hres
= IHTMLStyle2_put_right(style2
, v
);
343 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
347 hres
= IHTMLStyle2_get_right(style2
, &v
);
348 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
349 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
350 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
354 str
= (void*)0xdeadbeef;
355 hres
= IHTMLStyle2_get_direction(style2
, &str
);
356 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
357 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
360 hres
= IHTMLStyle2_put_direction(style2
, str
);
361 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
365 hres
= IHTMLStyle2_get_direction(style2
, &str
);
366 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
367 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
372 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
373 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
374 test_var_bstr(&v
, NULL
);
378 hres
= IHTMLStyle2_put_bottom(style2
, v
);
379 ok(hres
== S_OK
, "put_bottom failed: %08x\n", hres
);
382 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
383 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
384 test_var_bstr(&v
, "4px");
387 str
= (void*)0xdeadbeef;
388 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
389 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
390 ok(!str
, "overflowX = %s\n", wine_dbgstr_w(str
));
392 str
= a2bstr("hidden");
393 hres
= IHTMLStyle2_put_overflowX(style2
, str
);
394 ok(hres
== S_OK
, "put_overflowX failed: %08x\n", hres
);
398 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
399 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
400 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
403 str
= (void*)0xdeadbeef;
404 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
405 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
406 ok(!str
, "overflowY = %s\n", wine_dbgstr_w(str
));
408 str
= a2bstr("hidden");
409 hres
= IHTMLStyle2_put_overflowY(style2
, str
);
410 ok(hres
== S_OK
, "put_overflowY failed: %08x\n", hres
);
414 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
415 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
416 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
419 static void test_style3(IHTMLStyle3
*style3
)
424 str
= (void*)0xdeadbeef;
425 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
426 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
427 ok(!str
, "str != NULL\n");
429 str
= a2bstr("break-word");
430 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
431 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
435 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
436 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
437 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
441 static void test_style4(IHTMLStyle4
*style4
)
447 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
448 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
451 V_BSTR(&v
) = a2bstr("10px");
452 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
453 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
456 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
457 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
458 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
459 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
462 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
463 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
464 VariantClear(&vdefault
);
467 static void test_body_style(IHTMLStyle
*style
)
477 BSTR sOverflowDefault
;
482 test_style_csstext(style
, NULL
);
484 hres
= IHTMLStyle_get_position(style
, &str
);
485 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
486 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
489 hres
= IHTMLStyle_get_marginRight(style
, &v
);
490 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
491 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
492 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
496 hres
= IHTMLStyle_put_marginRight(style
, v
);
497 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
500 hres
= IHTMLStyle_get_marginRight(style
, &v
);
501 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
502 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
503 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
506 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
507 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
508 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
509 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
513 hres
= IHTMLStyle_put_marginBottom(style
, v
);
514 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
517 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
518 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
519 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
520 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
523 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
524 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
525 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
526 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
530 hres
= IHTMLStyle_put_marginLeft(style
, v
);
531 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
534 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
535 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
536 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
537 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
539 str
= (void*)0xdeadbeef;
540 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
541 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
542 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
544 str
= (void*)0xdeadbeef;
545 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
546 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
547 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
549 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
550 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
552 str
= a2bstr("test");
553 hres
= IHTMLStyle_put_fontWeight(style
, str
);
554 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
557 str
= a2bstr("bold");
558 hres
= IHTMLStyle_put_fontWeight(style
, str
);
559 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
562 str
= a2bstr("bolder");
563 hres
= IHTMLStyle_put_fontWeight(style
, str
);
564 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
567 str
= a2bstr("lighter");
568 hres
= IHTMLStyle_put_fontWeight(style
, str
);
569 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
573 hres
= IHTMLStyle_put_fontWeight(style
, str
);
574 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
578 hres
= IHTMLStyle_put_fontWeight(style
, str
);
579 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
583 hres
= IHTMLStyle_put_fontWeight(style
, str
);
584 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
588 hres
= IHTMLStyle_put_fontWeight(style
, str
);
589 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
593 hres
= IHTMLStyle_put_fontWeight(style
, str
);
594 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
598 hres
= IHTMLStyle_put_fontWeight(style
, str
);
599 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
603 hres
= IHTMLStyle_put_fontWeight(style
, str
);
604 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
608 hres
= IHTMLStyle_put_fontWeight(style
, str
);
609 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
613 hres
= IHTMLStyle_put_fontWeight(style
, str
);
614 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
617 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
618 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
619 ok(!strcmp_wa(str
, "900"), "str != style900\n");
622 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
623 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
624 SysFreeString(sDefault
);
627 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
628 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
630 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
631 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
633 str
= a2bstr("test");
634 hres
= IHTMLStyle_put_fontVariant(style
, str
);
635 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
638 str
= a2bstr("small-caps");
639 hres
= IHTMLStyle_put_fontVariant(style
, str
);
640 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
643 str
= a2bstr("normal");
644 hres
= IHTMLStyle_put_fontVariant(style
, str
);
645 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
648 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
649 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
650 SysFreeString(sDefault
);
652 str
= (void*)0xdeadbeef;
653 hres
= IHTMLStyle_get_display(style
, &str
);
654 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
655 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
657 str
= (void*)0xdeadbeef;
658 hres
= IHTMLStyle_get_visibility(style
, &str
);
659 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
660 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
663 hres
= IHTMLStyle_get_fontSize(style
, &v
);
664 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
665 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
666 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
670 hres
= IHTMLStyle_put_fontSize(style
, v
);
671 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
674 hres
= IHTMLStyle_get_fontSize(style
, &v
);
675 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
676 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
677 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
680 hres
= IHTMLStyle_get_color(style
, &v
);
681 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
682 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
683 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
687 hres
= IHTMLStyle_put_color(style
, v
);
688 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
691 hres
= IHTMLStyle_get_color(style
, &v
);
692 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
693 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
695 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
698 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
699 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
700 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
702 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
703 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
705 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
706 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
707 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
709 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
710 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
713 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
714 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
715 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
717 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
718 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
720 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
721 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
722 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
724 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
725 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
728 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
729 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
730 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
732 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
733 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
735 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
736 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
737 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
739 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
740 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
743 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
744 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
745 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
747 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
748 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
750 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
751 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
752 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
754 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
755 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
758 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
759 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
760 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
762 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
763 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
765 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
766 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
767 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
769 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
770 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
772 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
773 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
775 str
= a2bstr("invalid");
776 hres
= IHTMLStyle_put_textDecoration(style
, str
);
777 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
780 set_text_decoration(style
, "none");
781 test_text_decoration(style
, "none");
782 set_text_decoration(style
, "underline");
783 set_text_decoration(style
, "overline");
784 set_text_decoration(style
, "line-through");
785 set_text_decoration(style
, "blink");
786 set_text_decoration(style
, "overline");
787 set_text_decoration(style
, "blink");
788 test_text_decoration(style
, "blink");
790 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
791 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
792 SysFreeString(sDefault
);
794 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
795 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
797 hres
= IHTMLStyle_get_posWidth(style
, &f
);
798 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
799 ok(f
== 0.0f
, "f = %f\n", f
);
802 hres
= IHTMLStyle_get_width(style
, &v
);
803 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
804 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
805 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
807 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
808 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
810 hres
= IHTMLStyle_get_posWidth(style
, &f
);
811 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
817 V_BSTR(&v
) = a2bstr("auto");
818 hres
= IHTMLStyle_put_width(style
, v
);
819 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
823 hres
= IHTMLStyle_get_width(style
, &v
);
824 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
825 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
826 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
831 hres
= IHTMLStyle_put_width(style
, v
);
832 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
835 hres
= IHTMLStyle_get_width(style
, &v
);
836 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
837 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
838 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
841 hres
= IHTMLStyle_put_pixelWidth(style
, 50);
842 ok(hres
== S_OK
, "put_pixelWidth failed: %08x\n", hres
);
845 hres
= IHTMLStyle_get_width(style
, &v
);
846 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
847 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
848 ok(!strcmp_wa(V_BSTR(&v
), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
852 str
= (void*)0xdeadbeef;
853 hres
= IHTMLStyle_get_margin(style
, &str
);
854 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
855 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
858 hres
= IHTMLStyle_put_margin(style
, str
);
859 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
862 hres
= IHTMLStyle_get_margin(style
, &str
);
863 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
864 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
867 hres
= IHTMLStyle_put_margin(style
, NULL
);
868 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
870 str
= (void*)0xdeadbeef;
871 hres
= IHTMLStyle_get_marginTop(style
, &v
);
872 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
873 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
874 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
877 V_BSTR(&v
) = a2bstr("6px");
878 hres
= IHTMLStyle_put_marginTop(style
, v
);
879 SysFreeString(V_BSTR(&v
));
880 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
882 str
= (void*)0xdeadbeef;
883 hres
= IHTMLStyle_get_marginTop(style
, &v
);
884 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
885 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
886 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
891 hres
= IHTMLStyle_put_marginTop(style
, v
);
892 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
894 str
= (void*)0xdeadbeef;
895 hres
= IHTMLStyle_get_marginTop(style
, &v
);
896 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
897 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
898 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
902 hres
= IHTMLStyle_get_border(style
, &str
);
903 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
904 ok(!str
|| !*str
, "str is not empty\n");
908 hres
= IHTMLStyle_put_border(style
, str
);
909 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
913 hres
= IHTMLStyle_get_left(style
, &v
);
914 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
915 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
916 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
920 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
921 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
922 ok(!l
, "pixelLeft = %d\n", l
);
925 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
926 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
929 hres
= IHTMLStyle_get_posLeft(style
, &f
);
930 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
931 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
933 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
934 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
936 hres
= IHTMLStyle_get_posLeft(style
, &f
);
937 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
940 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
942 /* Ensure left is updated correctly. */
944 hres
= IHTMLStyle_get_left(style
, &v
);
945 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
946 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
947 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
948 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
949 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
954 V_BSTR(&v
) = a2bstr("3px");
955 hres
= IHTMLStyle_put_left(style
, v
);
956 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
959 hres
= IHTMLStyle_get_posLeft(style
, &f
);
960 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
961 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
964 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
965 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
966 ok(l
== 3, "pixelLeft = %d\n", l
);
969 hres
= IHTMLStyle_get_left(style
, &v
);
970 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
971 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
972 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
976 V_BSTR(&v
) = a2bstr("4.99");
977 hres
= IHTMLStyle_put_left(style
, v
);
978 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
982 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
983 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
984 ok(l
== 4, "pixelLeft = %d\n", l
);
987 hres
= IHTMLStyle_put_left(style
, v
);
988 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
991 hres
= IHTMLStyle_get_left(style
, &v
);
992 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
993 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
994 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
998 hres
= IHTMLStyle_get_top(style
, &v
);
999 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1000 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1001 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1005 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1006 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1007 ok(!l
, "pixelLeft = %d\n", l
);
1009 hres
= IHTMLStyle_put_pixelLeft(style
, 6);
1010 ok(hres
== S_OK
, "put_pixelLeft failed: %08x\n", hres
);
1013 hres
= IHTMLStyle_get_pixelLeft(style
, &l
);
1014 ok(hres
== S_OK
, "get_pixelLeft failed: %08x\n", hres
);
1015 ok(l
== 6, "pixelLeft = %d\n", l
);
1017 V_VT(&v
) = VT_EMPTY
;
1018 hres
= IHTMLStyle_get_left(style
, &v
);
1019 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1020 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1021 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1025 hres
= IHTMLStyle_get_posTop(style
, NULL
);
1026 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
1029 hres
= IHTMLStyle_get_posTop(style
, &f
);
1030 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1031 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1033 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
1034 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
1036 hres
= IHTMLStyle_get_posTop(style
, &f
);
1037 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1039 f
== 4.9f
, /* IE8 */
1040 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1043 V_BSTR(&v
) = a2bstr("3px");
1044 hres
= IHTMLStyle_put_top(style
, v
);
1045 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1048 V_VT(&v
) = VT_EMPTY
;
1049 hres
= IHTMLStyle_get_top(style
, &v
);
1050 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1051 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1052 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1055 hres
= IHTMLStyle_get_posTop(style
, &f
);
1056 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
1057 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
1060 hres
= IHTMLStyle_put_top(style
, v
);
1061 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
1063 V_VT(&v
) = VT_EMPTY
;
1064 hres
= IHTMLStyle_get_top(style
, &v
);
1065 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1066 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1067 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1070 /* Test posHeight */
1071 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1072 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1074 V_VT(&v
) = VT_EMPTY
;
1075 hres
= IHTMLStyle_get_height(style
, &v
);
1076 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1077 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1078 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1082 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1083 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1084 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1086 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1087 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1089 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1090 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1092 f
== 4.9f
, /* IE8 */
1093 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1096 V_BSTR(&v
) = a2bstr("70px");
1097 hres
= IHTMLStyle_put_height(style
, v
);
1098 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1101 V_VT(&v
) = VT_EMPTY
;
1102 hres
= IHTMLStyle_get_height(style
, &v
);
1103 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1104 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1105 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1110 hres
= IHTMLStyle_put_height(style
, v
);
1111 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1114 V_VT(&v
) = VT_EMPTY
;
1115 hres
= IHTMLStyle_get_height(style
, &v
);
1116 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1117 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1118 ok(!V_BSTR(&v
), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v
)));
1123 hres
= IHTMLStyle_put_height(style
, v
);
1124 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1126 V_VT(&v
) = VT_EMPTY
;
1127 hres
= IHTMLStyle_get_height(style
, &v
);
1128 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1129 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1130 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1133 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1134 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1135 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
1137 str
= (void*)0xdeadbeef;
1138 hres
= IHTMLStyle_get_cursor(style
, &str
);
1139 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1140 ok(!str
, "get_cursor != NULL\n");
1143 str
= a2bstr("default");
1144 hres
= IHTMLStyle_put_cursor(style
, str
);
1145 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1149 hres
= IHTMLStyle_get_cursor(style
, &str
);
1150 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1151 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1154 V_VT(&v
) = VT_EMPTY
;
1155 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1156 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1157 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1158 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1162 V_BSTR(&v
) = a2bstr("middle");
1163 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1164 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1167 V_VT(&v
) = VT_EMPTY
;
1168 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1169 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1170 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1171 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1176 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1177 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1180 V_VT(&v
) = VT_EMPTY
;
1181 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1182 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1183 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1184 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1187 str
= (void*)0xdeadbeef;
1188 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1189 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1190 ok(!str
, "textAlign != NULL\n");
1192 str
= a2bstr("center");
1193 hres
= IHTMLStyle_put_textAlign(style
, str
);
1194 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1198 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1199 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1200 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1203 str
= (void*)0xdeadbeef;
1204 hres
= IHTMLStyle_get_filter(style
, &str
);
1205 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1206 ok(!str
, "filter != NULL\n");
1208 str
= a2bstr("alpha(opacity=100)");
1209 hres
= IHTMLStyle_put_filter(style
, str
);
1210 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1213 V_VT(&v
) = VT_EMPTY
;
1214 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1215 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1216 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1217 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1221 V_BSTR(&v
) = a2bstr("1");
1222 hres
= IHTMLStyle_put_zIndex(style
, v
);
1223 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1226 V_VT(&v
) = VT_EMPTY
;
1227 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1228 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1229 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1230 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1234 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1235 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1237 str
= a2bstr("test");
1238 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1239 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1242 str
= a2bstr("italic");
1243 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1244 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1247 str
= a2bstr("oblique");
1248 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1249 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1252 str
= a2bstr("normal");
1253 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1254 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1257 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1258 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1259 SysFreeString(sDefault
);
1262 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1263 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1265 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1266 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1268 str
= a2bstr("test");
1269 hres
= IHTMLStyle_put_overflow(style
, str
);
1270 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1273 str
= a2bstr("visible");
1274 hres
= IHTMLStyle_put_overflow(style
, str
);
1275 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1278 str
= a2bstr("scroll");
1279 hres
= IHTMLStyle_put_overflow(style
, str
);
1280 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1283 str
= a2bstr("hidden");
1284 hres
= IHTMLStyle_put_overflow(style
, str
);
1285 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1288 str
= a2bstr("auto");
1289 hres
= IHTMLStyle_put_overflow(style
, str
);
1290 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1293 hres
= IHTMLStyle_get_overflow(style
, &str
);
1294 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1295 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1299 hres
= IHTMLStyle_put_overflow(style
, str
);
1300 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1303 hres
= IHTMLStyle_get_overflow(style
, &str
);
1304 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1305 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1308 /* restore overflow default */
1309 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1310 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1311 SysFreeString(sOverflowDefault
);
1313 /* Attribute Tests*/
1314 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1315 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1317 str
= a2bstr("position");
1318 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1319 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1321 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1322 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1323 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1326 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1327 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1330 V_BSTR(&v
) = a2bstr("absolute");
1331 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1332 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1335 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1336 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1337 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1338 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1343 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1344 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1349 str
= a2bstr("borderLeftStyle");
1350 test_border_styles(style
, str
);
1353 str
= a2bstr("borderbottomstyle");
1354 test_border_styles(style
, str
);
1357 str
= a2bstr("borderrightstyle");
1358 test_border_styles(style
, str
);
1361 str
= a2bstr("bordertopstyle");
1362 test_border_styles(style
, str
);
1365 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1366 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1368 str
= a2bstr("none dotted dashed solid");
1369 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1370 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1373 str
= a2bstr("none dotted dashed solid");
1374 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1375 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1376 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1377 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1380 str
= a2bstr("double groove ridge inset");
1381 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1382 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1385 str
= a2bstr("window-inset outset ridge inset");
1386 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1387 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1390 str
= a2bstr("window-inset");
1391 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1392 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1395 str
= a2bstr("none none none none none");
1396 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1397 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1400 str
= a2bstr("invalid none none none");
1401 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1402 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1405 str
= a2bstr("none invalid none none");
1406 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1407 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1410 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1411 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1412 SysFreeString(sDefault
);
1414 /* backgoundColor */
1415 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1416 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1417 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1418 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1422 V_BSTR(&v
) = a2bstr("red");
1423 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
1424 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
1427 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1428 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1429 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1430 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1434 hres
= IHTMLStyle_get_padding(style
, &str
);
1435 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1436 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1439 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1440 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1441 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1442 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1446 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1447 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1449 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1450 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1451 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1452 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1455 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1456 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1457 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1458 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1462 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1463 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1465 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1466 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1467 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1468 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1471 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1472 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1473 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1474 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1478 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
1479 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1481 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1482 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1483 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1484 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1488 hres
= IHTMLStyle_put_padding(style
, str
);
1489 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1492 hres
= IHTMLStyle_get_padding(style
, &str
);
1493 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1494 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1498 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1499 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1500 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1501 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1504 V_BSTR(&v
) = a2bstr("10");
1505 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1506 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1509 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1510 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1511 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1514 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1515 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1517 /* BackgroundRepeat */
1518 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1519 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1521 str
= a2bstr("invalid");
1522 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1523 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1526 str
= a2bstr("repeat");
1527 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1528 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1531 str
= a2bstr("no-repeat");
1532 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1533 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1536 str
= a2bstr("repeat-x");
1537 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1538 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1541 str
= a2bstr("repeat-y");
1542 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1543 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1546 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1547 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1548 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1551 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1552 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1553 SysFreeString(sDefault
);
1556 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1557 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1559 str
= a2bstr("red green red blue");
1560 hres
= IHTMLStyle_put_borderColor(style
, str
);
1561 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1564 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1565 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1566 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1569 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1570 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1571 SysFreeString(sDefault
);
1574 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1575 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1577 str
= a2bstr("thick dotted red");
1578 hres
= IHTMLStyle_put_borderRight(style
, str
);
1579 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1582 /* IHTMLStyle_get_borderRight appears to have a bug where
1583 it returns the first letter of the color. So we check
1584 each style individually.
1587 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1588 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1589 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1593 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1594 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1595 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1598 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1599 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1600 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1603 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1604 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1605 SysFreeString(sDefault
);
1608 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1609 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1611 str
= a2bstr("thick dotted red");
1612 hres
= IHTMLStyle_put_borderTop(style
, str
);
1613 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1616 /* IHTMLStyle_get_borderTop appears to have a bug where
1617 it returns the first letter of the color. So we check
1618 each style individually.
1621 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1622 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1623 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1627 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1628 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1629 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1632 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1633 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1634 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1637 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1638 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1639 SysFreeString(sDefault
);
1642 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1643 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1645 str
= a2bstr("thick dotted red");
1646 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1647 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1650 /* IHTMLStyle_get_borderBottom appears to have a bug where
1651 it returns the first letter of the color. So we check
1652 each style individually.
1655 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1656 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1657 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1661 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1662 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1663 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1666 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1667 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1668 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1671 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1672 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1673 SysFreeString(sDefault
);
1676 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1677 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1679 str
= a2bstr("thick dotted red");
1680 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1681 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1684 /* IHTMLStyle_get_borderLeft appears to have a bug where
1685 it returns the first letter of the color. So we check
1686 each style individually.
1689 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1690 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1691 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1695 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1696 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1697 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1700 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1701 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1702 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1705 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1706 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1707 SysFreeString(sDefault
);
1709 /* backgroundPositionX */
1710 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1711 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1712 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1713 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1717 V_BSTR(&v
) = a2bstr("10px");
1718 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1719 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1722 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1723 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1724 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1725 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1728 /* backgroundPositionY */
1729 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1730 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1731 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1735 V_BSTR(&v
) = a2bstr("15px");
1736 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
1737 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
1740 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1741 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1742 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1743 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1746 /* backgroundPosition */
1748 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1749 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1750 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1753 str
= a2bstr("center 20%");
1754 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
1755 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
1759 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1760 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1761 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1764 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1765 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1766 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1767 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1770 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1771 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1772 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1773 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1776 /* borderTopWidth */
1777 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
1778 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1781 V_BSTR(&v
) = a2bstr("10px");
1782 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
1783 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1786 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1787 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1788 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1791 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
1792 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1793 VariantClear(&vDefault
);
1795 /* borderRightWidth */
1796 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
1797 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1800 V_BSTR(&v
) = a2bstr("10");
1801 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
1802 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1805 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1806 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1807 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1810 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
1811 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1812 VariantClear(&vDefault
);
1814 /* borderBottomWidth */
1815 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
1816 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1819 V_BSTR(&v
) = a2bstr("10");
1820 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
1821 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1824 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1825 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1826 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1829 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
1830 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1831 VariantClear(&vDefault
);
1833 /* borderLeftWidth */
1834 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
1835 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1838 V_BSTR(&v
) = a2bstr("10");
1839 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
1840 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1843 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1844 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1845 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1848 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
1849 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1850 VariantClear(&vDefault
);
1853 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
1854 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1857 V_BSTR(&v
) = a2bstr("10");
1858 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
1859 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1862 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
1863 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1864 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1865 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1868 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
1869 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1870 VariantClear(&vDefault
);
1873 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
1874 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1877 V_BSTR(&v
) = a2bstr("11");
1878 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
1879 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1882 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
1883 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1884 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1885 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1888 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
1889 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1890 VariantClear(&vDefault
);
1892 /* borderTopColor */
1893 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
1894 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1897 V_BSTR(&v
) = a2bstr("red");
1898 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
1899 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1902 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1903 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1904 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1907 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
1908 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1910 /* borderRightColor */
1911 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
1912 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1915 V_BSTR(&v
) = a2bstr("blue");
1916 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
1917 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
1920 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1921 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1922 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1925 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
1926 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
1928 /* borderBottomColor */
1929 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
1930 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1933 V_BSTR(&v
) = a2bstr("cyan");
1934 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
1935 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1938 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1939 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1940 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1943 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
1944 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1946 /* borderLeftColor */
1947 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
1948 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1951 V_BSTR(&v
) = a2bstr("cyan");
1952 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
1953 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1956 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1957 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1958 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1961 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
1962 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1965 hres
= IHTMLStyle_get_clip(style
, &str
);
1966 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1967 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
1969 str
= a2bstr("rect(0px 1px 500px 505px)");
1970 hres
= IHTMLStyle_put_clip(style
, str
);
1971 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
1974 hres
= IHTMLStyle_get_clip(style
, &str
);
1975 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1976 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
1980 hres
= IHTMLStyle_get_clear(style
, &str
);
1981 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
1982 ok(!str
, "clear = %s\n", wine_dbgstr_w(str
));
1984 str
= a2bstr("both");
1985 hres
= IHTMLStyle_put_clear(style
, str
);
1986 ok(hres
== S_OK
, "put_clear failed: %08x\n", hres
);
1989 hres
= IHTMLStyle_get_clear(style
, &str
);
1990 ok(hres
== S_OK
, "get_clear failed: %08x\n", hres
);
1991 ok(!strcmp_wa(str
, "both"), "clear = %s\n", wine_dbgstr_w(str
));
1994 /* pageBreakAfter */
1995 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1996 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1997 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1999 str
= a2bstr("always");
2000 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
2001 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
2004 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
2005 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
2006 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
2009 /* pageBreakBefore */
2010 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2011 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2012 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2014 str
= a2bstr("always");
2015 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
2016 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
2019 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2020 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2021 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2024 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
2025 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
2027 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
2028 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
2029 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
2031 str
= (void*)0xdeadbeef;
2032 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2033 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2034 ok(!str
, "whiteSpace = %s\n", wine_dbgstr_w(str
));
2036 str
= a2bstr("nowrap");
2037 hres
= IHTMLStyle_put_whiteSpace(style
, str
);
2039 ok(hres
== S_OK
, "put_whiteSpace failed: %08x\n", hres
);
2042 hres
= IHTMLStyle_get_whiteSpace(style
, &str
);
2043 ok(hres
== S_OK
, "get_whiteSpace failed: %08x\n", hres
);
2044 ok(!strcmp_wa(str
, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str
));
2047 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
2048 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
2049 if(SUCCEEDED(hres
)) {
2050 test_style2(style2
);
2051 IHTMLStyle2_Release(style2
);
2054 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
2055 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
2056 if(SUCCEEDED(hres
)) {
2057 test_style3(style3
);
2058 IHTMLStyle3_Release(style3
);
2061 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
2062 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
2063 if(SUCCEEDED(hres
)) {
2064 test_style4(style4
);
2065 IHTMLStyle4_Release(style4
);
2069 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2070 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
2075 str
= (void*)0xdeadbeef;
2076 hres
= IHTMLStyle_get_filter(style
, &str
);
2077 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2079 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2081 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2086 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2087 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
2092 str
= (void*)0xdeadbeef;
2093 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
2094 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
2096 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
2098 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
2103 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2104 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
2106 BSTR str
= a2bstr(val
);
2109 hres
= IHTMLStyle_put_filter(style
, str
);
2110 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
2113 _test_style_filter(line
, style
, val
);
2116 static void test_style_filters(IHTMLElement
*elem
)
2118 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
2119 IHTMLCurrentStyle2
*current_style2
;
2120 IHTMLCurrentStyle
*current_style
;
2124 hres
= IHTMLElement_get_style(elem
, &style
);
2125 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2127 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
2128 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2130 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2132 test_style_filter(style
, NULL
);
2133 test_current_style_filter(current_style2
, NULL
);
2134 set_style_filter(style
, "alpha(opacity=50.0040)");
2135 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
2136 set_style_filter(style
, "alpha(opacity=100)");
2138 IHTMLStyle_Release(style
);
2140 hres
= IHTMLElement_get_style(elem
, &style
);
2141 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2143 test_style_filter(style
, "alpha(opacity=100)");
2144 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
2145 set_style_filter(style
, NULL
);
2146 set_style_filter(style
, "alpha(opacity=100)");
2147 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
2148 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
2149 test_style_filter(style
, NULL
);
2152 IHTMLCurrentStyle2_Release(current_style2
);
2153 IHTMLStyle_Release(style
);
2154 IHTMLElement2_Release(elem2
);
2157 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2159 IHTMLCurrentStyle2
*current_style2
;
2165 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2166 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2167 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2170 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2171 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2172 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2175 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2176 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2179 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2180 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2181 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2184 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2185 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2186 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2189 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2190 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2191 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2194 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2195 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2196 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
2199 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
2200 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2201 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
2204 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
2205 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2206 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
2209 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
2210 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2211 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
2214 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
2215 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
2216 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2219 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2220 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2221 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2224 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2225 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2226 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2229 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2230 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2231 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2234 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2235 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2238 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2239 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2242 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2243 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2246 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2247 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2250 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2251 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2254 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2255 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2258 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2259 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2262 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2263 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2264 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2265 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2268 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2269 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2270 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2273 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2274 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2275 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2278 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2279 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2280 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2283 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2284 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2285 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2288 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2289 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2290 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2293 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2294 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2295 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2298 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2299 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2300 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2301 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2304 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2305 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2306 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2307 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2310 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2311 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2312 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2315 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2316 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2317 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2320 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2321 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2322 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2326 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2327 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2328 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2331 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2332 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2333 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2336 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2337 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2338 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2341 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2342 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2343 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2346 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2347 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2348 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2351 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2352 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2353 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2356 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2357 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2358 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2361 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2362 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2363 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2366 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2367 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2368 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2371 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2372 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2373 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2376 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2377 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2378 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2381 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2382 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2383 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2386 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2387 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2388 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2391 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2392 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2393 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2396 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2397 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2398 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2401 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2402 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2403 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2406 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2407 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2408 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2411 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2412 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2413 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2416 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2417 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2418 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2421 current_style2
= get_current_style2_iface((IUnknown
*)current_style
);
2424 hres
= IHTMLCurrentStyle2_get_hasLayout(current_style2
, &b
);
2425 ok(hres
== S_OK
, "get_hasLayout failed: %08x\n", hres
);
2426 ok(b
== VARIANT_TRUE
, "hasLayout = %x\n", b
);
2428 IHTMLCurrentStyle2_Release(current_style2
);
2431 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2433 static void basic_style_test(IHTMLDocument2
*doc
)
2435 IHTMLCurrentStyle
*cstyle
;
2440 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2441 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2443 hres
= IHTMLElement_get_style(elem
, &style
);
2444 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2446 test_body_style(style
);
2448 cstyle
= get_current_style(elem
);
2449 test_current_style(cstyle
);
2450 IHTMLCurrentStyle_Release(cstyle
);
2451 IHTMLElement_Release(elem
);
2453 elem
= get_element_by_id(doc
, "divid");
2454 test_style_filters(elem
);
2456 test_set_csstext(style
);
2457 IHTMLStyle_Release(style
);
2458 IHTMLElement_Release(elem
);
2461 static const char runtimestyle_test_str
[] =
2462 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2464 static void runtimestyle_test(IHTMLDocument2
*doc
)
2466 IHTMLStyle
*style
, *runtime_style
;
2467 IHTMLElement2
*elem2
;
2472 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2473 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2475 elem2
= get_elem2_iface((IUnknown
*)elem
);
2477 hres
= IHTMLElement2_get_runtimeStyle(elem2
, &runtime_style
);
2478 ok(hres
== S_OK
, "get_runtimeStyle failed: %08x\n", hres
);
2480 hres
= IHTMLElement_get_style(elem
, &style
);
2481 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2483 test_text_decoration(style
, NULL
);
2484 test_text_decoration(runtime_style
, NULL
);
2485 set_text_decoration(style
, "underline");
2486 test_text_decoration(style
, "underline");
2488 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2489 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2490 ok(broken(!str
) || !strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2493 set_text_decoration(runtime_style
, "blink");
2494 test_text_decoration(runtime_style
, "blink");
2496 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
2497 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2499 ok(!strcmp_wa(str
, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str
));
2502 IHTMLStyle_Release(runtime_style
);
2503 IHTMLStyle_Release(style
);
2504 IHTMLElement2_Release(elem2
);
2505 IHTMLElement_Release(elem
);
2508 static IHTMLDocument2
*notif_doc
;
2509 static BOOL doc_complete
;
2511 static IHTMLDocument2
*create_document(void)
2513 IHTMLDocument2
*doc
;
2514 IHTMLDocument5
*doc5
;
2517 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2518 &IID_IHTMLDocument2
, (void**)&doc
);
2519 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2523 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2525 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2526 IHTMLDocument2_Release(doc
);
2530 IHTMLDocument5_Release(doc5
);
2534 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2535 REFIID riid
, void**ppv
)
2537 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2542 ok(0, "unexpected call\n");
2543 return E_NOINTERFACE
;
2546 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2551 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2556 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2558 if(dispID
== DISPID_READYSTATE
){
2562 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2563 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2565 if(!strcmp_wa(state
, "complete"))
2566 doc_complete
= TRUE
;
2568 SysFreeString(state
);
2574 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2576 ok(0, "unexpected call\n");
2580 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2581 PropertyNotifySink_QueryInterface
,
2582 PropertyNotifySink_AddRef
,
2583 PropertyNotifySink_Release
,
2584 PropertyNotifySink_OnChanged
,
2585 PropertyNotifySink_OnRequestEdit
2588 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2590 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2592 IPersistStreamInit
*init
;
2594 IHTMLDocument2
*doc
;
2598 notif_doc
= doc
= create_document();
2602 doc_complete
= FALSE
;
2604 mem
= GlobalAlloc(0, len
);
2605 memcpy(mem
, str
, len
);
2606 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2608 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2610 IPersistStreamInit_Load(init
, stream
);
2611 IPersistStreamInit_Release(init
);
2612 IStream_Release(stream
);
2617 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2619 IConnectionPointContainer
*container
;
2620 IConnectionPoint
*cp
;
2624 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2625 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2627 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2628 IConnectionPointContainer_Release(container
);
2629 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2631 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2632 IConnectionPoint_Release(cp
);
2633 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2636 typedef void (*style_test_t
)(IHTMLDocument2
*);
2638 static void run_test(const char *str
, style_test_t test
)
2640 IHTMLDocument2
*doc
;
2644 doc
= create_doc_with_string(str
);
2648 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2650 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
2651 TranslateMessage(&msg
);
2652 DispatchMessage(&msg
);
2657 ref
= IHTMLDocument2_Release(doc
);
2658 ok(!ref
|| broken(ref
== 1), /* Vista */
2667 run_test(basic_test_str
, basic_style_test
);
2668 run_test(runtimestyle_test_str
, runtimestyle_test
);