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 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
60 BSTR idW = a2bstr(id);
62 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
63 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
65 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
66 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
67 ok(result != NULL, "result == NULL\n");
70 IHTMLDocument3_Release(doc3);
74 #define get_current_style(e) _get_current_style(__LINE__,e)
75 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
77 IHTMLCurrentStyle *cstyle;
81 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
82 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
85 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
86 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
87 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
89 IHTMLElement2_Release(elem2);
93 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
94 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
99 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
100 LOCALE_USER_DEFAULT, &dispid);
101 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
104 DISPPARAMS params = {NULL,NULL,0,0};
105 DISPID dispidNamed = DISPID_PROPERTYPUT;
110 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
111 DISPATCH_PROPERTYGET, ¶ms, &vDefault, NULL, NULL);
112 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
115 params.cNamedArgs = 1;
116 params.rgdispidNamedArgs = &dispidNamed;
117 V_VT(&arg) = VT_BSTR;
118 V_BSTR(&arg) = a2bstr("none");
119 params.rgvarg = &arg;
120 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
121 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
122 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
125 V_VT(&arg) = VT_BSTR;
126 V_BSTR(&arg) = a2bstr("dotted");
127 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
128 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
129 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
132 V_VT(&arg) = VT_BSTR;
133 V_BSTR(&arg) = a2bstr("dashed");
134 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
135 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
136 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
139 V_VT(&arg) = VT_BSTR;
140 V_BSTR(&arg) = a2bstr("solid");
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, "solid. ret: %08x\n", hres);
146 V_VT(&arg) = VT_BSTR;
147 V_BSTR(&arg) = a2bstr("double");
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, "double. ret: %08x\n", hres);
153 V_VT(&arg) = VT_BSTR;
154 V_BSTR(&arg) = a2bstr("groove");
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, "groove. ret: %08x\n", hres);
160 V_VT(&arg) = VT_BSTR;
161 V_BSTR(&arg) = a2bstr("ridge");
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, "ridge. ret: %08x\n", hres);
167 V_VT(&arg) = VT_BSTR;
168 V_BSTR(&arg) = a2bstr("inset");
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, "inset. ret: %08x\n", hres);
174 V_VT(&arg) = VT_BSTR;
175 V_BSTR(&arg) = a2bstr("outset");
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, "outset. ret: %08x\n", hres);
181 V_VT(&arg) = VT_BSTR;
182 V_BSTR(&arg) = a2bstr("invalid");
183 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
184 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
185 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
188 params.rgvarg = &vDefault;
189 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
190 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
191 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
192 VariantClear(&vDefault);
196 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
197 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
199 BSTR text = (void*)0xdeadbeef;
202 hres = IHTMLStyle_get_cssText(style, &text);
203 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
205 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
207 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
212 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
213 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
219 hres = IHTMLStyle_put_cssText(style, tmp);
220 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
224 static void test_set_csstext(IHTMLStyle *style)
229 test_style_set_csstext(style, "background-color: black;");
231 hres = IHTMLStyle_get_backgroundColor(style, &v);
232 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
233 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
234 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
238 static void test_style2(IHTMLStyle2 *style2)
244 str = (void*)0xdeadbeef;
245 hres = IHTMLStyle2_get_position(style2, &str);
246 ok(hres == S_OK, "get_position failed: %08x\n", hres);
247 ok(!str, "str != NULL\n");
249 str = a2bstr("absolute");
250 hres = IHTMLStyle2_put_position(style2, str);
251 ok(hres == S_OK, "put_position failed: %08x\n", hres);
255 hres = IHTMLStyle2_get_position(style2, &str);
256 ok(hres == S_OK, "get_position failed: %08x\n", hres);
257 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
262 hres = IHTMLStyle2_get_right(style2, &v);
263 ok(hres == S_OK, "get_top failed: %08x\n", hres);
264 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
265 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
269 V_BSTR(&v) = a2bstr("3px");
270 hres = IHTMLStyle2_put_right(style2, v);
271 ok(hres == S_OK, "put_right failed: %08x\n", hres);
275 hres = IHTMLStyle2_get_right(style2, &v);
276 ok(hres == S_OK, "get_right failed: %08x\n", hres);
277 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
278 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
282 static void test_style3(IHTMLStyle3 *style3)
287 str = (void*)0xdeadbeef;
288 hres = IHTMLStyle3_get_wordWrap(style3, &str);
289 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
290 ok(!str, "str != NULL\n");
292 str = a2bstr("break-word");
293 hres = IHTMLStyle3_put_wordWrap(style3, str);
294 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
298 hres = IHTMLStyle3_get_wordWrap(style3, &str);
299 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
300 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
304 static void test_style4(IHTMLStyle4 *style4)
310 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
311 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
314 V_BSTR(&v) = a2bstr("10px");
315 hres = IHTMLStyle4_put_minHeight(style4, v);
316 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
319 hres = IHTMLStyle4_get_minHeight(style4, &v);
320 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
321 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
322 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
325 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
326 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
327 VariantClear(&vdefault);
330 static void test_body_style(IHTMLStyle *style)
340 BSTR sOverflowDefault;
344 test_style_csstext(style, NULL);
346 hres = IHTMLStyle_get_position(style, &str);
347 ok(hres == S_OK, "get_position failed: %08x\n", hres);
348 ok(!str, "str=%s\n", wine_dbgstr_w(str));
351 hres = IHTMLStyle_get_marginRight(style, &v);
352 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
353 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
354 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
357 hres = IHTMLStyle_get_marginLeft(style, &v);
358 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
359 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
360 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
362 str = (void*)0xdeadbeef;
363 hres = IHTMLStyle_get_fontFamily(style, &str);
364 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
365 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
367 str = (void*)0xdeadbeef;
368 hres = IHTMLStyle_get_fontWeight(style, &str);
369 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
370 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
372 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
373 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
375 str = a2bstr("test");
376 hres = IHTMLStyle_put_fontWeight(style, str);
377 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
380 str = a2bstr("bold");
381 hres = IHTMLStyle_put_fontWeight(style, str);
382 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
385 str = a2bstr("bolder");
386 hres = IHTMLStyle_put_fontWeight(style, str);
387 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
390 str = a2bstr("lighter");
391 hres = IHTMLStyle_put_fontWeight(style, str);
392 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
396 hres = IHTMLStyle_put_fontWeight(style, str);
397 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
401 hres = IHTMLStyle_put_fontWeight(style, str);
402 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
406 hres = IHTMLStyle_put_fontWeight(style, str);
407 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
411 hres = IHTMLStyle_put_fontWeight(style, str);
412 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
416 hres = IHTMLStyle_put_fontWeight(style, str);
417 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
421 hres = IHTMLStyle_put_fontWeight(style, str);
422 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
426 hres = IHTMLStyle_put_fontWeight(style, str);
427 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
431 hres = IHTMLStyle_put_fontWeight(style, str);
432 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
436 hres = IHTMLStyle_put_fontWeight(style, str);
437 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
440 hres = IHTMLStyle_get_fontWeight(style, &str);
441 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
442 ok(!strcmp_wa(str, "900"), "str != style900\n");
445 hres = IHTMLStyle_put_fontWeight(style, sDefault);
446 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
447 SysFreeString(sDefault);
450 hres = IHTMLStyle_get_fontVariant(style, NULL);
451 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
453 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
454 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
456 str = a2bstr("test");
457 hres = IHTMLStyle_put_fontVariant(style, str);
458 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
461 str = a2bstr("small-caps");
462 hres = IHTMLStyle_put_fontVariant(style, str);
463 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
466 str = a2bstr("normal");
467 hres = IHTMLStyle_put_fontVariant(style, str);
468 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
471 hres = IHTMLStyle_put_fontVariant(style, sDefault);
472 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
473 SysFreeString(sDefault);
475 str = (void*)0xdeadbeef;
476 hres = IHTMLStyle_get_display(style, &str);
477 ok(hres == S_OK, "get_display failed: %08x\n", hres);
478 ok(!str, "display = %s\n", wine_dbgstr_w(str));
480 str = (void*)0xdeadbeef;
481 hres = IHTMLStyle_get_visibility(style, &str);
482 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
483 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
486 hres = IHTMLStyle_get_fontSize(style, &v);
487 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
488 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
489 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
492 hres = IHTMLStyle_get_color(style, &v);
493 ok(hres == S_OK, "get_color failed: %08x\n", hres);
494 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
495 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
498 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
499 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
500 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
502 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
503 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
504 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
506 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
507 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
508 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
510 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
511 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
514 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
515 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
516 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
518 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
519 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
520 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
522 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
523 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
524 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
526 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
527 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
530 hres = IHTMLStyle_get_textDecorationNone(style, &b);
531 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
532 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
534 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
535 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
536 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
538 hres = IHTMLStyle_get_textDecorationNone(style, &b);
539 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
540 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
542 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
543 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
546 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
547 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
548 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
550 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
551 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
552 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
554 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
555 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
556 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
558 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
559 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
562 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
563 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
564 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
566 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
567 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
568 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
570 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
571 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
572 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
574 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
575 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
577 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
578 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
580 str = a2bstr("invalid");
581 hres = IHTMLStyle_put_textDecoration(style, str);
582 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
585 str = a2bstr("none");
586 hres = IHTMLStyle_put_textDecoration(style, str);
587 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
590 str = a2bstr("underline");
591 hres = IHTMLStyle_put_textDecoration(style, str);
592 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
595 str = a2bstr("overline");
596 hres = IHTMLStyle_put_textDecoration(style, str);
597 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
600 str = a2bstr("line-through");
601 hres = IHTMLStyle_put_textDecoration(style, str);
602 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
605 str = a2bstr("blink");
606 hres = IHTMLStyle_put_textDecoration(style, str);
607 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
610 hres = IHTMLStyle_get_textDecoration(style, &str);
611 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
612 ok(!strcmp_wa(str, "blink"), "str != blink\n");
615 hres = IHTMLStyle_put_textDecoration(style, sDefault);
616 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
617 SysFreeString(sDefault);
619 hres = IHTMLStyle_get_posWidth(style, NULL);
620 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
622 hres = IHTMLStyle_get_posWidth(style, &f);
623 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
624 ok(f == 0.0f, "f = %f\n", f);
627 hres = IHTMLStyle_get_width(style, &v);
628 ok(hres == S_OK, "get_width failed: %08x\n", hres);
629 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
630 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
632 hres = IHTMLStyle_put_posWidth(style, 2.2);
633 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
635 hres = IHTMLStyle_get_posWidth(style, &f);
636 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
642 V_BSTR(&v) = a2bstr("auto");
643 hres = IHTMLStyle_put_width(style, v);
644 ok(hres == S_OK, "put_width failed: %08x\n", hres);
648 hres = IHTMLStyle_get_width(style, &v);
649 ok(hres == S_OK, "get_width failed: %08x\n", hres);
650 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
651 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
656 hres = IHTMLStyle_put_width(style, v);
657 ok(hres == S_OK, "put_width failed: %08x\n", hres);
660 hres = IHTMLStyle_get_width(style, &v);
661 ok(hres == S_OK, "get_width failed: %08x\n", hres);
662 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
663 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
667 str = (void*)0xdeadbeef;
668 hres = IHTMLStyle_get_margin(style, &str);
669 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
670 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
673 hres = IHTMLStyle_put_margin(style, str);
674 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
677 hres = IHTMLStyle_get_margin(style, &str);
678 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
679 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
682 hres = IHTMLStyle_put_margin(style, NULL);
683 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
685 str = (void*)0xdeadbeef;
686 hres = IHTMLStyle_get_marginTop(style, &v);
687 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
688 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
689 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
692 V_BSTR(&v) = a2bstr("6px");
693 hres = IHTMLStyle_put_marginTop(style, v);
694 SysFreeString(V_BSTR(&v));
695 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
697 str = (void*)0xdeadbeef;
698 hres = IHTMLStyle_get_marginTop(style, &v);
699 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
700 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
701 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
705 hres = IHTMLStyle_get_border(style, &str);
706 ok(hres == S_OK, "get_border failed: %08x\n", hres);
707 ok(!str || !*str, "str is not empty\n");
711 hres = IHTMLStyle_put_border(style, str);
712 ok(hres == S_OK, "put_border failed: %08x\n", hres);
716 hres = IHTMLStyle_get_left(style, &v);
717 ok(hres == S_OK, "get_left failed: %08x\n", hres);
718 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
719 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
723 hres = IHTMLStyle_get_posLeft(style, NULL);
724 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
727 hres = IHTMLStyle_get_posLeft(style, &f);
728 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
729 ok(f == 0.0, "expected 0.0 got %f\n", f);
731 hres = IHTMLStyle_put_posLeft(style, 4.9f);
732 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
734 hres = IHTMLStyle_get_posLeft(style, &f);
735 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
738 "expected 4.0 or 4.9 (IE8) got %f\n", f);
740 /* Ensure left is updated correctly. */
742 hres = IHTMLStyle_get_left(style, &v);
743 ok(hres == S_OK, "get_left failed: %08x\n", hres);
744 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
745 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
746 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
747 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
752 V_BSTR(&v) = a2bstr("3px");
753 hres = IHTMLStyle_put_left(style, v);
754 ok(hres == S_OK, "put_left failed: %08x\n", hres);
757 hres = IHTMLStyle_get_posLeft(style, &f);
758 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
759 ok(f == 3.0, "expected 3.0 got %f\n", f);
762 hres = IHTMLStyle_get_left(style, &v);
763 ok(hres == S_OK, "get_left failed: %08x\n", hres);
764 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
765 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
769 hres = IHTMLStyle_put_left(style, v);
770 ok(hres == S_OK, "put_left failed: %08x\n", hres);
773 hres = IHTMLStyle_get_left(style, &v);
774 ok(hres == S_OK, "get_left failed: %08x\n", hres);
775 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
776 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
780 hres = IHTMLStyle_get_top(style, &v);
781 ok(hres == S_OK, "get_top failed: %08x\n", hres);
782 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
783 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
787 hres = IHTMLStyle_get_posTop(style, NULL);
788 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
791 hres = IHTMLStyle_get_posTop(style, &f);
792 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
793 ok(f == 0.0, "expected 0.0 got %f\n", f);
795 hres = IHTMLStyle_put_posTop(style, 4.9f);
796 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
798 hres = IHTMLStyle_get_posTop(style, &f);
799 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
802 "expected 4.0 or 4.9 (IE8) got %f\n", f);
805 V_BSTR(&v) = a2bstr("3px");
806 hres = IHTMLStyle_put_top(style, v);
807 ok(hres == S_OK, "put_top failed: %08x\n", hres);
811 hres = IHTMLStyle_get_top(style, &v);
812 ok(hres == S_OK, "get_top failed: %08x\n", hres);
813 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
814 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
817 hres = IHTMLStyle_get_posTop(style, &f);
818 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
819 ok(f == 3.0, "expected 3.0 got %f\n", f);
822 hres = IHTMLStyle_put_top(style, v);
823 ok(hres == S_OK, "put_top failed: %08x\n", hres);
826 hres = IHTMLStyle_get_top(style, &v);
827 ok(hres == S_OK, "get_top failed: %08x\n", hres);
828 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
829 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
833 hres = IHTMLStyle_get_posHeight(style, NULL);
834 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
837 hres = IHTMLStyle_get_height(style, &v);
838 ok(hres == S_OK, "get_height failed: %08x\n", hres);
839 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
840 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
844 hres = IHTMLStyle_get_posHeight(style, &f);
845 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
846 ok(f == 0.0, "expected 0.0 got %f\n", f);
848 hres = IHTMLStyle_put_posHeight(style, 4.9f);
849 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
851 hres = IHTMLStyle_get_posHeight(style, &f);
852 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
855 "expected 4.0 or 4.9 (IE8) got %f\n", f);
858 V_BSTR(&v) = a2bstr("64px");
859 hres = IHTMLStyle_put_height(style, v);
860 ok(hres == S_OK, "put_height failed: %08x\n", hres);
864 hres = IHTMLStyle_get_height(style, &v);
865 ok(hres == S_OK, "get_height failed: %08x\n", hres);
866 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
867 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
870 hres = IHTMLStyle_get_posHeight(style, &f);
871 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
872 ok(f == 64.0, "expected 64.0 got %f\n", f);
874 str = (void*)0xdeadbeef;
875 hres = IHTMLStyle_get_cursor(style, &str);
876 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
877 ok(!str, "get_cursor != NULL\n");
880 str = a2bstr("default");
881 hres = IHTMLStyle_put_cursor(style, str);
882 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
886 hres = IHTMLStyle_get_cursor(style, &str);
887 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
888 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
892 hres = IHTMLStyle_get_verticalAlign(style, &v);
893 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
894 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
895 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
899 V_BSTR(&v) = a2bstr("middle");
900 hres = IHTMLStyle_put_verticalAlign(style, v);
901 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
905 hres = IHTMLStyle_get_verticalAlign(style, &v);
906 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
907 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
908 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
911 str = (void*)0xdeadbeef;
912 hres = IHTMLStyle_get_textAlign(style, &str);
913 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
914 ok(!str, "textAlign != NULL\n");
916 str = a2bstr("center");
917 hres = IHTMLStyle_put_textAlign(style, str);
918 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
922 hres = IHTMLStyle_get_textAlign(style, &str);
923 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
924 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
927 str = (void*)0xdeadbeef;
928 hres = IHTMLStyle_get_filter(style, &str);
929 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
930 ok(!str, "filter != NULL\n");
932 str = a2bstr("alpha(opacity=100)");
933 hres = IHTMLStyle_put_filter(style, str);
934 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
938 hres = IHTMLStyle_get_zIndex(style, &v);
939 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
940 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
941 ok(!V_I4(&v), "V_I4(v) != 0\n");
945 V_BSTR(&v) = a2bstr("1");
946 hres = IHTMLStyle_put_zIndex(style, v);
947 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
951 hres = IHTMLStyle_get_zIndex(style, &v);
952 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
953 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
954 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
958 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
959 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
961 str = a2bstr("test");
962 hres = IHTMLStyle_put_fontStyle(style, str);
963 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
966 str = a2bstr("italic");
967 hres = IHTMLStyle_put_fontStyle(style, str);
968 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
971 str = a2bstr("oblique");
972 hres = IHTMLStyle_put_fontStyle(style, str);
973 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
976 str = a2bstr("normal");
977 hres = IHTMLStyle_put_fontStyle(style, str);
978 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
981 hres = IHTMLStyle_put_fontStyle(style, sDefault);
982 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
983 SysFreeString(sDefault);
986 hres = IHTMLStyle_get_overflow(style, NULL);
987 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
989 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
990 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
992 str = a2bstr("test");
993 hres = IHTMLStyle_put_overflow(style, str);
994 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
997 str = a2bstr("visible");
998 hres = IHTMLStyle_put_overflow(style, str);
999 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1002 str = a2bstr("scroll");
1003 hres = IHTMLStyle_put_overflow(style, str);
1004 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1007 str = a2bstr("hidden");
1008 hres = IHTMLStyle_put_overflow(style, str);
1009 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1012 str = a2bstr("auto");
1013 hres = IHTMLStyle_put_overflow(style, str);
1014 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1017 hres = IHTMLStyle_get_overflow(style, &str);
1018 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1019 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1023 hres = IHTMLStyle_put_overflow(style, str);
1024 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1027 hres = IHTMLStyle_get_overflow(style, &str);
1028 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1029 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1032 /* restore overflow default */
1033 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1034 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1035 SysFreeString(sOverflowDefault);
1037 /* Attribute Tests*/
1038 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1039 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1041 str = a2bstr("position");
1042 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1043 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1045 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1046 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1047 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1050 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1051 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1054 V_BSTR(&v) = a2bstr("absolute");
1055 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1056 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1059 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1060 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1061 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1062 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1067 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1068 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1073 str = a2bstr("borderLeftStyle");
1074 test_border_styles(style, str);
1077 str = a2bstr("borderbottomstyle");
1078 test_border_styles(style, str);
1081 str = a2bstr("borderrightstyle");
1082 test_border_styles(style, str);
1085 str = a2bstr("bordertopstyle");
1086 test_border_styles(style, str);
1089 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1090 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1092 str = a2bstr("none dotted dashed solid");
1093 hres = IHTMLStyle_put_borderStyle(style, str);
1094 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1097 str = a2bstr("none dotted dashed solid");
1098 hres = IHTMLStyle_get_borderStyle(style, &str);
1099 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1100 ok(!strcmp_wa(str, "none dotted dashed solid"),
1101 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1104 str = a2bstr("double groove ridge inset");
1105 hres = IHTMLStyle_put_borderStyle(style, str);
1106 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1109 str = a2bstr("window-inset outset ridge inset");
1110 hres = IHTMLStyle_put_borderStyle(style, str);
1111 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1114 str = a2bstr("window-inset");
1115 hres = IHTMLStyle_put_borderStyle(style, str);
1116 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1119 str = a2bstr("none none none none none");
1120 hres = IHTMLStyle_put_borderStyle(style, str);
1121 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1124 str = a2bstr("invalid none none none");
1125 hres = IHTMLStyle_put_borderStyle(style, str);
1126 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1129 str = a2bstr("none invalid none none");
1130 hres = IHTMLStyle_put_borderStyle(style, str);
1131 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1134 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1135 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1136 SysFreeString(sDefault);
1138 /* backgoundColor */
1139 hres = IHTMLStyle_get_backgroundColor(style, &v);
1140 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1141 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1142 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1146 hres = IHTMLStyle_get_padding(style, &str);
1147 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1148 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1152 hres = IHTMLStyle_put_padding(style, str);
1153 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1156 hres = IHTMLStyle_get_padding(style, &str);
1157 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1158 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1162 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1163 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1166 V_BSTR(&v) = a2bstr("10");
1167 hres = IHTMLStyle_put_paddingLeft(style, v);
1168 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1171 hres = IHTMLStyle_get_paddingLeft(style, &v);
1172 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1173 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1176 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1177 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1179 /* BackgroundRepeat */
1180 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1181 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1183 str = a2bstr("invalid");
1184 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1185 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1188 str = a2bstr("repeat");
1189 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1190 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1193 str = a2bstr("no-repeat");
1194 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1195 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1198 str = a2bstr("repeat-x");
1199 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1200 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1203 str = a2bstr("repeat-y");
1204 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1205 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1208 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1209 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1210 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1213 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1214 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1215 SysFreeString(sDefault);
1218 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1219 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1221 str = a2bstr("red green red blue");
1222 hres = IHTMLStyle_put_borderColor(style, str);
1223 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1226 hres = IHTMLStyle_get_borderColor(style, &str);
1227 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1228 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1231 hres = IHTMLStyle_put_borderColor(style, sDefault);
1232 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1233 SysFreeString(sDefault);
1236 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1237 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1239 str = a2bstr("thick dotted red");
1240 hres = IHTMLStyle_put_borderRight(style, str);
1241 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1244 /* IHTMLStyle_get_borderRight appears to have a bug where
1245 it returns the first letter of the color. So we check
1246 each style individually.
1249 hres = IHTMLStyle_get_borderRightColor(style, &v);
1250 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1251 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1255 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1256 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1257 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1260 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1261 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1262 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1265 hres = IHTMLStyle_put_borderRight(style, sDefault);
1266 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1267 SysFreeString(sDefault);
1270 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1271 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1273 str = a2bstr("thick dotted red");
1274 hres = IHTMLStyle_put_borderTop(style, str);
1275 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1278 /* IHTMLStyle_get_borderTop appears to have a bug where
1279 it returns the first letter of the color. So we check
1280 each style individually.
1283 hres = IHTMLStyle_get_borderTopColor(style, &v);
1284 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1285 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1289 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1290 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1291 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1294 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1295 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1296 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1299 hres = IHTMLStyle_put_borderTop(style, sDefault);
1300 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1301 SysFreeString(sDefault);
1304 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1305 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1307 str = a2bstr("thick dotted red");
1308 hres = IHTMLStyle_put_borderBottom(style, str);
1309 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1312 /* IHTMLStyle_get_borderBottom appears to have a bug where
1313 it returns the first letter of the color. So we check
1314 each style individually.
1317 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1318 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1319 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1323 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1324 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1325 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1328 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1329 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1330 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1333 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1334 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1335 SysFreeString(sDefault);
1338 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1339 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1341 str = a2bstr("thick dotted red");
1342 hres = IHTMLStyle_put_borderLeft(style, str);
1343 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1346 /* IHTMLStyle_get_borderLeft appears to have a bug where
1347 it returns the first letter of the color. So we check
1348 each style individually.
1351 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1352 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1353 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1357 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1358 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1359 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1362 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1363 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1364 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1367 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1368 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1369 SysFreeString(sDefault);
1371 /* backgroundPositionX */
1372 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1373 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1374 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1375 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1379 V_BSTR(&v) = a2bstr("10px");
1380 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1381 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1384 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1385 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1386 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1387 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1390 /* backgroundPositionY */
1391 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1392 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1393 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1397 V_BSTR(&v) = a2bstr("15px");
1398 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1399 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1402 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1403 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1404 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1405 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1408 /* backgroundPosition */
1410 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1411 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1412 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1415 str = a2bstr("center 20%");
1416 hres = IHTMLStyle_put_backgroundPosition(style, str);
1417 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1421 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1422 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1423 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1426 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1427 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1428 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1429 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1432 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1433 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1434 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1435 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1438 /* borderTopWidth */
1439 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1440 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1443 V_BSTR(&v) = a2bstr("10px");
1444 hres = IHTMLStyle_put_borderTopWidth(style, v);
1445 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1448 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1449 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1450 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1453 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1454 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1455 VariantClear(&vDefault);
1457 /* borderRightWidth */
1458 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1459 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1462 V_BSTR(&v) = a2bstr("10");
1463 hres = IHTMLStyle_put_borderRightWidth(style, v);
1464 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1467 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1468 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1469 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1472 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1473 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1474 VariantClear(&vDefault);
1476 /* borderBottomWidth */
1477 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1478 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1481 V_BSTR(&v) = a2bstr("10");
1482 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1483 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1486 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1487 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1488 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1491 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1492 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1493 VariantClear(&vDefault);
1495 /* borderLeftWidth */
1496 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1497 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1500 V_BSTR(&v) = a2bstr("10");
1501 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1502 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1505 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1506 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1507 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1510 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1511 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1512 VariantClear(&vDefault);
1515 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1516 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1519 V_BSTR(&v) = a2bstr("10");
1520 hres = IHTMLStyle_put_wordSpacing(style, v);
1521 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1524 hres = IHTMLStyle_get_wordSpacing(style, &v);
1525 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1526 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1527 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1530 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1531 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1532 VariantClear(&vDefault);
1535 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1536 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1539 V_BSTR(&v) = a2bstr("11");
1540 hres = IHTMLStyle_put_letterSpacing(style, v);
1541 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1544 hres = IHTMLStyle_get_letterSpacing(style, &v);
1545 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1546 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1547 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1550 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1551 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1552 VariantClear(&vDefault);
1554 /* borderTopColor */
1555 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1556 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1559 V_BSTR(&v) = a2bstr("red");
1560 hres = IHTMLStyle_put_borderTopColor(style, v);
1561 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1564 hres = IHTMLStyle_get_borderTopColor(style, &v);
1565 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1566 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1569 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1570 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1572 /* borderRightColor */
1573 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1574 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1577 V_BSTR(&v) = a2bstr("blue");
1578 hres = IHTMLStyle_put_borderRightColor(style, v);
1579 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1582 hres = IHTMLStyle_get_borderRightColor(style, &v);
1583 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1584 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1587 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1588 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1590 /* borderBottomColor */
1591 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1592 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1595 V_BSTR(&v) = a2bstr("cyan");
1596 hres = IHTMLStyle_put_borderBottomColor(style, v);
1597 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1600 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1601 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1602 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1605 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1606 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1608 /* borderLeftColor */
1609 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1610 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1613 V_BSTR(&v) = a2bstr("cyan");
1614 hres = IHTMLStyle_put_borderLeftColor(style, v);
1615 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1618 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1619 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1620 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1623 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1624 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1627 hres = IHTMLStyle_get_clip(style, &str);
1628 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1629 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1631 str = a2bstr("rect(0px 1px 500px 505px)");
1632 hres = IHTMLStyle_put_clip(style, str);
1633 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1636 hres = IHTMLStyle_get_clip(style, &str);
1637 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1638 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1641 /* pageBreakAfter */
1642 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1643 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1644 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1646 str = a2bstr("always");
1647 hres = IHTMLStyle_put_pageBreakAfter(style, str);
1648 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1651 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1652 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1653 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1656 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1657 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1658 if(SUCCEEDED(hres)) {
1659 test_style2(style2);
1660 IHTMLStyle2_Release(style2);
1663 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1664 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1665 if(SUCCEEDED(hres)) {
1666 test_style3(style3);
1667 IHTMLStyle3_Release(style3);
1670 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1671 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1672 if(SUCCEEDED(hres)) {
1673 test_style4(style4);
1674 IHTMLStyle4_Release(style4);
1678 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1679 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1684 str = (void*)0xdeadbeef;
1685 hres = IHTMLStyle_get_filter(style, &str);
1686 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1688 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1690 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1695 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1696 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
1698 BSTR str = a2bstr(val);
1701 hres = IHTMLStyle_put_filter(style, str);
1702 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
1705 _test_style_filter(line, style, val);
1708 static void test_style_filters(IHTMLElement *elem)
1713 hres = IHTMLElement_get_style(elem, &style);
1714 ok(hres == S_OK, "get_style failed: %08x\n", hres);
1716 test_style_filter(style, NULL);
1717 set_style_filter(style, "alpha(opacity=50.0040)");
1718 set_style_filter(style, "alpha(opacity=100)");
1720 IHTMLStyle_Release(style);
1722 hres = IHTMLElement_get_style(elem, &style);
1723 ok(hres == S_OK, "get_style failed: %08x\n", hres);
1725 test_style_filter(style, "alpha(opacity=100)");
1726 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
1727 set_style_filter(style, NULL);
1729 IHTMLStyle_Release(style);
1732 static void test_current_style(IHTMLCurrentStyle *current_style)
1738 hres = IHTMLCurrentStyle_get_display(current_style, &str);
1739 ok(hres == S_OK, "get_display failed: %08x\n", hres);
1740 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
1743 hres = IHTMLCurrentStyle_get_position(current_style, &str);
1744 ok(hres == S_OK, "get_position failed: %08x\n", hres);
1745 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
1748 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
1749 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
1752 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
1753 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1754 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
1757 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
1758 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
1759 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
1762 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
1763 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
1764 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
1767 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
1768 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1769 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
1772 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
1773 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1774 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
1777 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
1778 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1779 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
1782 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
1783 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1784 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
1787 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
1788 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1789 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
1792 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
1793 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1794 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
1797 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
1798 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1799 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1802 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
1803 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1804 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
1807 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
1808 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1811 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
1812 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1815 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
1816 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
1819 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
1820 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1823 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
1824 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
1827 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
1828 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1831 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
1832 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1835 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
1836 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1837 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
1838 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
1841 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
1842 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1843 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1846 hres = IHTMLCurrentStyle_get_left(current_style, &v);
1847 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1848 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1851 hres = IHTMLCurrentStyle_get_top(current_style, &v);
1852 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1853 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1856 hres = IHTMLCurrentStyle_get_width(current_style, &v);
1857 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1858 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1861 hres = IHTMLCurrentStyle_get_height(current_style, &v);
1862 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1863 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1866 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
1867 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
1868 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1871 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
1872 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1873 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
1874 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
1877 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
1878 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1879 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1880 ok(!strcmp_wa(V_BSTR(&v), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
1883 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
1884 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1885 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1888 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
1889 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
1890 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1893 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
1894 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1895 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1899 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
1900 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1901 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1904 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
1905 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1906 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1909 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
1910 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1911 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1914 hres = IHTMLCurrentStyle_get_color(current_style, &v);
1915 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1916 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1919 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
1920 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
1921 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1924 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
1925 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1926 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1929 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
1930 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1931 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1934 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
1935 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1936 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1939 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
1940 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1941 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1944 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
1945 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
1946 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1949 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
1950 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
1951 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1954 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
1955 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
1956 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1959 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
1960 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
1961 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1964 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
1965 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1966 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1969 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
1970 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
1971 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1974 hres = IHTMLCurrentStyle_get_right(current_style, &v);
1975 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
1976 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1979 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
1980 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
1981 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1984 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
1985 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1986 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1989 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
1990 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1991 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1995 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
1997 static void basic_style_test(IHTMLDocument2 *doc)
1999 IHTMLCurrentStyle *cstyle;
2004 hres = IHTMLDocument2_get_body(doc, &elem);
2005 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2007 hres = IHTMLElement_get_style(elem, &style);
2008 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2010 test_body_style(style);
2012 cstyle = get_current_style(elem);
2013 test_current_style(cstyle);
2014 IHTMLCurrentStyle_Release(cstyle);
2016 elem = get_element_by_id(doc, "divid");
2017 test_style_filters(elem);
2018 IHTMLElement_Release(elem);
2020 test_set_csstext(style);
2021 IHTMLStyle_Release(style);
2022 IHTMLElement_Release(elem);
2025 static IHTMLDocument2 *notif_doc;
2026 static BOOL doc_complete;
2028 static IHTMLDocument2 *create_document(void)
2030 IHTMLDocument2 *doc;
2031 IHTMLDocument5 *doc5;
2034 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2035 &IID_IHTMLDocument2, (void**)&doc);
2036 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2040 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2042 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2043 IHTMLDocument2_Release(doc);
2047 IHTMLDocument5_Release(doc5);
2051 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2052 REFIID riid, void**ppv)
2054 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2059 ok(0, "unexpected call\n");
2060 return E_NOINTERFACE;
2063 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2068 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2073 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2075 if(dispID == DISPID_READYSTATE){
2079 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2080 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2082 if(!strcmp_wa(state, "complete"))
2083 doc_complete = TRUE;
2085 SysFreeString(state);
2091 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2093 ok(0, "unexpected call\n");
2097 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2098 PropertyNotifySink_QueryInterface,
2099 PropertyNotifySink_AddRef,
2100 PropertyNotifySink_Release,
2101 PropertyNotifySink_OnChanged,
2102 PropertyNotifySink_OnRequestEdit
2105 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2107 static IHTMLDocument2 *create_doc_with_string(const char *str)
2109 IPersistStreamInit *init;
2111 IHTMLDocument2 *doc;
2115 notif_doc = doc = create_document();
2119 doc_complete = FALSE;
2121 mem = GlobalAlloc(0, len);
2122 memcpy(mem, str, len);
2123 CreateStreamOnHGlobal(mem, TRUE, &stream);
2125 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2127 IPersistStreamInit_Load(init, stream);
2128 IPersistStreamInit_Release(init);
2129 IStream_Release(stream);
2134 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2136 IConnectionPointContainer *container;
2137 IConnectionPoint *cp;
2141 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2142 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2144 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2145 IConnectionPointContainer_Release(container);
2146 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2148 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2149 IConnectionPoint_Release(cp);
2150 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2153 typedef void (*style_test_t)(IHTMLDocument2*);
2155 static void run_test(const char *str, style_test_t test)
2157 IHTMLDocument2 *doc;
2161 doc = create_doc_with_string(str);
2165 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2167 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2168 TranslateMessage(&msg);
2169 DispatchMessage(&msg);
2174 ref = IHTMLDocument2_Release(doc);
2175 ok(!ref || broken(ref == 1), /* Vista */
2184 run_test(basic_test_str, basic_style_test);