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 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
81 BSTR idW
= a2bstr(id
);
83 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
84 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
86 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
87 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
88 ok(result
!= NULL
, "result == NULL\n");
91 IHTMLDocument3_Release(doc3
);
95 #define get_current_style(e) _get_current_style(__LINE__,e)
96 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
98 IHTMLCurrentStyle
*cstyle
;
102 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
103 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
106 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
107 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
108 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
110 IHTMLElement2_Release(elem2
);
114 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
115 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
120 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
121 LOCALE_USER_DEFAULT
, &dispid
);
122 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
125 DISPPARAMS params
= {NULL
,NULL
,0,0};
126 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
131 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
132 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
133 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
136 params
.cNamedArgs
= 1;
137 params
.rgdispidNamedArgs
= &dispidNamed
;
138 V_VT(&arg
) = VT_BSTR
;
139 V_BSTR(&arg
) = a2bstr("none");
140 params
.rgvarg
= &arg
;
141 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
142 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
143 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
146 V_VT(&arg
) = VT_BSTR
;
147 V_BSTR(&arg
) = a2bstr("dotted");
148 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
149 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
150 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
153 V_VT(&arg
) = VT_BSTR
;
154 V_BSTR(&arg
) = a2bstr("dashed");
155 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
156 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
157 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
160 V_VT(&arg
) = VT_BSTR
;
161 V_BSTR(&arg
) = a2bstr("solid");
162 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
163 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
164 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
167 V_VT(&arg
) = VT_BSTR
;
168 V_BSTR(&arg
) = a2bstr("double");
169 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
170 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
171 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
174 V_VT(&arg
) = VT_BSTR
;
175 V_BSTR(&arg
) = a2bstr("groove");
176 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
177 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
178 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
181 V_VT(&arg
) = VT_BSTR
;
182 V_BSTR(&arg
) = a2bstr("ridge");
183 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
184 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
185 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
188 V_VT(&arg
) = VT_BSTR
;
189 V_BSTR(&arg
) = a2bstr("inset");
190 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
191 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
192 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
195 V_VT(&arg
) = VT_BSTR
;
196 V_BSTR(&arg
) = a2bstr("outset");
197 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
198 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
199 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
202 V_VT(&arg
) = VT_BSTR
;
203 V_BSTR(&arg
) = a2bstr("invalid");
204 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
205 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
206 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
209 params
.rgvarg
= &vDefault
;
210 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
211 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
212 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
213 VariantClear(&vDefault
);
217 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
218 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
220 BSTR text
= (void*)0xdeadbeef;
223 hres
= IHTMLStyle_get_cssText(style
, &text
);
224 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
226 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
228 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
233 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
234 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
240 hres
= IHTMLStyle_put_cssText(style
, tmp
);
241 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
245 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
246 static void _test_style_remove_attribute(unsigned line
, IHTMLStyle
*style
, const char *attr
, VARIANT_BOOL exb
)
248 BSTR str
= a2bstr(attr
);
249 VARIANT_BOOL b
= 100;
252 hres
= IHTMLStyle_removeAttribute(style
, str
, 1, &b
);
254 ok_(__FILE__
,line
)(hres
== S_OK
, "removeAttribute failed: %08x\n", hres
);
255 ok_(__FILE__
,line
)(b
== exb
, "removeAttribute returned %x, expected %x\n", b
, exb
);
258 static void test_set_csstext(IHTMLStyle
*style
)
263 test_style_set_csstext(style
, "background-color: black;");
265 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
266 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
267 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
268 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
272 static void test_style2(IHTMLStyle2
*style2
)
278 str
= (void*)0xdeadbeef;
279 hres
= IHTMLStyle2_get_position(style2
, &str
);
280 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
281 ok(!str
, "str != NULL\n");
283 str
= a2bstr("absolute");
284 hres
= IHTMLStyle2_put_position(style2
, str
);
285 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
289 hres
= IHTMLStyle2_get_position(style2
, &str
);
290 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
291 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
296 hres
= IHTMLStyle2_get_right(style2
, &v
);
297 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
298 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
299 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
303 V_BSTR(&v
) = a2bstr("3px");
304 hres
= IHTMLStyle2_put_right(style2
, v
);
305 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
309 hres
= IHTMLStyle2_get_right(style2
, &v
);
310 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
311 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
312 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
316 str
= (void*)0xdeadbeef;
317 hres
= IHTMLStyle2_get_direction(style2
, &str
);
318 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
319 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
322 hres
= IHTMLStyle2_put_direction(style2
, str
);
323 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
327 hres
= IHTMLStyle2_get_direction(style2
, &str
);
328 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
329 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
334 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
335 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
336 test_var_bstr(&v
, NULL
);
340 hres
= IHTMLStyle2_put_bottom(style2
, v
);
341 ok(hres
== S_OK
, "put_bottom failed: %08x\n", hres
);
344 hres
= IHTMLStyle2_get_bottom(style2
, &v
);
345 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
346 test_var_bstr(&v
, "4px");
349 str
= (void*)0xdeadbeef;
350 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
351 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
352 ok(!str
, "overflowX = %s\n", wine_dbgstr_w(str
));
354 str
= a2bstr("hidden");
355 hres
= IHTMLStyle2_put_overflowX(style2
, str
);
356 ok(hres
== S_OK
, "put_overflowX failed: %08x\n", hres
);
360 hres
= IHTMLStyle2_get_overflowX(style2
, &str
);
361 ok(hres
== S_OK
, "get_overflowX failed: %08x\n", hres
);
362 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
365 str
= (void*)0xdeadbeef;
366 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
367 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
368 ok(!str
, "overflowY = %s\n", wine_dbgstr_w(str
));
370 str
= a2bstr("hidden");
371 hres
= IHTMLStyle2_put_overflowY(style2
, str
);
372 ok(hres
== S_OK
, "put_overflowY failed: %08x\n", hres
);
376 hres
= IHTMLStyle2_get_overflowY(style2
, &str
);
377 ok(hres
== S_OK
, "get_overflowY failed: %08x\n", hres
);
378 ok(!strcmp_wa(str
, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str
));
381 static void test_style3(IHTMLStyle3
*style3
)
386 str
= (void*)0xdeadbeef;
387 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
388 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
389 ok(!str
, "str != NULL\n");
391 str
= a2bstr("break-word");
392 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
393 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
397 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
398 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
399 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
403 static void test_style4(IHTMLStyle4
*style4
)
409 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
410 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
413 V_BSTR(&v
) = a2bstr("10px");
414 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
415 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
418 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
419 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
420 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
421 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
424 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
425 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
426 VariantClear(&vdefault
);
429 static void test_body_style(IHTMLStyle
*style
)
439 BSTR sOverflowDefault
;
443 test_style_csstext(style
, NULL
);
445 hres
= IHTMLStyle_get_position(style
, &str
);
446 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
447 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
450 hres
= IHTMLStyle_get_marginRight(style
, &v
);
451 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
452 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
453 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
457 hres
= IHTMLStyle_put_marginRight(style
, v
);
458 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
461 hres
= IHTMLStyle_get_marginRight(style
, &v
);
462 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
463 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
464 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
467 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
468 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
469 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
470 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
474 hres
= IHTMLStyle_put_marginBottom(style
, v
);
475 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
478 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
479 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
480 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
481 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
484 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
485 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
486 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
487 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
491 hres
= IHTMLStyle_put_marginLeft(style
, v
);
492 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
495 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
496 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
497 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
498 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
500 str
= (void*)0xdeadbeef;
501 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
502 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
503 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
505 str
= (void*)0xdeadbeef;
506 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
507 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
508 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
510 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
511 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
513 str
= a2bstr("test");
514 hres
= IHTMLStyle_put_fontWeight(style
, str
);
515 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
518 str
= a2bstr("bold");
519 hres
= IHTMLStyle_put_fontWeight(style
, str
);
520 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
523 str
= a2bstr("bolder");
524 hres
= IHTMLStyle_put_fontWeight(style
, str
);
525 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
528 str
= a2bstr("lighter");
529 hres
= IHTMLStyle_put_fontWeight(style
, str
);
530 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
534 hres
= IHTMLStyle_put_fontWeight(style
, str
);
535 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
539 hres
= IHTMLStyle_put_fontWeight(style
, str
);
540 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
544 hres
= IHTMLStyle_put_fontWeight(style
, str
);
545 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
549 hres
= IHTMLStyle_put_fontWeight(style
, str
);
550 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
554 hres
= IHTMLStyle_put_fontWeight(style
, str
);
555 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
559 hres
= IHTMLStyle_put_fontWeight(style
, str
);
560 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
564 hres
= IHTMLStyle_put_fontWeight(style
, str
);
565 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
569 hres
= IHTMLStyle_put_fontWeight(style
, str
);
570 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
574 hres
= IHTMLStyle_put_fontWeight(style
, str
);
575 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
578 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
579 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
580 ok(!strcmp_wa(str
, "900"), "str != style900\n");
583 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
584 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
585 SysFreeString(sDefault
);
588 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
589 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
591 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
592 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
594 str
= a2bstr("test");
595 hres
= IHTMLStyle_put_fontVariant(style
, str
);
596 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
599 str
= a2bstr("small-caps");
600 hres
= IHTMLStyle_put_fontVariant(style
, str
);
601 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
604 str
= a2bstr("normal");
605 hres
= IHTMLStyle_put_fontVariant(style
, str
);
606 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
609 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
610 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
611 SysFreeString(sDefault
);
613 str
= (void*)0xdeadbeef;
614 hres
= IHTMLStyle_get_display(style
, &str
);
615 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
616 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
618 str
= (void*)0xdeadbeef;
619 hres
= IHTMLStyle_get_visibility(style
, &str
);
620 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
621 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
624 hres
= IHTMLStyle_get_fontSize(style
, &v
);
625 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
626 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
627 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
631 hres
= IHTMLStyle_put_fontSize(style
, v
);
632 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
635 hres
= IHTMLStyle_get_fontSize(style
, &v
);
636 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
637 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
638 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
641 hres
= IHTMLStyle_get_color(style
, &v
);
642 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
643 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
644 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
648 hres
= IHTMLStyle_put_color(style
, v
);
649 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
652 hres
= IHTMLStyle_get_color(style
, &v
);
653 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
654 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
656 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
659 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
660 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
661 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
663 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
664 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
665 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
667 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
668 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
669 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
671 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
672 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
675 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
676 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
677 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
679 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
680 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
681 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
683 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
684 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
685 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
687 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
688 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
691 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
692 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
693 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
695 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
696 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
697 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
699 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
700 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
701 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
703 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
704 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
707 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
708 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
709 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
711 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
712 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
713 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
715 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
716 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
717 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
719 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
720 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
723 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
724 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
725 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
727 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
728 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
729 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
731 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
732 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
733 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
735 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
736 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
738 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
739 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
741 str
= a2bstr("invalid");
742 hres
= IHTMLStyle_put_textDecoration(style
, str
);
743 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
746 str
= a2bstr("none");
747 hres
= IHTMLStyle_put_textDecoration(style
, str
);
748 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
751 str
= a2bstr("underline");
752 hres
= IHTMLStyle_put_textDecoration(style
, str
);
753 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
756 str
= a2bstr("overline");
757 hres
= IHTMLStyle_put_textDecoration(style
, str
);
758 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
761 str
= a2bstr("line-through");
762 hres
= IHTMLStyle_put_textDecoration(style
, str
);
763 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
766 str
= a2bstr("blink");
767 hres
= IHTMLStyle_put_textDecoration(style
, str
);
768 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
771 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
772 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
773 ok(!strcmp_wa(str
, "blink"), "str != blink\n");
776 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
777 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
778 SysFreeString(sDefault
);
780 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
781 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
783 hres
= IHTMLStyle_get_posWidth(style
, &f
);
784 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
785 ok(f
== 0.0f
, "f = %f\n", f
);
788 hres
= IHTMLStyle_get_width(style
, &v
);
789 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
790 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
791 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
793 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
794 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
796 hres
= IHTMLStyle_get_posWidth(style
, &f
);
797 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
803 V_BSTR(&v
) = a2bstr("auto");
804 hres
= IHTMLStyle_put_width(style
, v
);
805 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
809 hres
= IHTMLStyle_get_width(style
, &v
);
810 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
811 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
812 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
817 hres
= IHTMLStyle_put_width(style
, v
);
818 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
821 hres
= IHTMLStyle_get_width(style
, &v
);
822 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
823 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
824 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
828 str
= (void*)0xdeadbeef;
829 hres
= IHTMLStyle_get_margin(style
, &str
);
830 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
831 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
834 hres
= IHTMLStyle_put_margin(style
, str
);
835 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
838 hres
= IHTMLStyle_get_margin(style
, &str
);
839 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
840 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
843 hres
= IHTMLStyle_put_margin(style
, NULL
);
844 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
846 str
= (void*)0xdeadbeef;
847 hres
= IHTMLStyle_get_marginTop(style
, &v
);
848 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
849 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
850 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
853 V_BSTR(&v
) = a2bstr("6px");
854 hres
= IHTMLStyle_put_marginTop(style
, v
);
855 SysFreeString(V_BSTR(&v
));
856 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
858 str
= (void*)0xdeadbeef;
859 hres
= IHTMLStyle_get_marginTop(style
, &v
);
860 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
861 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
862 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
867 hres
= IHTMLStyle_put_marginTop(style
, v
);
868 ok(hres
== S_OK
, "put_marginTop 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(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
878 hres
= IHTMLStyle_get_border(style
, &str
);
879 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
880 ok(!str
|| !*str
, "str is not empty\n");
884 hres
= IHTMLStyle_put_border(style
, str
);
885 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
889 hres
= IHTMLStyle_get_left(style
, &v
);
890 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
891 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
892 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
896 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
897 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
900 hres
= IHTMLStyle_get_posLeft(style
, &f
);
901 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
902 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
904 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
905 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
907 hres
= IHTMLStyle_get_posLeft(style
, &f
);
908 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
911 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
913 /* Ensure left is updated correctly. */
915 hres
= IHTMLStyle_get_left(style
, &v
);
916 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
917 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
918 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
919 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
920 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
925 V_BSTR(&v
) = a2bstr("3px");
926 hres
= IHTMLStyle_put_left(style
, v
);
927 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
930 hres
= IHTMLStyle_get_posLeft(style
, &f
);
931 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
932 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
935 hres
= IHTMLStyle_get_left(style
, &v
);
936 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
937 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
938 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
942 hres
= IHTMLStyle_put_left(style
, v
);
943 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
946 hres
= IHTMLStyle_get_left(style
, &v
);
947 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
948 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
949 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
953 hres
= IHTMLStyle_get_top(style
, &v
);
954 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
955 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
956 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
960 hres
= IHTMLStyle_get_posTop(style
, NULL
);
961 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
964 hres
= IHTMLStyle_get_posTop(style
, &f
);
965 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
966 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
968 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
969 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
971 hres
= IHTMLStyle_get_posTop(style
, &f
);
972 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
975 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
978 V_BSTR(&v
) = a2bstr("3px");
979 hres
= IHTMLStyle_put_top(style
, v
);
980 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
984 hres
= IHTMLStyle_get_top(style
, &v
);
985 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
986 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
987 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
990 hres
= IHTMLStyle_get_posTop(style
, &f
);
991 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
992 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
995 hres
= IHTMLStyle_put_top(style
, v
);
996 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
999 hres
= IHTMLStyle_get_top(style
, &v
);
1000 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1001 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1002 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1005 /* Test posHeight */
1006 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
1007 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
1009 V_VT(&v
) = VT_EMPTY
;
1010 hres
= IHTMLStyle_get_height(style
, &v
);
1011 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1012 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1013 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1017 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1018 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1019 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
1021 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
1022 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
1024 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1025 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1027 f
== 4.9f
, /* IE8 */
1028 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
1031 V_BSTR(&v
) = a2bstr("70px");
1032 hres
= IHTMLStyle_put_height(style
, v
);
1033 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1036 V_VT(&v
) = VT_EMPTY
;
1037 hres
= IHTMLStyle_get_height(style
, &v
);
1038 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1039 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1040 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1045 hres
= IHTMLStyle_put_height(style
, v
);
1046 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
1048 V_VT(&v
) = VT_EMPTY
;
1049 hres
= IHTMLStyle_get_height(style
, &v
);
1050 ok(hres
== S_OK
, "get_height 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
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1055 hres
= IHTMLStyle_get_posHeight(style
, &f
);
1056 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
1057 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
1059 str
= (void*)0xdeadbeef;
1060 hres
= IHTMLStyle_get_cursor(style
, &str
);
1061 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1062 ok(!str
, "get_cursor != NULL\n");
1065 str
= a2bstr("default");
1066 hres
= IHTMLStyle_put_cursor(style
, str
);
1067 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1071 hres
= IHTMLStyle_get_cursor(style
, &str
);
1072 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1073 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1076 V_VT(&v
) = VT_EMPTY
;
1077 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1078 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1079 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1080 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1084 V_BSTR(&v
) = a2bstr("middle");
1085 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1086 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1089 V_VT(&v
) = VT_EMPTY
;
1090 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1091 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1092 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1093 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1098 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1099 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1102 V_VT(&v
) = VT_EMPTY
;
1103 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1104 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1105 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1106 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1109 str
= (void*)0xdeadbeef;
1110 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1111 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1112 ok(!str
, "textAlign != NULL\n");
1114 str
= a2bstr("center");
1115 hres
= IHTMLStyle_put_textAlign(style
, str
);
1116 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1120 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1121 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1122 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1125 str
= (void*)0xdeadbeef;
1126 hres
= IHTMLStyle_get_filter(style
, &str
);
1127 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1128 ok(!str
, "filter != NULL\n");
1130 str
= a2bstr("alpha(opacity=100)");
1131 hres
= IHTMLStyle_put_filter(style
, str
);
1132 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1135 V_VT(&v
) = VT_EMPTY
;
1136 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1137 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1138 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1139 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1143 V_BSTR(&v
) = a2bstr("1");
1144 hres
= IHTMLStyle_put_zIndex(style
, v
);
1145 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1148 V_VT(&v
) = VT_EMPTY
;
1149 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1150 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1151 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1152 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1156 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1157 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1159 str
= a2bstr("test");
1160 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1161 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1164 str
= a2bstr("italic");
1165 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1166 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1169 str
= a2bstr("oblique");
1170 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1171 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1174 str
= a2bstr("normal");
1175 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1176 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1179 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1180 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1181 SysFreeString(sDefault
);
1184 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1185 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1187 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1188 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1190 str
= a2bstr("test");
1191 hres
= IHTMLStyle_put_overflow(style
, str
);
1192 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1195 str
= a2bstr("visible");
1196 hres
= IHTMLStyle_put_overflow(style
, str
);
1197 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1200 str
= a2bstr("scroll");
1201 hres
= IHTMLStyle_put_overflow(style
, str
);
1202 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1205 str
= a2bstr("hidden");
1206 hres
= IHTMLStyle_put_overflow(style
, str
);
1207 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1210 str
= a2bstr("auto");
1211 hres
= IHTMLStyle_put_overflow(style
, str
);
1212 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1215 hres
= IHTMLStyle_get_overflow(style
, &str
);
1216 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1217 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1221 hres
= IHTMLStyle_put_overflow(style
, str
);
1222 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1225 hres
= IHTMLStyle_get_overflow(style
, &str
);
1226 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1227 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1230 /* restore overflow default */
1231 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1232 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1233 SysFreeString(sOverflowDefault
);
1235 /* Attribute Tests*/
1236 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1237 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1239 str
= a2bstr("position");
1240 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1241 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1243 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1244 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1245 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1248 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1249 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1252 V_BSTR(&v
) = a2bstr("absolute");
1253 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1254 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1257 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1258 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1259 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1260 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1265 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1266 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1271 str
= a2bstr("borderLeftStyle");
1272 test_border_styles(style
, str
);
1275 str
= a2bstr("borderbottomstyle");
1276 test_border_styles(style
, str
);
1279 str
= a2bstr("borderrightstyle");
1280 test_border_styles(style
, str
);
1283 str
= a2bstr("bordertopstyle");
1284 test_border_styles(style
, str
);
1287 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1288 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1290 str
= a2bstr("none dotted dashed solid");
1291 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1292 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1295 str
= a2bstr("none dotted dashed solid");
1296 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1297 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1298 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1299 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1302 str
= a2bstr("double groove ridge inset");
1303 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1304 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1307 str
= a2bstr("window-inset outset ridge inset");
1308 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1309 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1312 str
= a2bstr("window-inset");
1313 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1314 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1317 str
= a2bstr("none none none none none");
1318 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1319 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1322 str
= a2bstr("invalid none none none");
1323 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1324 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1327 str
= a2bstr("none invalid none none");
1328 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1329 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1332 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1333 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1334 SysFreeString(sDefault
);
1336 /* backgoundColor */
1337 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1338 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1339 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1340 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1344 V_BSTR(&v
) = a2bstr("red");
1345 hres
= IHTMLStyle_put_backgroundColor(style
, v
);
1346 ok(hres
== S_OK
, "put_backgroundColor failed: %08x\n", hres
);
1349 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1350 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1351 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1352 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1356 hres
= IHTMLStyle_get_padding(style
, &str
);
1357 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1358 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1361 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1362 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1363 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1364 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1368 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1369 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1371 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1372 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1373 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1374 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1377 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1378 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1379 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1380 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1384 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1385 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1387 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1388 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1389 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1390 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1393 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1394 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1395 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1396 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1400 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
1401 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1403 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1404 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1405 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1406 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1410 hres
= IHTMLStyle_put_padding(style
, str
);
1411 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1414 hres
= IHTMLStyle_get_padding(style
, &str
);
1415 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1416 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1420 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1421 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1422 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1423 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1426 V_BSTR(&v
) = a2bstr("10");
1427 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1428 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1431 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1432 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1433 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1436 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1437 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1439 /* BackgroundRepeat */
1440 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1441 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1443 str
= a2bstr("invalid");
1444 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1445 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1448 str
= a2bstr("repeat");
1449 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1450 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1453 str
= a2bstr("no-repeat");
1454 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1455 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1458 str
= a2bstr("repeat-x");
1459 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1460 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1463 str
= a2bstr("repeat-y");
1464 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1465 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1468 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1469 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1470 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1473 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1474 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1475 SysFreeString(sDefault
);
1478 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1479 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1481 str
= a2bstr("red green red blue");
1482 hres
= IHTMLStyle_put_borderColor(style
, str
);
1483 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1486 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1487 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1488 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1491 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1492 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1493 SysFreeString(sDefault
);
1496 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1497 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1499 str
= a2bstr("thick dotted red");
1500 hres
= IHTMLStyle_put_borderRight(style
, str
);
1501 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1504 /* IHTMLStyle_get_borderRight appears to have a bug where
1505 it returns the first letter of the color. So we check
1506 each style individually.
1509 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1510 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1511 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1515 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1516 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1517 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1520 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1521 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1522 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1525 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1526 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1527 SysFreeString(sDefault
);
1530 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1531 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1533 str
= a2bstr("thick dotted red");
1534 hres
= IHTMLStyle_put_borderTop(style
, str
);
1535 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1538 /* IHTMLStyle_get_borderTop appears to have a bug where
1539 it returns the first letter of the color. So we check
1540 each style individually.
1543 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1544 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1545 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1549 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1550 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1551 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1554 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1555 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1556 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1559 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1560 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1561 SysFreeString(sDefault
);
1564 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1565 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1567 str
= a2bstr("thick dotted red");
1568 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1569 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1572 /* IHTMLStyle_get_borderBottom appears to have a bug where
1573 it returns the first letter of the color. So we check
1574 each style individually.
1577 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1578 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1579 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1583 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1584 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1585 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1588 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1589 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1590 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1593 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1594 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1595 SysFreeString(sDefault
);
1598 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1599 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1601 str
= a2bstr("thick dotted red");
1602 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1603 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1606 /* IHTMLStyle_get_borderLeft appears to have a bug where
1607 it returns the first letter of the color. So we check
1608 each style individually.
1611 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1612 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1613 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1617 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1618 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1619 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1622 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1623 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1624 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1627 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1628 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1629 SysFreeString(sDefault
);
1631 /* backgroundPositionX */
1632 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1633 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1634 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1635 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1639 V_BSTR(&v
) = a2bstr("10px");
1640 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1641 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1644 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1645 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1646 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1647 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1650 /* backgroundPositionY */
1651 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1652 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1653 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1657 V_BSTR(&v
) = a2bstr("15px");
1658 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
1659 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
1662 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1663 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1664 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1665 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1668 /* backgroundPosition */
1670 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1671 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1672 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1675 str
= a2bstr("center 20%");
1676 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
1677 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
1681 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1682 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1683 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1686 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1687 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1688 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1689 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1692 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1693 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1694 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1695 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1698 /* borderTopWidth */
1699 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
1700 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1703 V_BSTR(&v
) = a2bstr("10px");
1704 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
1705 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1708 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1709 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1710 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1713 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
1714 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1715 VariantClear(&vDefault
);
1717 /* borderRightWidth */
1718 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
1719 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1722 V_BSTR(&v
) = a2bstr("10");
1723 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
1724 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1727 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1728 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1729 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1732 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
1733 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1734 VariantClear(&vDefault
);
1736 /* borderBottomWidth */
1737 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
1738 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1741 V_BSTR(&v
) = a2bstr("10");
1742 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
1743 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1746 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1747 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1748 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1751 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
1752 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1753 VariantClear(&vDefault
);
1755 /* borderLeftWidth */
1756 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
1757 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1760 V_BSTR(&v
) = a2bstr("10");
1761 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
1762 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1765 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1766 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1767 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1770 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
1771 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1772 VariantClear(&vDefault
);
1775 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
1776 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1779 V_BSTR(&v
) = a2bstr("10");
1780 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
1781 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1784 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
1785 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1786 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1787 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1790 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
1791 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1792 VariantClear(&vDefault
);
1795 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
1796 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1799 V_BSTR(&v
) = a2bstr("11");
1800 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
1801 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1804 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
1805 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1806 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1807 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1810 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
1811 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1812 VariantClear(&vDefault
);
1814 /* borderTopColor */
1815 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
1816 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1819 V_BSTR(&v
) = a2bstr("red");
1820 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
1821 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1824 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1825 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1826 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1829 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
1830 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1832 /* borderRightColor */
1833 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
1834 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1837 V_BSTR(&v
) = a2bstr("blue");
1838 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
1839 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
1842 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1843 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1844 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1847 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
1848 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
1850 /* borderBottomColor */
1851 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
1852 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1855 V_BSTR(&v
) = a2bstr("cyan");
1856 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
1857 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1860 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1861 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1862 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1865 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
1866 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1868 /* borderLeftColor */
1869 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
1870 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1873 V_BSTR(&v
) = a2bstr("cyan");
1874 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
1875 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1878 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1879 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1880 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1883 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
1884 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1887 hres
= IHTMLStyle_get_clip(style
, &str
);
1888 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1889 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
1891 str
= a2bstr("rect(0px 1px 500px 505px)");
1892 hres
= IHTMLStyle_put_clip(style
, str
);
1893 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
1896 hres
= IHTMLStyle_get_clip(style
, &str
);
1897 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1898 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
1901 /* pageBreakAfter */
1902 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1903 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1904 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1906 str
= a2bstr("always");
1907 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
1908 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
1911 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1912 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1913 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1916 /* pageBreakBefore */
1917 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1918 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1919 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1921 str
= a2bstr("always");
1922 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
1923 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
1926 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1927 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1928 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1931 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_TRUE
);
1932 test_style_remove_attribute(style
, "pageBreakBefore", VARIANT_FALSE
);
1934 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1935 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1936 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1938 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
1939 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
1940 if(SUCCEEDED(hres
)) {
1941 test_style2(style2
);
1942 IHTMLStyle2_Release(style2
);
1945 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
1946 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
1947 if(SUCCEEDED(hres
)) {
1948 test_style3(style3
);
1949 IHTMLStyle3_Release(style3
);
1952 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
1953 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
1954 if(SUCCEEDED(hres
)) {
1955 test_style4(style4
);
1956 IHTMLStyle4_Release(style4
);
1960 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1961 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
1966 str
= (void*)0xdeadbeef;
1967 hres
= IHTMLStyle_get_filter(style
, &str
);
1968 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1970 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
1972 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
1977 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
1978 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
1983 str
= (void*)0xdeadbeef;
1984 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
1985 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1987 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
1989 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
1994 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1995 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
1997 BSTR str
= a2bstr(val
);
2000 hres
= IHTMLStyle_put_filter(style
, str
);
2001 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
2004 _test_style_filter(line
, style
, val
);
2007 static void test_style_filters(IHTMLElement
*elem
)
2009 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
2010 IHTMLCurrentStyle2
*current_style2
;
2011 IHTMLCurrentStyle
*current_style
;
2015 hres
= IHTMLElement_get_style(elem
, &style
);
2016 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2018 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
2019 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2021 hres
= IHTMLCurrentStyle_QueryInterface(current_style
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
2022 IHTMLCurrentStyle_Release(current_style
);
2023 ok(hres
== S_OK
, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres
);
2025 test_style_filter(style
, NULL
);
2026 test_current_style_filter(current_style2
, NULL
);
2027 set_style_filter(style
, "alpha(opacity=50.0040)");
2028 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
2029 set_style_filter(style
, "alpha(opacity=100)");
2031 IHTMLStyle_Release(style
);
2033 hres
= IHTMLElement_get_style(elem
, &style
);
2034 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2036 test_style_filter(style
, "alpha(opacity=100)");
2037 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
2038 set_style_filter(style
, NULL
);
2039 set_style_filter(style
, "alpha(opacity=100)");
2040 test_style_remove_attribute(style
, "filter", VARIANT_TRUE
);
2041 test_style_remove_attribute(style
, "filter", VARIANT_FALSE
);
2042 test_style_filter(style
, NULL
);
2045 IHTMLCurrentStyle2_Release(current_style2
);
2046 IHTMLStyle_Release(style
);
2047 IHTMLElement2_Release(elem2
);
2050 static void test_current_style(IHTMLCurrentStyle
*current_style
)
2056 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
2057 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
2058 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
2061 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
2062 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
2063 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
2066 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
2067 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
2070 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
2071 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
2072 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
2075 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
2076 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
2077 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
2080 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
2081 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
2082 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
2085 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
2086 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
2087 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
2090 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
2091 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
2092 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
2095 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
2096 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
2097 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
2100 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
2101 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
2102 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
2105 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
2106 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
2107 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2110 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2111 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2112 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2115 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2116 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2117 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2120 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2121 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2122 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2125 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2126 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2129 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2130 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2133 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2134 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2137 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2138 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2141 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2142 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2145 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2146 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2149 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2150 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2153 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2154 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2155 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2156 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2159 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2160 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2161 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2164 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2165 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2166 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2169 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2170 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2171 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2174 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2175 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2176 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2179 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2180 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2181 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2184 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2185 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2186 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2189 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2190 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2191 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2192 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2195 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2196 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2197 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2198 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2201 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2202 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2203 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2206 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2207 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2208 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2211 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2212 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2213 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2217 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2218 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2219 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2222 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2223 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2224 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2227 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2228 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2229 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2232 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2233 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2234 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2237 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2238 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2239 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2242 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2243 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2244 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2247 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2248 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2249 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2252 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2253 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2254 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2257 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2258 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2259 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2262 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2263 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2264 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2267 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2268 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2269 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2272 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2273 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2274 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2277 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2278 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2279 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2282 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2283 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2284 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2287 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2288 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2289 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2292 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2293 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2294 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2297 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2298 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2299 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2302 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2303 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2304 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2307 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2308 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2309 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2313 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2315 static void basic_style_test(IHTMLDocument2
*doc
)
2317 IHTMLCurrentStyle
*cstyle
;
2322 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2323 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2325 hres
= IHTMLElement_get_style(elem
, &style
);
2326 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2328 test_body_style(style
);
2330 cstyle
= get_current_style(elem
);
2331 test_current_style(cstyle
);
2332 IHTMLCurrentStyle_Release(cstyle
);
2333 IHTMLElement_Release(elem
);
2335 elem
= get_element_by_id(doc
, "divid");
2336 test_style_filters(elem
);
2338 test_set_csstext(style
);
2339 IHTMLStyle_Release(style
);
2340 IHTMLElement_Release(elem
);
2343 static IHTMLDocument2
*notif_doc
;
2344 static BOOL doc_complete
;
2346 static IHTMLDocument2
*create_document(void)
2348 IHTMLDocument2
*doc
;
2349 IHTMLDocument5
*doc5
;
2352 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2353 &IID_IHTMLDocument2
, (void**)&doc
);
2354 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2358 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2360 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2361 IHTMLDocument2_Release(doc
);
2365 IHTMLDocument5_Release(doc5
);
2369 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2370 REFIID riid
, void**ppv
)
2372 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2377 ok(0, "unexpected call\n");
2378 return E_NOINTERFACE
;
2381 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2386 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2391 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2393 if(dispID
== DISPID_READYSTATE
){
2397 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2398 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2400 if(!strcmp_wa(state
, "complete"))
2401 doc_complete
= TRUE
;
2403 SysFreeString(state
);
2409 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2411 ok(0, "unexpected call\n");
2415 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2416 PropertyNotifySink_QueryInterface
,
2417 PropertyNotifySink_AddRef
,
2418 PropertyNotifySink_Release
,
2419 PropertyNotifySink_OnChanged
,
2420 PropertyNotifySink_OnRequestEdit
2423 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2425 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2427 IPersistStreamInit
*init
;
2429 IHTMLDocument2
*doc
;
2433 notif_doc
= doc
= create_document();
2437 doc_complete
= FALSE
;
2439 mem
= GlobalAlloc(0, len
);
2440 memcpy(mem
, str
, len
);
2441 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2443 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2445 IPersistStreamInit_Load(init
, stream
);
2446 IPersistStreamInit_Release(init
);
2447 IStream_Release(stream
);
2452 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2454 IConnectionPointContainer
*container
;
2455 IConnectionPoint
*cp
;
2459 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2460 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2462 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2463 IConnectionPointContainer_Release(container
);
2464 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2466 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2467 IConnectionPoint_Release(cp
);
2468 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2471 typedef void (*style_test_t
)(IHTMLDocument2
*);
2473 static void run_test(const char *str
, style_test_t test
)
2475 IHTMLDocument2
*doc
;
2479 doc
= create_doc_with_string(str
);
2483 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2485 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
2486 TranslateMessage(&msg
);
2487 DispatchMessage(&msg
);
2492 ref
= IHTMLDocument2_Release(doc
);
2493 ok(!ref
|| broken(ref
== 1), /* Vista */
2502 run_test(basic_test_str
, basic_style_test
);