mshtml: Added IHTMLStyle2::tableLayout property implementation.
[wine.git] / dlls / mshtml / tests / style.c
blobf279fb37d1325248b643e23ac88a31fd2b295fee
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 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
63 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
65 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
66 if(expect)
67 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
68 else
69 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
72 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
73 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
75 IHTMLElement2 *elem;
76 HRESULT hres;
78 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
79 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
80 return elem;
83 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
84 static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
86 IHTMLCurrentStyle2 *current_style2;
87 HRESULT hres;
89 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
90 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
91 return current_style2;
94 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
96 HRESULT hres;
97 IHTMLDocument3 *doc3;
98 IHTMLElement *result;
99 BSTR idW = a2bstr(id);
101 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
102 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
104 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
105 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
106 ok(result != NULL, "result == NULL\n");
107 SysFreeString(idW);
109 IHTMLDocument3_Release(doc3);
110 return result;
113 #define get_current_style(e) _get_current_style(__LINE__,e)
114 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
116 IHTMLCurrentStyle *cstyle;
117 IHTMLElement2 *elem2;
118 HRESULT hres;
120 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
121 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
123 cstyle = NULL;
124 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
125 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
126 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
128 IHTMLElement2_Release(elem2);
129 return cstyle;
132 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
133 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
135 HRESULT hres;
136 DISPID dispid;
138 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
139 LOCALE_USER_DEFAULT, &dispid);
140 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
141 if(hres == S_OK)
143 DISPPARAMS params = {NULL,NULL,0,0};
144 DISPID dispidNamed = DISPID_PROPERTYPUT;
145 VARIANT ret;
146 VARIANT vDefault;
147 VARIANTARG arg;
149 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
150 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
151 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
153 params.cArgs = 1;
154 params.cNamedArgs = 1;
155 params.rgdispidNamedArgs = &dispidNamed;
156 V_VT(&arg) = VT_BSTR;
157 V_BSTR(&arg) = a2bstr("none");
158 params.rgvarg = &arg;
159 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
160 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
161 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
162 VariantClear(&arg);
164 V_VT(&arg) = VT_BSTR;
165 V_BSTR(&arg) = a2bstr("dotted");
166 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
167 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
168 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
169 VariantClear(&arg);
171 V_VT(&arg) = VT_BSTR;
172 V_BSTR(&arg) = a2bstr("dashed");
173 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
174 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
175 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
176 VariantClear(&arg);
178 V_VT(&arg) = VT_BSTR;
179 V_BSTR(&arg) = a2bstr("solid");
180 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
181 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
182 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
183 VariantClear(&arg);
185 V_VT(&arg) = VT_BSTR;
186 V_BSTR(&arg) = a2bstr("double");
187 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
188 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
189 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
190 VariantClear(&arg);
192 V_VT(&arg) = VT_BSTR;
193 V_BSTR(&arg) = a2bstr("groove");
194 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
195 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
196 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
197 VariantClear(&arg);
199 V_VT(&arg) = VT_BSTR;
200 V_BSTR(&arg) = a2bstr("ridge");
201 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
202 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
203 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
204 VariantClear(&arg);
206 V_VT(&arg) = VT_BSTR;
207 V_BSTR(&arg) = a2bstr("inset");
208 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
209 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
210 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
211 VariantClear(&arg);
213 V_VT(&arg) = VT_BSTR;
214 V_BSTR(&arg) = a2bstr("outset");
215 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
216 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
217 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
218 VariantClear(&arg);
220 V_VT(&arg) = VT_BSTR;
221 V_BSTR(&arg) = a2bstr("invalid");
222 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
223 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
224 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
225 VariantClear(&arg);
227 params.rgvarg = &vDefault;
228 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
229 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
230 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
231 VariantClear(&vDefault);
235 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
236 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
238 BSTR text = (void*)0xdeadbeef;
239 HRESULT hres;
241 hres = IHTMLStyle_get_cssText(style, &text);
242 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
243 if(extext)
244 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
245 else
246 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
248 SysFreeString(text);
251 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
252 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
254 BSTR tmp;
255 HRESULT hres;
257 tmp = a2bstr(text);
258 hres = IHTMLStyle_put_cssText(style, tmp);
259 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
260 SysFreeString(tmp);
263 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
264 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
266 BSTR str = a2bstr(attr);
267 VARIANT_BOOL b = 100;
268 HRESULT hres;
270 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
271 SysFreeString(str);
272 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
273 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
276 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
277 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
279 BSTR str;
280 HRESULT hres;
282 str = a2bstr(v);
283 hres = IHTMLStyle_put_textDecoration(style, str);
284 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
285 SysFreeString(str);
288 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
289 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
291 BSTR str;
292 HRESULT hres;
294 hres = IHTMLStyle_get_textDecoration(style, &str);
295 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
296 if(exdec)
297 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
298 else
299 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
300 SysFreeString(str);
303 static void test_set_csstext(IHTMLStyle *style)
305 VARIANT v;
306 HRESULT hres;
308 test_style_set_csstext(style, "background-color: black;");
310 hres = IHTMLStyle_get_backgroundColor(style, &v);
311 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
312 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
313 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
314 VariantClear(&v);
317 static void test_style2(IHTMLStyle2 *style2)
319 VARIANT v;
320 BSTR str;
321 HRESULT hres;
323 str = (void*)0xdeadbeef;
324 hres = IHTMLStyle2_get_position(style2, &str);
325 ok(hres == S_OK, "get_position failed: %08x\n", hres);
326 ok(!str, "str != NULL\n");
328 str = a2bstr("absolute");
329 hres = IHTMLStyle2_put_position(style2, str);
330 ok(hres == S_OK, "put_position failed: %08x\n", hres);
331 SysFreeString(str);
333 str = NULL;
334 hres = IHTMLStyle2_get_position(style2, &str);
335 ok(hres == S_OK, "get_position failed: %08x\n", hres);
336 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
337 SysFreeString(str);
339 /* Test right */
340 V_VT(&v) = VT_EMPTY;
341 hres = IHTMLStyle2_get_right(style2, &v);
342 ok(hres == S_OK, "get_top failed: %08x\n", hres);
343 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
344 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
345 VariantClear(&v);
347 V_VT(&v) = VT_BSTR;
348 V_BSTR(&v) = a2bstr("3px");
349 hres = IHTMLStyle2_put_right(style2, v);
350 ok(hres == S_OK, "put_right failed: %08x\n", hres);
351 VariantClear(&v);
353 V_VT(&v) = VT_EMPTY;
354 hres = IHTMLStyle2_get_right(style2, &v);
355 ok(hres == S_OK, "get_right failed: %08x\n", hres);
356 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
357 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
358 VariantClear(&v);
360 /* direction */
361 str = (void*)0xdeadbeef;
362 hres = IHTMLStyle2_get_direction(style2, &str);
363 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
364 ok(!str, "str = %s\n", wine_dbgstr_w(str));
366 str = a2bstr("ltr");
367 hres = IHTMLStyle2_put_direction(style2, str);
368 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
369 SysFreeString(str);
371 str = NULL;
372 hres = IHTMLStyle2_get_direction(style2, &str);
373 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
374 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
375 SysFreeString(str);
377 /* bottom */
378 V_VT(&v) = VT_EMPTY;
379 hres = IHTMLStyle2_get_bottom(style2, &v);
380 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
381 test_var_bstr(&v, NULL);
383 V_VT(&v) = VT_I4;
384 V_I4(&v) = 4;
385 hres = IHTMLStyle2_put_bottom(style2, v);
386 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
388 V_VT(&v) = VT_EMPTY;
389 hres = IHTMLStyle2_get_bottom(style2, &v);
390 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
391 test_var_bstr(&v, "4px");
393 /* overflowX */
394 str = (void*)0xdeadbeef;
395 hres = IHTMLStyle2_get_overflowX(style2, &str);
396 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
397 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
399 str = a2bstr("hidden");
400 hres = IHTMLStyle2_put_overflowX(style2, str);
401 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
402 SysFreeString(str);
404 str = NULL;
405 hres = IHTMLStyle2_get_overflowX(style2, &str);
406 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
407 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
409 /* overflowY */
410 str = (void*)0xdeadbeef;
411 hres = IHTMLStyle2_get_overflowY(style2, &str);
412 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
413 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
415 str = a2bstr("hidden");
416 hres = IHTMLStyle2_put_overflowY(style2, str);
417 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
418 SysFreeString(str);
420 str = NULL;
421 hres = IHTMLStyle2_get_overflowY(style2, &str);
422 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
423 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
425 /* tableLayout */
426 str = a2bstr("fixed");
427 hres = IHTMLStyle2_put_tableLayout(style2, str);
428 ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres);
429 SysFreeString(str);
431 str = (void*)0xdeadbeef;
432 hres = IHTMLStyle2_get_tableLayout(style2, &str);
433 ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres);
434 ok(!strcmp_wa(str, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str));
435 SysFreeString(str);
438 static void test_style3(IHTMLStyle3 *style3)
440 BSTR str;
441 HRESULT hres;
443 str = (void*)0xdeadbeef;
444 hres = IHTMLStyle3_get_wordWrap(style3, &str);
445 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
446 ok(!str, "str != NULL\n");
448 str = a2bstr("break-word");
449 hres = IHTMLStyle3_put_wordWrap(style3, str);
450 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
451 SysFreeString(str);
453 str = NULL;
454 hres = IHTMLStyle3_get_wordWrap(style3, &str);
455 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
456 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
457 SysFreeString(str);
460 static void test_style4(IHTMLStyle4 *style4)
462 HRESULT hres;
463 VARIANT v;
464 VARIANT vdefault;
466 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
467 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
469 V_VT(&v) = VT_BSTR;
470 V_BSTR(&v) = a2bstr("10px");
471 hres = IHTMLStyle4_put_minHeight(style4, v);
472 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
473 VariantClear(&v);
475 hres = IHTMLStyle4_get_minHeight(style4, &v);
476 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
477 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
478 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
479 VariantClear(&v);
481 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
482 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
483 VariantClear(&vdefault);
486 static void test_style6(IHTMLStyle6 *style)
488 BSTR str;
489 HRESULT hres;
491 str = (void*)0xdeadbeef;
492 hres = IHTMLStyle6_get_outline(style, &str);
493 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
494 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
495 SysFreeString(str);
497 str = a2bstr("1px");
498 hres = IHTMLStyle6_put_outline(style, str);
499 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
500 SysFreeString(str);
502 str = (void*)0xdeadbeef;
503 hres = IHTMLStyle6_get_outline(style, &str);
504 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
505 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
506 SysFreeString(str);
508 str = (void*)0xdeadbeef;
509 hres = IHTMLStyle6_get_boxSizing(style, &str);
510 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
511 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
512 SysFreeString(str);
514 str = a2bstr("border-box");
515 hres = IHTMLStyle6_put_boxSizing(style, str);
516 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
517 SysFreeString(str);
519 str = NULL;
520 hres = IHTMLStyle6_get_boxSizing(style, &str);
521 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
522 ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
523 SysFreeString(str);
526 static void test_body_style(IHTMLStyle *style)
528 IHTMLStyle2 *style2;
529 IHTMLStyle3 *style3;
530 IHTMLStyle4 *style4;
531 IHTMLStyle6 *style6;
532 VARIANT_BOOL b;
533 VARIANT v;
534 BSTR str;
535 HRESULT hres;
536 float f;
537 BSTR sOverflowDefault;
538 BSTR sDefault;
539 LONG l;
540 VARIANT vDefault;
542 test_style_csstext(style, NULL);
544 hres = IHTMLStyle_get_position(style, &str);
545 ok(hres == S_OK, "get_position failed: %08x\n", hres);
546 ok(!str, "str=%s\n", wine_dbgstr_w(str));
548 V_VT(&v) = VT_NULL;
549 hres = IHTMLStyle_get_marginRight(style, &v);
550 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
551 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
552 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
554 V_VT(&v) = VT_I4;
555 V_I4(&v) = 6;
556 hres = IHTMLStyle_put_marginRight(style, v);
557 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
559 V_VT(&v) = VT_NULL;
560 hres = IHTMLStyle_get_marginRight(style, &v);
561 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
562 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
563 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
565 V_VT(&v) = VT_NULL;
566 hres = IHTMLStyle_get_marginBottom(style, &v);
567 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
568 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
569 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
571 V_VT(&v) = VT_I4;
572 V_I4(&v) = 6;
573 hres = IHTMLStyle_put_marginBottom(style, v);
574 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
576 V_VT(&v) = VT_NULL;
577 hres = IHTMLStyle_get_marginBottom(style, &v);
578 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
579 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
580 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
582 V_VT(&v) = VT_NULL;
583 hres = IHTMLStyle_get_marginLeft(style, &v);
584 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
585 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
586 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
588 V_VT(&v) = VT_I4;
589 V_I4(&v) = 6;
590 hres = IHTMLStyle_put_marginLeft(style, v);
591 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
593 V_VT(&v) = VT_NULL;
594 hres = IHTMLStyle_get_marginLeft(style, &v);
595 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
596 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
597 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
599 str = (void*)0xdeadbeef;
600 hres = IHTMLStyle_get_fontFamily(style, &str);
601 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
602 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
604 str = (void*)0xdeadbeef;
605 hres = IHTMLStyle_get_fontWeight(style, &str);
606 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
607 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
609 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
610 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
612 str = a2bstr("test");
613 hres = IHTMLStyle_put_fontWeight(style, str);
614 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
615 SysFreeString(str);
617 str = a2bstr("bold");
618 hres = IHTMLStyle_put_fontWeight(style, str);
619 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
620 SysFreeString(str);
622 str = a2bstr("bolder");
623 hres = IHTMLStyle_put_fontWeight(style, str);
624 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
625 SysFreeString(str);
627 str = a2bstr("lighter");
628 hres = IHTMLStyle_put_fontWeight(style, str);
629 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
630 SysFreeString(str);
632 str = a2bstr("100");
633 hres = IHTMLStyle_put_fontWeight(style, str);
634 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
635 SysFreeString(str);
637 str = a2bstr("200");
638 hres = IHTMLStyle_put_fontWeight(style, str);
639 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
640 SysFreeString(str);
642 str = a2bstr("300");
643 hres = IHTMLStyle_put_fontWeight(style, str);
644 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
645 SysFreeString(str);
647 str = a2bstr("400");
648 hres = IHTMLStyle_put_fontWeight(style, str);
649 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
650 SysFreeString(str);
652 str = a2bstr("500");
653 hres = IHTMLStyle_put_fontWeight(style, str);
654 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
655 SysFreeString(str);
657 str = a2bstr("600");
658 hres = IHTMLStyle_put_fontWeight(style, str);
659 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
660 SysFreeString(str);
662 str = a2bstr("700");
663 hres = IHTMLStyle_put_fontWeight(style, str);
664 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
665 SysFreeString(str);
667 str = a2bstr("800");
668 hres = IHTMLStyle_put_fontWeight(style, str);
669 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
670 SysFreeString(str);
672 str = a2bstr("900");
673 hres = IHTMLStyle_put_fontWeight(style, str);
674 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
675 SysFreeString(str);
677 hres = IHTMLStyle_get_fontWeight(style, &str);
678 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
679 ok(!strcmp_wa(str, "900"), "str != style900\n");
680 SysFreeString(str);
682 hres = IHTMLStyle_put_fontWeight(style, sDefault);
683 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
684 SysFreeString(sDefault);
686 /* font Variant */
687 hres = IHTMLStyle_get_fontVariant(style, NULL);
688 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
690 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
691 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
693 str = a2bstr("test");
694 hres = IHTMLStyle_put_fontVariant(style, str);
695 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
696 SysFreeString(str);
698 str = a2bstr("small-caps");
699 hres = IHTMLStyle_put_fontVariant(style, str);
700 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
701 SysFreeString(str);
703 str = a2bstr("normal");
704 hres = IHTMLStyle_put_fontVariant(style, str);
705 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
706 SysFreeString(str);
708 hres = IHTMLStyle_put_fontVariant(style, sDefault);
709 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
710 SysFreeString(sDefault);
712 str = (void*)0xdeadbeef;
713 hres = IHTMLStyle_get_display(style, &str);
714 ok(hres == S_OK, "get_display failed: %08x\n", hres);
715 ok(!str, "display = %s\n", wine_dbgstr_w(str));
717 str = (void*)0xdeadbeef;
718 hres = IHTMLStyle_get_visibility(style, &str);
719 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
720 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
722 V_VT(&v) = VT_NULL;
723 hres = IHTMLStyle_get_fontSize(style, &v);
724 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
725 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
726 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
728 V_VT(&v) = VT_I4;
729 V_I4(&v) = 12;
730 hres = IHTMLStyle_put_fontSize(style, v);
731 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
733 V_VT(&v) = VT_NULL;
734 hres = IHTMLStyle_get_fontSize(style, &v);
735 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
736 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
737 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
739 V_VT(&v) = VT_NULL;
740 hres = IHTMLStyle_get_color(style, &v);
741 ok(hres == S_OK, "get_color failed: %08x\n", hres);
742 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
743 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
745 V_VT(&v) = VT_I4;
746 V_I4(&v) = 0xfdfd;
747 hres = IHTMLStyle_put_color(style, v);
748 ok(hres == S_OK, "put_color failed: %08x\n", hres);
750 V_VT(&v) = VT_NULL;
751 hres = IHTMLStyle_get_color(style, &v);
752 ok(hres == S_OK, "get_color failed: %08x\n", hres);
753 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
754 todo_wine
755 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
757 V_VT(&v) = VT_I4;
758 V_I4(&v) = 3;
759 hres = IHTMLStyle_put_lineHeight(style, v);
760 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
762 hres = IHTMLStyle_get_lineHeight(style, &v);
763 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
764 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
765 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
767 V_VT(&v) = VT_BSTR;
768 V_BSTR(&v) = a2bstr("300%");
769 hres = IHTMLStyle_put_lineHeight(style, v);
770 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
771 VariantClear(&v);
773 hres = IHTMLStyle_get_lineHeight(style, &v);
774 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
775 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
776 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
777 VariantClear(&v);
779 b = 0xfefe;
780 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
781 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
782 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
784 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
785 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
787 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
788 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
789 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
791 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
792 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
794 b = 0xfefe;
795 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
796 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
797 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
799 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
800 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
802 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
803 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
804 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
806 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
807 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
809 b = 0xfefe;
810 hres = IHTMLStyle_get_textDecorationNone(style, &b);
811 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
812 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
814 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
815 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
817 hres = IHTMLStyle_get_textDecorationNone(style, &b);
818 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
819 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
821 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
822 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
824 b = 0xfefe;
825 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
826 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
827 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
829 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
830 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
832 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
833 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
834 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
836 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
837 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
839 b = 0xfefe;
840 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
841 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
842 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
844 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
845 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
847 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
848 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
849 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
851 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
852 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
854 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
855 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
857 str = a2bstr("invalid");
858 hres = IHTMLStyle_put_textDecoration(style, str);
859 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
860 SysFreeString(str);
862 set_text_decoration(style, "none");
863 test_text_decoration(style, "none");
864 set_text_decoration(style, "underline");
865 set_text_decoration(style, "overline");
866 set_text_decoration(style, "line-through");
867 set_text_decoration(style, "blink");
868 set_text_decoration(style, "overline");
869 set_text_decoration(style, "blink");
870 test_text_decoration(style, "blink");
872 hres = IHTMLStyle_put_textDecoration(style, sDefault);
873 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
874 SysFreeString(sDefault);
876 hres = IHTMLStyle_get_posWidth(style, NULL);
877 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
879 hres = IHTMLStyle_get_posWidth(style, &f);
880 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
881 ok(f == 0.0f, "f = %f\n", f);
883 V_VT(&v) = VT_EMPTY;
884 hres = IHTMLStyle_get_width(style, &v);
885 ok(hres == S_OK, "get_width failed: %08x\n", hres);
886 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
887 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
889 hres = IHTMLStyle_put_posWidth(style, 2.2);
890 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
892 hres = IHTMLStyle_get_posWidth(style, &f);
893 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
894 ok(f == 2.0f ||
895 f == 2.2f, /* IE8 */
896 "f = %f\n", f);
898 V_VT(&v) = VT_BSTR;
899 V_BSTR(&v) = a2bstr("auto");
900 hres = IHTMLStyle_put_width(style, v);
901 ok(hres == S_OK, "put_width failed: %08x\n", hres);
902 VariantClear(&v);
904 V_VT(&v) = VT_EMPTY;
905 hres = IHTMLStyle_get_width(style, &v);
906 ok(hres == S_OK, "get_width failed: %08x\n", hres);
907 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
908 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
909 VariantClear(&v);
911 V_VT(&v) = VT_I4;
912 V_I4(&v) = 100;
913 hres = IHTMLStyle_put_width(style, v);
914 ok(hres == S_OK, "put_width failed: %08x\n", hres);
916 V_VT(&v) = VT_EMPTY;
917 hres = IHTMLStyle_get_width(style, &v);
918 ok(hres == S_OK, "get_width failed: %08x\n", hres);
919 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
920 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
921 VariantClear(&v);
923 hres = IHTMLStyle_put_pixelWidth(style, 50);
924 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
926 V_VT(&v) = VT_EMPTY;
927 hres = IHTMLStyle_get_width(style, &v);
928 ok(hres == S_OK, "get_width failed: %08x\n", hres);
929 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
930 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
931 VariantClear(&v);
933 /* margin tests */
934 str = (void*)0xdeadbeef;
935 hres = IHTMLStyle_get_margin(style, &str);
936 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
937 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
939 str = a2bstr("1");
940 hres = IHTMLStyle_put_margin(style, str);
941 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
942 SysFreeString(str);
944 hres = IHTMLStyle_get_margin(style, &str);
945 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
946 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
947 SysFreeString(str);
949 hres = IHTMLStyle_put_margin(style, NULL);
950 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
952 str = (void*)0xdeadbeef;
953 hres = IHTMLStyle_get_marginTop(style, &v);
954 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
955 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
956 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
958 V_VT(&v) = VT_BSTR;
959 V_BSTR(&v) = a2bstr("6px");
960 hres = IHTMLStyle_put_marginTop(style, v);
961 SysFreeString(V_BSTR(&v));
962 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
964 str = (void*)0xdeadbeef;
965 hres = IHTMLStyle_get_marginTop(style, &v);
966 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
967 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
968 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
969 VariantClear(&v);
971 V_VT(&v) = VT_I4;
972 V_I4(&v) = 5;
973 hres = IHTMLStyle_put_marginTop(style, v);
974 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
976 str = (void*)0xdeadbeef;
977 hres = IHTMLStyle_get_marginTop(style, &v);
978 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
979 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
980 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
981 VariantClear(&v);
983 str = NULL;
984 hres = IHTMLStyle_get_border(style, &str);
985 ok(hres == S_OK, "get_border failed: %08x\n", hres);
986 ok(!str || !*str, "str is not empty\n");
987 SysFreeString(str);
989 str = a2bstr("1px");
990 hres = IHTMLStyle_put_border(style, str);
991 ok(hres == S_OK, "put_border failed: %08x\n", hres);
992 SysFreeString(str);
994 V_VT(&v) = VT_EMPTY;
995 hres = IHTMLStyle_get_left(style, &v);
996 ok(hres == S_OK, "get_left failed: %08x\n", hres);
997 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
998 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
999 VariantClear(&v);
1001 l = 0xdeadbeef;
1002 hres = IHTMLStyle_get_pixelLeft(style, &l);
1003 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1004 ok(!l, "pixelLeft = %d\n", l);
1006 /* Test posLeft */
1007 hres = IHTMLStyle_get_posLeft(style, NULL);
1008 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1010 f = 1.0f;
1011 hres = IHTMLStyle_get_posLeft(style, &f);
1012 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1013 ok(f == 0.0, "expected 0.0 got %f\n", f);
1015 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1016 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1018 hres = IHTMLStyle_get_posLeft(style, &f);
1019 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1020 ok(f == 4.0 ||
1021 f == 4.9f, /* IE8 */
1022 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1024 /* Ensure left is updated correctly. */
1025 V_VT(&v) = VT_EMPTY;
1026 hres = IHTMLStyle_get_left(style, &v);
1027 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1028 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1029 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1030 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1031 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1032 VariantClear(&v);
1034 /* Test left */
1035 V_VT(&v) = VT_BSTR;
1036 V_BSTR(&v) = a2bstr("3px");
1037 hres = IHTMLStyle_put_left(style, v);
1038 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1039 VariantClear(&v);
1041 hres = IHTMLStyle_get_posLeft(style, &f);
1042 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1043 ok(f == 3.0, "expected 3.0 got %f\n", f);
1045 l = 0xdeadbeef;
1046 hres = IHTMLStyle_get_pixelLeft(style, &l);
1047 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1048 ok(l == 3, "pixelLeft = %d\n", l);
1050 V_VT(&v) = VT_EMPTY;
1051 hres = IHTMLStyle_get_left(style, &v);
1052 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1053 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1054 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1055 VariantClear(&v);
1057 V_VT(&v) = VT_BSTR;
1058 V_BSTR(&v) = a2bstr("4.99");
1059 hres = IHTMLStyle_put_left(style, v);
1060 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1061 VariantClear(&v);
1063 l = 0xdeadbeef;
1064 hres = IHTMLStyle_get_pixelLeft(style, &l);
1065 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1066 ok(l == 4, "pixelLeft = %d\n", l);
1068 V_VT(&v) = VT_NULL;
1069 hres = IHTMLStyle_put_left(style, v);
1070 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1072 V_VT(&v) = VT_EMPTY;
1073 hres = IHTMLStyle_get_left(style, &v);
1074 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1075 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1076 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1077 VariantClear(&v);
1079 V_VT(&v) = VT_EMPTY;
1080 hres = IHTMLStyle_get_top(style, &v);
1081 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1082 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1083 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1084 VariantClear(&v);
1086 l = 0xdeadbeef;
1087 hres = IHTMLStyle_get_pixelLeft(style, &l);
1088 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1089 ok(!l, "pixelLeft = %d\n", l);
1091 hres = IHTMLStyle_put_pixelLeft(style, 6);
1092 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1094 l = 0xdeadbeef;
1095 hres = IHTMLStyle_get_pixelLeft(style, &l);
1096 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1097 ok(l == 6, "pixelLeft = %d\n", l);
1099 V_VT(&v) = VT_EMPTY;
1100 hres = IHTMLStyle_get_left(style, &v);
1101 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1102 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1103 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1104 VariantClear(&v);
1106 /* Test posTop */
1107 hres = IHTMLStyle_get_posTop(style, NULL);
1108 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1110 f = 1.0f;
1111 hres = IHTMLStyle_get_posTop(style, &f);
1112 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1113 ok(f == 0.0, "expected 0.0 got %f\n", f);
1115 hres = IHTMLStyle_put_posTop(style, 4.9f);
1116 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1118 hres = IHTMLStyle_get_posTop(style, &f);
1119 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1120 ok(f == 4.0 ||
1121 f == 4.9f, /* IE8 */
1122 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1124 V_VT(&v) = VT_BSTR;
1125 V_BSTR(&v) = a2bstr("3px");
1126 hres = IHTMLStyle_put_top(style, v);
1127 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1128 VariantClear(&v);
1130 V_VT(&v) = VT_EMPTY;
1131 hres = IHTMLStyle_get_top(style, &v);
1132 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1133 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1134 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1135 VariantClear(&v);
1137 hres = IHTMLStyle_get_posTop(style, &f);
1138 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1139 ok(f == 3.0, "expected 3.0 got %f\n", f);
1141 V_VT(&v) = VT_NULL;
1142 hres = IHTMLStyle_put_top(style, v);
1143 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1145 V_VT(&v) = VT_EMPTY;
1146 hres = IHTMLStyle_get_top(style, &v);
1147 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1148 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1149 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1150 VariantClear(&v);
1152 /* Test posHeight */
1153 hres = IHTMLStyle_get_posHeight(style, NULL);
1154 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1156 V_VT(&v) = VT_EMPTY;
1157 hres = IHTMLStyle_get_height(style, &v);
1158 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1159 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1160 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1161 VariantClear(&v);
1163 f = 1.0f;
1164 hres = IHTMLStyle_get_posHeight(style, &f);
1165 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1166 ok(f == 0.0, "expected 0.0 got %f\n", f);
1168 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1169 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1171 hres = IHTMLStyle_get_posHeight(style, &f);
1172 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1173 ok(f == 4.0 ||
1174 f == 4.9f, /* IE8 */
1175 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1177 V_VT(&v) = VT_BSTR;
1178 V_BSTR(&v) = a2bstr("70px");
1179 hres = IHTMLStyle_put_height(style, v);
1180 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1181 VariantClear(&v);
1183 V_VT(&v) = VT_EMPTY;
1184 hres = IHTMLStyle_get_height(style, &v);
1185 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1186 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1187 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1188 VariantClear(&v);
1190 V_VT(&v) = VT_BSTR;
1191 V_BSTR(&v) = NULL;
1192 hres = IHTMLStyle_put_height(style, v);
1193 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1194 VariantClear(&v);
1196 V_VT(&v) = VT_EMPTY;
1197 hres = IHTMLStyle_get_height(style, &v);
1198 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1199 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1200 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1201 VariantClear(&v);
1203 V_VT(&v) = VT_I4;
1204 V_I4(&v) = 64;
1205 hres = IHTMLStyle_put_height(style, v);
1206 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1208 V_VT(&v) = VT_EMPTY;
1209 hres = IHTMLStyle_get_height(style, &v);
1210 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1211 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1212 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1213 VariantClear(&v);
1215 hres = IHTMLStyle_get_posHeight(style, &f);
1216 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1217 ok(f == 64.0, "expected 64.0 got %f\n", f);
1219 str = (void*)0xdeadbeef;
1220 hres = IHTMLStyle_get_cursor(style, &str);
1221 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1222 ok(!str, "get_cursor != NULL\n");
1223 SysFreeString(str);
1225 str = a2bstr("default");
1226 hres = IHTMLStyle_put_cursor(style, str);
1227 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1228 SysFreeString(str);
1230 str = NULL;
1231 hres = IHTMLStyle_get_cursor(style, &str);
1232 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1233 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1234 SysFreeString(str);
1236 V_VT(&v) = VT_EMPTY;
1237 hres = IHTMLStyle_get_verticalAlign(style, &v);
1238 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1239 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1240 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1241 VariantClear(&v);
1243 V_VT(&v) = VT_BSTR;
1244 V_BSTR(&v) = a2bstr("middle");
1245 hres = IHTMLStyle_put_verticalAlign(style, v);
1246 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1247 VariantClear(&v);
1249 V_VT(&v) = VT_EMPTY;
1250 hres = IHTMLStyle_get_verticalAlign(style, &v);
1251 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1252 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1253 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1254 VariantClear(&v);
1256 V_VT(&v) = VT_I4;
1257 V_I4(&v) = 100;
1258 hres = IHTMLStyle_put_verticalAlign(style, v);
1259 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1260 VariantClear(&v);
1262 V_VT(&v) = VT_EMPTY;
1263 hres = IHTMLStyle_get_verticalAlign(style, &v);
1264 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1265 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1266 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1267 VariantClear(&v);
1269 str = (void*)0xdeadbeef;
1270 hres = IHTMLStyle_get_textAlign(style, &str);
1271 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1272 ok(!str, "textAlign != NULL\n");
1274 str = a2bstr("center");
1275 hres = IHTMLStyle_put_textAlign(style, str);
1276 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1277 SysFreeString(str);
1279 str = NULL;
1280 hres = IHTMLStyle_get_textAlign(style, &str);
1281 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1282 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1283 SysFreeString(str);
1285 V_VT(&v) = VT_NULL;
1286 hres = IHTMLStyle_get_textIndent(style, &v);
1287 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1288 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1289 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1291 V_VT(&v) = VT_I4;
1292 V_I4(&v) = 6;
1293 hres = IHTMLStyle_put_textIndent(style, v);
1294 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1296 V_VT(&v) = VT_NULL;
1297 hres = IHTMLStyle_get_textIndent(style, &v);
1298 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1299 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1300 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1302 str = (void*)0xdeadbeef;
1303 hres = IHTMLStyle_get_textTransform(style, &str);
1304 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1305 ok(!str, "textTransform != NULL\n");
1307 str = a2bstr("lowercase");
1308 hres = IHTMLStyle_put_textTransform(style, str);
1309 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1310 SysFreeString(str);
1312 str = NULL;
1313 hres = IHTMLStyle_get_textTransform(style, &str);
1314 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1315 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1316 SysFreeString(str);
1318 str = (void*)0xdeadbeef;
1319 hres = IHTMLStyle_get_filter(style, &str);
1320 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1321 ok(!str, "filter != NULL\n");
1323 str = a2bstr("alpha(opacity=100)");
1324 hres = IHTMLStyle_put_filter(style, str);
1325 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1326 SysFreeString(str);
1328 V_VT(&v) = VT_EMPTY;
1329 hres = IHTMLStyle_get_zIndex(style, &v);
1330 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1331 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1332 ok(!V_I4(&v), "V_I4(v) != 0\n");
1333 VariantClear(&v);
1335 V_VT(&v) = VT_BSTR;
1336 V_BSTR(&v) = a2bstr("1");
1337 hres = IHTMLStyle_put_zIndex(style, v);
1338 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1339 VariantClear(&v);
1341 V_VT(&v) = VT_EMPTY;
1342 hres = IHTMLStyle_get_zIndex(style, &v);
1343 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1344 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1345 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1346 VariantClear(&v);
1348 /* fontStyle */
1349 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1350 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1352 str = a2bstr("test");
1353 hres = IHTMLStyle_put_fontStyle(style, str);
1354 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1355 SysFreeString(str);
1357 str = a2bstr("italic");
1358 hres = IHTMLStyle_put_fontStyle(style, str);
1359 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1360 SysFreeString(str);
1362 str = a2bstr("oblique");
1363 hres = IHTMLStyle_put_fontStyle(style, str);
1364 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1365 SysFreeString(str);
1367 str = a2bstr("normal");
1368 hres = IHTMLStyle_put_fontStyle(style, str);
1369 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1370 SysFreeString(str);
1372 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1373 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1374 SysFreeString(sDefault);
1376 /* overflow */
1377 hres = IHTMLStyle_get_overflow(style, NULL);
1378 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1380 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1381 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1383 str = a2bstr("test");
1384 hres = IHTMLStyle_put_overflow(style, str);
1385 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1386 SysFreeString(str);
1388 str = a2bstr("visible");
1389 hres = IHTMLStyle_put_overflow(style, str);
1390 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1391 SysFreeString(str);
1393 str = a2bstr("scroll");
1394 hres = IHTMLStyle_put_overflow(style, str);
1395 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1396 SysFreeString(str);
1398 str = a2bstr("hidden");
1399 hres = IHTMLStyle_put_overflow(style, str);
1400 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1401 SysFreeString(str);
1403 str = a2bstr("auto");
1404 hres = IHTMLStyle_put_overflow(style, str);
1405 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1406 SysFreeString(str);
1408 hres = IHTMLStyle_get_overflow(style, &str);
1409 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1410 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1411 SysFreeString(str);
1413 str = a2bstr("");
1414 hres = IHTMLStyle_put_overflow(style, str);
1415 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1416 SysFreeString(str);
1418 hres = IHTMLStyle_get_overflow(style, &str);
1419 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1420 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1421 SysFreeString(str);
1423 /* restore overflow default */
1424 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1425 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1426 SysFreeString(sOverflowDefault);
1428 /* Attribute Tests*/
1429 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1430 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1432 str = a2bstr("position");
1433 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1434 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1436 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1437 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1438 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1439 VariantClear(&v);
1441 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1442 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1444 V_VT(&v) = VT_BSTR;
1445 V_BSTR(&v) = a2bstr("absolute");
1446 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1447 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1448 VariantClear(&v);
1450 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1451 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1452 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1453 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1454 VariantClear(&v);
1456 V_VT(&v) = VT_BSTR;
1457 V_BSTR(&v) = NULL;
1458 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1459 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1460 VariantClear(&v);
1462 SysFreeString(str);
1464 str = a2bstr("borderLeftStyle");
1465 test_border_styles(style, str);
1466 SysFreeString(str);
1468 str = a2bstr("borderbottomstyle");
1469 test_border_styles(style, str);
1470 SysFreeString(str);
1472 str = a2bstr("borderrightstyle");
1473 test_border_styles(style, str);
1474 SysFreeString(str);
1476 str = a2bstr("bordertopstyle");
1477 test_border_styles(style, str);
1478 SysFreeString(str);
1480 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1481 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1483 str = a2bstr("none dotted dashed solid");
1484 hres = IHTMLStyle_put_borderStyle(style, str);
1485 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1486 SysFreeString(str);
1488 str = a2bstr("none dotted dashed solid");
1489 hres = IHTMLStyle_get_borderStyle(style, &str);
1490 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1491 ok(!strcmp_wa(str, "none dotted dashed solid"),
1492 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1493 SysFreeString(str);
1495 str = a2bstr("double groove ridge inset");
1496 hres = IHTMLStyle_put_borderStyle(style, str);
1497 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1498 SysFreeString(str);
1500 str = a2bstr("window-inset outset ridge inset");
1501 hres = IHTMLStyle_put_borderStyle(style, str);
1502 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1503 SysFreeString(str);
1505 str = a2bstr("window-inset");
1506 hres = IHTMLStyle_put_borderStyle(style, str);
1507 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1508 SysFreeString(str);
1510 str = a2bstr("none none none none none");
1511 hres = IHTMLStyle_put_borderStyle(style, str);
1512 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1513 SysFreeString(str);
1515 str = a2bstr("invalid none none none");
1516 hres = IHTMLStyle_put_borderStyle(style, str);
1517 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1518 SysFreeString(str);
1520 str = a2bstr("none invalid none none");
1521 hres = IHTMLStyle_put_borderStyle(style, str);
1522 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1523 SysFreeString(str);
1525 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1526 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1527 SysFreeString(sDefault);
1529 /* backgoundColor */
1530 hres = IHTMLStyle_get_backgroundColor(style, &v);
1531 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1532 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1533 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1534 VariantClear(&v);
1536 V_VT(&v) = VT_BSTR;
1537 V_BSTR(&v) = a2bstr("red");
1538 hres = IHTMLStyle_put_backgroundColor(style, v);
1539 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1540 VariantClear(&v);
1542 hres = IHTMLStyle_get_backgroundColor(style, &v);
1543 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1544 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1545 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1546 VariantClear(&v);
1548 /* padding */
1549 hres = IHTMLStyle_get_padding(style, &str);
1550 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1551 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1552 SysFreeString(str);
1554 hres = IHTMLStyle_get_paddingTop(style, &v);
1555 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1556 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1557 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1559 V_VT(&v) = VT_I4;
1560 V_I4(&v) = 6;
1561 hres = IHTMLStyle_put_paddingTop(style, v);
1562 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1564 hres = IHTMLStyle_get_paddingTop(style, &v);
1565 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1566 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1567 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1568 VariantClear(&v);
1570 hres = IHTMLStyle_get_paddingRight(style, &v);
1571 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1572 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1573 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1575 V_VT(&v) = VT_I4;
1576 V_I4(&v) = 6;
1577 hres = IHTMLStyle_put_paddingRight(style, v);
1578 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1580 hres = IHTMLStyle_get_paddingRight(style, &v);
1581 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1582 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1583 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1584 VariantClear(&v);
1586 hres = IHTMLStyle_get_paddingBottom(style, &v);
1587 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1588 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1589 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1591 V_VT(&v) = VT_I4;
1592 V_I4(&v) = 6;
1593 hres = IHTMLStyle_put_paddingBottom(style, v);
1594 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1596 hres = IHTMLStyle_get_paddingBottom(style, &v);
1597 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1598 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1599 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1600 VariantClear(&v);
1602 str = a2bstr("1");
1603 hres = IHTMLStyle_put_padding(style, str);
1604 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1605 SysFreeString(str);
1607 hres = IHTMLStyle_get_padding(style, &str);
1608 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1609 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1610 SysFreeString(str);
1612 /* PaddingLeft */
1613 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1614 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1615 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1616 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1618 V_VT(&v) = VT_BSTR;
1619 V_BSTR(&v) = a2bstr("10");
1620 hres = IHTMLStyle_put_paddingLeft(style, v);
1621 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1622 VariantClear(&v);
1624 hres = IHTMLStyle_get_paddingLeft(style, &v);
1625 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1626 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1627 VariantClear(&v);
1629 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1630 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1632 /* BackgroundRepeat */
1633 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1634 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1636 str = a2bstr("invalid");
1637 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1638 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1639 SysFreeString(str);
1641 str = a2bstr("repeat");
1642 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1643 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1644 SysFreeString(str);
1646 str = a2bstr("no-repeat");
1647 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1648 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1649 SysFreeString(str);
1651 str = a2bstr("repeat-x");
1652 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1653 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1654 SysFreeString(str);
1656 str = a2bstr("repeat-y");
1657 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1658 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1659 SysFreeString(str);
1661 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1662 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1663 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1664 SysFreeString(str);
1666 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1667 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1668 SysFreeString(sDefault);
1670 /* BorderColor */
1671 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1672 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1674 str = a2bstr("red green red blue");
1675 hres = IHTMLStyle_put_borderColor(style, str);
1676 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1677 SysFreeString(str);
1679 hres = IHTMLStyle_get_borderColor(style, &str);
1680 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1681 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1682 SysFreeString(str);
1684 hres = IHTMLStyle_put_borderColor(style, sDefault);
1685 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1686 SysFreeString(sDefault);
1688 /* BorderRight */
1689 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1690 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1692 str = a2bstr("thick dotted red");
1693 hres = IHTMLStyle_put_borderRight(style, str);
1694 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1695 SysFreeString(str);
1697 /* IHTMLStyle_get_borderRight appears to have a bug where
1698 it returns the first letter of the color. So we check
1699 each style individually.
1701 V_BSTR(&v) = NULL;
1702 hres = IHTMLStyle_get_borderRightColor(style, &v);
1703 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1704 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1705 VariantClear(&v);
1707 V_BSTR(&v) = NULL;
1708 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1709 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1710 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1711 VariantClear(&v);
1713 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1714 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1715 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1716 SysFreeString(str);
1718 hres = IHTMLStyle_put_borderRight(style, sDefault);
1719 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1720 SysFreeString(sDefault);
1722 /* BorderTop */
1723 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1724 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1726 str = a2bstr("thick dotted red");
1727 hres = IHTMLStyle_put_borderTop(style, str);
1728 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1729 SysFreeString(str);
1731 /* IHTMLStyle_get_borderTop appears to have a bug where
1732 it returns the first letter of the color. So we check
1733 each style individually.
1735 V_BSTR(&v) = NULL;
1736 hres = IHTMLStyle_get_borderTopColor(style, &v);
1737 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1738 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1739 VariantClear(&v);
1741 V_BSTR(&v) = NULL;
1742 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1743 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1744 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1745 VariantClear(&v);
1747 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1748 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1749 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1750 SysFreeString(str);
1752 hres = IHTMLStyle_put_borderTop(style, sDefault);
1753 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1754 SysFreeString(sDefault);
1756 /* BorderBottom */
1757 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1758 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1760 str = a2bstr("thick dotted red");
1761 hres = IHTMLStyle_put_borderBottom(style, str);
1762 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1763 SysFreeString(str);
1765 /* IHTMLStyle_get_borderBottom appears to have a bug where
1766 it returns the first letter of the color. So we check
1767 each style individually.
1769 V_BSTR(&v) = NULL;
1770 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1771 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1772 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1773 VariantClear(&v);
1775 V_BSTR(&v) = NULL;
1776 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1777 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1778 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1779 VariantClear(&v);
1781 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1782 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1783 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1784 SysFreeString(str);
1786 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1787 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1788 SysFreeString(sDefault);
1790 /* BorderLeft */
1791 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1792 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1794 str = a2bstr("thick dotted red");
1795 hres = IHTMLStyle_put_borderLeft(style, str);
1796 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1797 SysFreeString(str);
1799 /* IHTMLStyle_get_borderLeft appears to have a bug where
1800 it returns the first letter of the color. So we check
1801 each style individually.
1803 V_BSTR(&v) = NULL;
1804 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1805 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1806 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1807 VariantClear(&v);
1809 V_BSTR(&v) = NULL;
1810 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1811 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1812 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1813 VariantClear(&v);
1815 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1816 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1817 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1818 SysFreeString(str);
1820 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1821 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1822 SysFreeString(sDefault);
1824 /* backgroundPositionX */
1825 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1826 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1827 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1828 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1829 VariantClear(&v);
1831 V_VT(&v) = VT_BSTR;
1832 V_BSTR(&v) = a2bstr("10px");
1833 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1834 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1835 VariantClear(&v);
1837 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1838 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1839 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1840 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1841 VariantClear(&v);
1843 /* backgroundPositionY */
1844 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1845 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1846 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1847 VariantClear(&v);
1849 V_VT(&v) = VT_BSTR;
1850 V_BSTR(&v) = a2bstr("15px");
1851 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1852 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1853 VariantClear(&v);
1855 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1856 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1857 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1858 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1859 VariantClear(&v);
1861 /* backgroundPosition */
1862 str = NULL;
1863 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1864 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1865 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1866 SysFreeString(str);
1868 str = a2bstr("center 20%");
1869 hres = IHTMLStyle_put_backgroundPosition(style, str);
1870 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1871 SysFreeString(str);
1873 str = NULL;
1874 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1875 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1876 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1877 SysFreeString(str);
1879 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1880 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1881 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1882 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1883 VariantClear(&v);
1885 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1886 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1887 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1888 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1889 VariantClear(&v);
1891 /* borderTopWidth */
1892 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1893 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1895 V_VT(&v) = VT_BSTR;
1896 V_BSTR(&v) = a2bstr("10px");
1897 hres = IHTMLStyle_put_borderTopWidth(style, v);
1898 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1899 VariantClear(&v);
1901 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1902 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1903 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1904 VariantClear(&v);
1906 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1907 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1908 VariantClear(&vDefault);
1910 /* borderRightWidth */
1911 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1912 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1914 V_VT(&v) = VT_BSTR;
1915 V_BSTR(&v) = a2bstr("10");
1916 hres = IHTMLStyle_put_borderRightWidth(style, v);
1917 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1918 VariantClear(&v);
1920 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1921 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1922 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1923 VariantClear(&v);
1925 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1926 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1927 VariantClear(&vDefault);
1929 /* borderBottomWidth */
1930 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1931 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1933 V_VT(&v) = VT_BSTR;
1934 V_BSTR(&v) = a2bstr("10");
1935 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1936 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1937 VariantClear(&v);
1939 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1940 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1941 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1942 VariantClear(&v);
1944 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1945 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1946 VariantClear(&vDefault);
1948 /* borderLeftWidth */
1949 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1950 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1952 V_VT(&v) = VT_BSTR;
1953 V_BSTR(&v) = a2bstr("10");
1954 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1955 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1956 VariantClear(&v);
1958 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1959 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1960 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1961 VariantClear(&v);
1963 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1964 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1965 VariantClear(&vDefault);
1967 /* wordSpacing */
1968 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1969 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1971 V_VT(&v) = VT_BSTR;
1972 V_BSTR(&v) = a2bstr("10");
1973 hres = IHTMLStyle_put_wordSpacing(style, v);
1974 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1975 VariantClear(&v);
1977 hres = IHTMLStyle_get_wordSpacing(style, &v);
1978 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1979 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1980 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1981 VariantClear(&v);
1983 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1984 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1985 VariantClear(&vDefault);
1987 /* letterSpacing */
1988 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1989 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1991 V_VT(&v) = VT_BSTR;
1992 V_BSTR(&v) = a2bstr("11");
1993 hres = IHTMLStyle_put_letterSpacing(style, v);
1994 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1995 VariantClear(&v);
1997 hres = IHTMLStyle_get_letterSpacing(style, &v);
1998 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1999 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2000 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2001 VariantClear(&v);
2003 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2004 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2005 VariantClear(&vDefault);
2007 /* borderTopColor */
2008 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2009 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2011 V_VT(&v) = VT_BSTR;
2012 V_BSTR(&v) = a2bstr("red");
2013 hres = IHTMLStyle_put_borderTopColor(style, v);
2014 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2015 VariantClear(&v);
2017 hres = IHTMLStyle_get_borderTopColor(style, &v);
2018 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2019 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2020 VariantClear(&v);
2022 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2023 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2025 /* borderRightColor */
2026 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2027 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2029 V_VT(&v) = VT_BSTR;
2030 V_BSTR(&v) = a2bstr("blue");
2031 hres = IHTMLStyle_put_borderRightColor(style, v);
2032 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2033 VariantClear(&v);
2035 hres = IHTMLStyle_get_borderRightColor(style, &v);
2036 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2037 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2038 VariantClear(&v);
2040 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2041 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2043 /* borderBottomColor */
2044 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2045 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2047 V_VT(&v) = VT_BSTR;
2048 V_BSTR(&v) = a2bstr("cyan");
2049 hres = IHTMLStyle_put_borderBottomColor(style, v);
2050 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2051 VariantClear(&v);
2053 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2054 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2055 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2056 VariantClear(&v);
2058 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2059 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2061 /* borderLeftColor */
2062 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2063 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2065 V_VT(&v) = VT_BSTR;
2066 V_BSTR(&v) = a2bstr("cyan");
2067 hres = IHTMLStyle_put_borderLeftColor(style, v);
2068 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2069 VariantClear(&v);
2071 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2072 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2073 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2074 VariantClear(&v);
2076 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2077 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2079 /* clip */
2080 hres = IHTMLStyle_get_clip(style, &str);
2081 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2082 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2084 str = a2bstr("rect(0px 1px 500px 505px)");
2085 hres = IHTMLStyle_put_clip(style, str);
2086 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2087 SysFreeString(str);
2089 hres = IHTMLStyle_get_clip(style, &str);
2090 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2091 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
2092 SysFreeString(str);
2094 /* clear */
2095 hres = IHTMLStyle_get_clear(style, &str);
2096 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2097 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2099 str = a2bstr("both");
2100 hres = IHTMLStyle_put_clear(style, str);
2101 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2102 SysFreeString(str);
2104 hres = IHTMLStyle_get_clear(style, &str);
2105 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2106 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2107 SysFreeString(str);
2109 /* pageBreakAfter */
2110 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2111 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2112 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2114 str = a2bstr("always");
2115 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2116 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2117 SysFreeString(str);
2119 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2120 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2121 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2122 SysFreeString(str);
2124 /* pageBreakBefore */
2125 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2126 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2127 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2129 str = a2bstr("always");
2130 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2131 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2132 SysFreeString(str);
2134 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2135 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2136 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2137 SysFreeString(str);
2139 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2140 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2142 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2143 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2144 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2146 str = (void*)0xdeadbeef;
2147 hres = IHTMLStyle_get_whiteSpace(style, &str);
2148 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2149 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2151 str = a2bstr("nowrap");
2152 hres = IHTMLStyle_put_whiteSpace(style, str);
2153 SysFreeString(str);
2154 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2156 str = NULL;
2157 hres = IHTMLStyle_get_whiteSpace(style, &str);
2158 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2159 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2160 SysFreeString(str);
2162 /* listStyleType */
2163 hres = IHTMLStyle_get_listStyleType(style, &str);
2164 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2165 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2167 str = a2bstr("square");
2168 hres = IHTMLStyle_put_listStyleType(style, str);
2169 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2170 SysFreeString(str);
2172 str = NULL;
2173 hres = IHTMLStyle_get_listStyleType(style, &str);
2174 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2175 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2177 str = a2bstr("inside");
2178 hres = IHTMLStyle_put_listStylePosition(style, str);
2179 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2180 SysFreeString(str);
2182 hres = IHTMLStyle_get_listStylePosition(style, &str);
2183 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2184 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2185 SysFreeString(str);
2187 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2188 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2189 if(SUCCEEDED(hres)) {
2190 test_style2(style2);
2191 IHTMLStyle2_Release(style2);
2194 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2195 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2196 if(SUCCEEDED(hres)) {
2197 test_style3(style3);
2198 IHTMLStyle3_Release(style3);
2201 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2202 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2203 if(SUCCEEDED(hres)) {
2204 test_style4(style4);
2205 IHTMLStyle4_Release(style4);
2208 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2209 if(SUCCEEDED(hres)) {
2210 test_style6(style6);
2211 IHTMLStyle6_Release(style6);
2212 }else {
2213 win_skip("IHTMLStyle6 not available\n");
2217 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2218 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2220 BSTR str;
2221 HRESULT hres;
2223 str = (void*)0xdeadbeef;
2224 hres = IHTMLStyle_get_filter(style, &str);
2225 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2226 if(exval)
2227 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2228 else
2229 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2231 SysFreeString(str);
2234 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2235 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2237 BSTR str;
2238 HRESULT hres;
2240 str = (void*)0xdeadbeef;
2241 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2242 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2243 if(exval)
2244 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2245 else
2246 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2248 SysFreeString(str);
2251 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2252 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2254 BSTR str = a2bstr(val);
2255 HRESULT hres;
2257 hres = IHTMLStyle_put_filter(style, str);
2258 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2259 SysFreeString(str);
2261 _test_style_filter(line, style, val);
2264 static void test_style_filters(IHTMLElement *elem)
2266 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2267 IHTMLCurrentStyle2 *current_style2;
2268 IHTMLCurrentStyle *current_style;
2269 IHTMLStyle *style;
2270 HRESULT hres;
2272 hres = IHTMLElement_get_style(elem, &style);
2273 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2275 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2276 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2278 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2280 test_style_filter(style, NULL);
2281 test_current_style_filter(current_style2, NULL);
2282 set_style_filter(style, "alpha(opacity=50.0040)");
2283 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2284 set_style_filter(style, "alpha(opacity=100)");
2286 IHTMLStyle_Release(style);
2288 hres = IHTMLElement_get_style(elem, &style);
2289 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2291 test_style_filter(style, "alpha(opacity=100)");
2292 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2293 set_style_filter(style, NULL);
2294 set_style_filter(style, "alpha(opacity=100)");
2295 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2296 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2297 test_style_filter(style, NULL);
2300 IHTMLCurrentStyle2_Release(current_style2);
2301 IHTMLStyle_Release(style);
2302 IHTMLElement2_Release(elem2);
2305 static void test_current_style(IHTMLCurrentStyle *current_style)
2307 IHTMLCurrentStyle2 *current_style2;
2308 VARIANT_BOOL b;
2309 BSTR str;
2310 HRESULT hres;
2311 VARIANT v;
2313 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2314 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2315 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2316 SysFreeString(str);
2318 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2319 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2320 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2321 SysFreeString(str);
2323 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2324 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2325 SysFreeString(str);
2327 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2328 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2329 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2330 SysFreeString(str);
2332 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2333 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2334 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2335 SysFreeString(str);
2337 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2338 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2339 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2340 SysFreeString(str);
2342 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2343 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2344 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2345 SysFreeString(str);
2347 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2348 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2349 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2350 SysFreeString(str);
2352 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2353 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2354 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2355 SysFreeString(str);
2357 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2358 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2359 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2360 SysFreeString(str);
2362 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2363 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2364 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2365 SysFreeString(str);
2367 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2368 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2369 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2370 SysFreeString(str);
2372 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2373 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2374 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2375 SysFreeString(str);
2377 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2378 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2379 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2380 SysFreeString(str);
2382 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2383 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2384 SysFreeString(str);
2386 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2387 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2388 SysFreeString(str);
2390 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2391 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2392 SysFreeString(str);
2394 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2395 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2396 SysFreeString(str);
2398 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2399 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2400 SysFreeString(str);
2402 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2403 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2404 SysFreeString(str);
2406 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2407 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2408 SysFreeString(str);
2410 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2411 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2412 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2413 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2414 VariantClear(&v);
2416 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2417 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2418 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2419 VariantClear(&v);
2421 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2422 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2423 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2424 VariantClear(&v);
2426 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2427 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2428 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2429 VariantClear(&v);
2431 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2432 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2433 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2434 VariantClear(&v);
2436 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2437 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2438 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2439 VariantClear(&v);
2441 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2442 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2443 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2444 VariantClear(&v);
2446 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2447 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2448 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2449 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2450 VariantClear(&v);
2452 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2453 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2454 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2455 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2456 VariantClear(&v);
2458 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2459 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2460 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2461 VariantClear(&v);
2463 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2464 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2465 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2466 VariantClear(&v);
2468 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2469 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2470 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2471 VariantClear(&v);
2473 V_BSTR(&v) = NULL;
2474 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2475 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2476 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2477 VariantClear(&v);
2479 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2480 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2481 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2482 VariantClear(&v);
2484 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2485 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2486 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2487 VariantClear(&v);
2489 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2490 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2491 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2492 VariantClear(&v);
2494 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2495 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2496 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2497 VariantClear(&v);
2499 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2500 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2501 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2502 VariantClear(&v);
2504 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2505 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2506 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2507 VariantClear(&v);
2509 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2510 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2511 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2512 VariantClear(&v);
2514 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2515 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2516 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2517 VariantClear(&v);
2519 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2520 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2521 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2522 VariantClear(&v);
2524 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2525 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2526 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2527 VariantClear(&v);
2529 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2530 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2531 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2532 VariantClear(&v);
2534 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2535 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2536 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2537 VariantClear(&v);
2539 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2540 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2541 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2542 VariantClear(&v);
2544 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2545 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2546 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2547 VariantClear(&v);
2549 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2550 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2551 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2552 VariantClear(&v);
2554 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2555 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2556 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2557 VariantClear(&v);
2559 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2560 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2561 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2562 VariantClear(&v);
2564 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2565 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2566 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2567 VariantClear(&v);
2569 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2571 b = 100;
2572 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2573 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2574 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2576 IHTMLCurrentStyle2_Release(current_style2);
2579 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2581 static void basic_style_test(IHTMLDocument2 *doc)
2583 IHTMLCurrentStyle *cstyle;
2584 IHTMLElement *elem;
2585 IHTMLStyle *style;
2586 HRESULT hres;
2588 hres = IHTMLDocument2_get_body(doc, &elem);
2589 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2591 hres = IHTMLElement_get_style(elem, &style);
2592 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2594 test_body_style(style);
2596 cstyle = get_current_style(elem);
2597 test_current_style(cstyle);
2598 IHTMLCurrentStyle_Release(cstyle);
2599 IHTMLElement_Release(elem);
2601 elem = get_element_by_id(doc, "divid");
2602 test_style_filters(elem);
2604 test_set_csstext(style);
2605 IHTMLStyle_Release(style);
2606 IHTMLElement_Release(elem);
2609 static const char runtimestyle_test_str[] =
2610 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2612 static void runtimestyle_test(IHTMLDocument2 *doc)
2614 IHTMLStyle *style, *runtime_style;
2615 IHTMLElement2 *elem2;
2616 IHTMLElement *elem;
2617 BSTR str;
2618 HRESULT hres;
2620 hres = IHTMLDocument2_get_body(doc, &elem);
2621 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2623 elem2 = get_elem2_iface((IUnknown*)elem);
2625 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2626 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2628 hres = IHTMLElement_get_style(elem, &style);
2629 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2631 test_text_decoration(style, NULL);
2632 test_text_decoration(runtime_style, NULL);
2633 set_text_decoration(style, "underline");
2634 test_text_decoration(style, "underline");
2636 hres = IHTMLStyle_get_textDecoration(style, &str);
2637 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2638 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2639 SysFreeString(str);
2641 set_text_decoration(runtime_style, "blink");
2642 test_text_decoration(runtime_style, "blink");
2644 hres = IHTMLStyle_get_textDecoration(style, &str);
2645 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2646 todo_wine
2647 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2648 SysFreeString(str);
2650 IHTMLStyle_Release(runtime_style);
2651 IHTMLStyle_Release(style);
2652 IHTMLElement2_Release(elem2);
2653 IHTMLElement_Release(elem);
2656 static IHTMLDocument2 *notif_doc;
2657 static BOOL doc_complete;
2659 static IHTMLDocument2 *create_document(void)
2661 IHTMLDocument2 *doc;
2662 IHTMLDocument5 *doc5;
2663 HRESULT hres;
2665 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2666 &IID_IHTMLDocument2, (void**)&doc);
2667 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2668 if(FAILED(hres))
2669 return NULL;
2671 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2672 if(FAILED(hres)) {
2673 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2674 IHTMLDocument2_Release(doc);
2675 return NULL;
2678 IHTMLDocument5_Release(doc5);
2679 return doc;
2682 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2683 REFIID riid, void**ppv)
2685 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2686 *ppv = iface;
2687 return S_OK;
2690 ok(0, "unexpected call\n");
2691 return E_NOINTERFACE;
2694 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2696 return 2;
2699 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2701 return 1;
2704 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2706 if(dispID == DISPID_READYSTATE){
2707 BSTR state;
2708 HRESULT hres;
2710 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2711 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2713 if(!strcmp_wa(state, "complete"))
2714 doc_complete = TRUE;
2716 SysFreeString(state);
2719 return S_OK;
2722 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2724 ok(0, "unexpected call\n");
2725 return E_NOTIMPL;
2728 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2729 PropertyNotifySink_QueryInterface,
2730 PropertyNotifySink_AddRef,
2731 PropertyNotifySink_Release,
2732 PropertyNotifySink_OnChanged,
2733 PropertyNotifySink_OnRequestEdit
2736 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2738 static IHTMLDocument2 *create_doc_with_string(const char *str)
2740 IPersistStreamInit *init;
2741 IStream *stream;
2742 IHTMLDocument2 *doc;
2743 HGLOBAL mem;
2744 SIZE_T len;
2746 notif_doc = doc = create_document();
2747 if(!doc)
2748 return NULL;
2750 doc_complete = FALSE;
2751 len = strlen(str);
2752 mem = GlobalAlloc(0, len);
2753 memcpy(mem, str, len);
2754 CreateStreamOnHGlobal(mem, TRUE, &stream);
2756 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2758 IPersistStreamInit_Load(init, stream);
2759 IPersistStreamInit_Release(init);
2760 IStream_Release(stream);
2762 return doc;
2765 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2767 IConnectionPointContainer *container;
2768 IConnectionPoint *cp;
2769 DWORD cookie;
2770 HRESULT hres;
2772 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2773 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2775 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2776 IConnectionPointContainer_Release(container);
2777 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2779 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2780 IConnectionPoint_Release(cp);
2781 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2784 typedef void (*style_test_t)(IHTMLDocument2*);
2786 static void run_test(const char *str, style_test_t test)
2788 IHTMLDocument2 *doc;
2789 ULONG ref;
2790 MSG msg;
2792 doc = create_doc_with_string(str);
2793 if(!doc)
2794 return;
2796 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2798 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
2799 TranslateMessage(&msg);
2800 DispatchMessageW(&msg);
2803 test(doc);
2805 ref = IHTMLDocument2_Release(doc);
2806 ok(!ref || broken(ref == 1), /* Vista */
2807 "ref = %d\n", ref);
2811 START_TEST(style)
2813 CoInitialize(NULL);
2815 run_test(basic_test_str, basic_style_test);
2816 run_test(runtimestyle_test_str, runtimestyle_test);
2818 CoUninitialize();