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)));
375 hres = IHTMLStyle_put_marginRight(style, v);
376 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
379 hres = IHTMLStyle_get_marginRight(style, &v);
380 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
381 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
382 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
385 hres = IHTMLStyle_get_marginBottom(style, &v);
386 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
387 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
388 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
392 hres = IHTMLStyle_put_marginBottom(style, v);
393 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
396 hres = IHTMLStyle_get_marginBottom(style, &v);
397 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
398 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
399 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
402 hres = IHTMLStyle_get_marginLeft(style, &v);
403 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
404 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
405 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
409 hres = IHTMLStyle_put_marginLeft(style, v);
410 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
413 hres = IHTMLStyle_get_marginLeft(style, &v);
414 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
415 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
416 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
418 str = (void*)0xdeadbeef;
419 hres = IHTMLStyle_get_fontFamily(style, &str);
420 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
421 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
423 str = (void*)0xdeadbeef;
424 hres = IHTMLStyle_get_fontWeight(style, &str);
425 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
426 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
428 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
429 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
431 str = a2bstr("test");
432 hres = IHTMLStyle_put_fontWeight(style, str);
433 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
436 str = a2bstr("bold");
437 hres = IHTMLStyle_put_fontWeight(style, str);
438 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
441 str = a2bstr("bolder");
442 hres = IHTMLStyle_put_fontWeight(style, str);
443 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
446 str = a2bstr("lighter");
447 hres = IHTMLStyle_put_fontWeight(style, str);
448 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
452 hres = IHTMLStyle_put_fontWeight(style, str);
453 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
457 hres = IHTMLStyle_put_fontWeight(style, str);
458 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
462 hres = IHTMLStyle_put_fontWeight(style, str);
463 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
467 hres = IHTMLStyle_put_fontWeight(style, str);
468 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
472 hres = IHTMLStyle_put_fontWeight(style, str);
473 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
477 hres = IHTMLStyle_put_fontWeight(style, str);
478 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
482 hres = IHTMLStyle_put_fontWeight(style, str);
483 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
487 hres = IHTMLStyle_put_fontWeight(style, str);
488 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
492 hres = IHTMLStyle_put_fontWeight(style, str);
493 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
496 hres = IHTMLStyle_get_fontWeight(style, &str);
497 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
498 ok(!strcmp_wa(str, "900"), "str != style900\n");
501 hres = IHTMLStyle_put_fontWeight(style, sDefault);
502 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
503 SysFreeString(sDefault);
506 hres = IHTMLStyle_get_fontVariant(style, NULL);
507 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
509 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
510 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
512 str = a2bstr("test");
513 hres = IHTMLStyle_put_fontVariant(style, str);
514 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
517 str = a2bstr("small-caps");
518 hres = IHTMLStyle_put_fontVariant(style, str);
519 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
522 str = a2bstr("normal");
523 hres = IHTMLStyle_put_fontVariant(style, str);
524 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
527 hres = IHTMLStyle_put_fontVariant(style, sDefault);
528 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
529 SysFreeString(sDefault);
531 str = (void*)0xdeadbeef;
532 hres = IHTMLStyle_get_display(style, &str);
533 ok(hres == S_OK, "get_display failed: %08x\n", hres);
534 ok(!str, "display = %s\n", wine_dbgstr_w(str));
536 str = (void*)0xdeadbeef;
537 hres = IHTMLStyle_get_visibility(style, &str);
538 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
539 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
542 hres = IHTMLStyle_get_fontSize(style, &v);
543 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
544 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
545 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
548 hres = IHTMLStyle_get_color(style, &v);
549 ok(hres == S_OK, "get_color failed: %08x\n", hres);
550 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
551 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
554 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
555 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
556 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
558 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
559 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
560 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
562 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
563 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
564 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
566 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
567 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
570 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
571 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
572 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
574 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
575 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
576 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
578 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
579 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
580 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
582 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
583 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
586 hres = IHTMLStyle_get_textDecorationNone(style, &b);
587 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
588 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
590 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
591 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
592 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
594 hres = IHTMLStyle_get_textDecorationNone(style, &b);
595 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
596 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
598 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
599 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
602 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
603 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
604 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
606 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
607 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
608 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
610 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
611 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
612 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
614 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
615 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
618 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
619 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
620 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
622 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
623 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
624 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
626 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
627 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
628 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
630 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
631 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
633 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
634 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
636 str = a2bstr("invalid");
637 hres = IHTMLStyle_put_textDecoration(style, str);
638 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
641 str = a2bstr("none");
642 hres = IHTMLStyle_put_textDecoration(style, str);
643 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
646 str = a2bstr("underline");
647 hres = IHTMLStyle_put_textDecoration(style, str);
648 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
651 str = a2bstr("overline");
652 hres = IHTMLStyle_put_textDecoration(style, str);
653 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
656 str = a2bstr("line-through");
657 hres = IHTMLStyle_put_textDecoration(style, str);
658 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
661 str = a2bstr("blink");
662 hres = IHTMLStyle_put_textDecoration(style, str);
663 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
666 hres = IHTMLStyle_get_textDecoration(style, &str);
667 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
668 ok(!strcmp_wa(str, "blink"), "str != blink\n");
671 hres = IHTMLStyle_put_textDecoration(style, sDefault);
672 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
673 SysFreeString(sDefault);
675 hres = IHTMLStyle_get_posWidth(style, NULL);
676 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
678 hres = IHTMLStyle_get_posWidth(style, &f);
679 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
680 ok(f == 0.0f, "f = %f\n", f);
683 hres = IHTMLStyle_get_width(style, &v);
684 ok(hres == S_OK, "get_width failed: %08x\n", hres);
685 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
686 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
688 hres = IHTMLStyle_put_posWidth(style, 2.2);
689 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
691 hres = IHTMLStyle_get_posWidth(style, &f);
692 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
698 V_BSTR(&v) = a2bstr("auto");
699 hres = IHTMLStyle_put_width(style, v);
700 ok(hres == S_OK, "put_width failed: %08x\n", hres);
704 hres = IHTMLStyle_get_width(style, &v);
705 ok(hres == S_OK, "get_width failed: %08x\n", hres);
706 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
707 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
712 hres = IHTMLStyle_put_width(style, v);
713 ok(hres == S_OK, "put_width failed: %08x\n", hres);
716 hres = IHTMLStyle_get_width(style, &v);
717 ok(hres == S_OK, "get_width failed: %08x\n", hres);
718 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
719 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
723 str = (void*)0xdeadbeef;
724 hres = IHTMLStyle_get_margin(style, &str);
725 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
726 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
729 hres = IHTMLStyle_put_margin(style, str);
730 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
733 hres = IHTMLStyle_get_margin(style, &str);
734 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
735 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
738 hres = IHTMLStyle_put_margin(style, NULL);
739 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
741 str = (void*)0xdeadbeef;
742 hres = IHTMLStyle_get_marginTop(style, &v);
743 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
744 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
745 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
748 V_BSTR(&v) = a2bstr("6px");
749 hres = IHTMLStyle_put_marginTop(style, v);
750 SysFreeString(V_BSTR(&v));
751 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
753 str = (void*)0xdeadbeef;
754 hres = IHTMLStyle_get_marginTop(style, &v);
755 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
756 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
757 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
762 hres = IHTMLStyle_put_marginTop(style, v);
763 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
765 str = (void*)0xdeadbeef;
766 hres = IHTMLStyle_get_marginTop(style, &v);
767 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
768 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
769 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
773 hres = IHTMLStyle_get_border(style, &str);
774 ok(hres == S_OK, "get_border failed: %08x\n", hres);
775 ok(!str || !*str, "str is not empty\n");
779 hres = IHTMLStyle_put_border(style, str);
780 ok(hres == S_OK, "put_border failed: %08x\n", hres);
784 hres = IHTMLStyle_get_left(style, &v);
785 ok(hres == S_OK, "get_left failed: %08x\n", hres);
786 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
787 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
791 hres = IHTMLStyle_get_posLeft(style, NULL);
792 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
795 hres = IHTMLStyle_get_posLeft(style, &f);
796 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
797 ok(f == 0.0, "expected 0.0 got %f\n", f);
799 hres = IHTMLStyle_put_posLeft(style, 4.9f);
800 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
802 hres = IHTMLStyle_get_posLeft(style, &f);
803 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
806 "expected 4.0 or 4.9 (IE8) got %f\n", f);
808 /* Ensure left is updated correctly. */
810 hres = IHTMLStyle_get_left(style, &v);
811 ok(hres == S_OK, "get_left failed: %08x\n", hres);
812 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
813 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
814 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
815 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
820 V_BSTR(&v) = a2bstr("3px");
821 hres = IHTMLStyle_put_left(style, v);
822 ok(hres == S_OK, "put_left failed: %08x\n", hres);
825 hres = IHTMLStyle_get_posLeft(style, &f);
826 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
827 ok(f == 3.0, "expected 3.0 got %f\n", f);
830 hres = IHTMLStyle_get_left(style, &v);
831 ok(hres == S_OK, "get_left failed: %08x\n", hres);
832 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
833 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
837 hres = IHTMLStyle_put_left(style, v);
838 ok(hres == S_OK, "put_left failed: %08x\n", hres);
841 hres = IHTMLStyle_get_left(style, &v);
842 ok(hres == S_OK, "get_left failed: %08x\n", hres);
843 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
844 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
848 hres = IHTMLStyle_get_top(style, &v);
849 ok(hres == S_OK, "get_top failed: %08x\n", hres);
850 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
851 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
855 hres = IHTMLStyle_get_posTop(style, NULL);
856 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
859 hres = IHTMLStyle_get_posTop(style, &f);
860 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
861 ok(f == 0.0, "expected 0.0 got %f\n", f);
863 hres = IHTMLStyle_put_posTop(style, 4.9f);
864 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
866 hres = IHTMLStyle_get_posTop(style, &f);
867 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
870 "expected 4.0 or 4.9 (IE8) got %f\n", f);
873 V_BSTR(&v) = a2bstr("3px");
874 hres = IHTMLStyle_put_top(style, v);
875 ok(hres == S_OK, "put_top failed: %08x\n", hres);
879 hres = IHTMLStyle_get_top(style, &v);
880 ok(hres == S_OK, "get_top failed: %08x\n", hres);
881 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
882 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
885 hres = IHTMLStyle_get_posTop(style, &f);
886 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
887 ok(f == 3.0, "expected 3.0 got %f\n", f);
890 hres = IHTMLStyle_put_top(style, v);
891 ok(hres == S_OK, "put_top failed: %08x\n", hres);
894 hres = IHTMLStyle_get_top(style, &v);
895 ok(hres == S_OK, "get_top failed: %08x\n", hres);
896 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
897 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
901 hres = IHTMLStyle_get_posHeight(style, NULL);
902 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
905 hres = IHTMLStyle_get_height(style, &v);
906 ok(hres == S_OK, "get_height failed: %08x\n", hres);
907 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
908 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
912 hres = IHTMLStyle_get_posHeight(style, &f);
913 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
914 ok(f == 0.0, "expected 0.0 got %f\n", f);
916 hres = IHTMLStyle_put_posHeight(style, 4.9f);
917 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
919 hres = IHTMLStyle_get_posHeight(style, &f);
920 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
923 "expected 4.0 or 4.9 (IE8) got %f\n", f);
926 V_BSTR(&v) = a2bstr("70px");
927 hres = IHTMLStyle_put_height(style, v);
928 ok(hres == S_OK, "put_height failed: %08x\n", hres);
932 hres = IHTMLStyle_get_height(style, &v);
933 ok(hres == S_OK, "get_height failed: %08x\n", hres);
934 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
935 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
940 hres = IHTMLStyle_put_height(style, v);
941 ok(hres == S_OK, "put_height failed: %08x\n", hres);
944 hres = IHTMLStyle_get_height(style, &v);
945 ok(hres == S_OK, "get_height failed: %08x\n", hres);
946 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
947 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
950 hres = IHTMLStyle_get_posHeight(style, &f);
951 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
952 ok(f == 64.0, "expected 64.0 got %f\n", f);
954 str = (void*)0xdeadbeef;
955 hres = IHTMLStyle_get_cursor(style, &str);
956 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
957 ok(!str, "get_cursor != NULL\n");
960 str = a2bstr("default");
961 hres = IHTMLStyle_put_cursor(style, str);
962 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
966 hres = IHTMLStyle_get_cursor(style, &str);
967 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
968 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
972 hres = IHTMLStyle_get_verticalAlign(style, &v);
973 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
974 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
975 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
979 V_BSTR(&v) = a2bstr("middle");
980 hres = IHTMLStyle_put_verticalAlign(style, v);
981 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
985 hres = IHTMLStyle_get_verticalAlign(style, &v);
986 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
987 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
988 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
991 str = (void*)0xdeadbeef;
992 hres = IHTMLStyle_get_textAlign(style, &str);
993 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
994 ok(!str, "textAlign != NULL\n");
996 str = a2bstr("center");
997 hres = IHTMLStyle_put_textAlign(style, str);
998 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1002 hres = IHTMLStyle_get_textAlign(style, &str);
1003 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1004 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1007 str = (void*)0xdeadbeef;
1008 hres = IHTMLStyle_get_filter(style, &str);
1009 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1010 ok(!str, "filter != NULL\n");
1012 str = a2bstr("alpha(opacity=100)");
1013 hres = IHTMLStyle_put_filter(style, str);
1014 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1017 V_VT(&v) = VT_EMPTY;
1018 hres = IHTMLStyle_get_zIndex(style, &v);
1019 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1020 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1021 ok(!V_I4(&v), "V_I4(v) != 0\n");
1025 V_BSTR(&v) = a2bstr("1");
1026 hres = IHTMLStyle_put_zIndex(style, v);
1027 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1030 V_VT(&v) = VT_EMPTY;
1031 hres = IHTMLStyle_get_zIndex(style, &v);
1032 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1033 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1034 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1038 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1039 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1041 str = a2bstr("test");
1042 hres = IHTMLStyle_put_fontStyle(style, str);
1043 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1046 str = a2bstr("italic");
1047 hres = IHTMLStyle_put_fontStyle(style, str);
1048 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1051 str = a2bstr("oblique");
1052 hres = IHTMLStyle_put_fontStyle(style, str);
1053 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1056 str = a2bstr("normal");
1057 hres = IHTMLStyle_put_fontStyle(style, str);
1058 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1061 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1062 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1063 SysFreeString(sDefault);
1066 hres = IHTMLStyle_get_overflow(style, NULL);
1067 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1069 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1070 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1072 str = a2bstr("test");
1073 hres = IHTMLStyle_put_overflow(style, str);
1074 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1077 str = a2bstr("visible");
1078 hres = IHTMLStyle_put_overflow(style, str);
1079 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1082 str = a2bstr("scroll");
1083 hres = IHTMLStyle_put_overflow(style, str);
1084 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1087 str = a2bstr("hidden");
1088 hres = IHTMLStyle_put_overflow(style, str);
1089 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1092 str = a2bstr("auto");
1093 hres = IHTMLStyle_put_overflow(style, str);
1094 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1097 hres = IHTMLStyle_get_overflow(style, &str);
1098 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1099 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1103 hres = IHTMLStyle_put_overflow(style, str);
1104 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1107 hres = IHTMLStyle_get_overflow(style, &str);
1108 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1109 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1112 /* restore overflow default */
1113 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1114 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1115 SysFreeString(sOverflowDefault);
1117 /* Attribute Tests*/
1118 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1119 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1121 str = a2bstr("position");
1122 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1123 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1125 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1126 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1127 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1130 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1131 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1134 V_BSTR(&v) = a2bstr("absolute");
1135 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1136 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1139 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1140 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1141 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1142 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1147 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1148 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1153 str = a2bstr("borderLeftStyle");
1154 test_border_styles(style, str);
1157 str = a2bstr("borderbottomstyle");
1158 test_border_styles(style, str);
1161 str = a2bstr("borderrightstyle");
1162 test_border_styles(style, str);
1165 str = a2bstr("bordertopstyle");
1166 test_border_styles(style, str);
1169 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1170 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1172 str = a2bstr("none dotted dashed solid");
1173 hres = IHTMLStyle_put_borderStyle(style, str);
1174 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1177 str = a2bstr("none dotted dashed solid");
1178 hres = IHTMLStyle_get_borderStyle(style, &str);
1179 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1180 ok(!strcmp_wa(str, "none dotted dashed solid"),
1181 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1184 str = a2bstr("double groove ridge inset");
1185 hres = IHTMLStyle_put_borderStyle(style, str);
1186 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1189 str = a2bstr("window-inset outset ridge inset");
1190 hres = IHTMLStyle_put_borderStyle(style, str);
1191 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1194 str = a2bstr("window-inset");
1195 hres = IHTMLStyle_put_borderStyle(style, str);
1196 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1199 str = a2bstr("none none none none none");
1200 hres = IHTMLStyle_put_borderStyle(style, str);
1201 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1204 str = a2bstr("invalid none none none");
1205 hres = IHTMLStyle_put_borderStyle(style, str);
1206 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1209 str = a2bstr("none invalid none none");
1210 hres = IHTMLStyle_put_borderStyle(style, str);
1211 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1214 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1215 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1216 SysFreeString(sDefault);
1218 /* backgoundColor */
1219 hres = IHTMLStyle_get_backgroundColor(style, &v);
1220 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1221 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1222 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1226 hres = IHTMLStyle_get_padding(style, &str);
1227 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1228 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1231 hres = IHTMLStyle_get_paddingTop(style, &v);
1232 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1233 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1234 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1238 hres = IHTMLStyle_put_paddingTop(style, v);
1239 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1241 hres = IHTMLStyle_get_paddingTop(style, &v);
1242 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1243 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1244 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1247 hres = IHTMLStyle_get_paddingRight(style, &v);
1248 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1249 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1250 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1254 hres = IHTMLStyle_put_paddingRight(style, v);
1255 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1257 hres = IHTMLStyle_get_paddingRight(style, &v);
1258 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1259 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1260 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1264 hres = IHTMLStyle_put_padding(style, str);
1265 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1268 hres = IHTMLStyle_get_padding(style, &str);
1269 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1270 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1274 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1275 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1278 V_BSTR(&v) = a2bstr("10");
1279 hres = IHTMLStyle_put_paddingLeft(style, v);
1280 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1283 hres = IHTMLStyle_get_paddingLeft(style, &v);
1284 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1285 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1288 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1289 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1291 /* BackgroundRepeat */
1292 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1293 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1295 str = a2bstr("invalid");
1296 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1297 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1300 str = a2bstr("repeat");
1301 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1302 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1305 str = a2bstr("no-repeat");
1306 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1307 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1310 str = a2bstr("repeat-x");
1311 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1312 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1315 str = a2bstr("repeat-y");
1316 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1317 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1320 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1321 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1322 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1325 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1326 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1327 SysFreeString(sDefault);
1330 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1331 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1333 str = a2bstr("red green red blue");
1334 hres = IHTMLStyle_put_borderColor(style, str);
1335 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1338 hres = IHTMLStyle_get_borderColor(style, &str);
1339 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1340 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1343 hres = IHTMLStyle_put_borderColor(style, sDefault);
1344 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1345 SysFreeString(sDefault);
1348 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1349 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1351 str = a2bstr("thick dotted red");
1352 hres = IHTMLStyle_put_borderRight(style, str);
1353 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1356 /* IHTMLStyle_get_borderRight appears to have a bug where
1357 it returns the first letter of the color. So we check
1358 each style individually.
1361 hres = IHTMLStyle_get_borderRightColor(style, &v);
1362 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1363 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1367 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1368 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1369 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1372 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1373 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1374 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1377 hres = IHTMLStyle_put_borderRight(style, sDefault);
1378 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1379 SysFreeString(sDefault);
1382 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1383 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1385 str = a2bstr("thick dotted red");
1386 hres = IHTMLStyle_put_borderTop(style, str);
1387 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1390 /* IHTMLStyle_get_borderTop appears to have a bug where
1391 it returns the first letter of the color. So we check
1392 each style individually.
1395 hres = IHTMLStyle_get_borderTopColor(style, &v);
1396 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1397 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1401 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1402 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1403 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1406 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1407 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1408 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1411 hres = IHTMLStyle_put_borderTop(style, sDefault);
1412 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1413 SysFreeString(sDefault);
1416 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1417 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1419 str = a2bstr("thick dotted red");
1420 hres = IHTMLStyle_put_borderBottom(style, str);
1421 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1424 /* IHTMLStyle_get_borderBottom appears to have a bug where
1425 it returns the first letter of the color. So we check
1426 each style individually.
1429 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1430 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1431 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1435 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1436 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1437 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1440 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1441 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1442 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1445 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1446 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1447 SysFreeString(sDefault);
1450 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1451 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1453 str = a2bstr("thick dotted red");
1454 hres = IHTMLStyle_put_borderLeft(style, str);
1455 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1458 /* IHTMLStyle_get_borderLeft appears to have a bug where
1459 it returns the first letter of the color. So we check
1460 each style individually.
1463 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1464 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1465 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1469 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1470 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1471 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1474 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1475 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1476 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1479 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1480 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1481 SysFreeString(sDefault);
1483 /* backgroundPositionX */
1484 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1485 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1486 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1487 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1491 V_BSTR(&v) = a2bstr("10px");
1492 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1493 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1496 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1497 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1498 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1499 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1502 /* backgroundPositionY */
1503 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1504 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1505 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1509 V_BSTR(&v) = a2bstr("15px");
1510 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1511 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1514 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1515 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1516 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1517 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1520 /* backgroundPosition */
1522 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1523 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1524 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1527 str = a2bstr("center 20%");
1528 hres = IHTMLStyle_put_backgroundPosition(style, str);
1529 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1533 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1534 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1535 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1538 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1539 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1540 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1541 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1544 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1545 ok(hres == S_OK, "get_backgroundPositionY failed: %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), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1550 /* borderTopWidth */
1551 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1552 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1555 V_BSTR(&v) = a2bstr("10px");
1556 hres = IHTMLStyle_put_borderTopWidth(style, v);
1557 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1560 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1561 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1562 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1565 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1566 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1567 VariantClear(&vDefault);
1569 /* borderRightWidth */
1570 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1571 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1574 V_BSTR(&v) = a2bstr("10");
1575 hres = IHTMLStyle_put_borderRightWidth(style, v);
1576 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1579 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1580 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1581 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1584 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1585 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1586 VariantClear(&vDefault);
1588 /* borderBottomWidth */
1589 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1590 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1593 V_BSTR(&v) = a2bstr("10");
1594 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1595 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1598 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1599 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1600 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1603 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1604 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1605 VariantClear(&vDefault);
1607 /* borderLeftWidth */
1608 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1609 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1612 V_BSTR(&v) = a2bstr("10");
1613 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1614 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1617 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1618 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1619 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1622 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1623 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1624 VariantClear(&vDefault);
1627 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1628 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1631 V_BSTR(&v) = a2bstr("10");
1632 hres = IHTMLStyle_put_wordSpacing(style, v);
1633 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1636 hres = IHTMLStyle_get_wordSpacing(style, &v);
1637 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1638 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1639 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1642 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1643 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1644 VariantClear(&vDefault);
1647 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1648 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1651 V_BSTR(&v) = a2bstr("11");
1652 hres = IHTMLStyle_put_letterSpacing(style, v);
1653 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1656 hres = IHTMLStyle_get_letterSpacing(style, &v);
1657 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1658 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1659 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1662 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1663 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1664 VariantClear(&vDefault);
1666 /* borderTopColor */
1667 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1668 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1671 V_BSTR(&v) = a2bstr("red");
1672 hres = IHTMLStyle_put_borderTopColor(style, v);
1673 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1676 hres = IHTMLStyle_get_borderTopColor(style, &v);
1677 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1678 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1681 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1682 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1684 /* borderRightColor */
1685 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1686 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1689 V_BSTR(&v) = a2bstr("blue");
1690 hres = IHTMLStyle_put_borderRightColor(style, v);
1691 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1694 hres = IHTMLStyle_get_borderRightColor(style, &v);
1695 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1696 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1699 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1700 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1702 /* borderBottomColor */
1703 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1704 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1707 V_BSTR(&v) = a2bstr("cyan");
1708 hres = IHTMLStyle_put_borderBottomColor(style, v);
1709 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1712 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1713 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1714 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1717 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1718 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1720 /* borderLeftColor */
1721 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1722 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1725 V_BSTR(&v) = a2bstr("cyan");
1726 hres = IHTMLStyle_put_borderLeftColor(style, v);
1727 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1730 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1731 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1732 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1735 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1736 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1739 hres = IHTMLStyle_get_clip(style, &str);
1740 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1741 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1743 str = a2bstr("rect(0px 1px 500px 505px)");
1744 hres = IHTMLStyle_put_clip(style, str);
1745 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1748 hres = IHTMLStyle_get_clip(style, &str);
1749 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1750 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1753 /* pageBreakAfter */
1754 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1755 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1756 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1758 str = a2bstr("always");
1759 hres = IHTMLStyle_put_pageBreakAfter(style, str);
1760 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1763 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1764 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1765 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1768 /* pageBreakBefore */
1769 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1770 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1771 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1773 str = a2bstr("always");
1774 hres = IHTMLStyle_put_pageBreakBefore(style, str);
1775 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1778 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1779 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1780 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1783 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1784 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1785 if(SUCCEEDED(hres)) {
1786 test_style2(style2);
1787 IHTMLStyle2_Release(style2);
1790 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1791 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1792 if(SUCCEEDED(hres)) {
1793 test_style3(style3);
1794 IHTMLStyle3_Release(style3);
1797 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1798 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1799 if(SUCCEEDED(hres)) {
1800 test_style4(style4);
1801 IHTMLStyle4_Release(style4);
1805 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1806 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1811 str = (void*)0xdeadbeef;
1812 hres = IHTMLStyle_get_filter(style, &str);
1813 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1815 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1817 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1822 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1823 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
1825 BSTR str = a2bstr(val);
1828 hres = IHTMLStyle_put_filter(style, str);
1829 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
1832 _test_style_filter(line, style, val);
1835 static void test_style_filters(IHTMLElement *elem)
1840 hres = IHTMLElement_get_style(elem, &style);
1841 ok(hres == S_OK, "get_style failed: %08x\n", hres);
1843 test_style_filter(style, NULL);
1844 set_style_filter(style, "alpha(opacity=50.0040)");
1845 set_style_filter(style, "alpha(opacity=100)");
1847 IHTMLStyle_Release(style);
1849 hres = IHTMLElement_get_style(elem, &style);
1850 ok(hres == S_OK, "get_style failed: %08x\n", hres);
1852 test_style_filter(style, "alpha(opacity=100)");
1853 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
1854 set_style_filter(style, NULL);
1856 IHTMLStyle_Release(style);
1859 static void test_current_style(IHTMLCurrentStyle *current_style)
1865 hres = IHTMLCurrentStyle_get_display(current_style, &str);
1866 ok(hres == S_OK, "get_display failed: %08x\n", hres);
1867 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
1870 hres = IHTMLCurrentStyle_get_position(current_style, &str);
1871 ok(hres == S_OK, "get_position failed: %08x\n", hres);
1872 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
1875 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
1876 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
1879 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
1880 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1881 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
1884 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
1885 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
1886 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
1889 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
1890 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
1891 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
1894 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
1895 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1896 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
1899 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
1900 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1901 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
1904 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
1905 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1906 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
1909 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
1910 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1911 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
1914 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
1915 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1916 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
1919 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
1920 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1921 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
1924 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
1925 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1926 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1929 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
1930 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1931 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
1934 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
1935 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1938 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
1939 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1942 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
1943 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
1946 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
1947 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1950 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
1951 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
1954 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
1955 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1958 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
1959 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1962 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
1963 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1964 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
1965 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
1968 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
1969 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1970 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1973 hres = IHTMLCurrentStyle_get_left(current_style, &v);
1974 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1975 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1978 hres = IHTMLCurrentStyle_get_top(current_style, &v);
1979 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1980 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1983 hres = IHTMLCurrentStyle_get_width(current_style, &v);
1984 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1985 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1988 hres = IHTMLCurrentStyle_get_height(current_style, &v);
1989 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1990 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1993 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
1994 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
1995 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1998 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
1999 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2000 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2001 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2004 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2005 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2006 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2007 ok(!strcmp_wa(V_BSTR(&v), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2010 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2011 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2012 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2015 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2016 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2017 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2020 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2021 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2022 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2026 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2027 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2028 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2031 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2032 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2033 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2036 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2037 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2038 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2041 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2042 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2043 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2046 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2047 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2048 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2051 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2052 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2053 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2056 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2057 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2058 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2061 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2062 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2063 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2066 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2067 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2068 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2071 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2072 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2073 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2076 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2077 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2078 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2081 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2082 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2083 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2086 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2087 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2088 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2091 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2092 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2093 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2096 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2097 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2098 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2101 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2102 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2103 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2106 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2107 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2108 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2111 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2112 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2113 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2116 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2117 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2118 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2122 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2124 static void basic_style_test(IHTMLDocument2 *doc)
2126 IHTMLCurrentStyle *cstyle;
2131 hres = IHTMLDocument2_get_body(doc, &elem);
2132 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2134 hres = IHTMLElement_get_style(elem, &style);
2135 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2137 test_body_style(style);
2139 cstyle = get_current_style(elem);
2140 test_current_style(cstyle);
2141 IHTMLCurrentStyle_Release(cstyle);
2142 IHTMLElement_Release(elem);
2144 elem = get_element_by_id(doc, "divid");
2145 test_style_filters(elem);
2147 test_set_csstext(style);
2148 IHTMLStyle_Release(style);
2149 IHTMLElement_Release(elem);
2152 static IHTMLDocument2 *notif_doc;
2153 static BOOL doc_complete;
2155 static IHTMLDocument2 *create_document(void)
2157 IHTMLDocument2 *doc;
2158 IHTMLDocument5 *doc5;
2161 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2162 &IID_IHTMLDocument2, (void**)&doc);
2163 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2167 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2169 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2170 IHTMLDocument2_Release(doc);
2174 IHTMLDocument5_Release(doc5);
2178 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2179 REFIID riid, void**ppv)
2181 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2186 ok(0, "unexpected call\n");
2187 return E_NOINTERFACE;
2190 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2195 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2200 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2202 if(dispID == DISPID_READYSTATE){
2206 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2207 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2209 if(!strcmp_wa(state, "complete"))
2210 doc_complete = TRUE;
2212 SysFreeString(state);
2218 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2220 ok(0, "unexpected call\n");
2224 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2225 PropertyNotifySink_QueryInterface,
2226 PropertyNotifySink_AddRef,
2227 PropertyNotifySink_Release,
2228 PropertyNotifySink_OnChanged,
2229 PropertyNotifySink_OnRequestEdit
2232 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2234 static IHTMLDocument2 *create_doc_with_string(const char *str)
2236 IPersistStreamInit *init;
2238 IHTMLDocument2 *doc;
2242 notif_doc = doc = create_document();
2246 doc_complete = FALSE;
2248 mem = GlobalAlloc(0, len);
2249 memcpy(mem, str, len);
2250 CreateStreamOnHGlobal(mem, TRUE, &stream);
2252 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2254 IPersistStreamInit_Load(init, stream);
2255 IPersistStreamInit_Release(init);
2256 IStream_Release(stream);
2261 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2263 IConnectionPointContainer *container;
2264 IConnectionPoint *cp;
2268 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2269 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2271 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2272 IConnectionPointContainer_Release(container);
2273 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2275 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2276 IConnectionPoint_Release(cp);
2277 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2280 typedef void (*style_test_t)(IHTMLDocument2*);
2282 static void run_test(const char *str, style_test_t test)
2284 IHTMLDocument2 *doc;
2288 doc = create_doc_with_string(str);
2292 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2294 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2295 TranslateMessage(&msg);
2296 DispatchMessage(&msg);
2301 ref = IHTMLDocument2_Release(doc);
2302 ok(!ref || broken(ref == 1), /* Vista */
2311 run_test(basic_test_str, basic_style_test);