2 * Copyright 2007-2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
33 static int strcmp_wa(LPCWSTR strw, const char *stra)
36 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
37 return lstrcmpA(stra, buf);
40 static BSTR a2bstr(const char *str)
48 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
49 ret = SysAllocStringLen(NULL, len);
50 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
55 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
56 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
58 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
60 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
62 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
65 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
66 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
71 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
72 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
76 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
81 BSTR idW = a2bstr(id);
83 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
84 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
86 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
87 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
88 ok(result != NULL, "result == NULL\n");
91 IHTMLDocument3_Release(doc3);
95 #define get_current_style(e) _get_current_style(__LINE__,e)
96 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
98 IHTMLCurrentStyle *cstyle;
102 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
103 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
106 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
107 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
108 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
110 IHTMLElement2_Release(elem2);
114 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
115 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
120 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
121 LOCALE_USER_DEFAULT, &dispid);
122 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
125 DISPPARAMS params = {NULL,NULL,0,0};
126 DISPID dispidNamed = DISPID_PROPERTYPUT;
131 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
132 DISPATCH_PROPERTYGET, ¶ms, &vDefault, NULL, NULL);
133 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
136 params.cNamedArgs = 1;
137 params.rgdispidNamedArgs = &dispidNamed;
138 V_VT(&arg) = VT_BSTR;
139 V_BSTR(&arg) = a2bstr("none");
140 params.rgvarg = &arg;
141 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
142 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
143 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
146 V_VT(&arg) = VT_BSTR;
147 V_BSTR(&arg) = a2bstr("dotted");
148 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
149 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
150 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
153 V_VT(&arg) = VT_BSTR;
154 V_BSTR(&arg) = a2bstr("dashed");
155 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
156 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
157 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
160 V_VT(&arg) = VT_BSTR;
161 V_BSTR(&arg) = a2bstr("solid");
162 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
163 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
164 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
167 V_VT(&arg) = VT_BSTR;
168 V_BSTR(&arg) = a2bstr("double");
169 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
170 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
171 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
174 V_VT(&arg) = VT_BSTR;
175 V_BSTR(&arg) = a2bstr("groove");
176 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
177 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
178 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
181 V_VT(&arg) = VT_BSTR;
182 V_BSTR(&arg) = a2bstr("ridge");
183 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
184 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
185 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
188 V_VT(&arg) = VT_BSTR;
189 V_BSTR(&arg) = a2bstr("inset");
190 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
191 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
192 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
195 V_VT(&arg) = VT_BSTR;
196 V_BSTR(&arg) = a2bstr("outset");
197 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
198 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
199 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
202 V_VT(&arg) = VT_BSTR;
203 V_BSTR(&arg) = a2bstr("invalid");
204 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
205 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
206 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
209 params.rgvarg = &vDefault;
210 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
211 DISPATCH_PROPERTYPUT, ¶ms, &ret, NULL, NULL);
212 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
213 VariantClear(&vDefault);
217 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
218 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
220 BSTR text = (void*)0xdeadbeef;
223 hres = IHTMLStyle_get_cssText(style, &text);
224 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
226 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
228 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
233 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
234 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
240 hres = IHTMLStyle_put_cssText(style, tmp);
241 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
245 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
246 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
248 BSTR str = a2bstr(attr);
249 VARIANT_BOOL b = 100;
252 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
254 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
255 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
258 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
259 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
265 hres = IHTMLStyle_put_textDecoration(style, str);
266 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
270 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
271 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
276 hres = IHTMLStyle_get_textDecoration(style, &str);
277 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
279 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
281 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
285 static void test_set_csstext(IHTMLStyle *style)
290 test_style_set_csstext(style, "background-color: black;");
292 hres = IHTMLStyle_get_backgroundColor(style, &v);
293 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
294 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
295 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
299 static void test_style2(IHTMLStyle2 *style2)
305 str = (void*)0xdeadbeef;
306 hres = IHTMLStyle2_get_position(style2, &str);
307 ok(hres == S_OK, "get_position failed: %08x\n", hres);
308 ok(!str, "str != NULL\n");
310 str = a2bstr("absolute");
311 hres = IHTMLStyle2_put_position(style2, str);
312 ok(hres == S_OK, "put_position failed: %08x\n", hres);
316 hres = IHTMLStyle2_get_position(style2, &str);
317 ok(hres == S_OK, "get_position failed: %08x\n", hres);
318 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
323 hres = IHTMLStyle2_get_right(style2, &v);
324 ok(hres == S_OK, "get_top failed: %08x\n", hres);
325 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
326 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
330 V_BSTR(&v) = a2bstr("3px");
331 hres = IHTMLStyle2_put_right(style2, v);
332 ok(hres == S_OK, "put_right failed: %08x\n", hres);
336 hres = IHTMLStyle2_get_right(style2, &v);
337 ok(hres == S_OK, "get_right 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), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
343 str = (void*)0xdeadbeef;
344 hres = IHTMLStyle2_get_direction(style2, &str);
345 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
346 ok(!str, "str = %s\n", wine_dbgstr_w(str));
349 hres = IHTMLStyle2_put_direction(style2, str);
350 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
354 hres = IHTMLStyle2_get_direction(style2, &str);
355 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
356 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
361 hres = IHTMLStyle2_get_bottom(style2, &v);
362 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
363 test_var_bstr(&v, NULL);
367 hres = IHTMLStyle2_put_bottom(style2, v);
368 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
371 hres = IHTMLStyle2_get_bottom(style2, &v);
372 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
373 test_var_bstr(&v, "4px");
376 str = (void*)0xdeadbeef;
377 hres = IHTMLStyle2_get_overflowX(style2, &str);
378 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
379 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
381 str = a2bstr("hidden");
382 hres = IHTMLStyle2_put_overflowX(style2, str);
383 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
387 hres = IHTMLStyle2_get_overflowX(style2, &str);
388 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
389 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
392 str = (void*)0xdeadbeef;
393 hres = IHTMLStyle2_get_overflowY(style2, &str);
394 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
395 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
397 str = a2bstr("hidden");
398 hres = IHTMLStyle2_put_overflowY(style2, str);
399 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
403 hres = IHTMLStyle2_get_overflowY(style2, &str);
404 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
405 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
408 static void test_style3(IHTMLStyle3 *style3)
413 str = (void*)0xdeadbeef;
414 hres = IHTMLStyle3_get_wordWrap(style3, &str);
415 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
416 ok(!str, "str != NULL\n");
418 str = a2bstr("break-word");
419 hres = IHTMLStyle3_put_wordWrap(style3, str);
420 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
424 hres = IHTMLStyle3_get_wordWrap(style3, &str);
425 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
426 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
430 static void test_style4(IHTMLStyle4 *style4)
436 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
437 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
440 V_BSTR(&v) = a2bstr("10px");
441 hres = IHTMLStyle4_put_minHeight(style4, v);
442 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
445 hres = IHTMLStyle4_get_minHeight(style4, &v);
446 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
447 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
448 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
451 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
452 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
453 VariantClear(&vdefault);
456 static void test_body_style(IHTMLStyle *style)
466 BSTR sOverflowDefault;
470 test_style_csstext(style, NULL);
472 hres = IHTMLStyle_get_position(style, &str);
473 ok(hres == S_OK, "get_position failed: %08x\n", hres);
474 ok(!str, "str=%s\n", wine_dbgstr_w(str));
477 hres = IHTMLStyle_get_marginRight(style, &v);
478 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
479 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
480 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
484 hres = IHTMLStyle_put_marginRight(style, v);
485 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
488 hres = IHTMLStyle_get_marginRight(style, &v);
489 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
490 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
491 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
494 hres = IHTMLStyle_get_marginBottom(style, &v);
495 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
496 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
497 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
501 hres = IHTMLStyle_put_marginBottom(style, v);
502 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
505 hres = IHTMLStyle_get_marginBottom(style, &v);
506 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
507 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
508 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
511 hres = IHTMLStyle_get_marginLeft(style, &v);
512 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
513 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
514 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
518 hres = IHTMLStyle_put_marginLeft(style, v);
519 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
522 hres = IHTMLStyle_get_marginLeft(style, &v);
523 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
524 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
525 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
527 str = (void*)0xdeadbeef;
528 hres = IHTMLStyle_get_fontFamily(style, &str);
529 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
530 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
532 str = (void*)0xdeadbeef;
533 hres = IHTMLStyle_get_fontWeight(style, &str);
534 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
535 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
537 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
538 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
540 str = a2bstr("test");
541 hres = IHTMLStyle_put_fontWeight(style, str);
542 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
545 str = a2bstr("bold");
546 hres = IHTMLStyle_put_fontWeight(style, str);
547 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
550 str = a2bstr("bolder");
551 hres = IHTMLStyle_put_fontWeight(style, str);
552 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
555 str = a2bstr("lighter");
556 hres = IHTMLStyle_put_fontWeight(style, str);
557 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
561 hres = IHTMLStyle_put_fontWeight(style, str);
562 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
566 hres = IHTMLStyle_put_fontWeight(style, str);
567 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
571 hres = IHTMLStyle_put_fontWeight(style, str);
572 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
576 hres = IHTMLStyle_put_fontWeight(style, str);
577 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
581 hres = IHTMLStyle_put_fontWeight(style, str);
582 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
586 hres = IHTMLStyle_put_fontWeight(style, str);
587 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
591 hres = IHTMLStyle_put_fontWeight(style, str);
592 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
596 hres = IHTMLStyle_put_fontWeight(style, str);
597 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
601 hres = IHTMLStyle_put_fontWeight(style, str);
602 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
605 hres = IHTMLStyle_get_fontWeight(style, &str);
606 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
607 ok(!strcmp_wa(str, "900"), "str != style900\n");
610 hres = IHTMLStyle_put_fontWeight(style, sDefault);
611 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
612 SysFreeString(sDefault);
615 hres = IHTMLStyle_get_fontVariant(style, NULL);
616 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
618 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
619 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
621 str = a2bstr("test");
622 hres = IHTMLStyle_put_fontVariant(style, str);
623 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
626 str = a2bstr("small-caps");
627 hres = IHTMLStyle_put_fontVariant(style, str);
628 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
631 str = a2bstr("normal");
632 hres = IHTMLStyle_put_fontVariant(style, str);
633 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
636 hres = IHTMLStyle_put_fontVariant(style, sDefault);
637 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
638 SysFreeString(sDefault);
640 str = (void*)0xdeadbeef;
641 hres = IHTMLStyle_get_display(style, &str);
642 ok(hres == S_OK, "get_display failed: %08x\n", hres);
643 ok(!str, "display = %s\n", wine_dbgstr_w(str));
645 str = (void*)0xdeadbeef;
646 hres = IHTMLStyle_get_visibility(style, &str);
647 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
648 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
651 hres = IHTMLStyle_get_fontSize(style, &v);
652 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
653 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
654 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
658 hres = IHTMLStyle_put_fontSize(style, v);
659 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
662 hres = IHTMLStyle_get_fontSize(style, &v);
663 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
664 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
665 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
668 hres = IHTMLStyle_get_color(style, &v);
669 ok(hres == S_OK, "get_color failed: %08x\n", hres);
670 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
671 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
675 hres = IHTMLStyle_put_color(style, v);
676 ok(hres == S_OK, "put_color failed: %08x\n", hres);
679 hres = IHTMLStyle_get_color(style, &v);
680 ok(hres == S_OK, "get_color failed: %08x\n", hres);
681 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
683 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
686 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
687 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
688 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
690 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
691 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
693 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
694 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
695 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
697 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
698 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
701 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
702 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
703 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
705 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
706 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
708 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
709 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
710 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
712 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
713 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
716 hres = IHTMLStyle_get_textDecorationNone(style, &b);
717 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
718 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
720 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
721 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
723 hres = IHTMLStyle_get_textDecorationNone(style, &b);
724 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
725 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
727 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
728 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
731 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
732 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
733 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
735 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
736 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
738 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
739 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
740 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
742 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
743 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
746 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
747 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
748 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
750 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
751 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
753 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
754 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
755 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
757 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
758 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
760 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
761 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
763 str = a2bstr("invalid");
764 hres = IHTMLStyle_put_textDecoration(style, str);
765 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
768 set_text_decoration(style, "none");
769 test_text_decoration(style, "none");
770 set_text_decoration(style, "underline");
771 set_text_decoration(style, "overline");
772 set_text_decoration(style, "line-through");
773 set_text_decoration(style, "blink");
774 set_text_decoration(style, "overline");
775 set_text_decoration(style, "blink");
776 test_text_decoration(style, "blink");
778 hres = IHTMLStyle_put_textDecoration(style, sDefault);
779 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
780 SysFreeString(sDefault);
782 hres = IHTMLStyle_get_posWidth(style, NULL);
783 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
785 hres = IHTMLStyle_get_posWidth(style, &f);
786 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
787 ok(f == 0.0f, "f = %f\n", f);
790 hres = IHTMLStyle_get_width(style, &v);
791 ok(hres == S_OK, "get_width 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)=%p\n", V_BSTR(&v));
795 hres = IHTMLStyle_put_posWidth(style, 2.2);
796 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
798 hres = IHTMLStyle_get_posWidth(style, &f);
799 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
805 V_BSTR(&v) = a2bstr("auto");
806 hres = IHTMLStyle_put_width(style, v);
807 ok(hres == S_OK, "put_width failed: %08x\n", hres);
811 hres = IHTMLStyle_get_width(style, &v);
812 ok(hres == S_OK, "get_width failed: %08x\n", hres);
813 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
814 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
819 hres = IHTMLStyle_put_width(style, v);
820 ok(hres == S_OK, "put_width failed: %08x\n", hres);
823 hres = IHTMLStyle_get_width(style, &v);
824 ok(hres == S_OK, "get_width failed: %08x\n", hres);
825 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
826 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
830 str = (void*)0xdeadbeef;
831 hres = IHTMLStyle_get_margin(style, &str);
832 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
833 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
836 hres = IHTMLStyle_put_margin(style, str);
837 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
840 hres = IHTMLStyle_get_margin(style, &str);
841 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
842 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
845 hres = IHTMLStyle_put_margin(style, NULL);
846 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
848 str = (void*)0xdeadbeef;
849 hres = IHTMLStyle_get_marginTop(style, &v);
850 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
851 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
852 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
855 V_BSTR(&v) = a2bstr("6px");
856 hres = IHTMLStyle_put_marginTop(style, v);
857 SysFreeString(V_BSTR(&v));
858 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
860 str = (void*)0xdeadbeef;
861 hres = IHTMLStyle_get_marginTop(style, &v);
862 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
863 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
864 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
869 hres = IHTMLStyle_put_marginTop(style, v);
870 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
872 str = (void*)0xdeadbeef;
873 hres = IHTMLStyle_get_marginTop(style, &v);
874 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
875 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
876 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
880 hres = IHTMLStyle_get_border(style, &str);
881 ok(hres == S_OK, "get_border failed: %08x\n", hres);
882 ok(!str || !*str, "str is not empty\n");
886 hres = IHTMLStyle_put_border(style, str);
887 ok(hres == S_OK, "put_border failed: %08x\n", hres);
891 hres = IHTMLStyle_get_left(style, &v);
892 ok(hres == S_OK, "get_left failed: %08x\n", hres);
893 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
894 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
898 hres = IHTMLStyle_get_posLeft(style, NULL);
899 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
902 hres = IHTMLStyle_get_posLeft(style, &f);
903 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
904 ok(f == 0.0, "expected 0.0 got %f\n", f);
906 hres = IHTMLStyle_put_posLeft(style, 4.9f);
907 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
909 hres = IHTMLStyle_get_posLeft(style, &f);
910 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
913 "expected 4.0 or 4.9 (IE8) got %f\n", f);
915 /* Ensure left is updated correctly. */
917 hres = IHTMLStyle_get_left(style, &v);
918 ok(hres == S_OK, "get_left failed: %08x\n", hres);
919 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
920 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
921 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
922 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
927 V_BSTR(&v) = a2bstr("3px");
928 hres = IHTMLStyle_put_left(style, v);
929 ok(hres == S_OK, "put_left failed: %08x\n", hres);
932 hres = IHTMLStyle_get_posLeft(style, &f);
933 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
934 ok(f == 3.0, "expected 3.0 got %f\n", f);
937 hres = IHTMLStyle_get_left(style, &v);
938 ok(hres == S_OK, "get_left failed: %08x\n", hres);
939 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
940 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
944 hres = IHTMLStyle_put_left(style, v);
945 ok(hres == S_OK, "put_left failed: %08x\n", hres);
948 hres = IHTMLStyle_get_left(style, &v);
949 ok(hres == S_OK, "get_left failed: %08x\n", hres);
950 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
951 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
955 hres = IHTMLStyle_get_top(style, &v);
956 ok(hres == S_OK, "get_top failed: %08x\n", hres);
957 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
958 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
962 hres = IHTMLStyle_get_posTop(style, NULL);
963 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
966 hres = IHTMLStyle_get_posTop(style, &f);
967 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
968 ok(f == 0.0, "expected 0.0 got %f\n", f);
970 hres = IHTMLStyle_put_posTop(style, 4.9f);
971 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
973 hres = IHTMLStyle_get_posTop(style, &f);
974 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
977 "expected 4.0 or 4.9 (IE8) got %f\n", f);
980 V_BSTR(&v) = a2bstr("3px");
981 hres = IHTMLStyle_put_top(style, v);
982 ok(hres == S_OK, "put_top failed: %08x\n", hres);
986 hres = IHTMLStyle_get_top(style, &v);
987 ok(hres == S_OK, "get_top failed: %08x\n", hres);
988 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
989 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
992 hres = IHTMLStyle_get_posTop(style, &f);
993 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
994 ok(f == 3.0, "expected 3.0 got %f\n", f);
997 hres = IHTMLStyle_put_top(style, v);
998 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1000 V_VT(&v) = VT_EMPTY;
1001 hres = IHTMLStyle_get_top(style, &v);
1002 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1003 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1004 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1007 /* Test posHeight */
1008 hres = IHTMLStyle_get_posHeight(style, NULL);
1009 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1011 V_VT(&v) = VT_EMPTY;
1012 hres = IHTMLStyle_get_height(style, &v);
1013 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1014 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1015 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1019 hres = IHTMLStyle_get_posHeight(style, &f);
1020 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1021 ok(f == 0.0, "expected 0.0 got %f\n", f);
1023 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1024 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1026 hres = IHTMLStyle_get_posHeight(style, &f);
1027 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1029 f == 4.9f, /* IE8 */
1030 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1033 V_BSTR(&v) = a2bstr("70px");
1034 hres = IHTMLStyle_put_height(style, v);
1035 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1038 V_VT(&v) = VT_EMPTY;
1039 hres = IHTMLStyle_get_height(style, &v);
1040 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1041 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1042 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1047 hres = IHTMLStyle_put_height(style, v);
1048 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1050 V_VT(&v) = VT_EMPTY;
1051 hres = IHTMLStyle_get_height(style, &v);
1052 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1053 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1054 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1057 hres = IHTMLStyle_get_posHeight(style, &f);
1058 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1059 ok(f == 64.0, "expected 64.0 got %f\n", f);
1061 str = (void*)0xdeadbeef;
1062 hres = IHTMLStyle_get_cursor(style, &str);
1063 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1064 ok(!str, "get_cursor != NULL\n");
1067 str = a2bstr("default");
1068 hres = IHTMLStyle_put_cursor(style, str);
1069 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1073 hres = IHTMLStyle_get_cursor(style, &str);
1074 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1075 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1078 V_VT(&v) = VT_EMPTY;
1079 hres = IHTMLStyle_get_verticalAlign(style, &v);
1080 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1081 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1082 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1086 V_BSTR(&v) = a2bstr("middle");
1087 hres = IHTMLStyle_put_verticalAlign(style, v);
1088 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1091 V_VT(&v) = VT_EMPTY;
1092 hres = IHTMLStyle_get_verticalAlign(style, &v);
1093 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1094 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1095 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1100 hres = IHTMLStyle_put_verticalAlign(style, v);
1101 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1104 V_VT(&v) = VT_EMPTY;
1105 hres = IHTMLStyle_get_verticalAlign(style, &v);
1106 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1107 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1108 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1111 str = (void*)0xdeadbeef;
1112 hres = IHTMLStyle_get_textAlign(style, &str);
1113 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1114 ok(!str, "textAlign != NULL\n");
1116 str = a2bstr("center");
1117 hres = IHTMLStyle_put_textAlign(style, str);
1118 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1122 hres = IHTMLStyle_get_textAlign(style, &str);
1123 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1124 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1127 str = (void*)0xdeadbeef;
1128 hres = IHTMLStyle_get_filter(style, &str);
1129 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1130 ok(!str, "filter != NULL\n");
1132 str = a2bstr("alpha(opacity=100)");
1133 hres = IHTMLStyle_put_filter(style, str);
1134 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1137 V_VT(&v) = VT_EMPTY;
1138 hres = IHTMLStyle_get_zIndex(style, &v);
1139 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1140 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1141 ok(!V_I4(&v), "V_I4(v) != 0\n");
1145 V_BSTR(&v) = a2bstr("1");
1146 hres = IHTMLStyle_put_zIndex(style, v);
1147 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1150 V_VT(&v) = VT_EMPTY;
1151 hres = IHTMLStyle_get_zIndex(style, &v);
1152 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1153 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1154 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1158 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1159 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1161 str = a2bstr("test");
1162 hres = IHTMLStyle_put_fontStyle(style, str);
1163 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1166 str = a2bstr("italic");
1167 hres = IHTMLStyle_put_fontStyle(style, str);
1168 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1171 str = a2bstr("oblique");
1172 hres = IHTMLStyle_put_fontStyle(style, str);
1173 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1176 str = a2bstr("normal");
1177 hres = IHTMLStyle_put_fontStyle(style, str);
1178 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1181 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1182 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1183 SysFreeString(sDefault);
1186 hres = IHTMLStyle_get_overflow(style, NULL);
1187 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1189 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1190 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1192 str = a2bstr("test");
1193 hres = IHTMLStyle_put_overflow(style, str);
1194 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1197 str = a2bstr("visible");
1198 hres = IHTMLStyle_put_overflow(style, str);
1199 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1202 str = a2bstr("scroll");
1203 hres = IHTMLStyle_put_overflow(style, str);
1204 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1207 str = a2bstr("hidden");
1208 hres = IHTMLStyle_put_overflow(style, str);
1209 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1212 str = a2bstr("auto");
1213 hres = IHTMLStyle_put_overflow(style, str);
1214 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1217 hres = IHTMLStyle_get_overflow(style, &str);
1218 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1219 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1223 hres = IHTMLStyle_put_overflow(style, str);
1224 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1227 hres = IHTMLStyle_get_overflow(style, &str);
1228 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1229 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1232 /* restore overflow default */
1233 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1234 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1235 SysFreeString(sOverflowDefault);
1237 /* Attribute Tests*/
1238 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1239 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1241 str = a2bstr("position");
1242 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1243 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1245 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1246 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1247 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1250 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1251 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1254 V_BSTR(&v) = a2bstr("absolute");
1255 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1256 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1259 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1260 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1261 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1262 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1267 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1268 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1273 str = a2bstr("borderLeftStyle");
1274 test_border_styles(style, str);
1277 str = a2bstr("borderbottomstyle");
1278 test_border_styles(style, str);
1281 str = a2bstr("borderrightstyle");
1282 test_border_styles(style, str);
1285 str = a2bstr("bordertopstyle");
1286 test_border_styles(style, str);
1289 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1290 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1292 str = a2bstr("none dotted dashed solid");
1293 hres = IHTMLStyle_put_borderStyle(style, str);
1294 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1297 str = a2bstr("none dotted dashed solid");
1298 hres = IHTMLStyle_get_borderStyle(style, &str);
1299 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1300 ok(!strcmp_wa(str, "none dotted dashed solid"),
1301 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1304 str = a2bstr("double groove ridge inset");
1305 hres = IHTMLStyle_put_borderStyle(style, str);
1306 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1309 str = a2bstr("window-inset outset ridge inset");
1310 hres = IHTMLStyle_put_borderStyle(style, str);
1311 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1314 str = a2bstr("window-inset");
1315 hres = IHTMLStyle_put_borderStyle(style, str);
1316 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1319 str = a2bstr("none none none none none");
1320 hres = IHTMLStyle_put_borderStyle(style, str);
1321 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1324 str = a2bstr("invalid none none none");
1325 hres = IHTMLStyle_put_borderStyle(style, str);
1326 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1329 str = a2bstr("none invalid none none");
1330 hres = IHTMLStyle_put_borderStyle(style, str);
1331 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1334 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1335 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1336 SysFreeString(sDefault);
1338 /* backgoundColor */
1339 hres = IHTMLStyle_get_backgroundColor(style, &v);
1340 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1341 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1342 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1346 V_BSTR(&v) = a2bstr("red");
1347 hres = IHTMLStyle_put_backgroundColor(style, v);
1348 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1351 hres = IHTMLStyle_get_backgroundColor(style, &v);
1352 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1353 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1354 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1358 hres = IHTMLStyle_get_padding(style, &str);
1359 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1360 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1363 hres = IHTMLStyle_get_paddingTop(style, &v);
1364 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1365 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1366 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1370 hres = IHTMLStyle_put_paddingTop(style, v);
1371 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1373 hres = IHTMLStyle_get_paddingTop(style, &v);
1374 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1375 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1376 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1379 hres = IHTMLStyle_get_paddingRight(style, &v);
1380 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1381 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1382 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1386 hres = IHTMLStyle_put_paddingRight(style, v);
1387 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1389 hres = IHTMLStyle_get_paddingRight(style, &v);
1390 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1391 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1392 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1395 hres = IHTMLStyle_get_paddingBottom(style, &v);
1396 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1397 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1398 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1402 hres = IHTMLStyle_put_paddingBottom(style, v);
1403 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1405 hres = IHTMLStyle_get_paddingBottom(style, &v);
1406 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1407 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1408 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1412 hres = IHTMLStyle_put_padding(style, str);
1413 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1416 hres = IHTMLStyle_get_padding(style, &str);
1417 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1418 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1422 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1423 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1424 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1425 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1428 V_BSTR(&v) = a2bstr("10");
1429 hres = IHTMLStyle_put_paddingLeft(style, v);
1430 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1433 hres = IHTMLStyle_get_paddingLeft(style, &v);
1434 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1435 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1438 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1439 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1441 /* BackgroundRepeat */
1442 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1443 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1445 str = a2bstr("invalid");
1446 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1447 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1450 str = a2bstr("repeat");
1451 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1452 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1455 str = a2bstr("no-repeat");
1456 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1457 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1460 str = a2bstr("repeat-x");
1461 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1462 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1465 str = a2bstr("repeat-y");
1466 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1467 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1470 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1471 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1472 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1475 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1476 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1477 SysFreeString(sDefault);
1480 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1481 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1483 str = a2bstr("red green red blue");
1484 hres = IHTMLStyle_put_borderColor(style, str);
1485 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1488 hres = IHTMLStyle_get_borderColor(style, &str);
1489 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1490 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1493 hres = IHTMLStyle_put_borderColor(style, sDefault);
1494 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1495 SysFreeString(sDefault);
1498 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1499 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1501 str = a2bstr("thick dotted red");
1502 hres = IHTMLStyle_put_borderRight(style, str);
1503 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1506 /* IHTMLStyle_get_borderRight appears to have a bug where
1507 it returns the first letter of the color. So we check
1508 each style individually.
1511 hres = IHTMLStyle_get_borderRightColor(style, &v);
1512 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1513 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1517 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1518 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1519 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1522 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1523 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1524 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1527 hres = IHTMLStyle_put_borderRight(style, sDefault);
1528 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1529 SysFreeString(sDefault);
1532 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1533 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1535 str = a2bstr("thick dotted red");
1536 hres = IHTMLStyle_put_borderTop(style, str);
1537 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1540 /* IHTMLStyle_get_borderTop appears to have a bug where
1541 it returns the first letter of the color. So we check
1542 each style individually.
1545 hres = IHTMLStyle_get_borderTopColor(style, &v);
1546 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1547 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1551 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1552 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1553 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1556 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1557 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1558 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1561 hres = IHTMLStyle_put_borderTop(style, sDefault);
1562 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1563 SysFreeString(sDefault);
1566 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1567 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1569 str = a2bstr("thick dotted red");
1570 hres = IHTMLStyle_put_borderBottom(style, str);
1571 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1574 /* IHTMLStyle_get_borderBottom appears to have a bug where
1575 it returns the first letter of the color. So we check
1576 each style individually.
1579 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1580 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1581 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1585 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1586 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1587 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1590 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1591 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1592 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1595 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1596 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1597 SysFreeString(sDefault);
1600 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1601 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1603 str = a2bstr("thick dotted red");
1604 hres = IHTMLStyle_put_borderLeft(style, str);
1605 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1608 /* IHTMLStyle_get_borderLeft appears to have a bug where
1609 it returns the first letter of the color. So we check
1610 each style individually.
1613 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1614 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1615 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1619 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1620 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1621 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1624 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1625 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1626 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1629 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1630 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1631 SysFreeString(sDefault);
1633 /* backgroundPositionX */
1634 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1635 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1636 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1637 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1641 V_BSTR(&v) = a2bstr("10px");
1642 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1643 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1646 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1647 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1648 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1649 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1652 /* backgroundPositionY */
1653 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1654 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1655 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1659 V_BSTR(&v) = a2bstr("15px");
1660 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1661 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1664 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1665 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1666 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1667 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1670 /* backgroundPosition */
1672 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1673 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1674 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1677 str = a2bstr("center 20%");
1678 hres = IHTMLStyle_put_backgroundPosition(style, str);
1679 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1683 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1684 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1685 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1688 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1689 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1690 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1691 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1694 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1695 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1696 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1697 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1700 /* borderTopWidth */
1701 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1702 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1705 V_BSTR(&v) = a2bstr("10px");
1706 hres = IHTMLStyle_put_borderTopWidth(style, v);
1707 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1710 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1711 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1712 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1715 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1716 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1717 VariantClear(&vDefault);
1719 /* borderRightWidth */
1720 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1721 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1724 V_BSTR(&v) = a2bstr("10");
1725 hres = IHTMLStyle_put_borderRightWidth(style, v);
1726 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1729 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1730 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1731 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1734 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1735 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1736 VariantClear(&vDefault);
1738 /* borderBottomWidth */
1739 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1740 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1743 V_BSTR(&v) = a2bstr("10");
1744 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1745 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1748 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1749 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1750 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1753 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1754 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1755 VariantClear(&vDefault);
1757 /* borderLeftWidth */
1758 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1759 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1762 V_BSTR(&v) = a2bstr("10");
1763 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1764 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1767 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1768 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1769 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1772 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1773 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1774 VariantClear(&vDefault);
1777 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1778 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1781 V_BSTR(&v) = a2bstr("10");
1782 hres = IHTMLStyle_put_wordSpacing(style, v);
1783 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1786 hres = IHTMLStyle_get_wordSpacing(style, &v);
1787 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1788 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1789 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1792 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1793 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1794 VariantClear(&vDefault);
1797 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1798 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1801 V_BSTR(&v) = a2bstr("11");
1802 hres = IHTMLStyle_put_letterSpacing(style, v);
1803 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1806 hres = IHTMLStyle_get_letterSpacing(style, &v);
1807 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1808 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1809 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1812 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1813 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1814 VariantClear(&vDefault);
1816 /* borderTopColor */
1817 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1818 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1821 V_BSTR(&v) = a2bstr("red");
1822 hres = IHTMLStyle_put_borderTopColor(style, v);
1823 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1826 hres = IHTMLStyle_get_borderTopColor(style, &v);
1827 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1828 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1831 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1832 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1834 /* borderRightColor */
1835 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1836 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1839 V_BSTR(&v) = a2bstr("blue");
1840 hres = IHTMLStyle_put_borderRightColor(style, v);
1841 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1844 hres = IHTMLStyle_get_borderRightColor(style, &v);
1845 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1846 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1849 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1850 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1852 /* borderBottomColor */
1853 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1854 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1857 V_BSTR(&v) = a2bstr("cyan");
1858 hres = IHTMLStyle_put_borderBottomColor(style, v);
1859 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1862 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1863 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1864 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1867 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1868 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1870 /* borderLeftColor */
1871 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1872 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1875 V_BSTR(&v) = a2bstr("cyan");
1876 hres = IHTMLStyle_put_borderLeftColor(style, v);
1877 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1880 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1881 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1882 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1885 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1886 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1889 hres = IHTMLStyle_get_clip(style, &str);
1890 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1891 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1893 str = a2bstr("rect(0px 1px 500px 505px)");
1894 hres = IHTMLStyle_put_clip(style, str);
1895 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1898 hres = IHTMLStyle_get_clip(style, &str);
1899 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1900 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1903 /* pageBreakAfter */
1904 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1905 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1906 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1908 str = a2bstr("always");
1909 hres = IHTMLStyle_put_pageBreakAfter(style, str);
1910 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1913 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1914 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1915 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1918 /* pageBreakBefore */
1919 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1920 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1921 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1923 str = a2bstr("always");
1924 hres = IHTMLStyle_put_pageBreakBefore(style, str);
1925 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1928 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1929 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1930 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1933 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
1934 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
1936 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1937 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1938 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1940 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1941 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1942 if(SUCCEEDED(hres)) {
1943 test_style2(style2);
1944 IHTMLStyle2_Release(style2);
1947 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1948 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1949 if(SUCCEEDED(hres)) {
1950 test_style3(style3);
1951 IHTMLStyle3_Release(style3);
1954 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1955 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1956 if(SUCCEEDED(hres)) {
1957 test_style4(style4);
1958 IHTMLStyle4_Release(style4);
1962 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1963 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1968 str = (void*)0xdeadbeef;
1969 hres = IHTMLStyle_get_filter(style, &str);
1970 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1972 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1974 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1979 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
1980 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
1985 str = (void*)0xdeadbeef;
1986 hres = IHTMLCurrentStyle2_get_filter(style, &str);
1987 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1989 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1991 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1996 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1997 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
1999 BSTR str = a2bstr(val);
2002 hres = IHTMLStyle_put_filter(style, str);
2003 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2006 _test_style_filter(line, style, val);
2009 static void test_style_filters(IHTMLElement *elem)
2011 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2012 IHTMLCurrentStyle2 *current_style2;
2013 IHTMLCurrentStyle *current_style;
2017 hres = IHTMLElement_get_style(elem, &style);
2018 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2020 hres = IHTMLElement2_get_currentStyle(elem2, ¤t_style);
2021 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2023 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle2, (void**)¤t_style2);
2024 IHTMLCurrentStyle_Release(current_style);
2025 ok(hres == S_OK, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres);
2027 test_style_filter(style, NULL);
2028 test_current_style_filter(current_style2, NULL);
2029 set_style_filter(style, "alpha(opacity=50.0040)");
2030 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2031 set_style_filter(style, "alpha(opacity=100)");
2033 IHTMLStyle_Release(style);
2035 hres = IHTMLElement_get_style(elem, &style);
2036 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2038 test_style_filter(style, "alpha(opacity=100)");
2039 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2040 set_style_filter(style, NULL);
2041 set_style_filter(style, "alpha(opacity=100)");
2042 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2043 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2044 test_style_filter(style, NULL);
2047 IHTMLCurrentStyle2_Release(current_style2);
2048 IHTMLStyle_Release(style);
2049 IHTMLElement2_Release(elem2);
2052 static void test_current_style(IHTMLCurrentStyle *current_style)
2058 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2059 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2060 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2063 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2064 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2065 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2068 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2069 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2072 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2073 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2074 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2077 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2078 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2079 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2082 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2083 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2084 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2087 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2088 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2089 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2092 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2093 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2094 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2097 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2098 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2099 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2102 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2103 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2104 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2107 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2108 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2109 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2112 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2113 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2114 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2117 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2118 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2119 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2122 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2123 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2124 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2127 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2128 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2131 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2132 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2135 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2136 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2139 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2140 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2143 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2144 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2147 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2148 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2151 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2152 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2155 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2156 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2157 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2158 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2161 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2162 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2163 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2166 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2167 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2168 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2171 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2172 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2173 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2176 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2177 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2178 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2181 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2182 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2183 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2186 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2187 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2188 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2191 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2192 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2193 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2194 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2197 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2198 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2199 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2200 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2203 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2204 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2205 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2208 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2209 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2210 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2213 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2214 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2215 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2219 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2220 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2221 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2224 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2225 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2226 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2229 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2230 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2231 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2234 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2235 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2236 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2239 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2240 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2241 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2244 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2245 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2246 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2249 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2250 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2251 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2254 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2255 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2256 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2259 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2260 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2261 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2264 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2265 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2266 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2269 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2270 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2271 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2274 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2275 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2276 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2279 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2280 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2281 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2284 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2285 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2286 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2289 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2290 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2291 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2294 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2295 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2296 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2299 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2300 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2301 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2304 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2305 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2306 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2309 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2310 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2311 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2315 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2317 static void basic_style_test(IHTMLDocument2 *doc)
2319 IHTMLCurrentStyle *cstyle;
2324 hres = IHTMLDocument2_get_body(doc, &elem);
2325 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2327 hres = IHTMLElement_get_style(elem, &style);
2328 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2330 test_body_style(style);
2332 cstyle = get_current_style(elem);
2333 test_current_style(cstyle);
2334 IHTMLCurrentStyle_Release(cstyle);
2335 IHTMLElement_Release(elem);
2337 elem = get_element_by_id(doc, "divid");
2338 test_style_filters(elem);
2340 test_set_csstext(style);
2341 IHTMLStyle_Release(style);
2342 IHTMLElement_Release(elem);
2345 static const char runtimestyle_test_str[] =
2346 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2348 static void runtimestyle_test(IHTMLDocument2 *doc)
2350 IHTMLStyle *style, *runtime_style;
2351 IHTMLElement2 *elem2;
2356 hres = IHTMLDocument2_get_body(doc, &elem);
2357 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2359 elem2 = get_elem2_iface((IUnknown*)elem);
2361 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2362 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2364 hres = IHTMLElement_get_style(elem, &style);
2365 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2367 test_text_decoration(style, NULL);
2368 test_text_decoration(runtime_style, NULL);
2369 set_text_decoration(style, "underline");
2370 test_text_decoration(style, "underline");
2372 hres = IHTMLStyle_get_textDecoration(style, &str);
2373 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2374 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2377 set_text_decoration(runtime_style, "blink");
2378 test_text_decoration(runtime_style, "blink");
2380 hres = IHTMLStyle_get_textDecoration(style, &str);
2381 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2383 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2386 IHTMLStyle_Release(runtime_style);
2387 IHTMLStyle_Release(style);
2388 IHTMLElement2_Release(elem2);
2389 IHTMLElement_Release(elem);
2392 static IHTMLDocument2 *notif_doc;
2393 static BOOL doc_complete;
2395 static IHTMLDocument2 *create_document(void)
2397 IHTMLDocument2 *doc;
2398 IHTMLDocument5 *doc5;
2401 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2402 &IID_IHTMLDocument2, (void**)&doc);
2403 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2407 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2409 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2410 IHTMLDocument2_Release(doc);
2414 IHTMLDocument5_Release(doc5);
2418 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2419 REFIID riid, void**ppv)
2421 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2426 ok(0, "unexpected call\n");
2427 return E_NOINTERFACE;
2430 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2435 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2440 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2442 if(dispID == DISPID_READYSTATE){
2446 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2447 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2449 if(!strcmp_wa(state, "complete"))
2450 doc_complete = TRUE;
2452 SysFreeString(state);
2458 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2460 ok(0, "unexpected call\n");
2464 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2465 PropertyNotifySink_QueryInterface,
2466 PropertyNotifySink_AddRef,
2467 PropertyNotifySink_Release,
2468 PropertyNotifySink_OnChanged,
2469 PropertyNotifySink_OnRequestEdit
2472 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2474 static IHTMLDocument2 *create_doc_with_string(const char *str)
2476 IPersistStreamInit *init;
2478 IHTMLDocument2 *doc;
2482 notif_doc = doc = create_document();
2486 doc_complete = FALSE;
2488 mem = GlobalAlloc(0, len);
2489 memcpy(mem, str, len);
2490 CreateStreamOnHGlobal(mem, TRUE, &stream);
2492 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2494 IPersistStreamInit_Load(init, stream);
2495 IPersistStreamInit_Release(init);
2496 IStream_Release(stream);
2501 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2503 IConnectionPointContainer *container;
2504 IConnectionPoint *cp;
2508 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2509 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2511 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2512 IConnectionPointContainer_Release(container);
2513 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2515 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2516 IConnectionPoint_Release(cp);
2517 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2520 typedef void (*style_test_t)(IHTMLDocument2*);
2522 static void run_test(const char *str, style_test_t test)
2524 IHTMLDocument2 *doc;
2528 doc = create_doc_with_string(str);
2532 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2534 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2535 TranslateMessage(&msg);
2536 DispatchMessage(&msg);
2541 ref = IHTMLDocument2_Release(doc);
2542 ok(!ref || broken(ref == 1), /* Vista */
2551 run_test(basic_test_str, basic_style_test);
2552 run_test(runtimestyle_test_str, runtimestyle_test);