oleacc: Added CAccPropServices stub implementation.
[wine/multimedia.git] / dlls / mshtml / tests / style.c
blobd8c86b156710ce0615d23768f15a91a70e1c870c
1 /*
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
19 #define COBJMACROS
20 #define CONST_VTABLE
22 #include <wine/test.h>
23 #include <stdarg.h>
24 #include <stdio.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ole2.h"
29 #include "mshtml.h"
30 #include "mshtmhst.h"
31 #include "docobj.h"
33 static int strcmp_wa(LPCWSTR strw, const char *stra)
35 CHAR buf[512];
36 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
37 return lstrcmpA(stra, buf);
40 static BOOL wstr_contains(const WCHAR *strw, const char *stra)
42 CHAR buf[512];
43 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
44 return strstr(buf, stra) != NULL;
47 static BSTR a2bstr(const char *str)
49 BSTR ret;
50 int len;
52 if(!str)
53 return NULL;
55 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
56 ret = SysAllocStringLen(NULL, len);
57 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
59 return ret;
62 static const WCHAR *strstr_wa(const WCHAR *str, const char *suba)
64 BSTR sub;
65 const WCHAR *ret = NULL;
66 sub = a2bstr(suba);
67 while (*str)
69 const WCHAR *p1 = str, *p2 = sub;
70 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
71 if (!*p2) {ret = str; break;}
72 str++;
74 SysFreeString(sub);
75 return ret;
78 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
79 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
81 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
82 if(expect)
83 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
84 else
85 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
88 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
89 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
91 IHTMLElement2 *elem;
92 HRESULT hres;
94 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
95 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
96 return elem;
99 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
100 static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
102 IHTMLCurrentStyle2 *current_style2;
103 HRESULT hres;
105 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
106 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
107 return current_style2;
110 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
112 HRESULT hres;
113 IHTMLDocument3 *doc3;
114 IHTMLElement *result;
115 BSTR idW = a2bstr(id);
117 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
118 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
120 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
121 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
122 ok(result != NULL, "result == NULL\n");
123 SysFreeString(idW);
125 IHTMLDocument3_Release(doc3);
126 return result;
129 #define get_current_style(e) _get_current_style(__LINE__,e)
130 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
132 IHTMLCurrentStyle *cstyle;
133 IHTMLElement2 *elem2;
134 HRESULT hres;
136 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
137 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
139 cstyle = NULL;
140 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
141 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
142 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
144 IHTMLElement2_Release(elem2);
145 return cstyle;
148 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
149 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
151 HRESULT hres;
152 DISPID dispid;
154 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
155 LOCALE_USER_DEFAULT, &dispid);
156 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
157 if(hres == S_OK)
159 DISPPARAMS params = {NULL,NULL,0,0};
160 DISPID dispidNamed = DISPID_PROPERTYPUT;
161 VARIANT ret;
162 VARIANT vDefault;
163 VARIANTARG arg;
165 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
166 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
167 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
169 params.cArgs = 1;
170 params.cNamedArgs = 1;
171 params.rgdispidNamedArgs = &dispidNamed;
172 V_VT(&arg) = VT_BSTR;
173 V_BSTR(&arg) = a2bstr("none");
174 params.rgvarg = &arg;
175 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
176 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
177 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
178 VariantClear(&arg);
180 V_VT(&arg) = VT_BSTR;
181 V_BSTR(&arg) = a2bstr("dotted");
182 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
183 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
184 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
185 VariantClear(&arg);
187 V_VT(&arg) = VT_BSTR;
188 V_BSTR(&arg) = a2bstr("dashed");
189 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
190 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
191 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
192 VariantClear(&arg);
194 V_VT(&arg) = VT_BSTR;
195 V_BSTR(&arg) = a2bstr("solid");
196 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
197 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
198 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
199 VariantClear(&arg);
201 V_VT(&arg) = VT_BSTR;
202 V_BSTR(&arg) = a2bstr("double");
203 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
204 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
205 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
206 VariantClear(&arg);
208 V_VT(&arg) = VT_BSTR;
209 V_BSTR(&arg) = a2bstr("groove");
210 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
211 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
212 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
213 VariantClear(&arg);
215 V_VT(&arg) = VT_BSTR;
216 V_BSTR(&arg) = a2bstr("ridge");
217 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
218 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
219 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
220 VariantClear(&arg);
222 V_VT(&arg) = VT_BSTR;
223 V_BSTR(&arg) = a2bstr("inset");
224 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
225 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
226 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
227 VariantClear(&arg);
229 V_VT(&arg) = VT_BSTR;
230 V_BSTR(&arg) = a2bstr("outset");
231 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
232 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
233 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
234 VariantClear(&arg);
236 V_VT(&arg) = VT_BSTR;
237 V_BSTR(&arg) = a2bstr("invalid");
238 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
239 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
240 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
241 VariantClear(&arg);
243 params.rgvarg = &vDefault;
244 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
245 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
246 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
247 VariantClear(&vDefault);
251 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
252 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
254 BSTR text = (void*)0xdeadbeef;
255 HRESULT hres;
257 hres = IHTMLStyle_get_cssText(style, &text);
258 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
259 if(extext)
260 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
261 else
262 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
264 SysFreeString(text);
267 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
268 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
270 BSTR tmp;
271 HRESULT hres;
273 tmp = a2bstr(text);
274 hres = IHTMLStyle_put_cssText(style, tmp);
275 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
276 SysFreeString(tmp);
279 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
280 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
282 BSTR str = a2bstr(attr);
283 VARIANT_BOOL b = 100;
284 HRESULT hres;
286 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
287 SysFreeString(str);
288 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
289 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
292 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
293 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
295 BSTR str;
296 HRESULT hres;
298 str = a2bstr(v);
299 hres = IHTMLStyle_put_textDecoration(style, str);
300 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
301 SysFreeString(str);
304 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
305 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
307 BSTR str;
308 HRESULT hres;
310 hres = IHTMLStyle_get_textDecoration(style, &str);
311 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
312 if(exdec)
313 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
314 else
315 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
316 SysFreeString(str);
319 static void test_set_csstext(IHTMLStyle *style)
321 VARIANT v;
322 HRESULT hres;
324 test_style_set_csstext(style, "background-color: black;");
326 hres = IHTMLStyle_get_backgroundColor(style, &v);
327 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
328 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
329 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
330 VariantClear(&v);
333 static void test_style2(IHTMLStyle2 *style2)
335 VARIANT v;
336 BSTR str;
337 HRESULT hres;
339 str = (void*)0xdeadbeef;
340 hres = IHTMLStyle2_get_position(style2, &str);
341 ok(hres == S_OK, "get_position failed: %08x\n", hres);
342 ok(!str, "str != NULL\n");
344 str = a2bstr("absolute");
345 hres = IHTMLStyle2_put_position(style2, str);
346 ok(hres == S_OK, "put_position failed: %08x\n", hres);
347 SysFreeString(str);
349 str = NULL;
350 hres = IHTMLStyle2_get_position(style2, &str);
351 ok(hres == S_OK, "get_position failed: %08x\n", hres);
352 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
353 SysFreeString(str);
355 /* Test right */
356 V_VT(&v) = VT_EMPTY;
357 hres = IHTMLStyle2_get_right(style2, &v);
358 ok(hres == S_OK, "get_top failed: %08x\n", hres);
359 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
360 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
361 VariantClear(&v);
363 V_VT(&v) = VT_BSTR;
364 V_BSTR(&v) = a2bstr("3px");
365 hres = IHTMLStyle2_put_right(style2, v);
366 ok(hres == S_OK, "put_right failed: %08x\n", hres);
367 VariantClear(&v);
369 V_VT(&v) = VT_EMPTY;
370 hres = IHTMLStyle2_get_right(style2, &v);
371 ok(hres == S_OK, "get_right failed: %08x\n", hres);
372 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
373 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
374 VariantClear(&v);
376 /* direction */
377 str = (void*)0xdeadbeef;
378 hres = IHTMLStyle2_get_direction(style2, &str);
379 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
380 ok(!str, "str = %s\n", wine_dbgstr_w(str));
382 str = a2bstr("ltr");
383 hres = IHTMLStyle2_put_direction(style2, str);
384 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
385 SysFreeString(str);
387 str = NULL;
388 hres = IHTMLStyle2_get_direction(style2, &str);
389 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
390 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
391 SysFreeString(str);
393 /* bottom */
394 V_VT(&v) = VT_EMPTY;
395 hres = IHTMLStyle2_get_bottom(style2, &v);
396 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
397 test_var_bstr(&v, NULL);
399 V_VT(&v) = VT_I4;
400 V_I4(&v) = 4;
401 hres = IHTMLStyle2_put_bottom(style2, v);
402 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
404 V_VT(&v) = VT_EMPTY;
405 hres = IHTMLStyle2_get_bottom(style2, &v);
406 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
407 test_var_bstr(&v, "4px");
409 /* overflowX */
410 str = (void*)0xdeadbeef;
411 hres = IHTMLStyle2_get_overflowX(style2, &str);
412 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
413 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
415 str = a2bstr("hidden");
416 hres = IHTMLStyle2_put_overflowX(style2, str);
417 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
418 SysFreeString(str);
420 str = NULL;
421 hres = IHTMLStyle2_get_overflowX(style2, &str);
422 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
423 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
425 /* overflowY */
426 str = (void*)0xdeadbeef;
427 hres = IHTMLStyle2_get_overflowY(style2, &str);
428 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
429 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
431 str = a2bstr("hidden");
432 hres = IHTMLStyle2_put_overflowY(style2, str);
433 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
434 SysFreeString(str);
436 str = NULL;
437 hres = IHTMLStyle2_get_overflowY(style2, &str);
438 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
439 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
441 /* tableLayout */
442 str = a2bstr("fixed");
443 hres = IHTMLStyle2_put_tableLayout(style2, str);
444 ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres);
445 SysFreeString(str);
447 str = (void*)0xdeadbeef;
448 hres = IHTMLStyle2_get_tableLayout(style2, &str);
449 ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres);
450 ok(!strcmp_wa(str, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str));
451 SysFreeString(str);
454 static void test_style3(IHTMLStyle3 *style3)
456 BSTR str;
457 HRESULT hres;
459 str = (void*)0xdeadbeef;
460 hres = IHTMLStyle3_get_wordWrap(style3, &str);
461 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
462 ok(!str, "str != NULL\n");
464 str = a2bstr("break-word");
465 hres = IHTMLStyle3_put_wordWrap(style3, str);
466 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
467 SysFreeString(str);
469 str = NULL;
470 hres = IHTMLStyle3_get_wordWrap(style3, &str);
471 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
472 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
473 SysFreeString(str);
476 static void test_style4(IHTMLStyle4 *style4)
478 HRESULT hres;
479 VARIANT v;
480 VARIANT vdefault;
482 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
483 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
485 V_VT(&v) = VT_BSTR;
486 V_BSTR(&v) = a2bstr("10px");
487 hres = IHTMLStyle4_put_minHeight(style4, v);
488 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
489 VariantClear(&v);
491 hres = IHTMLStyle4_get_minHeight(style4, &v);
492 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
493 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
494 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
495 VariantClear(&v);
497 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
498 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
499 VariantClear(&vdefault);
502 static void test_style5(IHTMLStyle5 *style5)
504 HRESULT hres;
505 VARIANT v;
506 VARIANT vdefault;
508 /* minWidth */
509 hres = IHTMLStyle5_get_minWidth(style5, &vdefault);
510 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
512 V_VT(&v) = VT_BSTR;
513 V_BSTR(&v) = a2bstr("12px");
514 hres = IHTMLStyle5_put_minWidth(style5, v);
515 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
516 VariantClear(&v);
518 hres = IHTMLStyle5_get_minWidth(style5, &v);
519 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
520 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
521 ok(!strcmp_wa(V_BSTR(&v), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
522 VariantClear(&v);
524 V_VT(&v) = VT_BSTR;
525 V_BSTR(&v) = a2bstr("10%");
526 hres = IHTMLStyle5_put_minWidth(style5, v);
527 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
528 VariantClear(&v);
530 hres = IHTMLStyle5_get_minWidth(style5, &v);
531 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
532 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
533 ok(!strcmp_wa(V_BSTR(&v), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
534 VariantClear(&v);
536 V_VT(&v) = VT_BSTR;
537 V_BSTR(&v) = a2bstr("10");
538 hres = IHTMLStyle5_put_minWidth(style5, v);
539 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
540 VariantClear(&v);
542 hres = IHTMLStyle5_get_minWidth(style5, &v);
543 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
544 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
545 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
546 VariantClear(&v);
548 hres = IHTMLStyle5_put_minWidth(style5, vdefault);
549 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
550 VariantClear(&vdefault);
553 static void test_style6(IHTMLStyle6 *style)
555 BSTR str;
556 HRESULT hres;
558 str = (void*)0xdeadbeef;
559 hres = IHTMLStyle6_get_outline(style, &str);
560 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
561 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
562 SysFreeString(str);
564 str = a2bstr("1px");
565 hres = IHTMLStyle6_put_outline(style, str);
566 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
567 SysFreeString(str);
569 str = (void*)0xdeadbeef;
570 hres = IHTMLStyle6_get_outline(style, &str);
571 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
572 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
573 SysFreeString(str);
575 str = (void*)0xdeadbeef;
576 hres = IHTMLStyle6_get_boxSizing(style, &str);
577 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
578 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
579 SysFreeString(str);
581 str = a2bstr("border-box");
582 hres = IHTMLStyle6_put_boxSizing(style, str);
583 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
584 SysFreeString(str);
586 str = NULL;
587 hres = IHTMLStyle6_get_boxSizing(style, &str);
588 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
589 ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
590 SysFreeString(str);
593 static void test_body_style(IHTMLStyle *style)
595 IHTMLStyle2 *style2;
596 IHTMLStyle3 *style3;
597 IHTMLStyle4 *style4;
598 IHTMLStyle5 *style5;
599 IHTMLStyle6 *style6;
600 VARIANT_BOOL b;
601 VARIANT v;
602 BSTR str;
603 HRESULT hres;
604 float f;
605 BSTR sOverflowDefault;
606 BSTR sDefault;
607 LONG l;
608 VARIANT vDefault;
610 test_style_csstext(style, NULL);
612 hres = IHTMLStyle_get_position(style, &str);
613 ok(hres == S_OK, "get_position failed: %08x\n", hres);
614 ok(!str, "str=%s\n", wine_dbgstr_w(str));
616 V_VT(&v) = VT_NULL;
617 hres = IHTMLStyle_get_marginRight(style, &v);
618 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
619 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
620 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
622 V_VT(&v) = VT_I4;
623 V_I4(&v) = 6;
624 hres = IHTMLStyle_put_marginRight(style, v);
625 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
627 V_VT(&v) = VT_NULL;
628 hres = IHTMLStyle_get_marginRight(style, &v);
629 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
630 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
631 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
633 V_VT(&v) = VT_NULL;
634 hres = IHTMLStyle_get_marginBottom(style, &v);
635 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
636 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
637 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
639 V_VT(&v) = VT_I4;
640 V_I4(&v) = 6;
641 hres = IHTMLStyle_put_marginBottom(style, v);
642 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
644 V_VT(&v) = VT_NULL;
645 hres = IHTMLStyle_get_marginBottom(style, &v);
646 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
647 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
648 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
650 V_VT(&v) = VT_NULL;
651 hres = IHTMLStyle_get_marginLeft(style, &v);
652 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
653 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
654 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
656 V_VT(&v) = VT_I4;
657 V_I4(&v) = 6;
658 hres = IHTMLStyle_put_marginLeft(style, v);
659 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
661 V_VT(&v) = VT_NULL;
662 hres = IHTMLStyle_get_marginLeft(style, &v);
663 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
664 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
665 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
667 str = (void*)0xdeadbeef;
668 hres = IHTMLStyle_get_fontFamily(style, &str);
669 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
670 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
672 str = (void*)0xdeadbeef;
673 hres = IHTMLStyle_get_fontWeight(style, &str);
674 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
675 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
677 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
678 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
680 str = a2bstr("test");
681 hres = IHTMLStyle_put_fontWeight(style, str);
682 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
683 SysFreeString(str);
685 str = a2bstr("bold");
686 hres = IHTMLStyle_put_fontWeight(style, str);
687 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
688 SysFreeString(str);
690 str = a2bstr("bolder");
691 hres = IHTMLStyle_put_fontWeight(style, str);
692 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
693 SysFreeString(str);
695 str = a2bstr("lighter");
696 hres = IHTMLStyle_put_fontWeight(style, str);
697 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
698 SysFreeString(str);
700 str = a2bstr("100");
701 hres = IHTMLStyle_put_fontWeight(style, str);
702 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
703 SysFreeString(str);
705 str = a2bstr("200");
706 hres = IHTMLStyle_put_fontWeight(style, str);
707 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
708 SysFreeString(str);
710 str = a2bstr("300");
711 hres = IHTMLStyle_put_fontWeight(style, str);
712 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
713 SysFreeString(str);
715 str = a2bstr("400");
716 hres = IHTMLStyle_put_fontWeight(style, str);
717 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
718 SysFreeString(str);
720 str = a2bstr("500");
721 hres = IHTMLStyle_put_fontWeight(style, str);
722 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
723 SysFreeString(str);
725 str = a2bstr("600");
726 hres = IHTMLStyle_put_fontWeight(style, str);
727 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
728 SysFreeString(str);
730 str = a2bstr("700");
731 hres = IHTMLStyle_put_fontWeight(style, str);
732 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
733 SysFreeString(str);
735 str = a2bstr("800");
736 hres = IHTMLStyle_put_fontWeight(style, str);
737 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
738 SysFreeString(str);
740 str = a2bstr("900");
741 hres = IHTMLStyle_put_fontWeight(style, str);
742 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
743 SysFreeString(str);
745 hres = IHTMLStyle_get_fontWeight(style, &str);
746 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
747 ok(!strcmp_wa(str, "900"), "str != style900\n");
748 SysFreeString(str);
750 hres = IHTMLStyle_put_fontWeight(style, sDefault);
751 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
752 SysFreeString(sDefault);
754 /* font Variant */
755 hres = IHTMLStyle_get_fontVariant(style, NULL);
756 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
758 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
759 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
761 str = a2bstr("test");
762 hres = IHTMLStyle_put_fontVariant(style, str);
763 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
764 SysFreeString(str);
766 str = a2bstr("small-caps");
767 hres = IHTMLStyle_put_fontVariant(style, str);
768 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
769 SysFreeString(str);
771 str = a2bstr("normal");
772 hres = IHTMLStyle_put_fontVariant(style, str);
773 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
774 SysFreeString(str);
776 hres = IHTMLStyle_put_fontVariant(style, sDefault);
777 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
778 SysFreeString(sDefault);
780 str = (void*)0xdeadbeef;
781 hres = IHTMLStyle_get_display(style, &str);
782 ok(hres == S_OK, "get_display failed: %08x\n", hres);
783 ok(!str, "display = %s\n", wine_dbgstr_w(str));
785 str = (void*)0xdeadbeef;
786 hres = IHTMLStyle_get_visibility(style, &str);
787 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
788 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
790 V_VT(&v) = VT_NULL;
791 hres = IHTMLStyle_get_fontSize(style, &v);
792 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
793 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
794 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
796 V_VT(&v) = VT_I4;
797 V_I4(&v) = 12;
798 hres = IHTMLStyle_put_fontSize(style, v);
799 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
801 V_VT(&v) = VT_NULL;
802 hres = IHTMLStyle_get_fontSize(style, &v);
803 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
804 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
805 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
807 V_VT(&v) = VT_NULL;
808 hres = IHTMLStyle_get_color(style, &v);
809 ok(hres == S_OK, "get_color failed: %08x\n", hres);
810 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
811 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
813 V_VT(&v) = VT_I4;
814 V_I4(&v) = 0xfdfd;
815 hres = IHTMLStyle_put_color(style, v);
816 ok(hres == S_OK, "put_color failed: %08x\n", hres);
818 V_VT(&v) = VT_NULL;
819 hres = IHTMLStyle_get_color(style, &v);
820 ok(hres == S_OK, "get_color failed: %08x\n", hres);
821 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
822 todo_wine
823 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
825 V_VT(&v) = VT_I4;
826 V_I4(&v) = 3;
827 hres = IHTMLStyle_put_lineHeight(style, v);
828 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
830 hres = IHTMLStyle_get_lineHeight(style, &v);
831 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
832 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
833 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
835 V_VT(&v) = VT_BSTR;
836 V_BSTR(&v) = a2bstr("300%");
837 hres = IHTMLStyle_put_lineHeight(style, v);
838 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
839 VariantClear(&v);
841 hres = IHTMLStyle_get_lineHeight(style, &v);
842 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
843 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
844 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
845 VariantClear(&v);
847 b = 0xfefe;
848 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
849 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
850 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
852 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
853 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
855 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
856 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
857 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
859 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
860 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
862 b = 0xfefe;
863 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
864 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
865 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
867 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
868 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
870 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
871 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
872 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
874 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
875 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
877 b = 0xfefe;
878 hres = IHTMLStyle_get_textDecorationNone(style, &b);
879 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
880 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
882 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
883 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
885 hres = IHTMLStyle_get_textDecorationNone(style, &b);
886 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
887 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
889 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
890 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
892 b = 0xfefe;
893 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
894 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
895 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
897 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
898 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
900 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
901 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
902 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
904 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
905 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
907 b = 0xfefe;
908 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
909 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
910 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
912 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
913 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
915 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
916 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
917 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
919 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
920 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
922 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
923 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
925 str = a2bstr("invalid");
926 hres = IHTMLStyle_put_textDecoration(style, str);
927 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
928 SysFreeString(str);
930 set_text_decoration(style, "none");
931 test_text_decoration(style, "none");
932 set_text_decoration(style, "underline");
933 set_text_decoration(style, "overline");
934 set_text_decoration(style, "line-through");
935 set_text_decoration(style, "blink");
936 set_text_decoration(style, "overline");
937 set_text_decoration(style, "blink");
938 test_text_decoration(style, "blink");
940 hres = IHTMLStyle_put_textDecoration(style, sDefault);
941 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
942 SysFreeString(sDefault);
944 hres = IHTMLStyle_get_posWidth(style, NULL);
945 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
947 hres = IHTMLStyle_get_posWidth(style, &f);
948 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
949 ok(f == 0.0f, "f = %f\n", f);
951 V_VT(&v) = VT_EMPTY;
952 hres = IHTMLStyle_get_width(style, &v);
953 ok(hres == S_OK, "get_width failed: %08x\n", hres);
954 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
955 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
957 hres = IHTMLStyle_put_posWidth(style, 2.2);
958 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
960 hres = IHTMLStyle_get_posWidth(style, &f);
961 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
962 ok(f == 2.0f ||
963 f == 2.2f, /* IE8 */
964 "f = %f\n", f);
966 l = 0xdeadbeef;
967 hres = IHTMLStyle_get_pixelWidth(style, &l);
968 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
969 ok(l == 2, "pixelWidth = %d\n", l);
971 V_VT(&v) = VT_BSTR;
972 V_BSTR(&v) = a2bstr("auto");
973 hres = IHTMLStyle_put_width(style, v);
974 ok(hres == S_OK, "put_width failed: %08x\n", hres);
975 VariantClear(&v);
977 V_VT(&v) = VT_EMPTY;
978 hres = IHTMLStyle_get_width(style, &v);
979 ok(hres == S_OK, "get_width failed: %08x\n", hres);
980 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
981 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
982 VariantClear(&v);
984 V_VT(&v) = VT_I4;
985 V_I4(&v) = 100;
986 hres = IHTMLStyle_put_width(style, v);
987 ok(hres == S_OK, "put_width failed: %08x\n", hres);
989 l = 0xdeadbeef;
990 hres = IHTMLStyle_get_pixelWidth(style, &l);
991 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
992 ok(l == 100, "pixelWidth = %d\n", l);
994 V_VT(&v) = VT_EMPTY;
995 hres = IHTMLStyle_get_width(style, &v);
996 ok(hres == S_OK, "get_width failed: %08x\n", hres);
997 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
998 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
999 VariantClear(&v);
1001 hres = IHTMLStyle_put_pixelWidth(style, 50);
1002 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1004 l = 0xdeadbeef;
1005 hres = IHTMLStyle_get_pixelWidth(style, &l);
1006 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1007 ok(l == 50, "pixelWidth = %d\n", l);
1009 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1010 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1012 V_VT(&v) = VT_EMPTY;
1013 hres = IHTMLStyle_get_width(style, &v);
1014 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1015 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1016 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1017 VariantClear(&v);
1019 /* margin tests */
1020 str = (void*)0xdeadbeef;
1021 hres = IHTMLStyle_get_margin(style, &str);
1022 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1023 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1025 str = a2bstr("1");
1026 hres = IHTMLStyle_put_margin(style, str);
1027 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1028 SysFreeString(str);
1030 hres = IHTMLStyle_get_margin(style, &str);
1031 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1032 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
1033 SysFreeString(str);
1035 hres = IHTMLStyle_put_margin(style, NULL);
1036 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1038 str = (void*)0xdeadbeef;
1039 hres = IHTMLStyle_get_marginTop(style, &v);
1040 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1041 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1042 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1044 V_VT(&v) = VT_BSTR;
1045 V_BSTR(&v) = a2bstr("6px");
1046 hres = IHTMLStyle_put_marginTop(style, v);
1047 SysFreeString(V_BSTR(&v));
1048 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1050 str = (void*)0xdeadbeef;
1051 hres = IHTMLStyle_get_marginTop(style, &v);
1052 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1053 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1054 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1055 VariantClear(&v);
1057 V_VT(&v) = VT_I4;
1058 V_I4(&v) = 5;
1059 hres = IHTMLStyle_put_marginTop(style, v);
1060 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1062 str = (void*)0xdeadbeef;
1063 hres = IHTMLStyle_get_marginTop(style, &v);
1064 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1065 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1066 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1067 VariantClear(&v);
1069 str = NULL;
1070 hres = IHTMLStyle_get_border(style, &str);
1071 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1072 ok(!str || !*str, "str is not empty\n");
1073 SysFreeString(str);
1075 str = a2bstr("1px");
1076 hres = IHTMLStyle_put_border(style, str);
1077 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1078 SysFreeString(str);
1080 V_VT(&v) = VT_EMPTY;
1081 hres = IHTMLStyle_get_left(style, &v);
1082 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1083 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1084 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1085 VariantClear(&v);
1087 l = 0xdeadbeef;
1088 hres = IHTMLStyle_get_pixelLeft(style, &l);
1089 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1090 ok(!l, "pixelLeft = %d\n", l);
1092 /* Test posLeft */
1093 hres = IHTMLStyle_get_posLeft(style, NULL);
1094 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1096 f = 1.0f;
1097 hres = IHTMLStyle_get_posLeft(style, &f);
1098 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1099 ok(f == 0.0, "expected 0.0 got %f\n", f);
1101 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1102 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1104 hres = IHTMLStyle_get_posLeft(style, &f);
1105 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1106 ok(f == 4.0 ||
1107 f == 4.9f, /* IE8 */
1108 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1110 /* Ensure left is updated correctly. */
1111 V_VT(&v) = VT_EMPTY;
1112 hres = IHTMLStyle_get_left(style, &v);
1113 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1114 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1115 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1116 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1117 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1118 VariantClear(&v);
1120 /* Test left */
1121 V_VT(&v) = VT_BSTR;
1122 V_BSTR(&v) = a2bstr("3px");
1123 hres = IHTMLStyle_put_left(style, v);
1124 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1125 VariantClear(&v);
1127 hres = IHTMLStyle_get_posLeft(style, &f);
1128 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1129 ok(f == 3.0, "expected 3.0 got %f\n", f);
1131 l = 0xdeadbeef;
1132 hres = IHTMLStyle_get_pixelLeft(style, &l);
1133 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1134 ok(l == 3, "pixelLeft = %d\n", l);
1136 V_VT(&v) = VT_EMPTY;
1137 hres = IHTMLStyle_get_left(style, &v);
1138 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1139 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1140 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1141 VariantClear(&v);
1143 V_VT(&v) = VT_BSTR;
1144 V_BSTR(&v) = a2bstr("4.99");
1145 hres = IHTMLStyle_put_left(style, v);
1146 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1147 VariantClear(&v);
1149 l = 0xdeadbeef;
1150 hres = IHTMLStyle_get_pixelLeft(style, &l);
1151 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1152 ok(l == 4, "pixelLeft = %d\n", l);
1154 V_VT(&v) = VT_NULL;
1155 hres = IHTMLStyle_put_left(style, v);
1156 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1158 V_VT(&v) = VT_EMPTY;
1159 hres = IHTMLStyle_get_left(style, &v);
1160 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1161 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1162 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1163 VariantClear(&v);
1165 V_VT(&v) = VT_EMPTY;
1166 hres = IHTMLStyle_get_top(style, &v);
1167 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1168 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1169 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1170 VariantClear(&v);
1172 l = 0xdeadbeef;
1173 hres = IHTMLStyle_get_pixelLeft(style, &l);
1174 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1175 ok(!l, "pixelLeft = %d\n", l);
1177 hres = IHTMLStyle_put_pixelLeft(style, 6);
1178 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1180 l = 0xdeadbeef;
1181 hres = IHTMLStyle_get_pixelLeft(style, &l);
1182 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1183 ok(l == 6, "pixelLeft = %d\n", l);
1185 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1186 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
1188 V_VT(&v) = VT_EMPTY;
1189 hres = IHTMLStyle_get_left(style, &v);
1190 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1191 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1192 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1193 VariantClear(&v);
1195 /* Test posTop */
1196 hres = IHTMLStyle_get_posTop(style, NULL);
1197 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1199 f = 1.0f;
1200 hres = IHTMLStyle_get_posTop(style, &f);
1201 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1202 ok(f == 0.0, "expected 0.0 got %f\n", f);
1204 hres = IHTMLStyle_put_posTop(style, 4.9f);
1205 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1207 hres = IHTMLStyle_get_posTop(style, &f);
1208 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1209 ok(f == 4.0 ||
1210 f == 4.9f, /* IE8 */
1211 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1213 hres = IHTMLStyle_put_pixelTop(style, 6);
1214 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1216 l = 0xdeadbeef;
1217 hres = IHTMLStyle_get_pixelTop(style, &l);
1218 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1219 ok(l == 6, "pixelTop = %d\n", l);
1221 hres = IHTMLStyle_get_pixelTop(style, NULL);
1222 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1224 V_VT(&v) = VT_BSTR;
1225 V_BSTR(&v) = a2bstr("3px");
1226 hres = IHTMLStyle_put_top(style, v);
1227 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1228 VariantClear(&v);
1230 V_VT(&v) = VT_EMPTY;
1231 hres = IHTMLStyle_get_top(style, &v);
1232 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1233 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1234 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1235 VariantClear(&v);
1237 hres = IHTMLStyle_get_posTop(style, &f);
1238 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1239 ok(f == 3.0, "expected 3.0 got %f\n", f);
1241 l = 0xdeadbeef;
1242 hres = IHTMLStyle_get_pixelTop(style, &l);
1243 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1244 ok(l == 3, "pixelTop = %d\n", l);
1246 V_VT(&v) = VT_NULL;
1247 hres = IHTMLStyle_put_top(style, v);
1248 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1250 V_VT(&v) = VT_EMPTY;
1251 hres = IHTMLStyle_get_top(style, &v);
1252 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1253 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1254 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1255 VariantClear(&v);
1257 l = 0xdeadbeef;
1258 hres = IHTMLStyle_get_pixelTop(style, &l);
1259 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1260 ok(!l, "pixelTop = %d\n", l);
1262 /* Test posHeight */
1263 hres = IHTMLStyle_get_posHeight(style, NULL);
1264 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1266 V_VT(&v) = VT_EMPTY;
1267 hres = IHTMLStyle_get_height(style, &v);
1268 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1269 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1270 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1271 VariantClear(&v);
1273 f = 1.0f;
1274 hres = IHTMLStyle_get_posHeight(style, &f);
1275 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1276 ok(f == 0.0, "expected 0.0 got %f\n", f);
1278 l = 0xdeadbeef;
1279 hres = IHTMLStyle_get_pixelHeight(style, &l);
1280 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1281 ok(!l, "pixelHeight = %d\n", l);
1283 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1284 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1286 hres = IHTMLStyle_get_posHeight(style, &f);
1287 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1288 ok(f == 4.0 ||
1289 f == 4.9f, /* IE8 */
1290 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1292 l = 0xdeadbeef;
1293 hres = IHTMLStyle_get_pixelHeight(style, &l);
1294 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1295 ok(l == 4 ||
1296 l == 5, /* IE8 */
1297 "pixelHeight = %d\n", l);
1299 V_VT(&v) = VT_BSTR;
1300 V_BSTR(&v) = a2bstr("70px");
1301 hres = IHTMLStyle_put_height(style, v);
1302 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1303 VariantClear(&v);
1305 V_VT(&v) = VT_EMPTY;
1306 hres = IHTMLStyle_get_height(style, &v);
1307 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1308 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1309 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1310 VariantClear(&v);
1312 l = 0xdeadbeef;
1313 hres = IHTMLStyle_get_pixelHeight(style, &l);
1314 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1315 ok(l == 70, "pixelHeight = %d\n", l);
1317 V_VT(&v) = VT_BSTR;
1318 V_BSTR(&v) = NULL;
1319 hres = IHTMLStyle_put_height(style, v);
1320 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1321 VariantClear(&v);
1323 V_VT(&v) = VT_EMPTY;
1324 hres = IHTMLStyle_get_height(style, &v);
1325 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1326 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1327 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1328 VariantClear(&v);
1330 l = 0xdeadbeef;
1331 hres = IHTMLStyle_get_pixelHeight(style, &l);
1332 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1333 ok(!l, "pixelHeight = %d\n", l);
1335 hres = IHTMLStyle_put_pixelHeight(style, 50);
1336 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
1338 l = 0xdeadbeef;
1339 hres = IHTMLStyle_get_pixelHeight(style, &l);
1340 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1341 ok(l == 50, "pixelHeight = %d\n", l);
1343 hres = IHTMLStyle_get_pixelHeight(style, NULL);
1344 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
1346 V_VT(&v) = VT_I4;
1347 V_I4(&v) = 64;
1348 hres = IHTMLStyle_put_height(style, v);
1349 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1351 V_VT(&v) = VT_EMPTY;
1352 hres = IHTMLStyle_get_height(style, &v);
1353 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1354 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1355 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1356 VariantClear(&v);
1358 hres = IHTMLStyle_get_posHeight(style, &f);
1359 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1360 ok(f == 64.0, "expected 64.0 got %f\n", f);
1362 l = 0xdeadbeef;
1363 hres = IHTMLStyle_get_pixelHeight(style, &l);
1364 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1365 ok(l == 64, "pixelHeight = %d\n", l);
1367 str = (void*)0xdeadbeef;
1368 hres = IHTMLStyle_get_cursor(style, &str);
1369 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1370 ok(!str, "get_cursor != NULL\n");
1371 SysFreeString(str);
1373 str = a2bstr("default");
1374 hres = IHTMLStyle_put_cursor(style, str);
1375 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1376 SysFreeString(str);
1378 str = NULL;
1379 hres = IHTMLStyle_get_cursor(style, &str);
1380 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1381 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1382 SysFreeString(str);
1384 V_VT(&v) = VT_EMPTY;
1385 hres = IHTMLStyle_get_verticalAlign(style, &v);
1386 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1387 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1388 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1389 VariantClear(&v);
1391 V_VT(&v) = VT_BSTR;
1392 V_BSTR(&v) = a2bstr("middle");
1393 hres = IHTMLStyle_put_verticalAlign(style, v);
1394 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1395 VariantClear(&v);
1397 V_VT(&v) = VT_EMPTY;
1398 hres = IHTMLStyle_get_verticalAlign(style, &v);
1399 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1400 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1401 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1402 VariantClear(&v);
1404 V_VT(&v) = VT_I4;
1405 V_I4(&v) = 100;
1406 hres = IHTMLStyle_put_verticalAlign(style, v);
1407 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1408 VariantClear(&v);
1410 V_VT(&v) = VT_EMPTY;
1411 hres = IHTMLStyle_get_verticalAlign(style, &v);
1412 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1413 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1414 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1415 VariantClear(&v);
1417 str = (void*)0xdeadbeef;
1418 hres = IHTMLStyle_get_textAlign(style, &str);
1419 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1420 ok(!str, "textAlign != NULL\n");
1422 str = a2bstr("center");
1423 hres = IHTMLStyle_put_textAlign(style, str);
1424 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1425 SysFreeString(str);
1427 str = NULL;
1428 hres = IHTMLStyle_get_textAlign(style, &str);
1429 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1430 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1431 SysFreeString(str);
1433 V_VT(&v) = VT_NULL;
1434 hres = IHTMLStyle_get_textIndent(style, &v);
1435 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1436 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1437 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1439 V_VT(&v) = VT_I4;
1440 V_I4(&v) = 6;
1441 hres = IHTMLStyle_put_textIndent(style, v);
1442 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1444 V_VT(&v) = VT_NULL;
1445 hres = IHTMLStyle_get_textIndent(style, &v);
1446 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1447 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1448 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1450 str = (void*)0xdeadbeef;
1451 hres = IHTMLStyle_get_textTransform(style, &str);
1452 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1453 ok(!str, "textTransform != NULL\n");
1455 str = a2bstr("lowercase");
1456 hres = IHTMLStyle_put_textTransform(style, str);
1457 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1458 SysFreeString(str);
1460 str = NULL;
1461 hres = IHTMLStyle_get_textTransform(style, &str);
1462 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1463 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1464 SysFreeString(str);
1466 str = (void*)0xdeadbeef;
1467 hres = IHTMLStyle_get_filter(style, &str);
1468 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1469 ok(!str, "filter != NULL\n");
1471 str = a2bstr("alpha(opacity=100)");
1472 hres = IHTMLStyle_put_filter(style, str);
1473 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1474 SysFreeString(str);
1476 V_VT(&v) = VT_EMPTY;
1477 hres = IHTMLStyle_get_zIndex(style, &v);
1478 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1479 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1480 ok(!V_I4(&v), "V_I4(v) != 0\n");
1481 VariantClear(&v);
1483 V_VT(&v) = VT_BSTR;
1484 V_BSTR(&v) = a2bstr("1");
1485 hres = IHTMLStyle_put_zIndex(style, v);
1486 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1487 VariantClear(&v);
1489 V_VT(&v) = VT_EMPTY;
1490 hres = IHTMLStyle_get_zIndex(style, &v);
1491 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1492 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1493 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1494 VariantClear(&v);
1496 /* fontStyle */
1497 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1498 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1500 str = a2bstr("test");
1501 hres = IHTMLStyle_put_fontStyle(style, str);
1502 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1503 SysFreeString(str);
1505 str = a2bstr("italic");
1506 hres = IHTMLStyle_put_fontStyle(style, str);
1507 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1508 SysFreeString(str);
1510 str = a2bstr("oblique");
1511 hres = IHTMLStyle_put_fontStyle(style, str);
1512 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1513 SysFreeString(str);
1515 str = a2bstr("normal");
1516 hres = IHTMLStyle_put_fontStyle(style, str);
1517 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1518 SysFreeString(str);
1520 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1521 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1522 SysFreeString(sDefault);
1524 /* overflow */
1525 hres = IHTMLStyle_get_overflow(style, NULL);
1526 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1528 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1529 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1531 str = a2bstr("test");
1532 hres = IHTMLStyle_put_overflow(style, str);
1533 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1534 SysFreeString(str);
1536 str = a2bstr("visible");
1537 hres = IHTMLStyle_put_overflow(style, str);
1538 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1539 SysFreeString(str);
1541 str = a2bstr("scroll");
1542 hres = IHTMLStyle_put_overflow(style, str);
1543 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1544 SysFreeString(str);
1546 str = a2bstr("hidden");
1547 hres = IHTMLStyle_put_overflow(style, str);
1548 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1549 SysFreeString(str);
1551 str = a2bstr("auto");
1552 hres = IHTMLStyle_put_overflow(style, str);
1553 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1554 SysFreeString(str);
1556 hres = IHTMLStyle_get_overflow(style, &str);
1557 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1558 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1559 SysFreeString(str);
1561 str = a2bstr("");
1562 hres = IHTMLStyle_put_overflow(style, str);
1563 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1564 SysFreeString(str);
1566 hres = IHTMLStyle_get_overflow(style, &str);
1567 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1568 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1569 SysFreeString(str);
1571 /* restore overflow default */
1572 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1573 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1574 SysFreeString(sOverflowDefault);
1576 /* Attribute Tests*/
1577 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1578 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1580 str = a2bstr("position");
1581 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1582 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1584 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1585 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1586 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1587 VariantClear(&v);
1589 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1590 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1592 V_VT(&v) = VT_BSTR;
1593 V_BSTR(&v) = a2bstr("absolute");
1594 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1595 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1596 VariantClear(&v);
1598 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1599 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1600 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1601 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1602 VariantClear(&v);
1604 V_VT(&v) = VT_BSTR;
1605 V_BSTR(&v) = NULL;
1606 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1607 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1608 VariantClear(&v);
1610 SysFreeString(str);
1612 str = a2bstr("borderLeftStyle");
1613 test_border_styles(style, str);
1614 SysFreeString(str);
1616 str = a2bstr("borderbottomstyle");
1617 test_border_styles(style, str);
1618 SysFreeString(str);
1620 str = a2bstr("borderrightstyle");
1621 test_border_styles(style, str);
1622 SysFreeString(str);
1624 str = a2bstr("bordertopstyle");
1625 test_border_styles(style, str);
1626 SysFreeString(str);
1628 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1629 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1631 str = a2bstr("none dotted dashed solid");
1632 hres = IHTMLStyle_put_borderStyle(style, str);
1633 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1634 SysFreeString(str);
1636 str = a2bstr("none dotted dashed solid");
1637 hres = IHTMLStyle_get_borderStyle(style, &str);
1638 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1639 ok(!strcmp_wa(str, "none dotted dashed solid"),
1640 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1641 SysFreeString(str);
1643 str = a2bstr("double groove ridge inset");
1644 hres = IHTMLStyle_put_borderStyle(style, str);
1645 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1646 SysFreeString(str);
1648 str = a2bstr("window-inset outset ridge inset");
1649 hres = IHTMLStyle_put_borderStyle(style, str);
1650 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1651 SysFreeString(str);
1653 str = a2bstr("window-inset");
1654 hres = IHTMLStyle_put_borderStyle(style, str);
1655 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1656 SysFreeString(str);
1658 str = a2bstr("none none none none none");
1659 hres = IHTMLStyle_put_borderStyle(style, str);
1660 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1661 SysFreeString(str);
1663 str = a2bstr("invalid none none none");
1664 hres = IHTMLStyle_put_borderStyle(style, str);
1665 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1666 SysFreeString(str);
1668 str = a2bstr("none invalid none none");
1669 hres = IHTMLStyle_put_borderStyle(style, str);
1670 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1671 SysFreeString(str);
1673 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1674 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1675 SysFreeString(sDefault);
1677 /* backgoundColor */
1678 hres = IHTMLStyle_get_backgroundColor(style, &v);
1679 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1680 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1681 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1682 VariantClear(&v);
1684 V_VT(&v) = VT_BSTR;
1685 V_BSTR(&v) = a2bstr("red");
1686 hres = IHTMLStyle_put_backgroundColor(style, v);
1687 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1688 VariantClear(&v);
1690 hres = IHTMLStyle_get_backgroundColor(style, &v);
1691 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1692 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1693 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1694 VariantClear(&v);
1696 str = a2bstr("fixed");
1697 hres = IHTMLStyle_put_backgroundAttachment(style, str);
1698 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
1699 SysFreeString(str);
1701 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
1702 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
1703 ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str));
1704 SysFreeString(str);
1706 /* padding */
1707 hres = IHTMLStyle_get_padding(style, &str);
1708 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1709 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1710 SysFreeString(str);
1712 hres = IHTMLStyle_get_paddingTop(style, &v);
1713 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1714 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1715 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1717 V_VT(&v) = VT_I4;
1718 V_I4(&v) = 6;
1719 hres = IHTMLStyle_put_paddingTop(style, v);
1720 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1722 hres = IHTMLStyle_get_paddingTop(style, &v);
1723 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1724 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1725 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1726 VariantClear(&v);
1728 hres = IHTMLStyle_get_paddingRight(style, &v);
1729 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1730 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1731 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1733 V_VT(&v) = VT_I4;
1734 V_I4(&v) = 6;
1735 hres = IHTMLStyle_put_paddingRight(style, v);
1736 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1738 hres = IHTMLStyle_get_paddingRight(style, &v);
1739 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1740 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1741 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1742 VariantClear(&v);
1744 hres = IHTMLStyle_get_paddingBottom(style, &v);
1745 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1746 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1747 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1749 V_VT(&v) = VT_I4;
1750 V_I4(&v) = 6;
1751 hres = IHTMLStyle_put_paddingBottom(style, v);
1752 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1754 hres = IHTMLStyle_get_paddingBottom(style, &v);
1755 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1756 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1757 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1758 VariantClear(&v);
1760 str = a2bstr("1");
1761 hres = IHTMLStyle_put_padding(style, str);
1762 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1763 SysFreeString(str);
1765 hres = IHTMLStyle_get_padding(style, &str);
1766 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1767 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1768 SysFreeString(str);
1770 /* PaddingLeft */
1771 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1772 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1773 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1774 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1776 V_VT(&v) = VT_BSTR;
1777 V_BSTR(&v) = a2bstr("10");
1778 hres = IHTMLStyle_put_paddingLeft(style, v);
1779 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1780 VariantClear(&v);
1782 hres = IHTMLStyle_get_paddingLeft(style, &v);
1783 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1784 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1785 VariantClear(&v);
1787 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1788 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1790 /* BackgroundRepeat */
1791 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1792 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1794 str = a2bstr("invalid");
1795 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1796 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1797 SysFreeString(str);
1799 str = a2bstr("repeat");
1800 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1801 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1802 SysFreeString(str);
1804 str = a2bstr("no-repeat");
1805 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1806 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1807 SysFreeString(str);
1809 str = a2bstr("repeat-x");
1810 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1811 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1812 SysFreeString(str);
1814 str = a2bstr("repeat-y");
1815 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1816 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1817 SysFreeString(str);
1819 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1820 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1821 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1822 SysFreeString(str);
1824 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1825 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1826 SysFreeString(sDefault);
1828 /* BorderColor */
1829 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1830 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1832 str = a2bstr("red green red blue");
1833 hres = IHTMLStyle_put_borderColor(style, str);
1834 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1835 SysFreeString(str);
1837 hres = IHTMLStyle_get_borderColor(style, &str);
1838 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1839 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1840 SysFreeString(str);
1842 hres = IHTMLStyle_put_borderColor(style, sDefault);
1843 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1844 SysFreeString(sDefault);
1846 /* BorderRight */
1847 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1848 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1850 str = a2bstr("thick dotted red");
1851 hres = IHTMLStyle_put_borderRight(style, str);
1852 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1853 SysFreeString(str);
1855 /* IHTMLStyle_get_borderRight appears to have a bug where
1856 it returns the first letter of the color. So we check
1857 each style individually.
1859 V_BSTR(&v) = NULL;
1860 hres = IHTMLStyle_get_borderRightColor(style, &v);
1861 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1862 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1863 VariantClear(&v);
1865 V_BSTR(&v) = NULL;
1866 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1867 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1868 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1869 VariantClear(&v);
1871 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1872 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1873 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1874 SysFreeString(str);
1876 hres = IHTMLStyle_put_borderRight(style, sDefault);
1877 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1878 SysFreeString(sDefault);
1880 /* BorderTop */
1881 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1882 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1884 str = a2bstr("thick dotted red");
1885 hres = IHTMLStyle_put_borderTop(style, str);
1886 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1887 SysFreeString(str);
1889 /* IHTMLStyle_get_borderTop appears to have a bug where
1890 it returns the first letter of the color. So we check
1891 each style individually.
1893 V_BSTR(&v) = NULL;
1894 hres = IHTMLStyle_get_borderTopColor(style, &v);
1895 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1896 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1897 VariantClear(&v);
1899 V_BSTR(&v) = NULL;
1900 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1901 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1902 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1903 VariantClear(&v);
1905 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1906 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1907 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1908 SysFreeString(str);
1910 hres = IHTMLStyle_put_borderTop(style, sDefault);
1911 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1912 SysFreeString(sDefault);
1914 /* BorderBottom */
1915 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1916 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1918 str = a2bstr("thick dotted red");
1919 hres = IHTMLStyle_put_borderBottom(style, str);
1920 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1921 SysFreeString(str);
1923 /* IHTMLStyle_get_borderBottom appears to have a bug where
1924 it returns the first letter of the color. So we check
1925 each style individually.
1927 V_BSTR(&v) = NULL;
1928 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1929 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1930 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1931 VariantClear(&v);
1933 V_BSTR(&v) = NULL;
1934 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1935 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1936 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1937 VariantClear(&v);
1939 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1940 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1941 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1942 SysFreeString(str);
1944 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1945 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1946 SysFreeString(sDefault);
1948 /* BorderLeft */
1949 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1950 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1952 str = a2bstr("thick dotted red");
1953 hres = IHTMLStyle_put_borderLeft(style, str);
1954 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1955 SysFreeString(str);
1957 /* IHTMLStyle_get_borderLeft appears to have a bug where
1958 it returns the first letter of the color. So we check
1959 each style individually.
1961 V_BSTR(&v) = NULL;
1962 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1963 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1964 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1965 VariantClear(&v);
1967 V_BSTR(&v) = NULL;
1968 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1969 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1970 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1971 VariantClear(&v);
1973 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1974 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1975 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1976 SysFreeString(str);
1978 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1979 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1980 SysFreeString(sDefault);
1982 /* backgroundPositionX */
1983 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1984 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1985 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1986 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1987 VariantClear(&v);
1989 V_VT(&v) = VT_BSTR;
1990 V_BSTR(&v) = a2bstr("10px");
1991 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1992 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1993 VariantClear(&v);
1995 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1996 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1997 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1998 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1999 VariantClear(&v);
2001 /* backgroundPositionY */
2002 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2003 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2004 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2005 VariantClear(&v);
2007 V_VT(&v) = VT_BSTR;
2008 V_BSTR(&v) = a2bstr("15px");
2009 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2010 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2011 VariantClear(&v);
2013 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2014 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2015 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2016 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2017 VariantClear(&v);
2019 /* backgroundPosition */
2020 str = NULL;
2021 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2022 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2023 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2024 SysFreeString(str);
2026 str = a2bstr("center 20%");
2027 hres = IHTMLStyle_put_backgroundPosition(style, str);
2028 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2029 SysFreeString(str);
2031 str = NULL;
2032 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2033 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2034 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2035 SysFreeString(str);
2037 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2038 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2039 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2040 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2041 VariantClear(&v);
2043 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2044 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2045 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2046 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2047 VariantClear(&v);
2049 /* borderTopWidth */
2050 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2051 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2053 V_VT(&v) = VT_BSTR;
2054 V_BSTR(&v) = a2bstr("10px");
2055 hres = IHTMLStyle_put_borderTopWidth(style, v);
2056 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2057 VariantClear(&v);
2059 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2060 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2061 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2062 VariantClear(&v);
2064 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2065 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2066 VariantClear(&vDefault);
2068 /* borderRightWidth */
2069 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2070 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2072 V_VT(&v) = VT_BSTR;
2073 V_BSTR(&v) = a2bstr("10");
2074 hres = IHTMLStyle_put_borderRightWidth(style, v);
2075 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2076 VariantClear(&v);
2078 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2079 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2080 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2081 VariantClear(&v);
2083 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2084 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2085 VariantClear(&vDefault);
2087 /* borderBottomWidth */
2088 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2089 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2091 V_VT(&v) = VT_BSTR;
2092 V_BSTR(&v) = a2bstr("10");
2093 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2094 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2095 VariantClear(&v);
2097 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2098 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2099 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2100 VariantClear(&v);
2102 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2103 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2104 VariantClear(&vDefault);
2106 /* borderLeftWidth */
2107 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2108 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2110 V_VT(&v) = VT_BSTR;
2111 V_BSTR(&v) = a2bstr("10");
2112 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2113 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2114 VariantClear(&v);
2116 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2117 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2118 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2119 VariantClear(&v);
2121 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2122 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2123 VariantClear(&vDefault);
2125 /* wordSpacing */
2126 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2127 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2129 V_VT(&v) = VT_BSTR;
2130 V_BSTR(&v) = a2bstr("10");
2131 hres = IHTMLStyle_put_wordSpacing(style, v);
2132 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2133 VariantClear(&v);
2135 hres = IHTMLStyle_get_wordSpacing(style, &v);
2136 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2137 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2138 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2139 VariantClear(&v);
2141 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2142 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2143 VariantClear(&vDefault);
2145 /* letterSpacing */
2146 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2147 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2149 V_VT(&v) = VT_BSTR;
2150 V_BSTR(&v) = a2bstr("11");
2151 hres = IHTMLStyle_put_letterSpacing(style, v);
2152 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2153 VariantClear(&v);
2155 hres = IHTMLStyle_get_letterSpacing(style, &v);
2156 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2157 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2158 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2159 VariantClear(&v);
2161 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2162 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2163 VariantClear(&vDefault);
2165 /* borderTopColor */
2166 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2167 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2169 V_VT(&v) = VT_BSTR;
2170 V_BSTR(&v) = a2bstr("red");
2171 hres = IHTMLStyle_put_borderTopColor(style, v);
2172 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2173 VariantClear(&v);
2175 hres = IHTMLStyle_get_borderTopColor(style, &v);
2176 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2177 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2178 VariantClear(&v);
2180 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2181 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2183 /* borderRightColor */
2184 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2185 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2187 V_VT(&v) = VT_BSTR;
2188 V_BSTR(&v) = a2bstr("blue");
2189 hres = IHTMLStyle_put_borderRightColor(style, v);
2190 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2191 VariantClear(&v);
2193 hres = IHTMLStyle_get_borderRightColor(style, &v);
2194 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2195 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2196 VariantClear(&v);
2198 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2199 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2201 /* borderBottomColor */
2202 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2203 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2205 V_VT(&v) = VT_BSTR;
2206 V_BSTR(&v) = a2bstr("cyan");
2207 hres = IHTMLStyle_put_borderBottomColor(style, v);
2208 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2209 VariantClear(&v);
2211 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2212 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2213 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2214 VariantClear(&v);
2216 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2217 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2219 /* borderLeftColor */
2220 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2221 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2223 V_VT(&v) = VT_BSTR;
2224 V_BSTR(&v) = a2bstr("cyan");
2225 hres = IHTMLStyle_put_borderLeftColor(style, v);
2226 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2227 VariantClear(&v);
2229 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2230 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2231 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2232 VariantClear(&v);
2234 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2235 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2237 /* clip */
2238 hres = IHTMLStyle_get_clip(style, &str);
2239 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2240 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2242 str = a2bstr("rect(0px 1px 500px 505px)");
2243 hres = IHTMLStyle_put_clip(style, str);
2244 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2245 SysFreeString(str);
2247 hres = IHTMLStyle_get_clip(style, &str);
2248 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2249 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
2250 SysFreeString(str);
2252 /* clear */
2253 hres = IHTMLStyle_get_clear(style, &str);
2254 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2255 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2257 str = a2bstr("both");
2258 hres = IHTMLStyle_put_clear(style, str);
2259 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2260 SysFreeString(str);
2262 hres = IHTMLStyle_get_clear(style, &str);
2263 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2264 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2265 SysFreeString(str);
2267 /* pageBreakAfter */
2268 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2269 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2270 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2272 str = a2bstr("always");
2273 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2274 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2275 SysFreeString(str);
2277 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2278 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2279 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2280 SysFreeString(str);
2282 /* pageBreakBefore */
2283 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2284 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2285 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2287 str = a2bstr("always");
2288 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2289 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2290 SysFreeString(str);
2292 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2293 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2294 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2295 SysFreeString(str);
2297 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2298 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2300 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2301 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2302 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2304 str = (void*)0xdeadbeef;
2305 hres = IHTMLStyle_get_whiteSpace(style, &str);
2306 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2307 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2309 str = a2bstr("nowrap");
2310 hres = IHTMLStyle_put_whiteSpace(style, str);
2311 SysFreeString(str);
2312 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2314 str = NULL;
2315 hres = IHTMLStyle_get_whiteSpace(style, &str);
2316 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2317 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2318 SysFreeString(str);
2320 /* listStyleType */
2321 hres = IHTMLStyle_get_listStyleType(style, &str);
2322 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2323 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2325 str = a2bstr("square");
2326 hres = IHTMLStyle_put_listStyleType(style, str);
2327 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2328 SysFreeString(str);
2330 str = NULL;
2331 hres = IHTMLStyle_get_listStyleType(style, &str);
2332 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2333 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2335 str = a2bstr("inside");
2336 hres = IHTMLStyle_put_listStylePosition(style, str);
2337 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2338 SysFreeString(str);
2340 hres = IHTMLStyle_get_listStylePosition(style, &str);
2341 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2342 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2343 SysFreeString(str);
2345 str = a2bstr("decimal-leading-zero none inside");
2346 hres = IHTMLStyle_put_listStyle(style, str);
2347 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
2348 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
2349 SysFreeString(str);
2351 if (hres != E_INVALIDARG) {
2352 hres = IHTMLStyle_get_listStyle(style, &str);
2353 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
2354 ok(strstr_wa(str, "decimal-leading-zero") == str &&
2355 strstr_wa(str, "none") != NULL &&
2356 strstr_wa(str, "inside") != NULL,
2357 "listStyle = %s\n", wine_dbgstr_w(str));
2358 SysFreeString(str);
2359 } else {
2360 win_skip("IHTMLStyle_put_listStyle already failed\n");
2363 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2364 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2365 if(SUCCEEDED(hres)) {
2366 test_style2(style2);
2367 IHTMLStyle2_Release(style2);
2370 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2371 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2372 if(SUCCEEDED(hres)) {
2373 test_style3(style3);
2374 IHTMLStyle3_Release(style3);
2377 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2378 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2379 if(SUCCEEDED(hres)) {
2380 test_style4(style4);
2381 IHTMLStyle4_Release(style4);
2384 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
2385 if(SUCCEEDED(hres)) {
2386 test_style5(style5);
2387 IHTMLStyle5_Release(style5);
2388 }else {
2389 win_skip("IHTMLStyle5 not available\n");
2392 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2393 if(SUCCEEDED(hres)) {
2394 test_style6(style6);
2395 IHTMLStyle6_Release(style6);
2396 }else {
2397 win_skip("IHTMLStyle6 not available\n");
2401 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2402 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2404 BSTR str;
2405 HRESULT hres;
2407 str = (void*)0xdeadbeef;
2408 hres = IHTMLStyle_get_filter(style, &str);
2409 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2410 if(exval)
2411 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2412 else
2413 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2415 SysFreeString(str);
2418 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2419 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2421 BSTR str;
2422 HRESULT hres;
2424 str = (void*)0xdeadbeef;
2425 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2426 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2427 if(exval)
2428 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2429 else
2430 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2432 SysFreeString(str);
2435 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2436 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2438 BSTR str = a2bstr(val);
2439 HRESULT hres;
2441 hres = IHTMLStyle_put_filter(style, str);
2442 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2443 SysFreeString(str);
2445 _test_style_filter(line, style, val);
2448 static void test_style_filters(IHTMLElement *elem)
2450 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2451 IHTMLCurrentStyle2 *current_style2;
2452 IHTMLCurrentStyle *current_style;
2453 IHTMLStyle *style;
2454 HRESULT hres;
2456 hres = IHTMLElement_get_style(elem, &style);
2457 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2459 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2460 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2462 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2464 test_style_filter(style, NULL);
2465 test_current_style_filter(current_style2, NULL);
2466 set_style_filter(style, "alpha(opacity=50.0040)");
2467 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2468 set_style_filter(style, "alpha(opacity=100)");
2470 IHTMLStyle_Release(style);
2472 hres = IHTMLElement_get_style(elem, &style);
2473 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2475 test_style_filter(style, "alpha(opacity=100)");
2476 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2477 set_style_filter(style, NULL);
2478 set_style_filter(style, "alpha(opacity=100)");
2479 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2480 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2481 test_style_filter(style, NULL);
2484 IHTMLCurrentStyle2_Release(current_style2);
2485 IHTMLStyle_Release(style);
2486 IHTMLElement2_Release(elem2);
2489 static void test_current_style(IHTMLCurrentStyle *current_style)
2491 IHTMLCurrentStyle2 *current_style2;
2492 VARIANT_BOOL b;
2493 BSTR str;
2494 HRESULT hres;
2495 VARIANT v;
2497 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2498 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2499 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2500 SysFreeString(str);
2502 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2503 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2504 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2505 SysFreeString(str);
2507 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2508 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2509 SysFreeString(str);
2511 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2512 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2513 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2514 SysFreeString(str);
2516 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2517 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2518 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2519 SysFreeString(str);
2521 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2522 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2523 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2524 SysFreeString(str);
2526 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2527 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2528 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2529 SysFreeString(str);
2531 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2532 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2533 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2534 SysFreeString(str);
2536 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2537 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2538 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2539 SysFreeString(str);
2541 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2542 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2543 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2544 SysFreeString(str);
2546 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2547 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2548 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2549 SysFreeString(str);
2551 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2552 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2553 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2554 SysFreeString(str);
2556 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2557 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2558 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2559 SysFreeString(str);
2561 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2562 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2563 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2564 SysFreeString(str);
2566 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2567 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2568 SysFreeString(str);
2570 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2571 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2572 SysFreeString(str);
2574 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2575 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2576 SysFreeString(str);
2578 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2579 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2580 SysFreeString(str);
2582 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2583 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2584 SysFreeString(str);
2586 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2587 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2588 SysFreeString(str);
2590 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2591 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2592 SysFreeString(str);
2594 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2595 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2596 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2597 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2598 VariantClear(&v);
2600 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2601 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2602 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2603 VariantClear(&v);
2605 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2606 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2607 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2608 VariantClear(&v);
2610 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2611 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2612 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2613 VariantClear(&v);
2615 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2616 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2617 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2618 VariantClear(&v);
2620 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2621 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2622 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2623 VariantClear(&v);
2625 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2626 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2627 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2628 VariantClear(&v);
2630 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2631 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2632 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2633 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2634 VariantClear(&v);
2636 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2637 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2638 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2639 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2640 VariantClear(&v);
2642 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2643 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2644 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2645 VariantClear(&v);
2647 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2648 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2649 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2650 VariantClear(&v);
2652 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2653 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2654 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2655 VariantClear(&v);
2657 V_BSTR(&v) = NULL;
2658 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2659 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2660 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2661 VariantClear(&v);
2663 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2664 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2665 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2666 VariantClear(&v);
2668 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2669 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2670 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2671 VariantClear(&v);
2673 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2674 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2675 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2676 VariantClear(&v);
2678 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2679 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2680 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2681 VariantClear(&v);
2683 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2684 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2685 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2686 VariantClear(&v);
2688 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2689 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2690 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2691 VariantClear(&v);
2693 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2694 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2695 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2696 VariantClear(&v);
2698 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2699 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2700 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2701 VariantClear(&v);
2703 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2704 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2705 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2706 VariantClear(&v);
2708 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2709 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2710 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2711 VariantClear(&v);
2713 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2714 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2715 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2716 VariantClear(&v);
2718 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2719 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2720 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2721 VariantClear(&v);
2723 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2724 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2725 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2726 VariantClear(&v);
2728 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2729 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2730 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2731 VariantClear(&v);
2733 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2734 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2735 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2736 VariantClear(&v);
2738 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2739 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2740 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2741 VariantClear(&v);
2743 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2744 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2745 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2746 VariantClear(&v);
2748 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2749 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2750 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2751 VariantClear(&v);
2753 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
2754 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2755 SysFreeString(str);
2757 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2759 b = 100;
2760 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2761 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2762 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2764 IHTMLCurrentStyle2_Release(current_style2);
2767 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2769 static void basic_style_test(IHTMLDocument2 *doc)
2771 IHTMLCurrentStyle *cstyle;
2772 IHTMLElement *elem;
2773 IHTMLStyle *style;
2774 HRESULT hres;
2776 hres = IHTMLDocument2_get_body(doc, &elem);
2777 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2779 hres = IHTMLElement_get_style(elem, &style);
2780 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2782 test_body_style(style);
2784 cstyle = get_current_style(elem);
2785 test_current_style(cstyle);
2786 IHTMLCurrentStyle_Release(cstyle);
2787 IHTMLElement_Release(elem);
2789 elem = get_element_by_id(doc, "divid");
2790 test_style_filters(elem);
2792 test_set_csstext(style);
2793 IHTMLStyle_Release(style);
2794 IHTMLElement_Release(elem);
2797 static const char runtimestyle_test_str[] =
2798 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2800 static void runtimestyle_test(IHTMLDocument2 *doc)
2802 IHTMLStyle *style, *runtime_style;
2803 IHTMLElement2 *elem2;
2804 IHTMLElement *elem;
2805 BSTR str;
2806 HRESULT hres;
2808 hres = IHTMLDocument2_get_body(doc, &elem);
2809 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2811 elem2 = get_elem2_iface((IUnknown*)elem);
2813 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2814 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2816 hres = IHTMLElement_get_style(elem, &style);
2817 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2819 test_text_decoration(style, NULL);
2820 test_text_decoration(runtime_style, NULL);
2821 set_text_decoration(style, "underline");
2822 test_text_decoration(style, "underline");
2824 hres = IHTMLStyle_get_textDecoration(style, &str);
2825 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2826 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2827 SysFreeString(str);
2829 set_text_decoration(runtime_style, "blink");
2830 test_text_decoration(runtime_style, "blink");
2832 hres = IHTMLStyle_get_textDecoration(style, &str);
2833 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2834 todo_wine
2835 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2836 SysFreeString(str);
2838 IHTMLStyle_Release(runtime_style);
2839 IHTMLStyle_Release(style);
2840 IHTMLElement2_Release(elem2);
2841 IHTMLElement_Release(elem);
2844 static IHTMLDocument2 *notif_doc;
2845 static BOOL doc_complete;
2847 static IHTMLDocument2 *create_document(void)
2849 IHTMLDocument2 *doc;
2850 IHTMLDocument5 *doc5;
2851 HRESULT hres;
2853 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2854 &IID_IHTMLDocument2, (void**)&doc);
2855 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2856 if(FAILED(hres))
2857 return NULL;
2859 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2860 if(FAILED(hres)) {
2861 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2862 IHTMLDocument2_Release(doc);
2863 return NULL;
2866 IHTMLDocument5_Release(doc5);
2867 return doc;
2870 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2871 REFIID riid, void**ppv)
2873 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2874 *ppv = iface;
2875 return S_OK;
2878 ok(0, "unexpected call\n");
2879 return E_NOINTERFACE;
2882 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2884 return 2;
2887 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2889 return 1;
2892 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2894 if(dispID == DISPID_READYSTATE){
2895 BSTR state;
2896 HRESULT hres;
2898 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2899 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2901 if(!strcmp_wa(state, "complete"))
2902 doc_complete = TRUE;
2904 SysFreeString(state);
2907 return S_OK;
2910 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2912 ok(0, "unexpected call\n");
2913 return E_NOTIMPL;
2916 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2917 PropertyNotifySink_QueryInterface,
2918 PropertyNotifySink_AddRef,
2919 PropertyNotifySink_Release,
2920 PropertyNotifySink_OnChanged,
2921 PropertyNotifySink_OnRequestEdit
2924 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2926 static IHTMLDocument2 *create_doc_with_string(const char *str)
2928 IPersistStreamInit *init;
2929 IStream *stream;
2930 IHTMLDocument2 *doc;
2931 HGLOBAL mem;
2932 SIZE_T len;
2934 notif_doc = doc = create_document();
2935 if(!doc)
2936 return NULL;
2938 doc_complete = FALSE;
2939 len = strlen(str);
2940 mem = GlobalAlloc(0, len);
2941 memcpy(mem, str, len);
2942 CreateStreamOnHGlobal(mem, TRUE, &stream);
2944 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2946 IPersistStreamInit_Load(init, stream);
2947 IPersistStreamInit_Release(init);
2948 IStream_Release(stream);
2950 return doc;
2953 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2955 IConnectionPointContainer *container;
2956 IConnectionPoint *cp;
2957 DWORD cookie;
2958 HRESULT hres;
2960 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2961 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2963 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2964 IConnectionPointContainer_Release(container);
2965 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2967 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2968 IConnectionPoint_Release(cp);
2969 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2972 typedef void (*style_test_t)(IHTMLDocument2*);
2974 static void run_test(const char *str, style_test_t test)
2976 IHTMLDocument2 *doc;
2977 ULONG ref;
2978 MSG msg;
2980 doc = create_doc_with_string(str);
2981 if(!doc)
2982 return;
2984 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2986 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
2987 TranslateMessage(&msg);
2988 DispatchMessageW(&msg);
2991 test(doc);
2993 ref = IHTMLDocument2_Release(doc);
2994 ok(!ref || broken(ref == 1), /* Vista */
2995 "ref = %d\n", ref);
2999 START_TEST(style)
3001 CoInitialize(NULL);
3003 run_test(basic_test_str, basic_style_test);
3004 run_test(runtimestyle_test_str, runtimestyle_test);
3006 CoUninitialize();