mshtml: Added IHTMLStyle::styleFloat attribute implementation.
[wine.git] / dlls / mshtml / tests / style.c
blob1cdd1c73fbe0dd4c2c958a221b28e33662d275b1
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);
552 /* maxWidth */
553 hres = IHTMLStyle5_get_maxWidth(style5, &vdefault);
554 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
556 V_VT(&v) = VT_BSTR;
557 V_BSTR(&v) = a2bstr("200px");
558 hres = IHTMLStyle5_put_maxWidth(style5, v);
559 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
560 VariantClear(&v);
562 hres = IHTMLStyle5_get_maxWidth(style5, &v);
563 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
564 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n",V_VT(&v));
565 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
566 VariantClear(&v);
568 V_VT(&v) = VT_BSTR;
569 V_BSTR(&v) = a2bstr("70%");
570 hres = IHTMLStyle5_put_maxWidth(style5, v);
571 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
572 VariantClear(&v);
574 hres = IHTMLStyle5_get_maxWidth(style5, &v);
575 ok(hres == S_OK, "get maxWidth failed: %08x\n", hres);
576 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
577 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
578 VariantClear(&v);
580 hres = IHTMLStyle5_put_maxWidth(style5,vdefault);
581 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
582 VariantClear(&vdefault);
584 /* maxHeight */
585 hres = IHTMLStyle5_get_maxHeight(style5, &vdefault);
586 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
588 V_VT(&v) = VT_BSTR;
589 V_BSTR(&v) = a2bstr("200px");
590 hres = IHTMLStyle5_put_maxHeight(style5, v);
591 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
592 VariantClear(&v);
594 hres = IHTMLStyle5_get_maxHeight(style5, &v);
595 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
596 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
597 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
598 VariantClear(&v);
600 V_VT(&v) = VT_BSTR;
601 V_BSTR(&v) = a2bstr("70%");
602 hres = IHTMLStyle5_put_maxHeight(style5, v);
603 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
604 VariantClear(&v);
606 hres = IHTMLStyle5_get_maxHeight(style5, &v);
607 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
608 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
609 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
610 VariantClear(&v);
612 V_VT(&v) = VT_BSTR;
613 V_BSTR(&v) = a2bstr("100");
614 hres = IHTMLStyle5_put_maxHeight(style5, v);
615 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
616 VariantClear(&v);
618 hres = IHTMLStyle5_get_maxHeight(style5, &v);
619 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
620 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
621 ok(!strcmp_wa(V_BSTR(&v), "100px"), "expect 100 got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
622 VariantClear(&v);
624 hres = IHTMLStyle5_put_maxHeight(style5, vdefault);
625 ok(hres == S_OK, "put maxHeight failed:%08x\n", hres);
626 VariantClear(&vdefault);
629 static void test_style6(IHTMLStyle6 *style)
631 BSTR str;
632 HRESULT hres;
634 str = (void*)0xdeadbeef;
635 hres = IHTMLStyle6_get_outline(style, &str);
636 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
637 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
638 SysFreeString(str);
640 str = a2bstr("1px");
641 hres = IHTMLStyle6_put_outline(style, str);
642 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
643 SysFreeString(str);
645 str = (void*)0xdeadbeef;
646 hres = IHTMLStyle6_get_outline(style, &str);
647 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
648 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
649 SysFreeString(str);
651 str = (void*)0xdeadbeef;
652 hres = IHTMLStyle6_get_boxSizing(style, &str);
653 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
654 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
655 SysFreeString(str);
657 str = a2bstr("border-box");
658 hres = IHTMLStyle6_put_boxSizing(style, str);
659 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
660 SysFreeString(str);
662 str = NULL;
663 hres = IHTMLStyle6_get_boxSizing(style, &str);
664 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
665 ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
666 SysFreeString(str);
669 static void test_body_style(IHTMLStyle *style)
671 IHTMLStyle2 *style2;
672 IHTMLStyle3 *style3;
673 IHTMLStyle4 *style4;
674 IHTMLStyle5 *style5;
675 IHTMLStyle6 *style6;
676 VARIANT_BOOL b;
677 VARIANT v;
678 BSTR str;
679 HRESULT hres;
680 float f;
681 BSTR sOverflowDefault;
682 BSTR sDefault;
683 LONG l;
684 VARIANT vDefault;
686 test_style_csstext(style, NULL);
688 hres = IHTMLStyle_get_position(style, &str);
689 ok(hres == S_OK, "get_position failed: %08x\n", hres);
690 ok(!str, "str=%s\n", wine_dbgstr_w(str));
692 V_VT(&v) = VT_NULL;
693 hres = IHTMLStyle_get_marginRight(style, &v);
694 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
695 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
696 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
698 V_VT(&v) = VT_I4;
699 V_I4(&v) = 6;
700 hres = IHTMLStyle_put_marginRight(style, v);
701 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
703 V_VT(&v) = VT_NULL;
704 hres = IHTMLStyle_get_marginRight(style, &v);
705 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
706 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
707 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
709 V_VT(&v) = VT_NULL;
710 hres = IHTMLStyle_get_marginBottom(style, &v);
711 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
712 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
713 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
715 V_VT(&v) = VT_I4;
716 V_I4(&v) = 6;
717 hres = IHTMLStyle_put_marginBottom(style, v);
718 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
720 V_VT(&v) = VT_NULL;
721 hres = IHTMLStyle_get_marginBottom(style, &v);
722 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
723 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
724 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
726 V_VT(&v) = VT_NULL;
727 hres = IHTMLStyle_get_marginLeft(style, &v);
728 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
729 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
730 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
732 V_VT(&v) = VT_I4;
733 V_I4(&v) = 6;
734 hres = IHTMLStyle_put_marginLeft(style, v);
735 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
737 V_VT(&v) = VT_NULL;
738 hres = IHTMLStyle_get_marginLeft(style, &v);
739 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
740 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
741 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
743 str = (void*)0xdeadbeef;
744 hres = IHTMLStyle_get_fontFamily(style, &str);
745 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
746 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
748 str = (void*)0xdeadbeef;
749 hres = IHTMLStyle_get_fontWeight(style, &str);
750 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
751 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
753 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
754 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
756 str = a2bstr("test");
757 hres = IHTMLStyle_put_fontWeight(style, str);
758 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
759 SysFreeString(str);
761 str = a2bstr("bold");
762 hres = IHTMLStyle_put_fontWeight(style, str);
763 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
764 SysFreeString(str);
766 str = a2bstr("bolder");
767 hres = IHTMLStyle_put_fontWeight(style, str);
768 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
769 SysFreeString(str);
771 str = a2bstr("lighter");
772 hres = IHTMLStyle_put_fontWeight(style, str);
773 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
774 SysFreeString(str);
776 str = a2bstr("100");
777 hres = IHTMLStyle_put_fontWeight(style, str);
778 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
779 SysFreeString(str);
781 str = a2bstr("200");
782 hres = IHTMLStyle_put_fontWeight(style, str);
783 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
784 SysFreeString(str);
786 str = a2bstr("300");
787 hres = IHTMLStyle_put_fontWeight(style, str);
788 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
789 SysFreeString(str);
791 str = a2bstr("400");
792 hres = IHTMLStyle_put_fontWeight(style, str);
793 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
794 SysFreeString(str);
796 str = a2bstr("500");
797 hres = IHTMLStyle_put_fontWeight(style, str);
798 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
799 SysFreeString(str);
801 str = a2bstr("600");
802 hres = IHTMLStyle_put_fontWeight(style, str);
803 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
804 SysFreeString(str);
806 str = a2bstr("700");
807 hres = IHTMLStyle_put_fontWeight(style, str);
808 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
809 SysFreeString(str);
811 str = a2bstr("800");
812 hres = IHTMLStyle_put_fontWeight(style, str);
813 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
814 SysFreeString(str);
816 str = a2bstr("900");
817 hres = IHTMLStyle_put_fontWeight(style, str);
818 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
819 SysFreeString(str);
821 hres = IHTMLStyle_get_fontWeight(style, &str);
822 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
823 ok(!strcmp_wa(str, "900"), "str != style900\n");
824 SysFreeString(str);
826 str = a2bstr("");
827 hres = IHTMLStyle_put_fontWeight(style, str);
828 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
829 SysFreeString(str);
831 hres = IHTMLStyle_get_fontWeight(style, &str);
832 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
833 ok(!str, "str != NULL\n");
834 SysFreeString(str);
836 hres = IHTMLStyle_put_fontWeight(style, sDefault);
837 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
838 SysFreeString(sDefault);
840 /* font Variant */
841 hres = IHTMLStyle_get_fontVariant(style, NULL);
842 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
844 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
845 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
847 str = a2bstr("test");
848 hres = IHTMLStyle_put_fontVariant(style, str);
849 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
850 SysFreeString(str);
852 str = a2bstr("small-caps");
853 hres = IHTMLStyle_put_fontVariant(style, str);
854 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
855 SysFreeString(str);
857 str = a2bstr("normal");
858 hres = IHTMLStyle_put_fontVariant(style, str);
859 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
860 SysFreeString(str);
862 hres = IHTMLStyle_put_fontVariant(style, sDefault);
863 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
864 SysFreeString(sDefault);
866 str = (void*)0xdeadbeef;
867 hres = IHTMLStyle_get_display(style, &str);
868 ok(hres == S_OK, "get_display failed: %08x\n", hres);
869 ok(!str, "display = %s\n", wine_dbgstr_w(str));
871 str = (void*)0xdeadbeef;
872 hres = IHTMLStyle_get_visibility(style, &str);
873 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
874 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
876 V_VT(&v) = VT_NULL;
877 hres = IHTMLStyle_get_fontSize(style, &v);
878 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
879 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
880 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
882 V_VT(&v) = VT_I4;
883 V_I4(&v) = 12;
884 hres = IHTMLStyle_put_fontSize(style, v);
885 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
887 V_VT(&v) = VT_NULL;
888 hres = IHTMLStyle_get_fontSize(style, &v);
889 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
890 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
891 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
893 V_VT(&v) = VT_NULL;
894 hres = IHTMLStyle_get_color(style, &v);
895 ok(hres == S_OK, "get_color failed: %08x\n", hres);
896 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
897 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
899 V_VT(&v) = VT_I4;
900 V_I4(&v) = 0xfdfd;
901 hres = IHTMLStyle_put_color(style, v);
902 ok(hres == S_OK, "put_color failed: %08x\n", hres);
904 V_VT(&v) = VT_NULL;
905 hres = IHTMLStyle_get_color(style, &v);
906 ok(hres == S_OK, "get_color failed: %08x\n", hres);
907 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
908 todo_wine
909 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
911 V_VT(&v) = VT_I4;
912 V_I4(&v) = 3;
913 hres = IHTMLStyle_put_lineHeight(style, v);
914 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
916 hres = IHTMLStyle_get_lineHeight(style, &v);
917 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
918 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
919 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
921 V_VT(&v) = VT_BSTR;
922 V_BSTR(&v) = a2bstr("300%");
923 hres = IHTMLStyle_put_lineHeight(style, v);
924 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
925 VariantClear(&v);
927 hres = IHTMLStyle_get_lineHeight(style, &v);
928 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
929 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
930 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
931 VariantClear(&v);
933 b = 0xfefe;
934 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
935 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
936 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
938 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
939 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
941 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
942 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
943 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
945 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
946 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
948 b = 0xfefe;
949 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
950 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
951 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
953 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
954 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
956 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
957 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
958 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
960 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
961 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
963 b = 0xfefe;
964 hres = IHTMLStyle_get_textDecorationNone(style, &b);
965 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
966 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
968 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
969 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
971 hres = IHTMLStyle_get_textDecorationNone(style, &b);
972 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
973 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
975 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
976 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
978 b = 0xfefe;
979 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
980 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
981 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
983 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
984 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
986 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
987 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
988 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
990 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
991 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
993 b = 0xfefe;
994 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
995 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
996 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
998 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
999 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1001 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1002 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1003 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1005 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1006 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1008 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1009 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1011 str = a2bstr("invalid");
1012 hres = IHTMLStyle_put_textDecoration(style, str);
1013 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
1014 SysFreeString(str);
1016 set_text_decoration(style, "none");
1017 test_text_decoration(style, "none");
1018 set_text_decoration(style, "underline");
1019 set_text_decoration(style, "overline");
1020 set_text_decoration(style, "line-through");
1021 set_text_decoration(style, "blink");
1022 set_text_decoration(style, "overline");
1023 set_text_decoration(style, "blink");
1024 test_text_decoration(style, "blink");
1026 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1027 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1028 SysFreeString(sDefault);
1030 hres = IHTMLStyle_get_posWidth(style, NULL);
1031 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1033 hres = IHTMLStyle_get_posWidth(style, &f);
1034 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1035 ok(f == 0.0f, "f = %f\n", f);
1037 V_VT(&v) = VT_EMPTY;
1038 hres = IHTMLStyle_get_width(style, &v);
1039 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1040 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1041 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1043 hres = IHTMLStyle_put_posWidth(style, 2.2);
1044 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1046 hres = IHTMLStyle_get_posWidth(style, &f);
1047 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1048 ok(f == 2.0f ||
1049 f == 2.2f, /* IE8 */
1050 "f = %f\n", f);
1052 l = 0xdeadbeef;
1053 hres = IHTMLStyle_get_pixelWidth(style, &l);
1054 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1055 ok(l == 2, "pixelWidth = %d\n", l);
1057 V_VT(&v) = VT_BSTR;
1058 V_BSTR(&v) = a2bstr("auto");
1059 hres = IHTMLStyle_put_width(style, v);
1060 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1061 VariantClear(&v);
1063 V_VT(&v) = VT_EMPTY;
1064 hres = IHTMLStyle_get_width(style, &v);
1065 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1066 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1067 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1068 VariantClear(&v);
1070 V_VT(&v) = VT_I4;
1071 V_I4(&v) = 100;
1072 hres = IHTMLStyle_put_width(style, v);
1073 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1075 l = 0xdeadbeef;
1076 hres = IHTMLStyle_get_pixelWidth(style, &l);
1077 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1078 ok(l == 100, "pixelWidth = %d\n", l);
1080 V_VT(&v) = VT_EMPTY;
1081 hres = IHTMLStyle_get_width(style, &v);
1082 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1083 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1084 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1085 VariantClear(&v);
1087 hres = IHTMLStyle_put_pixelWidth(style, 50);
1088 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1090 l = 0xdeadbeef;
1091 hres = IHTMLStyle_get_pixelWidth(style, &l);
1092 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1093 ok(l == 50, "pixelWidth = %d\n", l);
1095 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1096 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1098 V_VT(&v) = VT_EMPTY;
1099 hres = IHTMLStyle_get_width(style, &v);
1100 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1101 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1102 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1103 VariantClear(&v);
1105 /* margin tests */
1106 str = (void*)0xdeadbeef;
1107 hres = IHTMLStyle_get_margin(style, &str);
1108 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1109 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1111 str = a2bstr("1");
1112 hres = IHTMLStyle_put_margin(style, str);
1113 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1114 SysFreeString(str);
1116 hres = IHTMLStyle_get_margin(style, &str);
1117 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1118 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
1119 SysFreeString(str);
1121 hres = IHTMLStyle_put_margin(style, NULL);
1122 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1124 str = (void*)0xdeadbeef;
1125 hres = IHTMLStyle_get_marginTop(style, &v);
1126 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1127 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1128 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1130 V_VT(&v) = VT_BSTR;
1131 V_BSTR(&v) = a2bstr("6px");
1132 hres = IHTMLStyle_put_marginTop(style, v);
1133 SysFreeString(V_BSTR(&v));
1134 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1136 str = (void*)0xdeadbeef;
1137 hres = IHTMLStyle_get_marginTop(style, &v);
1138 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1139 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1140 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1141 VariantClear(&v);
1143 V_VT(&v) = VT_I4;
1144 V_I4(&v) = 5;
1145 hres = IHTMLStyle_put_marginTop(style, v);
1146 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1148 str = (void*)0xdeadbeef;
1149 hres = IHTMLStyle_get_marginTop(style, &v);
1150 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1151 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1152 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1153 VariantClear(&v);
1155 str = NULL;
1156 hres = IHTMLStyle_get_border(style, &str);
1157 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1158 ok(!str || !*str, "str is not empty\n");
1159 SysFreeString(str);
1161 str = a2bstr("1px");
1162 hres = IHTMLStyle_put_border(style, str);
1163 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1164 SysFreeString(str);
1166 V_VT(&v) = VT_EMPTY;
1167 hres = IHTMLStyle_get_left(style, &v);
1168 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1169 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1170 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1171 VariantClear(&v);
1173 l = 0xdeadbeef;
1174 hres = IHTMLStyle_get_pixelLeft(style, &l);
1175 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1176 ok(!l, "pixelLeft = %d\n", l);
1178 /* Test posLeft */
1179 hres = IHTMLStyle_get_posLeft(style, NULL);
1180 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1182 f = 1.0f;
1183 hres = IHTMLStyle_get_posLeft(style, &f);
1184 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1185 ok(f == 0.0, "expected 0.0 got %f\n", f);
1187 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1188 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1190 hres = IHTMLStyle_get_posLeft(style, &f);
1191 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1192 ok(f == 4.0 ||
1193 f == 4.9f, /* IE8 */
1194 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1196 /* Ensure left is updated correctly. */
1197 V_VT(&v) = VT_EMPTY;
1198 hres = IHTMLStyle_get_left(style, &v);
1199 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1200 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1201 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1202 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1203 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1204 VariantClear(&v);
1206 /* Test left */
1207 V_VT(&v) = VT_BSTR;
1208 V_BSTR(&v) = a2bstr("3px");
1209 hres = IHTMLStyle_put_left(style, v);
1210 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1211 VariantClear(&v);
1213 hres = IHTMLStyle_get_posLeft(style, &f);
1214 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1215 ok(f == 3.0, "expected 3.0 got %f\n", f);
1217 l = 0xdeadbeef;
1218 hres = IHTMLStyle_get_pixelLeft(style, &l);
1219 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1220 ok(l == 3, "pixelLeft = %d\n", l);
1222 V_VT(&v) = VT_EMPTY;
1223 hres = IHTMLStyle_get_left(style, &v);
1224 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1225 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1226 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1227 VariantClear(&v);
1229 V_VT(&v) = VT_BSTR;
1230 V_BSTR(&v) = a2bstr("4.99");
1231 hres = IHTMLStyle_put_left(style, v);
1232 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1233 VariantClear(&v);
1235 l = 0xdeadbeef;
1236 hres = IHTMLStyle_get_pixelLeft(style, &l);
1237 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1238 ok(l == 4, "pixelLeft = %d\n", l);
1240 V_VT(&v) = VT_NULL;
1241 hres = IHTMLStyle_put_left(style, v);
1242 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1244 V_VT(&v) = VT_EMPTY;
1245 hres = IHTMLStyle_get_left(style, &v);
1246 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1247 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1248 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1249 VariantClear(&v);
1251 V_VT(&v) = VT_EMPTY;
1252 hres = IHTMLStyle_get_top(style, &v);
1253 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1254 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1255 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1256 VariantClear(&v);
1258 l = 0xdeadbeef;
1259 hres = IHTMLStyle_get_pixelLeft(style, &l);
1260 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1261 ok(!l, "pixelLeft = %d\n", l);
1263 hres = IHTMLStyle_put_pixelLeft(style, 6);
1264 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1266 l = 0xdeadbeef;
1267 hres = IHTMLStyle_get_pixelLeft(style, &l);
1268 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1269 ok(l == 6, "pixelLeft = %d\n", l);
1271 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1272 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
1274 V_VT(&v) = VT_EMPTY;
1275 hres = IHTMLStyle_get_left(style, &v);
1276 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1277 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1278 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1279 VariantClear(&v);
1281 /* Test posTop */
1282 hres = IHTMLStyle_get_posTop(style, NULL);
1283 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1285 f = 1.0f;
1286 hres = IHTMLStyle_get_posTop(style, &f);
1287 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1288 ok(f == 0.0, "expected 0.0 got %f\n", f);
1290 hres = IHTMLStyle_put_posTop(style, 4.9f);
1291 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1293 hres = IHTMLStyle_get_posTop(style, &f);
1294 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1295 ok(f == 4.0 ||
1296 f == 4.9f, /* IE8 */
1297 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1299 hres = IHTMLStyle_put_pixelTop(style, 6);
1300 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1302 l = 0xdeadbeef;
1303 hres = IHTMLStyle_get_pixelTop(style, &l);
1304 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1305 ok(l == 6, "pixelTop = %d\n", l);
1307 hres = IHTMLStyle_get_pixelTop(style, NULL);
1308 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1310 V_VT(&v) = VT_BSTR;
1311 V_BSTR(&v) = a2bstr("3px");
1312 hres = IHTMLStyle_put_top(style, v);
1313 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1314 VariantClear(&v);
1316 V_VT(&v) = VT_EMPTY;
1317 hres = IHTMLStyle_get_top(style, &v);
1318 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1319 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1320 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1321 VariantClear(&v);
1323 hres = IHTMLStyle_get_posTop(style, &f);
1324 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1325 ok(f == 3.0, "expected 3.0 got %f\n", f);
1327 l = 0xdeadbeef;
1328 hres = IHTMLStyle_get_pixelTop(style, &l);
1329 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1330 ok(l == 3, "pixelTop = %d\n", l);
1332 V_VT(&v) = VT_NULL;
1333 hres = IHTMLStyle_put_top(style, v);
1334 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1336 V_VT(&v) = VT_EMPTY;
1337 hres = IHTMLStyle_get_top(style, &v);
1338 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1339 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1340 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1341 VariantClear(&v);
1343 l = 0xdeadbeef;
1344 hres = IHTMLStyle_get_pixelTop(style, &l);
1345 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1346 ok(!l, "pixelTop = %d\n", l);
1348 /* Test posHeight */
1349 hres = IHTMLStyle_get_posHeight(style, NULL);
1350 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1352 V_VT(&v) = VT_EMPTY;
1353 hres = IHTMLStyle_get_height(style, &v);
1354 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1355 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1356 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1357 VariantClear(&v);
1359 f = 1.0f;
1360 hres = IHTMLStyle_get_posHeight(style, &f);
1361 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1362 ok(f == 0.0, "expected 0.0 got %f\n", f);
1364 l = 0xdeadbeef;
1365 hres = IHTMLStyle_get_pixelHeight(style, &l);
1366 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1367 ok(!l, "pixelHeight = %d\n", l);
1369 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1370 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1372 hres = IHTMLStyle_get_posHeight(style, &f);
1373 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1374 ok(f == 4.0 ||
1375 f == 4.9f, /* IE8 */
1376 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1378 l = 0xdeadbeef;
1379 hres = IHTMLStyle_get_pixelHeight(style, &l);
1380 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1381 ok(l == 4 ||
1382 l == 5, /* IE8 */
1383 "pixelHeight = %d\n", l);
1385 V_VT(&v) = VT_BSTR;
1386 V_BSTR(&v) = a2bstr("70px");
1387 hres = IHTMLStyle_put_height(style, v);
1388 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1389 VariantClear(&v);
1391 V_VT(&v) = VT_EMPTY;
1392 hres = IHTMLStyle_get_height(style, &v);
1393 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1394 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1395 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1396 VariantClear(&v);
1398 l = 0xdeadbeef;
1399 hres = IHTMLStyle_get_pixelHeight(style, &l);
1400 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1401 ok(l == 70, "pixelHeight = %d\n", l);
1403 V_VT(&v) = VT_BSTR;
1404 V_BSTR(&v) = NULL;
1405 hres = IHTMLStyle_put_height(style, v);
1406 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1407 VariantClear(&v);
1409 V_VT(&v) = VT_EMPTY;
1410 hres = IHTMLStyle_get_height(style, &v);
1411 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1412 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1413 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1414 VariantClear(&v);
1416 l = 0xdeadbeef;
1417 hres = IHTMLStyle_get_pixelHeight(style, &l);
1418 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1419 ok(!l, "pixelHeight = %d\n", l);
1421 hres = IHTMLStyle_put_pixelHeight(style, 50);
1422 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
1424 l = 0xdeadbeef;
1425 hres = IHTMLStyle_get_pixelHeight(style, &l);
1426 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1427 ok(l == 50, "pixelHeight = %d\n", l);
1429 hres = IHTMLStyle_get_pixelHeight(style, NULL);
1430 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
1432 V_VT(&v) = VT_I4;
1433 V_I4(&v) = 64;
1434 hres = IHTMLStyle_put_height(style, v);
1435 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1437 V_VT(&v) = VT_EMPTY;
1438 hres = IHTMLStyle_get_height(style, &v);
1439 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1440 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1441 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1442 VariantClear(&v);
1444 hres = IHTMLStyle_get_posHeight(style, &f);
1445 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1446 ok(f == 64.0, "expected 64.0 got %f\n", f);
1448 l = 0xdeadbeef;
1449 hres = IHTMLStyle_get_pixelHeight(style, &l);
1450 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1451 ok(l == 64, "pixelHeight = %d\n", l);
1453 str = (void*)0xdeadbeef;
1454 hres = IHTMLStyle_get_cursor(style, &str);
1455 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1456 ok(!str, "get_cursor != NULL\n");
1457 SysFreeString(str);
1459 str = a2bstr("default");
1460 hres = IHTMLStyle_put_cursor(style, str);
1461 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1462 SysFreeString(str);
1464 str = NULL;
1465 hres = IHTMLStyle_get_cursor(style, &str);
1466 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1467 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1468 SysFreeString(str);
1470 V_VT(&v) = VT_EMPTY;
1471 hres = IHTMLStyle_get_verticalAlign(style, &v);
1472 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1473 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1474 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1475 VariantClear(&v);
1477 V_VT(&v) = VT_BSTR;
1478 V_BSTR(&v) = a2bstr("middle");
1479 hres = IHTMLStyle_put_verticalAlign(style, v);
1480 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1481 VariantClear(&v);
1483 V_VT(&v) = VT_EMPTY;
1484 hres = IHTMLStyle_get_verticalAlign(style, &v);
1485 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1486 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1487 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1488 VariantClear(&v);
1490 V_VT(&v) = VT_I4;
1491 V_I4(&v) = 100;
1492 hres = IHTMLStyle_put_verticalAlign(style, v);
1493 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1494 VariantClear(&v);
1496 V_VT(&v) = VT_EMPTY;
1497 hres = IHTMLStyle_get_verticalAlign(style, &v);
1498 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1499 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1500 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1501 VariantClear(&v);
1503 str = (void*)0xdeadbeef;
1504 hres = IHTMLStyle_get_textAlign(style, &str);
1505 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1506 ok(!str, "textAlign != NULL\n");
1508 str = a2bstr("center");
1509 hres = IHTMLStyle_put_textAlign(style, str);
1510 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1511 SysFreeString(str);
1513 str = NULL;
1514 hres = IHTMLStyle_get_textAlign(style, &str);
1515 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1516 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1517 SysFreeString(str);
1519 V_VT(&v) = VT_NULL;
1520 hres = IHTMLStyle_get_textIndent(style, &v);
1521 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1522 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1523 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1525 V_VT(&v) = VT_I4;
1526 V_I4(&v) = 6;
1527 hres = IHTMLStyle_put_textIndent(style, v);
1528 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1530 V_VT(&v) = VT_NULL;
1531 hres = IHTMLStyle_get_textIndent(style, &v);
1532 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1533 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1534 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1536 str = (void*)0xdeadbeef;
1537 hres = IHTMLStyle_get_textTransform(style, &str);
1538 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1539 ok(!str, "textTransform != NULL\n");
1541 str = a2bstr("lowercase");
1542 hres = IHTMLStyle_put_textTransform(style, str);
1543 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1544 SysFreeString(str);
1546 str = NULL;
1547 hres = IHTMLStyle_get_textTransform(style, &str);
1548 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1549 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1550 SysFreeString(str);
1552 str = (void*)0xdeadbeef;
1553 hres = IHTMLStyle_get_filter(style, &str);
1554 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1555 ok(!str, "filter != NULL\n");
1557 str = a2bstr("alpha(opacity=100)");
1558 hres = IHTMLStyle_put_filter(style, str);
1559 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1560 SysFreeString(str);
1562 V_VT(&v) = VT_EMPTY;
1563 hres = IHTMLStyle_get_zIndex(style, &v);
1564 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1565 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1566 ok(!V_I4(&v), "V_I4(v) != 0\n");
1567 VariantClear(&v);
1569 V_VT(&v) = VT_BSTR;
1570 V_BSTR(&v) = a2bstr("1");
1571 hres = IHTMLStyle_put_zIndex(style, v);
1572 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1573 VariantClear(&v);
1575 V_VT(&v) = VT_EMPTY;
1576 hres = IHTMLStyle_get_zIndex(style, &v);
1577 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1578 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1579 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1580 VariantClear(&v);
1582 /* fontStyle */
1583 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1584 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1586 str = a2bstr("test");
1587 hres = IHTMLStyle_put_fontStyle(style, str);
1588 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1589 SysFreeString(str);
1591 str = a2bstr("italic");
1592 hres = IHTMLStyle_put_fontStyle(style, str);
1593 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1594 SysFreeString(str);
1596 str = a2bstr("oblique");
1597 hres = IHTMLStyle_put_fontStyle(style, str);
1598 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1599 SysFreeString(str);
1601 str = a2bstr("normal");
1602 hres = IHTMLStyle_put_fontStyle(style, str);
1603 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1604 SysFreeString(str);
1606 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1607 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1608 SysFreeString(sDefault);
1610 /* overflow */
1611 hres = IHTMLStyle_get_overflow(style, NULL);
1612 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1614 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1615 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1617 str = a2bstr("test");
1618 hres = IHTMLStyle_put_overflow(style, str);
1619 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1620 SysFreeString(str);
1622 str = a2bstr("visible");
1623 hres = IHTMLStyle_put_overflow(style, str);
1624 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1625 SysFreeString(str);
1627 str = a2bstr("scroll");
1628 hres = IHTMLStyle_put_overflow(style, str);
1629 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1630 SysFreeString(str);
1632 str = a2bstr("hidden");
1633 hres = IHTMLStyle_put_overflow(style, str);
1634 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1635 SysFreeString(str);
1637 str = a2bstr("auto");
1638 hres = IHTMLStyle_put_overflow(style, str);
1639 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1640 SysFreeString(str);
1642 hres = IHTMLStyle_get_overflow(style, &str);
1643 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1644 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1645 SysFreeString(str);
1647 str = a2bstr("");
1648 hres = IHTMLStyle_put_overflow(style, str);
1649 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1650 SysFreeString(str);
1652 hres = IHTMLStyle_get_overflow(style, &str);
1653 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1654 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1655 SysFreeString(str);
1657 /* restore overflow default */
1658 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1659 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1660 SysFreeString(sOverflowDefault);
1662 /* Attribute Tests*/
1663 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1664 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1666 str = a2bstr("position");
1667 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1668 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1670 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1671 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1672 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1673 VariantClear(&v);
1675 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1676 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1678 V_VT(&v) = VT_BSTR;
1679 V_BSTR(&v) = a2bstr("absolute");
1680 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1681 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1682 VariantClear(&v);
1684 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1685 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1686 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1687 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1688 VariantClear(&v);
1690 V_VT(&v) = VT_BSTR;
1691 V_BSTR(&v) = NULL;
1692 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1693 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1694 VariantClear(&v);
1696 SysFreeString(str);
1698 str = a2bstr("borderLeftStyle");
1699 test_border_styles(style, str);
1700 SysFreeString(str);
1702 str = a2bstr("borderbottomstyle");
1703 test_border_styles(style, str);
1704 SysFreeString(str);
1706 str = a2bstr("borderrightstyle");
1707 test_border_styles(style, str);
1708 SysFreeString(str);
1710 str = a2bstr("bordertopstyle");
1711 test_border_styles(style, str);
1712 SysFreeString(str);
1714 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1715 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1717 str = a2bstr("none dotted dashed solid");
1718 hres = IHTMLStyle_put_borderStyle(style, str);
1719 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1720 SysFreeString(str);
1722 str = a2bstr("none dotted dashed solid");
1723 hres = IHTMLStyle_get_borderStyle(style, &str);
1724 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1725 ok(!strcmp_wa(str, "none dotted dashed solid"),
1726 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1727 SysFreeString(str);
1729 str = a2bstr("double groove ridge inset");
1730 hres = IHTMLStyle_put_borderStyle(style, str);
1731 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1732 SysFreeString(str);
1734 str = a2bstr("window-inset outset ridge inset");
1735 hres = IHTMLStyle_put_borderStyle(style, str);
1736 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1737 SysFreeString(str);
1739 str = a2bstr("window-inset");
1740 hres = IHTMLStyle_put_borderStyle(style, str);
1741 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1742 SysFreeString(str);
1744 str = a2bstr("none none none none none");
1745 hres = IHTMLStyle_put_borderStyle(style, str);
1746 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1747 SysFreeString(str);
1749 str = a2bstr("invalid none none none");
1750 hres = IHTMLStyle_put_borderStyle(style, str);
1751 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1752 SysFreeString(str);
1754 str = a2bstr("none invalid none none");
1755 hres = IHTMLStyle_put_borderStyle(style, str);
1756 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1757 SysFreeString(str);
1759 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1760 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1761 SysFreeString(sDefault);
1763 /* backgoundColor */
1764 hres = IHTMLStyle_get_backgroundColor(style, &v);
1765 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1766 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1767 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1768 VariantClear(&v);
1770 V_VT(&v) = VT_BSTR;
1771 V_BSTR(&v) = a2bstr("red");
1772 hres = IHTMLStyle_put_backgroundColor(style, v);
1773 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1774 VariantClear(&v);
1776 hres = IHTMLStyle_get_backgroundColor(style, &v);
1777 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1778 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1779 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1780 VariantClear(&v);
1782 str = a2bstr("fixed");
1783 hres = IHTMLStyle_put_backgroundAttachment(style, str);
1784 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
1785 SysFreeString(str);
1787 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
1788 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
1789 ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str));
1790 SysFreeString(str);
1792 /* padding */
1793 hres = IHTMLStyle_get_padding(style, &str);
1794 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1795 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1796 SysFreeString(str);
1798 hres = IHTMLStyle_get_paddingTop(style, &v);
1799 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1800 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1801 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1803 V_VT(&v) = VT_I4;
1804 V_I4(&v) = 6;
1805 hres = IHTMLStyle_put_paddingTop(style, v);
1806 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1808 hres = IHTMLStyle_get_paddingTop(style, &v);
1809 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1810 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1811 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1812 VariantClear(&v);
1814 hres = IHTMLStyle_get_paddingRight(style, &v);
1815 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1816 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1817 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1819 V_VT(&v) = VT_I4;
1820 V_I4(&v) = 6;
1821 hres = IHTMLStyle_put_paddingRight(style, v);
1822 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1824 hres = IHTMLStyle_get_paddingRight(style, &v);
1825 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1826 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1827 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1828 VariantClear(&v);
1830 hres = IHTMLStyle_get_paddingBottom(style, &v);
1831 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1832 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1833 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1835 V_VT(&v) = VT_I4;
1836 V_I4(&v) = 6;
1837 hres = IHTMLStyle_put_paddingBottom(style, v);
1838 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1840 hres = IHTMLStyle_get_paddingBottom(style, &v);
1841 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1842 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1843 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1844 VariantClear(&v);
1846 str = a2bstr("1");
1847 hres = IHTMLStyle_put_padding(style, str);
1848 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1849 SysFreeString(str);
1851 hres = IHTMLStyle_get_padding(style, &str);
1852 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1853 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1854 SysFreeString(str);
1856 /* PaddingLeft */
1857 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1858 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1859 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1860 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1862 V_VT(&v) = VT_BSTR;
1863 V_BSTR(&v) = a2bstr("10");
1864 hres = IHTMLStyle_put_paddingLeft(style, v);
1865 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1866 VariantClear(&v);
1868 hres = IHTMLStyle_get_paddingLeft(style, &v);
1869 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1870 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1871 VariantClear(&v);
1873 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1874 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1876 /* BackgroundRepeat */
1877 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1878 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1880 str = a2bstr("invalid");
1881 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1882 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1883 SysFreeString(str);
1885 str = a2bstr("repeat");
1886 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1887 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1888 SysFreeString(str);
1890 str = a2bstr("no-repeat");
1891 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1892 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1893 SysFreeString(str);
1895 str = a2bstr("repeat-x");
1896 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1897 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1898 SysFreeString(str);
1900 str = a2bstr("repeat-y");
1901 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1902 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1903 SysFreeString(str);
1905 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1906 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1907 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1908 SysFreeString(str);
1910 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1911 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1912 SysFreeString(sDefault);
1914 /* BorderColor */
1915 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1916 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1918 str = a2bstr("red green red blue");
1919 hres = IHTMLStyle_put_borderColor(style, str);
1920 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1921 SysFreeString(str);
1923 hres = IHTMLStyle_get_borderColor(style, &str);
1924 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1925 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1926 SysFreeString(str);
1928 hres = IHTMLStyle_put_borderColor(style, sDefault);
1929 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1930 SysFreeString(sDefault);
1932 /* BorderRight */
1933 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1934 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1936 str = a2bstr("thick dotted red");
1937 hres = IHTMLStyle_put_borderRight(style, str);
1938 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1939 SysFreeString(str);
1941 /* IHTMLStyle_get_borderRight appears to have a bug where
1942 it returns the first letter of the color. So we check
1943 each style individually.
1945 V_BSTR(&v) = NULL;
1946 hres = IHTMLStyle_get_borderRightColor(style, &v);
1947 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1948 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1949 VariantClear(&v);
1951 V_BSTR(&v) = NULL;
1952 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1953 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1954 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1955 VariantClear(&v);
1957 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1958 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1959 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1960 SysFreeString(str);
1962 hres = IHTMLStyle_put_borderRight(style, sDefault);
1963 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1964 SysFreeString(sDefault);
1966 /* BorderTop */
1967 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1968 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1970 str = a2bstr("thick dotted red");
1971 hres = IHTMLStyle_put_borderTop(style, str);
1972 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1973 SysFreeString(str);
1975 /* IHTMLStyle_get_borderTop appears to have a bug where
1976 it returns the first letter of the color. So we check
1977 each style individually.
1979 V_BSTR(&v) = NULL;
1980 hres = IHTMLStyle_get_borderTopColor(style, &v);
1981 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1982 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1983 VariantClear(&v);
1985 V_BSTR(&v) = NULL;
1986 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1987 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1988 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1989 VariantClear(&v);
1991 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1992 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1993 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1994 SysFreeString(str);
1996 hres = IHTMLStyle_put_borderTop(style, sDefault);
1997 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1998 SysFreeString(sDefault);
2000 /* BorderBottom */
2001 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2002 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2004 str = a2bstr("thick dotted red");
2005 hres = IHTMLStyle_put_borderBottom(style, str);
2006 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2007 SysFreeString(str);
2009 /* IHTMLStyle_get_borderBottom appears to have a bug where
2010 it returns the first letter of the color. So we check
2011 each style individually.
2013 V_BSTR(&v) = NULL;
2014 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2015 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2016 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2017 VariantClear(&v);
2019 V_BSTR(&v) = NULL;
2020 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2021 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2022 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2023 VariantClear(&v);
2025 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2026 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2027 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2028 SysFreeString(str);
2030 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2031 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2032 SysFreeString(sDefault);
2034 /* BorderLeft */
2035 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2036 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2038 str = a2bstr("thick dotted red");
2039 hres = IHTMLStyle_put_borderLeft(style, str);
2040 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2041 SysFreeString(str);
2043 /* IHTMLStyle_get_borderLeft appears to have a bug where
2044 it returns the first letter of the color. So we check
2045 each style individually.
2047 V_BSTR(&v) = NULL;
2048 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2049 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2050 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2051 VariantClear(&v);
2053 V_BSTR(&v) = NULL;
2054 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2055 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2056 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2057 VariantClear(&v);
2059 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2060 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2061 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2062 SysFreeString(str);
2064 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2065 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2066 SysFreeString(sDefault);
2068 /* backgroundPositionX */
2069 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2070 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2071 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2072 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2073 VariantClear(&v);
2075 V_VT(&v) = VT_BSTR;
2076 V_BSTR(&v) = a2bstr("10px");
2077 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2078 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2079 VariantClear(&v);
2081 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2082 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2083 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2084 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2085 VariantClear(&v);
2087 /* backgroundPositionY */
2088 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2089 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2090 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2091 VariantClear(&v);
2093 V_VT(&v) = VT_BSTR;
2094 V_BSTR(&v) = a2bstr("15px");
2095 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2096 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2097 VariantClear(&v);
2099 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2100 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2101 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2102 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2103 VariantClear(&v);
2105 /* backgroundPosition */
2106 str = NULL;
2107 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2108 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2109 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2110 SysFreeString(str);
2112 str = a2bstr("center 20%");
2113 hres = IHTMLStyle_put_backgroundPosition(style, str);
2114 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2115 SysFreeString(str);
2117 str = NULL;
2118 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2119 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2120 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2121 SysFreeString(str);
2123 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2124 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2125 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2126 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2127 VariantClear(&v);
2129 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2130 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2131 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2132 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2133 VariantClear(&v);
2135 /* borderTopWidth */
2136 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2137 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2139 V_VT(&v) = VT_BSTR;
2140 V_BSTR(&v) = a2bstr("10px");
2141 hres = IHTMLStyle_put_borderTopWidth(style, v);
2142 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2143 VariantClear(&v);
2145 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2146 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2147 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2148 VariantClear(&v);
2150 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2151 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2152 VariantClear(&vDefault);
2154 /* borderRightWidth */
2155 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2156 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2158 V_VT(&v) = VT_BSTR;
2159 V_BSTR(&v) = a2bstr("10");
2160 hres = IHTMLStyle_put_borderRightWidth(style, v);
2161 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2162 VariantClear(&v);
2164 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2165 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2166 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2167 VariantClear(&v);
2169 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2170 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2171 VariantClear(&vDefault);
2173 /* borderBottomWidth */
2174 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2175 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2177 V_VT(&v) = VT_BSTR;
2178 V_BSTR(&v) = a2bstr("10");
2179 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2180 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2181 VariantClear(&v);
2183 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2184 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2185 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2186 VariantClear(&v);
2188 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2189 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2190 VariantClear(&vDefault);
2192 /* borderLeftWidth */
2193 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2194 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2196 V_VT(&v) = VT_BSTR;
2197 V_BSTR(&v) = a2bstr("10");
2198 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2199 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2200 VariantClear(&v);
2202 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2203 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2204 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2205 VariantClear(&v);
2207 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2208 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2209 VariantClear(&vDefault);
2211 /* wordSpacing */
2212 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2213 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2215 V_VT(&v) = VT_BSTR;
2216 V_BSTR(&v) = a2bstr("10");
2217 hres = IHTMLStyle_put_wordSpacing(style, v);
2218 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2219 VariantClear(&v);
2221 hres = IHTMLStyle_get_wordSpacing(style, &v);
2222 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2223 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2224 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2225 VariantClear(&v);
2227 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2228 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2229 VariantClear(&vDefault);
2231 /* letterSpacing */
2232 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2233 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2235 V_VT(&v) = VT_BSTR;
2236 V_BSTR(&v) = a2bstr("11");
2237 hres = IHTMLStyle_put_letterSpacing(style, v);
2238 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2239 VariantClear(&v);
2241 hres = IHTMLStyle_get_letterSpacing(style, &v);
2242 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2243 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2244 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2245 VariantClear(&v);
2247 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2248 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2249 VariantClear(&vDefault);
2251 /* borderTopColor */
2252 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2253 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2255 V_VT(&v) = VT_BSTR;
2256 V_BSTR(&v) = a2bstr("red");
2257 hres = IHTMLStyle_put_borderTopColor(style, v);
2258 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2259 VariantClear(&v);
2261 hres = IHTMLStyle_get_borderTopColor(style, &v);
2262 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2263 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2264 VariantClear(&v);
2266 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2267 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2269 /* borderRightColor */
2270 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2271 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2273 V_VT(&v) = VT_BSTR;
2274 V_BSTR(&v) = a2bstr("blue");
2275 hres = IHTMLStyle_put_borderRightColor(style, v);
2276 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2277 VariantClear(&v);
2279 hres = IHTMLStyle_get_borderRightColor(style, &v);
2280 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2281 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2282 VariantClear(&v);
2284 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2285 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2287 /* borderBottomColor */
2288 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2289 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2291 V_VT(&v) = VT_BSTR;
2292 V_BSTR(&v) = a2bstr("cyan");
2293 hres = IHTMLStyle_put_borderBottomColor(style, v);
2294 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2295 VariantClear(&v);
2297 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2298 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2299 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2300 VariantClear(&v);
2302 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2303 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2305 /* borderLeftColor */
2306 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2307 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2309 V_VT(&v) = VT_BSTR;
2310 V_BSTR(&v) = a2bstr("cyan");
2311 hres = IHTMLStyle_put_borderLeftColor(style, v);
2312 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2313 VariantClear(&v);
2315 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2316 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2317 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2318 VariantClear(&v);
2320 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2321 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2323 /* clip */
2324 hres = IHTMLStyle_get_clip(style, &str);
2325 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2326 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2328 str = a2bstr("rect(0px 1px 500px 505px)");
2329 hres = IHTMLStyle_put_clip(style, str);
2330 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2331 SysFreeString(str);
2333 hres = IHTMLStyle_get_clip(style, &str);
2334 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2335 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
2336 SysFreeString(str);
2338 /* clear */
2339 hres = IHTMLStyle_get_clear(style, &str);
2340 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2341 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2343 str = a2bstr("both");
2344 hres = IHTMLStyle_put_clear(style, str);
2345 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2346 SysFreeString(str);
2348 hres = IHTMLStyle_get_clear(style, &str);
2349 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2350 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2351 SysFreeString(str);
2353 /* pageBreakAfter */
2354 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2355 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2356 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2358 str = a2bstr("always");
2359 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2360 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2361 SysFreeString(str);
2363 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2364 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2365 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2366 SysFreeString(str);
2368 /* pageBreakBefore */
2369 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2370 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2371 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2373 str = a2bstr("always");
2374 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2375 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2376 SysFreeString(str);
2378 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2379 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2380 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2381 SysFreeString(str);
2383 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2384 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2386 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2387 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2388 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2390 str = (void*)0xdeadbeef;
2391 hres = IHTMLStyle_get_whiteSpace(style, &str);
2392 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2393 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2395 str = a2bstr("nowrap");
2396 hres = IHTMLStyle_put_whiteSpace(style, str);
2397 SysFreeString(str);
2398 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2400 str = NULL;
2401 hres = IHTMLStyle_get_whiteSpace(style, &str);
2402 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2403 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2404 SysFreeString(str);
2406 /* listStyleType */
2407 hres = IHTMLStyle_get_listStyleType(style, &str);
2408 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2409 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2411 str = a2bstr("square");
2412 hres = IHTMLStyle_put_listStyleType(style, str);
2413 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2414 SysFreeString(str);
2416 str = NULL;
2417 hres = IHTMLStyle_get_listStyleType(style, &str);
2418 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2419 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2421 str = a2bstr("inside");
2422 hres = IHTMLStyle_put_listStylePosition(style, str);
2423 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2424 SysFreeString(str);
2426 hres = IHTMLStyle_get_listStylePosition(style, &str);
2427 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2428 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2429 SysFreeString(str);
2431 str = a2bstr("decimal-leading-zero none inside");
2432 hres = IHTMLStyle_put_listStyle(style, str);
2433 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
2434 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
2435 SysFreeString(str);
2437 if (hres != E_INVALIDARG) {
2438 hres = IHTMLStyle_get_listStyle(style, &str);
2439 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
2440 ok(strstr_wa(str, "decimal-leading-zero") &&
2441 strstr_wa(str, "none") != NULL &&
2442 strstr_wa(str, "inside") != NULL,
2443 "listStyle = %s\n", wine_dbgstr_w(str));
2444 SysFreeString(str);
2445 } else {
2446 win_skip("IHTMLStyle_put_listStyle already failed\n");
2449 str = (void*)0xdeadbeef;
2450 hres = IHTMLStyle_get_styleFloat(style, &str);
2451 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2452 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
2454 str = a2bstr("left");
2455 hres = IHTMLStyle_put_styleFloat(style, str);
2456 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
2457 SysFreeString(str);
2459 str = NULL;
2460 hres = IHTMLStyle_get_styleFloat(style, &str);
2461 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2462 ok(!strcmp_wa(str, "left"), "styleFloat = %s\n", wine_dbgstr_w(str));
2464 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2465 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2466 if(SUCCEEDED(hres)) {
2467 test_style2(style2);
2468 IHTMLStyle2_Release(style2);
2471 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2472 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2473 if(SUCCEEDED(hres)) {
2474 test_style3(style3);
2475 IHTMLStyle3_Release(style3);
2478 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2479 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2480 if(SUCCEEDED(hres)) {
2481 test_style4(style4);
2482 IHTMLStyle4_Release(style4);
2485 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
2486 if(SUCCEEDED(hres)) {
2487 test_style5(style5);
2488 IHTMLStyle5_Release(style5);
2489 }else {
2490 win_skip("IHTMLStyle5 not available\n");
2493 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2494 if(SUCCEEDED(hres)) {
2495 test_style6(style6);
2496 IHTMLStyle6_Release(style6);
2497 }else {
2498 win_skip("IHTMLStyle6 not available\n");
2502 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2503 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2505 BSTR str;
2506 HRESULT hres;
2508 str = (void*)0xdeadbeef;
2509 hres = IHTMLStyle_get_filter(style, &str);
2510 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2511 if(exval)
2512 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2513 else
2514 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2516 SysFreeString(str);
2519 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2520 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2522 BSTR str;
2523 HRESULT hres;
2525 str = (void*)0xdeadbeef;
2526 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2527 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2528 if(exval)
2529 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2530 else
2531 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2533 SysFreeString(str);
2536 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2537 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2539 BSTR str = a2bstr(val);
2540 HRESULT hres;
2542 hres = IHTMLStyle_put_filter(style, str);
2543 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2544 SysFreeString(str);
2546 _test_style_filter(line, style, val);
2549 static void test_style_filters(IHTMLElement *elem)
2551 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2552 IHTMLCurrentStyle2 *current_style2;
2553 IHTMLCurrentStyle *current_style;
2554 IHTMLStyle *style;
2555 HRESULT hres;
2557 hres = IHTMLElement_get_style(elem, &style);
2558 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2560 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2561 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2563 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2565 test_style_filter(style, NULL);
2566 test_current_style_filter(current_style2, NULL);
2567 set_style_filter(style, "alpha(opacity=50.0040)");
2568 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2569 set_style_filter(style, "alpha(opacity=100)");
2571 IHTMLStyle_Release(style);
2573 hres = IHTMLElement_get_style(elem, &style);
2574 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2576 test_style_filter(style, "alpha(opacity=100)");
2577 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2578 set_style_filter(style, NULL);
2579 set_style_filter(style, "alpha(opacity=100)");
2580 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2581 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2582 test_style_filter(style, NULL);
2585 IHTMLCurrentStyle2_Release(current_style2);
2586 IHTMLStyle_Release(style);
2587 IHTMLElement2_Release(elem2);
2590 static void test_current_style(IHTMLCurrentStyle *current_style)
2592 IHTMLCurrentStyle2 *current_style2;
2593 VARIANT_BOOL b;
2594 BSTR str;
2595 HRESULT hres;
2596 VARIANT v;
2598 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2599 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2600 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2601 SysFreeString(str);
2603 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2604 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2605 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2606 SysFreeString(str);
2608 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2609 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2610 SysFreeString(str);
2612 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2613 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2614 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2615 SysFreeString(str);
2617 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2618 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2619 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2620 SysFreeString(str);
2622 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2623 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2624 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2625 SysFreeString(str);
2627 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2628 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2629 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2630 SysFreeString(str);
2632 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2633 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2634 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2635 SysFreeString(str);
2637 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2638 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2639 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2640 SysFreeString(str);
2642 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2643 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2644 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2645 SysFreeString(str);
2647 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2648 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2649 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2650 SysFreeString(str);
2652 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2653 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2654 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2655 SysFreeString(str);
2657 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2658 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2659 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2660 SysFreeString(str);
2662 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2663 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2664 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2665 SysFreeString(str);
2667 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2668 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2669 SysFreeString(str);
2671 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2672 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2673 SysFreeString(str);
2675 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2676 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2677 SysFreeString(str);
2679 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2680 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2681 SysFreeString(str);
2683 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2684 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2685 SysFreeString(str);
2687 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2688 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2689 SysFreeString(str);
2691 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2692 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2693 SysFreeString(str);
2695 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2696 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2697 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2698 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2699 VariantClear(&v);
2701 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2702 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2703 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2704 VariantClear(&v);
2706 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2707 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2708 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2709 VariantClear(&v);
2711 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2712 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2713 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2714 VariantClear(&v);
2716 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2717 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2718 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2719 VariantClear(&v);
2721 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2722 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2723 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2724 VariantClear(&v);
2726 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2727 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2728 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2729 VariantClear(&v);
2731 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2732 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2733 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2734 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2735 VariantClear(&v);
2737 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2738 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2739 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2740 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2741 VariantClear(&v);
2743 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2744 ok(hres == S_OK, "get_marginRight 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_marginLeft(current_style, &v);
2749 ok(hres == S_OK, "get_marginLeft 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_borderLeftWidth(current_style, &v);
2754 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2755 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2756 VariantClear(&v);
2758 V_BSTR(&v) = NULL;
2759 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2760 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2761 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2762 VariantClear(&v);
2764 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2765 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2766 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2767 VariantClear(&v);
2769 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2770 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2771 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2772 VariantClear(&v);
2774 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2775 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2776 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2777 VariantClear(&v);
2779 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2780 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2781 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2782 VariantClear(&v);
2784 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2785 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2786 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2787 VariantClear(&v);
2789 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2790 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2791 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2792 VariantClear(&v);
2794 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2795 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2796 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2797 VariantClear(&v);
2799 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2800 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2801 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2802 VariantClear(&v);
2804 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2805 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2806 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2807 VariantClear(&v);
2809 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2810 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2811 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2812 VariantClear(&v);
2814 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2815 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2816 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2817 VariantClear(&v);
2819 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2820 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2821 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2822 VariantClear(&v);
2824 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2825 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2826 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2827 VariantClear(&v);
2829 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2830 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2831 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2832 VariantClear(&v);
2834 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2835 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2836 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2837 VariantClear(&v);
2839 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2840 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2841 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2842 VariantClear(&v);
2844 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2845 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2846 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2847 VariantClear(&v);
2849 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2850 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2851 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2852 VariantClear(&v);
2854 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
2855 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2856 SysFreeString(str);
2858 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2860 b = 100;
2861 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2862 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2863 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2865 IHTMLCurrentStyle2_Release(current_style2);
2868 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2870 static void basic_style_test(IHTMLDocument2 *doc)
2872 IHTMLCurrentStyle *cstyle;
2873 IHTMLElement *elem;
2874 IHTMLStyle *style;
2875 HRESULT hres;
2877 hres = IHTMLDocument2_get_body(doc, &elem);
2878 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2880 hres = IHTMLElement_get_style(elem, &style);
2881 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2883 test_body_style(style);
2885 cstyle = get_current_style(elem);
2886 test_current_style(cstyle);
2887 IHTMLCurrentStyle_Release(cstyle);
2888 IHTMLElement_Release(elem);
2890 elem = get_element_by_id(doc, "divid");
2891 test_style_filters(elem);
2893 test_set_csstext(style);
2894 IHTMLStyle_Release(style);
2895 IHTMLElement_Release(elem);
2898 static const char runtimestyle_test_str[] =
2899 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2901 static void runtimestyle_test(IHTMLDocument2 *doc)
2903 IHTMLStyle *style, *runtime_style;
2904 IHTMLElement2 *elem2;
2905 IHTMLElement *elem;
2906 BSTR str;
2907 HRESULT hres;
2909 hres = IHTMLDocument2_get_body(doc, &elem);
2910 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2912 elem2 = get_elem2_iface((IUnknown*)elem);
2914 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2915 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2917 hres = IHTMLElement_get_style(elem, &style);
2918 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2920 test_text_decoration(style, NULL);
2921 test_text_decoration(runtime_style, NULL);
2922 set_text_decoration(style, "underline");
2923 test_text_decoration(style, "underline");
2925 hres = IHTMLStyle_get_textDecoration(style, &str);
2926 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2927 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2928 SysFreeString(str);
2930 set_text_decoration(runtime_style, "blink");
2931 test_text_decoration(runtime_style, "blink");
2933 hres = IHTMLStyle_get_textDecoration(style, &str);
2934 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2935 todo_wine
2936 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2937 SysFreeString(str);
2939 IHTMLStyle_Release(runtime_style);
2940 IHTMLStyle_Release(style);
2941 IHTMLElement2_Release(elem2);
2942 IHTMLElement_Release(elem);
2945 static IHTMLDocument2 *notif_doc;
2946 static BOOL doc_complete;
2948 static IHTMLDocument2 *create_document(void)
2950 IHTMLDocument2 *doc;
2951 IHTMLDocument5 *doc5;
2952 HRESULT hres;
2954 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2955 &IID_IHTMLDocument2, (void**)&doc);
2956 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2957 if(FAILED(hres))
2958 return NULL;
2960 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2961 if(FAILED(hres)) {
2962 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2963 IHTMLDocument2_Release(doc);
2964 return NULL;
2967 IHTMLDocument5_Release(doc5);
2968 return doc;
2971 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2972 REFIID riid, void**ppv)
2974 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2975 *ppv = iface;
2976 return S_OK;
2979 ok(0, "unexpected call\n");
2980 return E_NOINTERFACE;
2983 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2985 return 2;
2988 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2990 return 1;
2993 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2995 if(dispID == DISPID_READYSTATE){
2996 BSTR state;
2997 HRESULT hres;
2999 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3000 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3002 if(!strcmp_wa(state, "complete"))
3003 doc_complete = TRUE;
3005 SysFreeString(state);
3008 return S_OK;
3011 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
3013 ok(0, "unexpected call\n");
3014 return E_NOTIMPL;
3017 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3018 PropertyNotifySink_QueryInterface,
3019 PropertyNotifySink_AddRef,
3020 PropertyNotifySink_Release,
3021 PropertyNotifySink_OnChanged,
3022 PropertyNotifySink_OnRequestEdit
3025 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
3027 static IHTMLDocument2 *create_doc_with_string(const char *str)
3029 IPersistStreamInit *init;
3030 IStream *stream;
3031 IHTMLDocument2 *doc;
3032 HGLOBAL mem;
3033 SIZE_T len;
3035 notif_doc = doc = create_document();
3036 if(!doc)
3037 return NULL;
3039 doc_complete = FALSE;
3040 len = strlen(str);
3041 mem = GlobalAlloc(0, len);
3042 memcpy(mem, str, len);
3043 CreateStreamOnHGlobal(mem, TRUE, &stream);
3045 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3047 IPersistStreamInit_Load(init, stream);
3048 IPersistStreamInit_Release(init);
3049 IStream_Release(stream);
3051 return doc;
3054 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3056 IConnectionPointContainer *container;
3057 IConnectionPoint *cp;
3058 DWORD cookie;
3059 HRESULT hres;
3061 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3062 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3064 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3065 IConnectionPointContainer_Release(container);
3066 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3068 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3069 IConnectionPoint_Release(cp);
3070 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3073 typedef void (*style_test_t)(IHTMLDocument2*);
3075 static void run_test(const char *str, style_test_t test)
3077 IHTMLDocument2 *doc;
3078 ULONG ref;
3079 MSG msg;
3081 doc = create_doc_with_string(str);
3082 if(!doc)
3083 return;
3085 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
3087 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3088 TranslateMessage(&msg);
3089 DispatchMessageW(&msg);
3092 test(doc);
3094 ref = IHTMLDocument2_Release(doc);
3095 ok(!ref || broken(ref == 1), /* Vista */
3096 "ref = %d\n", ref);
3100 START_TEST(style)
3102 CoInitialize(NULL);
3104 run_test(basic_test_str, basic_style_test);
3105 run_test(runtimestyle_test_str, runtimestyle_test);
3107 CoUninitialize();