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);
666 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
667 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
668 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
670 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
671 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
674 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
675 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
676 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
678 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
679 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
681 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
682 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
683 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
685 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
686 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
689 hres = IHTMLStyle_get_textDecorationNone(style, &b);
690 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
691 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
693 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
694 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
696 hres = IHTMLStyle_get_textDecorationNone(style, &b);
697 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
698 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
700 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
701 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
704 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
705 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
706 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
708 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
709 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
711 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
712 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
713 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
715 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
716 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
719 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
720 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
721 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
723 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
724 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
726 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
727 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
728 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
730 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
731 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
733 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
734 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
736 str = a2bstr("invalid");
737 hres = IHTMLStyle_put_textDecoration(style, str);
738 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
741 str = a2bstr("none");
742 hres = IHTMLStyle_put_textDecoration(style, str);
743 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
746 str = a2bstr("underline");
747 hres = IHTMLStyle_put_textDecoration(style, str);
748 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
751 str = a2bstr("overline");
752 hres = IHTMLStyle_put_textDecoration(style, str);
753 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
756 str = a2bstr("line-through");
757 hres = IHTMLStyle_put_textDecoration(style, str);
758 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
761 str = a2bstr("blink");
762 hres = IHTMLStyle_put_textDecoration(style, str);
763 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
766 hres = IHTMLStyle_get_textDecoration(style, &str);
767 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
768 ok(!strcmp_wa(str, "blink"), "str != blink\n");
771 hres = IHTMLStyle_put_textDecoration(style, sDefault);
772 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
773 SysFreeString(sDefault);
775 hres = IHTMLStyle_get_posWidth(style, NULL);
776 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
778 hres = IHTMLStyle_get_posWidth(style, &f);
779 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
780 ok(f == 0.0f, "f = %f\n", f);
783 hres = IHTMLStyle_get_width(style, &v);
784 ok(hres == S_OK, "get_width failed: %08x\n", hres);
785 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
786 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
788 hres = IHTMLStyle_put_posWidth(style, 2.2);
789 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
791 hres = IHTMLStyle_get_posWidth(style, &f);
792 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
798 V_BSTR(&v) = a2bstr("auto");
799 hres = IHTMLStyle_put_width(style, v);
800 ok(hres == S_OK, "put_width failed: %08x\n", hres);
804 hres = IHTMLStyle_get_width(style, &v);
805 ok(hres == S_OK, "get_width failed: %08x\n", hres);
806 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
807 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
812 hres = IHTMLStyle_put_width(style, v);
813 ok(hres == S_OK, "put_width failed: %08x\n", hres);
816 hres = IHTMLStyle_get_width(style, &v);
817 ok(hres == S_OK, "get_width failed: %08x\n", hres);
818 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
819 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
823 str = (void*)0xdeadbeef;
824 hres = IHTMLStyle_get_margin(style, &str);
825 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
826 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
829 hres = IHTMLStyle_put_margin(style, str);
830 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
833 hres = IHTMLStyle_get_margin(style, &str);
834 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
835 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
838 hres = IHTMLStyle_put_margin(style, NULL);
839 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
841 str = (void*)0xdeadbeef;
842 hres = IHTMLStyle_get_marginTop(style, &v);
843 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
844 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
845 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
848 V_BSTR(&v) = a2bstr("6px");
849 hres = IHTMLStyle_put_marginTop(style, v);
850 SysFreeString(V_BSTR(&v));
851 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
853 str = (void*)0xdeadbeef;
854 hres = IHTMLStyle_get_marginTop(style, &v);
855 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
856 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
857 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
862 hres = IHTMLStyle_put_marginTop(style, v);
863 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
865 str = (void*)0xdeadbeef;
866 hres = IHTMLStyle_get_marginTop(style, &v);
867 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
868 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
869 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
873 hres = IHTMLStyle_get_border(style, &str);
874 ok(hres == S_OK, "get_border failed: %08x\n", hres);
875 ok(!str || !*str, "str is not empty\n");
879 hres = IHTMLStyle_put_border(style, str);
880 ok(hres == S_OK, "put_border failed: %08x\n", hres);
884 hres = IHTMLStyle_get_left(style, &v);
885 ok(hres == S_OK, "get_left failed: %08x\n", hres);
886 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
887 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
891 hres = IHTMLStyle_get_posLeft(style, NULL);
892 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
895 hres = IHTMLStyle_get_posLeft(style, &f);
896 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
897 ok(f == 0.0, "expected 0.0 got %f\n", f);
899 hres = IHTMLStyle_put_posLeft(style, 4.9f);
900 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
902 hres = IHTMLStyle_get_posLeft(style, &f);
903 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
906 "expected 4.0 or 4.9 (IE8) got %f\n", f);
908 /* Ensure left is updated correctly. */
910 hres = IHTMLStyle_get_left(style, &v);
911 ok(hres == S_OK, "get_left failed: %08x\n", hres);
912 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
913 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
914 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
915 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
920 V_BSTR(&v) = a2bstr("3px");
921 hres = IHTMLStyle_put_left(style, v);
922 ok(hres == S_OK, "put_left failed: %08x\n", hres);
925 hres = IHTMLStyle_get_posLeft(style, &f);
926 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
927 ok(f == 3.0, "expected 3.0 got %f\n", f);
930 hres = IHTMLStyle_get_left(style, &v);
931 ok(hres == S_OK, "get_left failed: %08x\n", hres);
932 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
933 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
937 hres = IHTMLStyle_put_left(style, v);
938 ok(hres == S_OK, "put_left failed: %08x\n", hres);
941 hres = IHTMLStyle_get_left(style, &v);
942 ok(hres == S_OK, "get_left failed: %08x\n", hres);
943 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
944 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
948 hres = IHTMLStyle_get_top(style, &v);
949 ok(hres == S_OK, "get_top failed: %08x\n", hres);
950 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
951 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
955 hres = IHTMLStyle_get_posTop(style, NULL);
956 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
959 hres = IHTMLStyle_get_posTop(style, &f);
960 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
961 ok(f == 0.0, "expected 0.0 got %f\n", f);
963 hres = IHTMLStyle_put_posTop(style, 4.9f);
964 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
966 hres = IHTMLStyle_get_posTop(style, &f);
967 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
970 "expected 4.0 or 4.9 (IE8) got %f\n", f);
973 V_BSTR(&v) = a2bstr("3px");
974 hres = IHTMLStyle_put_top(style, v);
975 ok(hres == S_OK, "put_top failed: %08x\n", hres);
979 hres = IHTMLStyle_get_top(style, &v);
980 ok(hres == S_OK, "get_top failed: %08x\n", hres);
981 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
982 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
985 hres = IHTMLStyle_get_posTop(style, &f);
986 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
987 ok(f == 3.0, "expected 3.0 got %f\n", f);
990 hres = IHTMLStyle_put_top(style, v);
991 ok(hres == S_OK, "put_top failed: %08x\n", hres);
994 hres = IHTMLStyle_get_top(style, &v);
995 ok(hres == S_OK, "get_top failed: %08x\n", hres);
996 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
997 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1000 /* Test posHeight */
1001 hres = IHTMLStyle_get_posHeight(style, NULL);
1002 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1004 V_VT(&v) = VT_EMPTY;
1005 hres = IHTMLStyle_get_height(style, &v);
1006 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1007 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1008 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1012 hres = IHTMLStyle_get_posHeight(style, &f);
1013 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1014 ok(f == 0.0, "expected 0.0 got %f\n", f);
1016 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1017 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1019 hres = IHTMLStyle_get_posHeight(style, &f);
1020 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1022 f == 4.9f, /* IE8 */
1023 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1026 V_BSTR(&v) = a2bstr("70px");
1027 hres = IHTMLStyle_put_height(style, v);
1028 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1031 V_VT(&v) = VT_EMPTY;
1032 hres = IHTMLStyle_get_height(style, &v);
1033 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1034 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1035 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1040 hres = IHTMLStyle_put_height(style, v);
1041 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1043 V_VT(&v) = VT_EMPTY;
1044 hres = IHTMLStyle_get_height(style, &v);
1045 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1046 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1047 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1050 hres = IHTMLStyle_get_posHeight(style, &f);
1051 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1052 ok(f == 64.0, "expected 64.0 got %f\n", f);
1054 str = (void*)0xdeadbeef;
1055 hres = IHTMLStyle_get_cursor(style, &str);
1056 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1057 ok(!str, "get_cursor != NULL\n");
1060 str = a2bstr("default");
1061 hres = IHTMLStyle_put_cursor(style, str);
1062 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1066 hres = IHTMLStyle_get_cursor(style, &str);
1067 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1068 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1071 V_VT(&v) = VT_EMPTY;
1072 hres = IHTMLStyle_get_verticalAlign(style, &v);
1073 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1074 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1075 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1079 V_BSTR(&v) = a2bstr("middle");
1080 hres = IHTMLStyle_put_verticalAlign(style, v);
1081 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1084 V_VT(&v) = VT_EMPTY;
1085 hres = IHTMLStyle_get_verticalAlign(style, &v);
1086 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1087 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1088 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1093 hres = IHTMLStyle_put_verticalAlign(style, v);
1094 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1097 V_VT(&v) = VT_EMPTY;
1098 hres = IHTMLStyle_get_verticalAlign(style, &v);
1099 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1100 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1101 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1104 str = (void*)0xdeadbeef;
1105 hres = IHTMLStyle_get_textAlign(style, &str);
1106 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1107 ok(!str, "textAlign != NULL\n");
1109 str = a2bstr("center");
1110 hres = IHTMLStyle_put_textAlign(style, str);
1111 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1115 hres = IHTMLStyle_get_textAlign(style, &str);
1116 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1117 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1120 str = (void*)0xdeadbeef;
1121 hres = IHTMLStyle_get_filter(style, &str);
1122 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1123 ok(!str, "filter != NULL\n");
1125 str = a2bstr("alpha(opacity=100)");
1126 hres = IHTMLStyle_put_filter(style, str);
1127 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1130 V_VT(&v) = VT_EMPTY;
1131 hres = IHTMLStyle_get_zIndex(style, &v);
1132 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1133 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1134 ok(!V_I4(&v), "V_I4(v) != 0\n");
1138 V_BSTR(&v) = a2bstr("1");
1139 hres = IHTMLStyle_put_zIndex(style, v);
1140 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1143 V_VT(&v) = VT_EMPTY;
1144 hres = IHTMLStyle_get_zIndex(style, &v);
1145 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1146 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1147 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1151 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1152 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1154 str = a2bstr("test");
1155 hres = IHTMLStyle_put_fontStyle(style, str);
1156 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1159 str = a2bstr("italic");
1160 hres = IHTMLStyle_put_fontStyle(style, str);
1161 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1164 str = a2bstr("oblique");
1165 hres = IHTMLStyle_put_fontStyle(style, str);
1166 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1169 str = a2bstr("normal");
1170 hres = IHTMLStyle_put_fontStyle(style, str);
1171 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1174 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1175 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1176 SysFreeString(sDefault);
1179 hres = IHTMLStyle_get_overflow(style, NULL);
1180 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1182 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1183 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1185 str = a2bstr("test");
1186 hres = IHTMLStyle_put_overflow(style, str);
1187 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1190 str = a2bstr("visible");
1191 hres = IHTMLStyle_put_overflow(style, str);
1192 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1195 str = a2bstr("scroll");
1196 hres = IHTMLStyle_put_overflow(style, str);
1197 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1200 str = a2bstr("hidden");
1201 hres = IHTMLStyle_put_overflow(style, str);
1202 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1205 str = a2bstr("auto");
1206 hres = IHTMLStyle_put_overflow(style, str);
1207 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1210 hres = IHTMLStyle_get_overflow(style, &str);
1211 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1212 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1216 hres = IHTMLStyle_put_overflow(style, str);
1217 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1220 hres = IHTMLStyle_get_overflow(style, &str);
1221 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1222 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1225 /* restore overflow default */
1226 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1227 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1228 SysFreeString(sOverflowDefault);
1230 /* Attribute Tests*/
1231 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1232 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1234 str = a2bstr("position");
1235 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1236 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1238 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1239 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1240 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1243 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1244 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1247 V_BSTR(&v) = a2bstr("absolute");
1248 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1249 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1252 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1253 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1254 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1255 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1260 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1261 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1266 str = a2bstr("borderLeftStyle");
1267 test_border_styles(style, str);
1270 str = a2bstr("borderbottomstyle");
1271 test_border_styles(style, str);
1274 str = a2bstr("borderrightstyle");
1275 test_border_styles(style, str);
1278 str = a2bstr("bordertopstyle");
1279 test_border_styles(style, str);
1282 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1283 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1285 str = a2bstr("none dotted dashed solid");
1286 hres = IHTMLStyle_put_borderStyle(style, str);
1287 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1290 str = a2bstr("none dotted dashed solid");
1291 hres = IHTMLStyle_get_borderStyle(style, &str);
1292 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1293 ok(!strcmp_wa(str, "none dotted dashed solid"),
1294 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1297 str = a2bstr("double groove ridge inset");
1298 hres = IHTMLStyle_put_borderStyle(style, str);
1299 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1302 str = a2bstr("window-inset outset 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");
1308 hres = IHTMLStyle_put_borderStyle(style, str);
1309 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1312 str = a2bstr("none none none none none");
1313 hres = IHTMLStyle_put_borderStyle(style, str);
1314 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1317 str = a2bstr("invalid none none none");
1318 hres = IHTMLStyle_put_borderStyle(style, str);
1319 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1322 str = a2bstr("none invalid none none");
1323 hres = IHTMLStyle_put_borderStyle(style, str);
1324 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1327 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1328 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1329 SysFreeString(sDefault);
1331 /* backgoundColor */
1332 hres = IHTMLStyle_get_backgroundColor(style, &v);
1333 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1334 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1335 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1339 V_BSTR(&v) = a2bstr("red");
1340 hres = IHTMLStyle_put_backgroundColor(style, v);
1341 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1344 hres = IHTMLStyle_get_backgroundColor(style, &v);
1345 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1346 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1347 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1351 hres = IHTMLStyle_get_padding(style, &str);
1352 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1353 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1356 hres = IHTMLStyle_get_paddingTop(style, &v);
1357 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1358 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1359 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1363 hres = IHTMLStyle_put_paddingTop(style, v);
1364 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1366 hres = IHTMLStyle_get_paddingTop(style, &v);
1367 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1368 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1369 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1372 hres = IHTMLStyle_get_paddingRight(style, &v);
1373 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1374 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1375 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1379 hres = IHTMLStyle_put_paddingRight(style, v);
1380 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1382 hres = IHTMLStyle_get_paddingRight(style, &v);
1383 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1384 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1385 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1388 hres = IHTMLStyle_get_paddingBottom(style, &v);
1389 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1390 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1391 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1395 hres = IHTMLStyle_put_paddingBottom(style, v);
1396 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1398 hres = IHTMLStyle_get_paddingBottom(style, &v);
1399 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1400 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1401 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1405 hres = IHTMLStyle_put_padding(style, str);
1406 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1409 hres = IHTMLStyle_get_padding(style, &str);
1410 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1411 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1415 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1416 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1417 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1418 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1421 V_BSTR(&v) = a2bstr("10");
1422 hres = IHTMLStyle_put_paddingLeft(style, v);
1423 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1426 hres = IHTMLStyle_get_paddingLeft(style, &v);
1427 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1428 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1431 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1432 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1434 /* BackgroundRepeat */
1435 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1436 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1438 str = a2bstr("invalid");
1439 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1440 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1443 str = a2bstr("repeat");
1444 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1445 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1448 str = a2bstr("no-repeat");
1449 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1450 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1453 str = a2bstr("repeat-x");
1454 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1455 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1458 str = a2bstr("repeat-y");
1459 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1460 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1463 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1464 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1465 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1468 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1469 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1470 SysFreeString(sDefault);
1473 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1474 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1476 str = a2bstr("red green red blue");
1477 hres = IHTMLStyle_put_borderColor(style, str);
1478 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1481 hres = IHTMLStyle_get_borderColor(style, &str);
1482 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1483 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1486 hres = IHTMLStyle_put_borderColor(style, sDefault);
1487 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1488 SysFreeString(sDefault);
1491 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1492 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1494 str = a2bstr("thick dotted red");
1495 hres = IHTMLStyle_put_borderRight(style, str);
1496 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1499 /* IHTMLStyle_get_borderRight appears to have a bug where
1500 it returns the first letter of the color. So we check
1501 each style individually.
1504 hres = IHTMLStyle_get_borderRightColor(style, &v);
1505 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1506 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1510 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1511 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1512 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1515 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1516 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1517 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1520 hres = IHTMLStyle_put_borderRight(style, sDefault);
1521 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1522 SysFreeString(sDefault);
1525 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1526 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1528 str = a2bstr("thick dotted red");
1529 hres = IHTMLStyle_put_borderTop(style, str);
1530 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1533 /* IHTMLStyle_get_borderTop appears to have a bug where
1534 it returns the first letter of the color. So we check
1535 each style individually.
1538 hres = IHTMLStyle_get_borderTopColor(style, &v);
1539 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1540 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1544 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1545 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1546 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1549 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1550 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1551 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1554 hres = IHTMLStyle_put_borderTop(style, sDefault);
1555 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1556 SysFreeString(sDefault);
1559 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1560 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1562 str = a2bstr("thick dotted red");
1563 hres = IHTMLStyle_put_borderBottom(style, str);
1564 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1567 /* IHTMLStyle_get_borderBottom appears to have a bug where
1568 it returns the first letter of the color. So we check
1569 each style individually.
1572 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1573 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1574 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1578 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1579 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1580 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1583 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1584 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1585 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1588 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1589 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1590 SysFreeString(sDefault);
1593 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1594 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1596 str = a2bstr("thick dotted red");
1597 hres = IHTMLStyle_put_borderLeft(style, str);
1598 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1601 /* IHTMLStyle_get_borderLeft appears to have a bug where
1602 it returns the first letter of the color. So we check
1603 each style individually.
1606 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1607 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1608 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1612 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1613 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1614 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1617 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1618 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1619 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1622 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1623 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1624 SysFreeString(sDefault);
1626 /* backgroundPositionX */
1627 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1628 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1629 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1630 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1634 V_BSTR(&v) = a2bstr("10px");
1635 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1636 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1639 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1640 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1641 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1642 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1645 /* backgroundPositionY */
1646 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1647 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1648 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1652 V_BSTR(&v) = a2bstr("15px");
1653 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1654 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1657 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1658 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1659 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1660 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1663 /* backgroundPosition */
1665 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1666 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1667 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1670 str = a2bstr("center 20%");
1671 hres = IHTMLStyle_put_backgroundPosition(style, str);
1672 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1676 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1677 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1678 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1681 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1682 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1683 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1684 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1687 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1688 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1689 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1690 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1693 /* borderTopWidth */
1694 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1695 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1698 V_BSTR(&v) = a2bstr("10px");
1699 hres = IHTMLStyle_put_borderTopWidth(style, v);
1700 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1703 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1704 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1705 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1708 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1709 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1710 VariantClear(&vDefault);
1712 /* borderRightWidth */
1713 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1714 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1717 V_BSTR(&v) = a2bstr("10");
1718 hres = IHTMLStyle_put_borderRightWidth(style, v);
1719 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1722 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1723 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1724 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1727 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1728 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1729 VariantClear(&vDefault);
1731 /* borderBottomWidth */
1732 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1733 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1736 V_BSTR(&v) = a2bstr("10");
1737 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1738 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1741 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1742 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1743 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1746 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1747 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1748 VariantClear(&vDefault);
1750 /* borderLeftWidth */
1751 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1752 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1755 V_BSTR(&v) = a2bstr("10");
1756 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1757 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1760 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1761 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1762 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1765 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1766 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1767 VariantClear(&vDefault);
1770 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1771 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1774 V_BSTR(&v) = a2bstr("10");
1775 hres = IHTMLStyle_put_wordSpacing(style, v);
1776 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1779 hres = IHTMLStyle_get_wordSpacing(style, &v);
1780 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1781 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1782 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1785 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1786 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1787 VariantClear(&vDefault);
1790 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1791 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1794 V_BSTR(&v) = a2bstr("11");
1795 hres = IHTMLStyle_put_letterSpacing(style, v);
1796 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1799 hres = IHTMLStyle_get_letterSpacing(style, &v);
1800 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1801 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1802 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1805 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1806 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1807 VariantClear(&vDefault);
1809 /* borderTopColor */
1810 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1811 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1814 V_BSTR(&v) = a2bstr("red");
1815 hres = IHTMLStyle_put_borderTopColor(style, v);
1816 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1819 hres = IHTMLStyle_get_borderTopColor(style, &v);
1820 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1821 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1824 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1825 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1827 /* borderRightColor */
1828 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1829 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1832 V_BSTR(&v) = a2bstr("blue");
1833 hres = IHTMLStyle_put_borderRightColor(style, v);
1834 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1837 hres = IHTMLStyle_get_borderRightColor(style, &v);
1838 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1839 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1842 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1843 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1845 /* borderBottomColor */
1846 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1847 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1850 V_BSTR(&v) = a2bstr("cyan");
1851 hres = IHTMLStyle_put_borderBottomColor(style, v);
1852 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1855 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1856 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1857 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1860 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1861 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1863 /* borderLeftColor */
1864 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1865 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1868 V_BSTR(&v) = a2bstr("cyan");
1869 hres = IHTMLStyle_put_borderLeftColor(style, v);
1870 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1873 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1874 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1875 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1878 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1879 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1882 hres = IHTMLStyle_get_clip(style, &str);
1883 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1884 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1886 str = a2bstr("rect(0px 1px 500px 505px)");
1887 hres = IHTMLStyle_put_clip(style, str);
1888 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1891 hres = IHTMLStyle_get_clip(style, &str);
1892 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1893 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1896 /* pageBreakAfter */
1897 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1898 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1899 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1901 str = a2bstr("always");
1902 hres = IHTMLStyle_put_pageBreakAfter(style, str);
1903 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1906 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1907 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1908 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1911 /* pageBreakBefore */
1912 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1913 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1914 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1916 str = a2bstr("always");
1917 hres = IHTMLStyle_put_pageBreakBefore(style, str);
1918 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1921 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1922 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1923 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1926 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
1927 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
1929 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1930 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1931 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1933 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1934 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1935 if(SUCCEEDED(hres)) {
1936 test_style2(style2);
1937 IHTMLStyle2_Release(style2);
1940 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1941 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1942 if(SUCCEEDED(hres)) {
1943 test_style3(style3);
1944 IHTMLStyle3_Release(style3);
1947 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1948 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1949 if(SUCCEEDED(hres)) {
1950 test_style4(style4);
1951 IHTMLStyle4_Release(style4);
1955 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1956 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1961 str = (void*)0xdeadbeef;
1962 hres = IHTMLStyle_get_filter(style, &str);
1963 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1965 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1967 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1972 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
1973 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
1978 str = (void*)0xdeadbeef;
1979 hres = IHTMLCurrentStyle2_get_filter(style, &str);
1980 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1982 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1984 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1989 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1990 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
1992 BSTR str = a2bstr(val);
1995 hres = IHTMLStyle_put_filter(style, str);
1996 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
1999 _test_style_filter(line, style, val);
2002 static void test_style_filters(IHTMLElement *elem)
2004 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2005 IHTMLCurrentStyle2 *current_style2;
2006 IHTMLCurrentStyle *current_style;
2010 hres = IHTMLElement_get_style(elem, &style);
2011 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2013 hres = IHTMLElement2_get_currentStyle(elem2, ¤t_style);
2014 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2016 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle2, (void**)¤t_style2);
2017 IHTMLCurrentStyle_Release(current_style);
2018 ok(hres == S_OK, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres);
2020 test_style_filter(style, NULL);
2021 test_current_style_filter(current_style2, NULL);
2022 set_style_filter(style, "alpha(opacity=50.0040)");
2023 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2024 set_style_filter(style, "alpha(opacity=100)");
2026 IHTMLStyle_Release(style);
2028 hres = IHTMLElement_get_style(elem, &style);
2029 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2031 test_style_filter(style, "alpha(opacity=100)");
2032 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2033 set_style_filter(style, NULL);
2034 set_style_filter(style, "alpha(opacity=100)");
2035 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2036 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2037 test_style_filter(style, NULL);
2040 IHTMLCurrentStyle2_Release(current_style2);
2041 IHTMLStyle_Release(style);
2042 IHTMLElement2_Release(elem2);
2045 static void test_current_style(IHTMLCurrentStyle *current_style)
2051 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2052 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2053 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2056 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2057 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2058 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2061 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2062 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2065 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2066 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2067 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2070 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2071 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2072 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2075 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2076 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2077 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2080 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2081 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2082 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2085 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2086 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2087 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2090 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2091 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2092 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2095 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2096 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2097 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2100 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2101 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2102 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2105 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2106 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2107 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2110 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2111 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2112 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2115 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2116 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2117 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2120 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2121 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2124 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2125 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2128 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2129 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2132 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2133 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2136 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2137 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2140 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2141 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2144 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2145 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2148 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2149 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2150 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2151 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2154 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2155 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2156 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2159 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2160 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2161 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2164 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2165 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2166 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2169 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2170 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2171 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2174 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2175 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2176 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2179 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2180 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2181 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2184 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2185 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2186 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2187 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2190 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2191 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2192 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2193 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2196 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2197 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2198 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2201 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2202 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2203 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2206 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2207 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2208 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2212 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2213 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2214 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2217 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2218 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2219 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2222 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2223 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2224 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2227 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2228 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2229 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2232 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2233 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2234 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2237 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2238 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2239 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2242 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2243 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2244 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2247 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2248 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2249 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2252 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2253 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2254 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2257 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2258 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2259 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2262 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2263 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2264 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2267 hres = IHTMLCurrentStyle_get_paddingBottom(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_letterSpacing(current_style, &v);
2273 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2274 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2277 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2278 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2279 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2282 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2283 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2284 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2287 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2288 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2289 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2292 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2293 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2294 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2297 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2298 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2299 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2302 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2303 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2304 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2308 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2310 static void basic_style_test(IHTMLDocument2 *doc)
2312 IHTMLCurrentStyle *cstyle;
2317 hres = IHTMLDocument2_get_body(doc, &elem);
2318 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2320 hres = IHTMLElement_get_style(elem, &style);
2321 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2323 test_body_style(style);
2325 cstyle = get_current_style(elem);
2326 test_current_style(cstyle);
2327 IHTMLCurrentStyle_Release(cstyle);
2328 IHTMLElement_Release(elem);
2330 elem = get_element_by_id(doc, "divid");
2331 test_style_filters(elem);
2333 test_set_csstext(style);
2334 IHTMLStyle_Release(style);
2335 IHTMLElement_Release(elem);
2338 static IHTMLDocument2 *notif_doc;
2339 static BOOL doc_complete;
2341 static IHTMLDocument2 *create_document(void)
2343 IHTMLDocument2 *doc;
2344 IHTMLDocument5 *doc5;
2347 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2348 &IID_IHTMLDocument2, (void**)&doc);
2349 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2353 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2355 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2356 IHTMLDocument2_Release(doc);
2360 IHTMLDocument5_Release(doc5);
2364 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2365 REFIID riid, void**ppv)
2367 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2372 ok(0, "unexpected call\n");
2373 return E_NOINTERFACE;
2376 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2381 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2386 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2388 if(dispID == DISPID_READYSTATE){
2392 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2393 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2395 if(!strcmp_wa(state, "complete"))
2396 doc_complete = TRUE;
2398 SysFreeString(state);
2404 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2406 ok(0, "unexpected call\n");
2410 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2411 PropertyNotifySink_QueryInterface,
2412 PropertyNotifySink_AddRef,
2413 PropertyNotifySink_Release,
2414 PropertyNotifySink_OnChanged,
2415 PropertyNotifySink_OnRequestEdit
2418 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2420 static IHTMLDocument2 *create_doc_with_string(const char *str)
2422 IPersistStreamInit *init;
2424 IHTMLDocument2 *doc;
2428 notif_doc = doc = create_document();
2432 doc_complete = FALSE;
2434 mem = GlobalAlloc(0, len);
2435 memcpy(mem, str, len);
2436 CreateStreamOnHGlobal(mem, TRUE, &stream);
2438 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2440 IPersistStreamInit_Load(init, stream);
2441 IPersistStreamInit_Release(init);
2442 IStream_Release(stream);
2447 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2449 IConnectionPointContainer *container;
2450 IConnectionPoint *cp;
2454 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2455 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2457 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2458 IConnectionPointContainer_Release(container);
2459 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2461 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2462 IConnectionPoint_Release(cp);
2463 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2466 typedef void (*style_test_t)(IHTMLDocument2*);
2468 static void run_test(const char *str, style_test_t test)
2470 IHTMLDocument2 *doc;
2474 doc = create_doc_with_string(str);
2478 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2480 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2481 TranslateMessage(&msg);
2482 DispatchMessage(&msg);
2487 ref = IHTMLDocument2_Release(doc);
2488 ok(!ref || broken(ref == 1), /* Vista */
2497 run_test(basic_test_str, basic_style_test);