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 str = (void*)0xdeadbeef;
283 hres = IHTMLStyle2_get_direction(style2, &str);
284 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
285 ok(!str, "str = %s\n", wine_dbgstr_w(str));
288 hres = IHTMLStyle2_put_direction(style2, str);
289 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
293 hres = IHTMLStyle2_get_direction(style2, &str);
294 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
295 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
299 static void test_style3(IHTMLStyle3 *style3)
304 str = (void*)0xdeadbeef;
305 hres = IHTMLStyle3_get_wordWrap(style3, &str);
306 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
307 ok(!str, "str != NULL\n");
309 str = a2bstr("break-word");
310 hres = IHTMLStyle3_put_wordWrap(style3, str);
311 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
315 hres = IHTMLStyle3_get_wordWrap(style3, &str);
316 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
317 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
321 static void test_style4(IHTMLStyle4 *style4)
327 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
328 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
331 V_BSTR(&v) = a2bstr("10px");
332 hres = IHTMLStyle4_put_minHeight(style4, v);
333 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
336 hres = IHTMLStyle4_get_minHeight(style4, &v);
337 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
338 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
339 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
342 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
343 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
344 VariantClear(&vdefault);
347 static void test_body_style(IHTMLStyle *style)
357 BSTR sOverflowDefault;
361 test_style_csstext(style, NULL);
363 hres = IHTMLStyle_get_position(style, &str);
364 ok(hres == S_OK, "get_position failed: %08x\n", hres);
365 ok(!str, "str=%s\n", wine_dbgstr_w(str));
368 hres = IHTMLStyle_get_marginRight(style, &v);
369 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
370 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
371 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
374 hres = IHTMLStyle_get_marginLeft(style, &v);
375 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
376 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
377 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
379 str = (void*)0xdeadbeef;
380 hres = IHTMLStyle_get_fontFamily(style, &str);
381 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
382 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
384 str = (void*)0xdeadbeef;
385 hres = IHTMLStyle_get_fontWeight(style, &str);
386 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
387 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
389 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
390 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
392 str = a2bstr("test");
393 hres = IHTMLStyle_put_fontWeight(style, str);
394 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
397 str = a2bstr("bold");
398 hres = IHTMLStyle_put_fontWeight(style, str);
399 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
402 str = a2bstr("bolder");
403 hres = IHTMLStyle_put_fontWeight(style, str);
404 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
407 str = a2bstr("lighter");
408 hres = IHTMLStyle_put_fontWeight(style, str);
409 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
413 hres = IHTMLStyle_put_fontWeight(style, str);
414 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
418 hres = IHTMLStyle_put_fontWeight(style, str);
419 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
423 hres = IHTMLStyle_put_fontWeight(style, str);
424 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
428 hres = IHTMLStyle_put_fontWeight(style, str);
429 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
433 hres = IHTMLStyle_put_fontWeight(style, str);
434 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
438 hres = IHTMLStyle_put_fontWeight(style, str);
439 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
443 hres = IHTMLStyle_put_fontWeight(style, str);
444 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
448 hres = IHTMLStyle_put_fontWeight(style, str);
449 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
453 hres = IHTMLStyle_put_fontWeight(style, str);
454 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
457 hres = IHTMLStyle_get_fontWeight(style, &str);
458 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
459 ok(!strcmp_wa(str, "900"), "str != style900\n");
462 hres = IHTMLStyle_put_fontWeight(style, sDefault);
463 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
464 SysFreeString(sDefault);
467 hres = IHTMLStyle_get_fontVariant(style, NULL);
468 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
470 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
471 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
473 str = a2bstr("test");
474 hres = IHTMLStyle_put_fontVariant(style, str);
475 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
478 str = a2bstr("small-caps");
479 hres = IHTMLStyle_put_fontVariant(style, str);
480 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
483 str = a2bstr("normal");
484 hres = IHTMLStyle_put_fontVariant(style, str);
485 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
488 hres = IHTMLStyle_put_fontVariant(style, sDefault);
489 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
490 SysFreeString(sDefault);
492 str = (void*)0xdeadbeef;
493 hres = IHTMLStyle_get_display(style, &str);
494 ok(hres == S_OK, "get_display failed: %08x\n", hres);
495 ok(!str, "display = %s\n", wine_dbgstr_w(str));
497 str = (void*)0xdeadbeef;
498 hres = IHTMLStyle_get_visibility(style, &str);
499 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
500 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
503 hres = IHTMLStyle_get_fontSize(style, &v);
504 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
505 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
506 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
509 hres = IHTMLStyle_get_color(style, &v);
510 ok(hres == S_OK, "get_color failed: %08x\n", hres);
511 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
512 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
515 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
516 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
517 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
519 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
520 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
521 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
523 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
524 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
525 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
527 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
528 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
531 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
532 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
533 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
535 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
536 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
537 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
539 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
540 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
541 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
543 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
544 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
547 hres = IHTMLStyle_get_textDecorationNone(style, &b);
548 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
549 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
551 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
552 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
553 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
555 hres = IHTMLStyle_get_textDecorationNone(style, &b);
556 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
557 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
559 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
560 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
563 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
564 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
565 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
567 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
568 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
569 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
571 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
572 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
573 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
575 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
576 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
579 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
580 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
581 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
583 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
584 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
585 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
587 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
588 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
589 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
591 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
592 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
594 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
595 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
597 str = a2bstr("invalid");
598 hres = IHTMLStyle_put_textDecoration(style, str);
599 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
602 str = a2bstr("none");
603 hres = IHTMLStyle_put_textDecoration(style, str);
604 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
607 str = a2bstr("underline");
608 hres = IHTMLStyle_put_textDecoration(style, str);
609 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
612 str = a2bstr("overline");
613 hres = IHTMLStyle_put_textDecoration(style, str);
614 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
617 str = a2bstr("line-through");
618 hres = IHTMLStyle_put_textDecoration(style, str);
619 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
622 str = a2bstr("blink");
623 hres = IHTMLStyle_put_textDecoration(style, str);
624 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
627 hres = IHTMLStyle_get_textDecoration(style, &str);
628 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
629 ok(!strcmp_wa(str, "blink"), "str != blink\n");
632 hres = IHTMLStyle_put_textDecoration(style, sDefault);
633 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
634 SysFreeString(sDefault);
636 hres = IHTMLStyle_get_posWidth(style, NULL);
637 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
639 hres = IHTMLStyle_get_posWidth(style, &f);
640 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
641 ok(f == 0.0f, "f = %f\n", f);
644 hres = IHTMLStyle_get_width(style, &v);
645 ok(hres == S_OK, "get_width failed: %08x\n", hres);
646 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
647 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
649 hres = IHTMLStyle_put_posWidth(style, 2.2);
650 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
652 hres = IHTMLStyle_get_posWidth(style, &f);
653 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
659 V_BSTR(&v) = a2bstr("auto");
660 hres = IHTMLStyle_put_width(style, v);
661 ok(hres == S_OK, "put_width failed: %08x\n", hres);
665 hres = IHTMLStyle_get_width(style, &v);
666 ok(hres == S_OK, "get_width failed: %08x\n", hres);
667 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
668 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
673 hres = IHTMLStyle_put_width(style, v);
674 ok(hres == S_OK, "put_width failed: %08x\n", hres);
677 hres = IHTMLStyle_get_width(style, &v);
678 ok(hres == S_OK, "get_width failed: %08x\n", hres);
679 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
680 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
684 str = (void*)0xdeadbeef;
685 hres = IHTMLStyle_get_margin(style, &str);
686 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
687 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
690 hres = IHTMLStyle_put_margin(style, str);
691 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
694 hres = IHTMLStyle_get_margin(style, &str);
695 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
696 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
699 hres = IHTMLStyle_put_margin(style, NULL);
700 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
702 str = (void*)0xdeadbeef;
703 hres = IHTMLStyle_get_marginTop(style, &v);
704 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
705 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
706 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
709 V_BSTR(&v) = a2bstr("6px");
710 hres = IHTMLStyle_put_marginTop(style, v);
711 SysFreeString(V_BSTR(&v));
712 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
714 str = (void*)0xdeadbeef;
715 hres = IHTMLStyle_get_marginTop(style, &v);
716 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
717 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
718 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
722 hres = IHTMLStyle_get_border(style, &str);
723 ok(hres == S_OK, "get_border failed: %08x\n", hres);
724 ok(!str || !*str, "str is not empty\n");
728 hres = IHTMLStyle_put_border(style, str);
729 ok(hres == S_OK, "put_border failed: %08x\n", hres);
733 hres = IHTMLStyle_get_left(style, &v);
734 ok(hres == S_OK, "get_left failed: %08x\n", hres);
735 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
736 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
740 hres = IHTMLStyle_get_posLeft(style, NULL);
741 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
744 hres = IHTMLStyle_get_posLeft(style, &f);
745 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
746 ok(f == 0.0, "expected 0.0 got %f\n", f);
748 hres = IHTMLStyle_put_posLeft(style, 4.9f);
749 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
751 hres = IHTMLStyle_get_posLeft(style, &f);
752 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
755 "expected 4.0 or 4.9 (IE8) got %f\n", f);
757 /* Ensure left is updated correctly. */
759 hres = IHTMLStyle_get_left(style, &v);
760 ok(hres == S_OK, "get_left failed: %08x\n", hres);
761 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
762 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
763 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
764 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
769 V_BSTR(&v) = a2bstr("3px");
770 hres = IHTMLStyle_put_left(style, v);
771 ok(hres == S_OK, "put_left failed: %08x\n", hres);
774 hres = IHTMLStyle_get_posLeft(style, &f);
775 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
776 ok(f == 3.0, "expected 3.0 got %f\n", f);
779 hres = IHTMLStyle_get_left(style, &v);
780 ok(hres == S_OK, "get_left failed: %08x\n", hres);
781 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
782 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
786 hres = IHTMLStyle_put_left(style, v);
787 ok(hres == S_OK, "put_left failed: %08x\n", hres);
790 hres = IHTMLStyle_get_left(style, &v);
791 ok(hres == S_OK, "get_left failed: %08x\n", hres);
792 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
793 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
797 hres = IHTMLStyle_get_top(style, &v);
798 ok(hres == S_OK, "get_top failed: %08x\n", hres);
799 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
800 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
804 hres = IHTMLStyle_get_posTop(style, NULL);
805 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
808 hres = IHTMLStyle_get_posTop(style, &f);
809 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
810 ok(f == 0.0, "expected 0.0 got %f\n", f);
812 hres = IHTMLStyle_put_posTop(style, 4.9f);
813 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
815 hres = IHTMLStyle_get_posTop(style, &f);
816 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
819 "expected 4.0 or 4.9 (IE8) got %f\n", f);
822 V_BSTR(&v) = a2bstr("3px");
823 hres = IHTMLStyle_put_top(style, v);
824 ok(hres == S_OK, "put_top failed: %08x\n", hres);
828 hres = IHTMLStyle_get_top(style, &v);
829 ok(hres == S_OK, "get_top failed: %08x\n", hres);
830 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
831 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
834 hres = IHTMLStyle_get_posTop(style, &f);
835 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
836 ok(f == 3.0, "expected 3.0 got %f\n", f);
839 hres = IHTMLStyle_put_top(style, v);
840 ok(hres == S_OK, "put_top failed: %08x\n", hres);
843 hres = IHTMLStyle_get_top(style, &v);
844 ok(hres == S_OK, "get_top failed: %08x\n", hres);
845 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
846 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
850 hres = IHTMLStyle_get_posHeight(style, NULL);
851 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
854 hres = IHTMLStyle_get_height(style, &v);
855 ok(hres == S_OK, "get_height failed: %08x\n", hres);
856 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
857 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
861 hres = IHTMLStyle_get_posHeight(style, &f);
862 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
863 ok(f == 0.0, "expected 0.0 got %f\n", f);
865 hres = IHTMLStyle_put_posHeight(style, 4.9f);
866 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
868 hres = IHTMLStyle_get_posHeight(style, &f);
869 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
872 "expected 4.0 or 4.9 (IE8) got %f\n", f);
875 V_BSTR(&v) = a2bstr("70px");
876 hres = IHTMLStyle_put_height(style, v);
877 ok(hres == S_OK, "put_height failed: %08x\n", hres);
881 hres = IHTMLStyle_get_height(style, &v);
882 ok(hres == S_OK, "get_height failed: %08x\n", hres);
883 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
884 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
889 hres = IHTMLStyle_put_height(style, v);
890 ok(hres == S_OK, "put_height failed: %08x\n", hres);
893 hres = IHTMLStyle_get_height(style, &v);
894 ok(hres == S_OK, "get_height failed: %08x\n", hres);
895 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
896 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
899 hres = IHTMLStyle_get_posHeight(style, &f);
900 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
901 ok(f == 64.0, "expected 64.0 got %f\n", f);
903 str = (void*)0xdeadbeef;
904 hres = IHTMLStyle_get_cursor(style, &str);
905 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
906 ok(!str, "get_cursor != NULL\n");
909 str = a2bstr("default");
910 hres = IHTMLStyle_put_cursor(style, str);
911 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
915 hres = IHTMLStyle_get_cursor(style, &str);
916 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
917 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
921 hres = IHTMLStyle_get_verticalAlign(style, &v);
922 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
923 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
924 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
928 V_BSTR(&v) = a2bstr("middle");
929 hres = IHTMLStyle_put_verticalAlign(style, v);
930 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
934 hres = IHTMLStyle_get_verticalAlign(style, &v);
935 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
936 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
937 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
940 str = (void*)0xdeadbeef;
941 hres = IHTMLStyle_get_textAlign(style, &str);
942 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
943 ok(!str, "textAlign != NULL\n");
945 str = a2bstr("center");
946 hres = IHTMLStyle_put_textAlign(style, str);
947 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
951 hres = IHTMLStyle_get_textAlign(style, &str);
952 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
953 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
956 str = (void*)0xdeadbeef;
957 hres = IHTMLStyle_get_filter(style, &str);
958 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
959 ok(!str, "filter != NULL\n");
961 str = a2bstr("alpha(opacity=100)");
962 hres = IHTMLStyle_put_filter(style, str);
963 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
967 hres = IHTMLStyle_get_zIndex(style, &v);
968 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
969 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
970 ok(!V_I4(&v), "V_I4(v) != 0\n");
974 V_BSTR(&v) = a2bstr("1");
975 hres = IHTMLStyle_put_zIndex(style, v);
976 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
980 hres = IHTMLStyle_get_zIndex(style, &v);
981 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
982 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
983 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
987 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
988 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
990 str = a2bstr("test");
991 hres = IHTMLStyle_put_fontStyle(style, str);
992 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
995 str = a2bstr("italic");
996 hres = IHTMLStyle_put_fontStyle(style, str);
997 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1000 str = a2bstr("oblique");
1001 hres = IHTMLStyle_put_fontStyle(style, str);
1002 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1005 str = a2bstr("normal");
1006 hres = IHTMLStyle_put_fontStyle(style, str);
1007 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1010 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1011 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1012 SysFreeString(sDefault);
1015 hres = IHTMLStyle_get_overflow(style, NULL);
1016 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1018 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1019 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1021 str = a2bstr("test");
1022 hres = IHTMLStyle_put_overflow(style, str);
1023 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1026 str = a2bstr("visible");
1027 hres = IHTMLStyle_put_overflow(style, str);
1028 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1031 str = a2bstr("scroll");
1032 hres = IHTMLStyle_put_overflow(style, str);
1033 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1036 str = a2bstr("hidden");
1037 hres = IHTMLStyle_put_overflow(style, str);
1038 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1041 str = a2bstr("auto");
1042 hres = IHTMLStyle_put_overflow(style, str);
1043 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1046 hres = IHTMLStyle_get_overflow(style, &str);
1047 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1048 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1052 hres = IHTMLStyle_put_overflow(style, str);
1053 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1056 hres = IHTMLStyle_get_overflow(style, &str);
1057 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1058 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1061 /* restore overflow default */
1062 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1063 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1064 SysFreeString(sOverflowDefault);
1066 /* Attribute Tests*/
1067 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1068 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1070 str = a2bstr("position");
1071 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1072 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1074 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1075 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1076 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1079 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1080 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1083 V_BSTR(&v) = a2bstr("absolute");
1084 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1085 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1088 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1089 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1090 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1091 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1096 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1097 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1102 str = a2bstr("borderLeftStyle");
1103 test_border_styles(style, str);
1106 str = a2bstr("borderbottomstyle");
1107 test_border_styles(style, str);
1110 str = a2bstr("borderrightstyle");
1111 test_border_styles(style, str);
1114 str = a2bstr("bordertopstyle");
1115 test_border_styles(style, str);
1118 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1119 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1121 str = a2bstr("none dotted dashed solid");
1122 hres = IHTMLStyle_put_borderStyle(style, str);
1123 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1126 str = a2bstr("none dotted dashed solid");
1127 hres = IHTMLStyle_get_borderStyle(style, &str);
1128 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1129 ok(!strcmp_wa(str, "none dotted dashed solid"),
1130 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1133 str = a2bstr("double groove ridge inset");
1134 hres = IHTMLStyle_put_borderStyle(style, str);
1135 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1138 str = a2bstr("window-inset outset ridge inset");
1139 hres = IHTMLStyle_put_borderStyle(style, str);
1140 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1143 str = a2bstr("window-inset");
1144 hres = IHTMLStyle_put_borderStyle(style, str);
1145 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1148 str = a2bstr("none none none none none");
1149 hres = IHTMLStyle_put_borderStyle(style, str);
1150 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1153 str = a2bstr("invalid none none none");
1154 hres = IHTMLStyle_put_borderStyle(style, str);
1155 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1158 str = a2bstr("none invalid none none");
1159 hres = IHTMLStyle_put_borderStyle(style, str);
1160 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1163 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1164 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1165 SysFreeString(sDefault);
1167 /* backgoundColor */
1168 hres = IHTMLStyle_get_backgroundColor(style, &v);
1169 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1170 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1171 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1175 hres = IHTMLStyle_get_padding(style, &str);
1176 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1177 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1181 hres = IHTMLStyle_put_padding(style, str);
1182 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1185 hres = IHTMLStyle_get_padding(style, &str);
1186 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1187 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1191 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1192 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1195 V_BSTR(&v) = a2bstr("10");
1196 hres = IHTMLStyle_put_paddingLeft(style, v);
1197 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1200 hres = IHTMLStyle_get_paddingLeft(style, &v);
1201 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1202 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1205 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1206 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1208 /* BackgroundRepeat */
1209 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1210 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1212 str = a2bstr("invalid");
1213 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1214 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1217 str = a2bstr("repeat");
1218 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1219 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1222 str = a2bstr("no-repeat");
1223 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1224 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1227 str = a2bstr("repeat-x");
1228 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1229 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1232 str = a2bstr("repeat-y");
1233 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1234 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1237 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1238 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1239 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1242 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1243 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1244 SysFreeString(sDefault);
1247 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1248 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1250 str = a2bstr("red green red blue");
1251 hres = IHTMLStyle_put_borderColor(style, str);
1252 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1255 hres = IHTMLStyle_get_borderColor(style, &str);
1256 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1257 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1260 hres = IHTMLStyle_put_borderColor(style, sDefault);
1261 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1262 SysFreeString(sDefault);
1265 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1266 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1268 str = a2bstr("thick dotted red");
1269 hres = IHTMLStyle_put_borderRight(style, str);
1270 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1273 /* IHTMLStyle_get_borderRight appears to have a bug where
1274 it returns the first letter of the color. So we check
1275 each style individually.
1278 hres = IHTMLStyle_get_borderRightColor(style, &v);
1279 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1280 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1284 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1285 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1286 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1289 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1290 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1291 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1294 hres = IHTMLStyle_put_borderRight(style, sDefault);
1295 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1296 SysFreeString(sDefault);
1299 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1300 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1302 str = a2bstr("thick dotted red");
1303 hres = IHTMLStyle_put_borderTop(style, str);
1304 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1307 /* IHTMLStyle_get_borderTop appears to have a bug where
1308 it returns the first letter of the color. So we check
1309 each style individually.
1312 hres = IHTMLStyle_get_borderTopColor(style, &v);
1313 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1314 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1318 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1319 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1320 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1323 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1324 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1325 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1328 hres = IHTMLStyle_put_borderTop(style, sDefault);
1329 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1330 SysFreeString(sDefault);
1333 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1334 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1336 str = a2bstr("thick dotted red");
1337 hres = IHTMLStyle_put_borderBottom(style, str);
1338 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1341 /* IHTMLStyle_get_borderBottom appears to have a bug where
1342 it returns the first letter of the color. So we check
1343 each style individually.
1346 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1347 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1348 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1352 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1353 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1354 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1357 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1358 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1359 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1362 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1363 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1364 SysFreeString(sDefault);
1367 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1368 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1370 str = a2bstr("thick dotted red");
1371 hres = IHTMLStyle_put_borderLeft(style, str);
1372 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1375 /* IHTMLStyle_get_borderLeft appears to have a bug where
1376 it returns the first letter of the color. So we check
1377 each style individually.
1380 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1381 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1382 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1386 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1387 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1388 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1391 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1392 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1393 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1396 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1397 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1398 SysFreeString(sDefault);
1400 /* backgroundPositionX */
1401 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1402 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1403 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1404 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1408 V_BSTR(&v) = a2bstr("10px");
1409 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1410 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1413 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1414 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1415 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1416 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1419 /* backgroundPositionY */
1420 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1421 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1422 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1426 V_BSTR(&v) = a2bstr("15px");
1427 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1428 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1431 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1432 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1433 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1434 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1437 /* backgroundPosition */
1439 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1440 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1441 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1444 str = a2bstr("center 20%");
1445 hres = IHTMLStyle_put_backgroundPosition(style, str);
1446 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1450 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1451 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1452 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1455 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1456 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1457 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1458 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1461 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1462 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1463 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1464 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1467 /* borderTopWidth */
1468 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1469 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1472 V_BSTR(&v) = a2bstr("10px");
1473 hres = IHTMLStyle_put_borderTopWidth(style, v);
1474 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1477 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1478 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1479 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1482 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1483 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1484 VariantClear(&vDefault);
1486 /* borderRightWidth */
1487 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1488 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1491 V_BSTR(&v) = a2bstr("10");
1492 hres = IHTMLStyle_put_borderRightWidth(style, v);
1493 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1496 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1497 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1498 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1501 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1502 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1503 VariantClear(&vDefault);
1505 /* borderBottomWidth */
1506 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1507 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1510 V_BSTR(&v) = a2bstr("10");
1511 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1512 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1515 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1516 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1517 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1520 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1521 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1522 VariantClear(&vDefault);
1524 /* borderLeftWidth */
1525 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1526 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1529 V_BSTR(&v) = a2bstr("10");
1530 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1531 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1534 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1535 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1536 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1539 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1540 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1541 VariantClear(&vDefault);
1544 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1545 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1548 V_BSTR(&v) = a2bstr("10");
1549 hres = IHTMLStyle_put_wordSpacing(style, v);
1550 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1553 hres = IHTMLStyle_get_wordSpacing(style, &v);
1554 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1555 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1556 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1559 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1560 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1561 VariantClear(&vDefault);
1564 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1565 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1568 V_BSTR(&v) = a2bstr("11");
1569 hres = IHTMLStyle_put_letterSpacing(style, v);
1570 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1573 hres = IHTMLStyle_get_letterSpacing(style, &v);
1574 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1575 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1576 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1579 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1580 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1581 VariantClear(&vDefault);
1583 /* borderTopColor */
1584 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1585 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1588 V_BSTR(&v) = a2bstr("red");
1589 hres = IHTMLStyle_put_borderTopColor(style, v);
1590 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1593 hres = IHTMLStyle_get_borderTopColor(style, &v);
1594 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1595 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1598 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1599 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1601 /* borderRightColor */
1602 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1603 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1606 V_BSTR(&v) = a2bstr("blue");
1607 hres = IHTMLStyle_put_borderRightColor(style, v);
1608 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1611 hres = IHTMLStyle_get_borderRightColor(style, &v);
1612 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1613 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1616 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1617 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1619 /* borderBottomColor */
1620 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1621 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1624 V_BSTR(&v) = a2bstr("cyan");
1625 hres = IHTMLStyle_put_borderBottomColor(style, v);
1626 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1629 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1630 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1631 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1634 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1635 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1637 /* borderLeftColor */
1638 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1639 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1642 V_BSTR(&v) = a2bstr("cyan");
1643 hres = IHTMLStyle_put_borderLeftColor(style, v);
1644 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1647 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1648 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1649 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1652 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1653 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1656 hres = IHTMLStyle_get_clip(style, &str);
1657 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1658 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1660 str = a2bstr("rect(0px 1px 500px 505px)");
1661 hres = IHTMLStyle_put_clip(style, str);
1662 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1665 hres = IHTMLStyle_get_clip(style, &str);
1666 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1667 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1670 /* pageBreakAfter */
1671 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1672 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1673 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1675 str = a2bstr("always");
1676 hres = IHTMLStyle_put_pageBreakAfter(style, str);
1677 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1680 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1681 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1682 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1685 /* pageBreakBefore */
1686 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1687 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1688 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1690 str = a2bstr("always");
1691 hres = IHTMLStyle_put_pageBreakBefore(style, str);
1692 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1695 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1696 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1697 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1700 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1701 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1702 if(SUCCEEDED(hres)) {
1703 test_style2(style2);
1704 IHTMLStyle2_Release(style2);
1707 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1708 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1709 if(SUCCEEDED(hres)) {
1710 test_style3(style3);
1711 IHTMLStyle3_Release(style3);
1714 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1715 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1716 if(SUCCEEDED(hres)) {
1717 test_style4(style4);
1718 IHTMLStyle4_Release(style4);
1722 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1723 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1728 str = (void*)0xdeadbeef;
1729 hres = IHTMLStyle_get_filter(style, &str);
1730 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1732 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1734 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1739 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1740 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
1742 BSTR str = a2bstr(val);
1745 hres = IHTMLStyle_put_filter(style, str);
1746 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
1749 _test_style_filter(line, style, val);
1752 static void test_style_filters(IHTMLElement *elem)
1757 hres = IHTMLElement_get_style(elem, &style);
1758 ok(hres == S_OK, "get_style failed: %08x\n", hres);
1760 test_style_filter(style, NULL);
1761 set_style_filter(style, "alpha(opacity=50.0040)");
1762 set_style_filter(style, "alpha(opacity=100)");
1764 IHTMLStyle_Release(style);
1766 hres = IHTMLElement_get_style(elem, &style);
1767 ok(hres == S_OK, "get_style failed: %08x\n", hres);
1769 test_style_filter(style, "alpha(opacity=100)");
1770 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
1771 set_style_filter(style, NULL);
1773 IHTMLStyle_Release(style);
1776 static void test_current_style(IHTMLCurrentStyle *current_style)
1782 hres = IHTMLCurrentStyle_get_display(current_style, &str);
1783 ok(hres == S_OK, "get_display failed: %08x\n", hres);
1784 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
1787 hres = IHTMLCurrentStyle_get_position(current_style, &str);
1788 ok(hres == S_OK, "get_position failed: %08x\n", hres);
1789 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
1792 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
1793 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
1796 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
1797 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1798 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
1801 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
1802 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
1803 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
1806 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
1807 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
1808 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
1811 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
1812 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1813 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
1816 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
1817 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1818 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
1821 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
1822 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1823 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
1826 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
1827 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1828 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
1831 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
1832 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1833 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
1836 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
1837 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1838 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
1841 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
1842 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1843 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1846 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
1847 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1848 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
1851 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
1852 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1855 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
1856 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1859 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
1860 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
1863 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
1864 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1867 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
1868 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
1871 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
1872 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1875 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
1876 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1879 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
1880 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1881 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
1882 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
1885 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
1886 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1887 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1890 hres = IHTMLCurrentStyle_get_left(current_style, &v);
1891 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1892 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1895 hres = IHTMLCurrentStyle_get_top(current_style, &v);
1896 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1897 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1900 hres = IHTMLCurrentStyle_get_width(current_style, &v);
1901 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1902 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1905 hres = IHTMLCurrentStyle_get_height(current_style, &v);
1906 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1907 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1910 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
1911 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
1912 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1915 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
1916 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1917 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
1918 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
1921 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
1922 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1923 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1924 ok(!strcmp_wa(V_BSTR(&v), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
1927 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
1928 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1929 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1932 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
1933 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
1934 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1937 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
1938 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1939 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1943 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
1944 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1945 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1948 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
1949 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1950 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1953 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
1954 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1955 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1958 hres = IHTMLCurrentStyle_get_color(current_style, &v);
1959 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1960 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1963 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
1964 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
1965 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1968 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
1969 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1970 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1973 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
1974 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1975 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1978 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
1979 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1980 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1983 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
1984 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1985 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1988 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
1989 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
1990 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1993 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
1994 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
1995 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1998 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
1999 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2000 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2003 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2004 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2005 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2008 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2009 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2010 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2013 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2014 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2015 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2018 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2019 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2020 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2023 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2024 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2025 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2028 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2029 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2030 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2033 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2034 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2035 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2039 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2041 static void basic_style_test(IHTMLDocument2 *doc)
2043 IHTMLCurrentStyle *cstyle;
2048 hres = IHTMLDocument2_get_body(doc, &elem);
2049 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2051 hres = IHTMLElement_get_style(elem, &style);
2052 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2054 test_body_style(style);
2056 cstyle = get_current_style(elem);
2057 test_current_style(cstyle);
2058 IHTMLCurrentStyle_Release(cstyle);
2059 IHTMLElement_Release(elem);
2061 elem = get_element_by_id(doc, "divid");
2062 test_style_filters(elem);
2064 test_set_csstext(style);
2065 IHTMLStyle_Release(style);
2066 IHTMLElement_Release(elem);
2069 static IHTMLDocument2 *notif_doc;
2070 static BOOL doc_complete;
2072 static IHTMLDocument2 *create_document(void)
2074 IHTMLDocument2 *doc;
2075 IHTMLDocument5 *doc5;
2078 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2079 &IID_IHTMLDocument2, (void**)&doc);
2080 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2084 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2086 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2087 IHTMLDocument2_Release(doc);
2091 IHTMLDocument5_Release(doc5);
2095 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2096 REFIID riid, void**ppv)
2098 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2103 ok(0, "unexpected call\n");
2104 return E_NOINTERFACE;
2107 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2112 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2117 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2119 if(dispID == DISPID_READYSTATE){
2123 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2124 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2126 if(!strcmp_wa(state, "complete"))
2127 doc_complete = TRUE;
2129 SysFreeString(state);
2135 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2137 ok(0, "unexpected call\n");
2141 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2142 PropertyNotifySink_QueryInterface,
2143 PropertyNotifySink_AddRef,
2144 PropertyNotifySink_Release,
2145 PropertyNotifySink_OnChanged,
2146 PropertyNotifySink_OnRequestEdit
2149 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2151 static IHTMLDocument2 *create_doc_with_string(const char *str)
2153 IPersistStreamInit *init;
2155 IHTMLDocument2 *doc;
2159 notif_doc = doc = create_document();
2163 doc_complete = FALSE;
2165 mem = GlobalAlloc(0, len);
2166 memcpy(mem, str, len);
2167 CreateStreamOnHGlobal(mem, TRUE, &stream);
2169 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2171 IPersistStreamInit_Load(init, stream);
2172 IPersistStreamInit_Release(init);
2173 IStream_Release(stream);
2178 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2180 IConnectionPointContainer *container;
2181 IConnectionPoint *cp;
2185 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2186 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2188 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2189 IConnectionPointContainer_Release(container);
2190 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2192 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2193 IConnectionPoint_Release(cp);
2194 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2197 typedef void (*style_test_t)(IHTMLDocument2*);
2199 static void run_test(const char *str, style_test_t test)
2201 IHTMLDocument2 *doc;
2205 doc = create_doc_with_string(str);
2209 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2211 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2212 TranslateMessage(&msg);
2213 DispatchMessage(&msg);
2218 ref = IHTMLDocument2_Release(doc);
2219 ok(!ref || broken(ref == 1), /* Vista */
2228 run_test(basic_test_str, basic_style_test);