mshtml: Added IHTMLStyle6::outline property implementation.
[wine.git] / dlls / mshtml / tests / style.c
blob71eb955c223a28cefcc20de3c088646f61723da9
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));
426 static void test_style3(IHTMLStyle3 *style3)
428 BSTR str;
429 HRESULT hres;
431 str = (void*)0xdeadbeef;
432 hres = IHTMLStyle3_get_wordWrap(style3, &str);
433 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
434 ok(!str, "str != NULL\n");
436 str = a2bstr("break-word");
437 hres = IHTMLStyle3_put_wordWrap(style3, str);
438 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
439 SysFreeString(str);
441 str = NULL;
442 hres = IHTMLStyle3_get_wordWrap(style3, &str);
443 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
444 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
445 SysFreeString(str);
448 static void test_style4(IHTMLStyle4 *style4)
450 HRESULT hres;
451 VARIANT v;
452 VARIANT vdefault;
454 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
455 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
457 V_VT(&v) = VT_BSTR;
458 V_BSTR(&v) = a2bstr("10px");
459 hres = IHTMLStyle4_put_minHeight(style4, v);
460 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
461 VariantClear(&v);
463 hres = IHTMLStyle4_get_minHeight(style4, &v);
464 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
465 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
466 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
467 VariantClear(&v);
469 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
470 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
471 VariantClear(&vdefault);
474 static void test_style6(IHTMLStyle6 *style)
476 BSTR str;
477 HRESULT hres;
479 str = (void*)0xdeadbeef;
480 hres = IHTMLStyle6_get_outline(style, &str);
481 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
482 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
483 SysFreeString(str);
485 str = a2bstr("1px");
486 hres = IHTMLStyle6_put_outline(style, str);
487 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
488 SysFreeString(str);
490 str = (void*)0xdeadbeef;
491 hres = IHTMLStyle6_get_outline(style, &str);
492 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
493 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
494 SysFreeString(str);
497 static void test_body_style(IHTMLStyle *style)
499 IHTMLStyle2 *style2;
500 IHTMLStyle3 *style3;
501 IHTMLStyle4 *style4;
502 IHTMLStyle6 *style6;
503 VARIANT_BOOL b;
504 VARIANT v;
505 BSTR str;
506 HRESULT hres;
507 float f;
508 BSTR sOverflowDefault;
509 BSTR sDefault;
510 LONG l;
511 VARIANT vDefault;
513 test_style_csstext(style, NULL);
515 hres = IHTMLStyle_get_position(style, &str);
516 ok(hres == S_OK, "get_position failed: %08x\n", hres);
517 ok(!str, "str=%s\n", wine_dbgstr_w(str));
519 V_VT(&v) = VT_NULL;
520 hres = IHTMLStyle_get_marginRight(style, &v);
521 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
522 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
523 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
525 V_VT(&v) = VT_I4;
526 V_I4(&v) = 6;
527 hres = IHTMLStyle_put_marginRight(style, v);
528 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
530 V_VT(&v) = VT_NULL;
531 hres = IHTMLStyle_get_marginRight(style, &v);
532 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
533 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
534 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
536 V_VT(&v) = VT_NULL;
537 hres = IHTMLStyle_get_marginBottom(style, &v);
538 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
539 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
540 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
542 V_VT(&v) = VT_I4;
543 V_I4(&v) = 6;
544 hres = IHTMLStyle_put_marginBottom(style, v);
545 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
547 V_VT(&v) = VT_NULL;
548 hres = IHTMLStyle_get_marginBottom(style, &v);
549 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
550 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
551 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
553 V_VT(&v) = VT_NULL;
554 hres = IHTMLStyle_get_marginLeft(style, &v);
555 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
556 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
557 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
559 V_VT(&v) = VT_I4;
560 V_I4(&v) = 6;
561 hres = IHTMLStyle_put_marginLeft(style, v);
562 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
564 V_VT(&v) = VT_NULL;
565 hres = IHTMLStyle_get_marginLeft(style, &v);
566 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
567 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
568 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
570 str = (void*)0xdeadbeef;
571 hres = IHTMLStyle_get_fontFamily(style, &str);
572 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
573 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
575 str = (void*)0xdeadbeef;
576 hres = IHTMLStyle_get_fontWeight(style, &str);
577 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
578 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
580 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
581 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
583 str = a2bstr("test");
584 hres = IHTMLStyle_put_fontWeight(style, str);
585 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
586 SysFreeString(str);
588 str = a2bstr("bold");
589 hres = IHTMLStyle_put_fontWeight(style, str);
590 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
591 SysFreeString(str);
593 str = a2bstr("bolder");
594 hres = IHTMLStyle_put_fontWeight(style, str);
595 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
596 SysFreeString(str);
598 str = a2bstr("lighter");
599 hres = IHTMLStyle_put_fontWeight(style, str);
600 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
601 SysFreeString(str);
603 str = a2bstr("100");
604 hres = IHTMLStyle_put_fontWeight(style, str);
605 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
606 SysFreeString(str);
608 str = a2bstr("200");
609 hres = IHTMLStyle_put_fontWeight(style, str);
610 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
611 SysFreeString(str);
613 str = a2bstr("300");
614 hres = IHTMLStyle_put_fontWeight(style, str);
615 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
616 SysFreeString(str);
618 str = a2bstr("400");
619 hres = IHTMLStyle_put_fontWeight(style, str);
620 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
621 SysFreeString(str);
623 str = a2bstr("500");
624 hres = IHTMLStyle_put_fontWeight(style, str);
625 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
626 SysFreeString(str);
628 str = a2bstr("600");
629 hres = IHTMLStyle_put_fontWeight(style, str);
630 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
631 SysFreeString(str);
633 str = a2bstr("700");
634 hres = IHTMLStyle_put_fontWeight(style, str);
635 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
636 SysFreeString(str);
638 str = a2bstr("800");
639 hres = IHTMLStyle_put_fontWeight(style, str);
640 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
641 SysFreeString(str);
643 str = a2bstr("900");
644 hres = IHTMLStyle_put_fontWeight(style, str);
645 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
646 SysFreeString(str);
648 hres = IHTMLStyle_get_fontWeight(style, &str);
649 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
650 ok(!strcmp_wa(str, "900"), "str != style900\n");
651 SysFreeString(str);
653 hres = IHTMLStyle_put_fontWeight(style, sDefault);
654 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
655 SysFreeString(sDefault);
657 /* font Variant */
658 hres = IHTMLStyle_get_fontVariant(style, NULL);
659 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
661 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
662 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
664 str = a2bstr("test");
665 hres = IHTMLStyle_put_fontVariant(style, str);
666 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
667 SysFreeString(str);
669 str = a2bstr("small-caps");
670 hres = IHTMLStyle_put_fontVariant(style, str);
671 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
672 SysFreeString(str);
674 str = a2bstr("normal");
675 hres = IHTMLStyle_put_fontVariant(style, str);
676 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
677 SysFreeString(str);
679 hres = IHTMLStyle_put_fontVariant(style, sDefault);
680 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
681 SysFreeString(sDefault);
683 str = (void*)0xdeadbeef;
684 hres = IHTMLStyle_get_display(style, &str);
685 ok(hres == S_OK, "get_display failed: %08x\n", hres);
686 ok(!str, "display = %s\n", wine_dbgstr_w(str));
688 str = (void*)0xdeadbeef;
689 hres = IHTMLStyle_get_visibility(style, &str);
690 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
691 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
693 V_VT(&v) = VT_NULL;
694 hres = IHTMLStyle_get_fontSize(style, &v);
695 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
696 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
697 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
699 V_VT(&v) = VT_I4;
700 V_I4(&v) = 12;
701 hres = IHTMLStyle_put_fontSize(style, v);
702 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
704 V_VT(&v) = VT_NULL;
705 hres = IHTMLStyle_get_fontSize(style, &v);
706 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
707 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
708 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
710 V_VT(&v) = VT_NULL;
711 hres = IHTMLStyle_get_color(style, &v);
712 ok(hres == S_OK, "get_color failed: %08x\n", hres);
713 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
714 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
716 V_VT(&v) = VT_I4;
717 V_I4(&v) = 0xfdfd;
718 hres = IHTMLStyle_put_color(style, v);
719 ok(hres == S_OK, "put_color failed: %08x\n", hres);
721 V_VT(&v) = VT_NULL;
722 hres = IHTMLStyle_get_color(style, &v);
723 ok(hres == S_OK, "get_color failed: %08x\n", hres);
724 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
725 todo_wine
726 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
728 b = 0xfefe;
729 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
730 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
731 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
733 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
734 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
736 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
737 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
738 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
740 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
741 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
743 b = 0xfefe;
744 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
745 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
746 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
748 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
749 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
751 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
752 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
753 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
755 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
756 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
758 b = 0xfefe;
759 hres = IHTMLStyle_get_textDecorationNone(style, &b);
760 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
761 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
763 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
764 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
766 hres = IHTMLStyle_get_textDecorationNone(style, &b);
767 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
768 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
770 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
771 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
773 b = 0xfefe;
774 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
775 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
776 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
778 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
779 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
781 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
782 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
783 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
785 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
786 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
788 b = 0xfefe;
789 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
790 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
791 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
793 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
794 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
796 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
797 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
798 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
800 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
801 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
803 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
804 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
806 str = a2bstr("invalid");
807 hres = IHTMLStyle_put_textDecoration(style, str);
808 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
809 SysFreeString(str);
811 set_text_decoration(style, "none");
812 test_text_decoration(style, "none");
813 set_text_decoration(style, "underline");
814 set_text_decoration(style, "overline");
815 set_text_decoration(style, "line-through");
816 set_text_decoration(style, "blink");
817 set_text_decoration(style, "overline");
818 set_text_decoration(style, "blink");
819 test_text_decoration(style, "blink");
821 hres = IHTMLStyle_put_textDecoration(style, sDefault);
822 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
823 SysFreeString(sDefault);
825 hres = IHTMLStyle_get_posWidth(style, NULL);
826 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
828 hres = IHTMLStyle_get_posWidth(style, &f);
829 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
830 ok(f == 0.0f, "f = %f\n", f);
832 V_VT(&v) = VT_EMPTY;
833 hres = IHTMLStyle_get_width(style, &v);
834 ok(hres == S_OK, "get_width failed: %08x\n", hres);
835 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
836 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
838 hres = IHTMLStyle_put_posWidth(style, 2.2);
839 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
841 hres = IHTMLStyle_get_posWidth(style, &f);
842 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
843 ok(f == 2.0f ||
844 f == 2.2f, /* IE8 */
845 "f = %f\n", f);
847 V_VT(&v) = VT_BSTR;
848 V_BSTR(&v) = a2bstr("auto");
849 hres = IHTMLStyle_put_width(style, v);
850 ok(hres == S_OK, "put_width failed: %08x\n", hres);
851 VariantClear(&v);
853 V_VT(&v) = VT_EMPTY;
854 hres = IHTMLStyle_get_width(style, &v);
855 ok(hres == S_OK, "get_width failed: %08x\n", hres);
856 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
857 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
858 VariantClear(&v);
860 V_VT(&v) = VT_I4;
861 V_I4(&v) = 100;
862 hres = IHTMLStyle_put_width(style, v);
863 ok(hres == S_OK, "put_width failed: %08x\n", hres);
865 V_VT(&v) = VT_EMPTY;
866 hres = IHTMLStyle_get_width(style, &v);
867 ok(hres == S_OK, "get_width failed: %08x\n", hres);
868 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
869 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
870 VariantClear(&v);
872 hres = IHTMLStyle_put_pixelWidth(style, 50);
873 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
875 V_VT(&v) = VT_EMPTY;
876 hres = IHTMLStyle_get_width(style, &v);
877 ok(hres == S_OK, "get_width failed: %08x\n", hres);
878 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
879 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
880 VariantClear(&v);
882 /* margin tests */
883 str = (void*)0xdeadbeef;
884 hres = IHTMLStyle_get_margin(style, &str);
885 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
886 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
888 str = a2bstr("1");
889 hres = IHTMLStyle_put_margin(style, str);
890 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
891 SysFreeString(str);
893 hres = IHTMLStyle_get_margin(style, &str);
894 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
895 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
896 SysFreeString(str);
898 hres = IHTMLStyle_put_margin(style, NULL);
899 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
901 str = (void*)0xdeadbeef;
902 hres = IHTMLStyle_get_marginTop(style, &v);
903 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
904 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
905 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
907 V_VT(&v) = VT_BSTR;
908 V_BSTR(&v) = a2bstr("6px");
909 hres = IHTMLStyle_put_marginTop(style, v);
910 SysFreeString(V_BSTR(&v));
911 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
913 str = (void*)0xdeadbeef;
914 hres = IHTMLStyle_get_marginTop(style, &v);
915 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
916 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
917 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
918 VariantClear(&v);
920 V_VT(&v) = VT_I4;
921 V_I4(&v) = 5;
922 hres = IHTMLStyle_put_marginTop(style, v);
923 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
925 str = (void*)0xdeadbeef;
926 hres = IHTMLStyle_get_marginTop(style, &v);
927 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
928 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
929 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
930 VariantClear(&v);
932 str = NULL;
933 hres = IHTMLStyle_get_border(style, &str);
934 ok(hres == S_OK, "get_border failed: %08x\n", hres);
935 ok(!str || !*str, "str is not empty\n");
936 SysFreeString(str);
938 str = a2bstr("1px");
939 hres = IHTMLStyle_put_border(style, str);
940 ok(hres == S_OK, "put_border failed: %08x\n", hres);
941 SysFreeString(str);
943 V_VT(&v) = VT_EMPTY;
944 hres = IHTMLStyle_get_left(style, &v);
945 ok(hres == S_OK, "get_left failed: %08x\n", hres);
946 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
947 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
948 VariantClear(&v);
950 l = 0xdeadbeef;
951 hres = IHTMLStyle_get_pixelLeft(style, &l);
952 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
953 ok(!l, "pixelLeft = %d\n", l);
955 /* Test posLeft */
956 hres = IHTMLStyle_get_posLeft(style, NULL);
957 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
959 f = 1.0f;
960 hres = IHTMLStyle_get_posLeft(style, &f);
961 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
962 ok(f == 0.0, "expected 0.0 got %f\n", f);
964 hres = IHTMLStyle_put_posLeft(style, 4.9f);
965 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
967 hres = IHTMLStyle_get_posLeft(style, &f);
968 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
969 ok(f == 4.0 ||
970 f == 4.9f, /* IE8 */
971 "expected 4.0 or 4.9 (IE8) got %f\n", f);
973 /* Ensure left is updated correctly. */
974 V_VT(&v) = VT_EMPTY;
975 hres = IHTMLStyle_get_left(style, &v);
976 ok(hres == S_OK, "get_left failed: %08x\n", hres);
977 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
978 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
979 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
980 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
981 VariantClear(&v);
983 /* Test left */
984 V_VT(&v) = VT_BSTR;
985 V_BSTR(&v) = a2bstr("3px");
986 hres = IHTMLStyle_put_left(style, v);
987 ok(hres == S_OK, "put_left failed: %08x\n", hres);
988 VariantClear(&v);
990 hres = IHTMLStyle_get_posLeft(style, &f);
991 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
992 ok(f == 3.0, "expected 3.0 got %f\n", f);
994 l = 0xdeadbeef;
995 hres = IHTMLStyle_get_pixelLeft(style, &l);
996 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
997 ok(l == 3, "pixelLeft = %d\n", l);
999 V_VT(&v) = VT_EMPTY;
1000 hres = IHTMLStyle_get_left(style, &v);
1001 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1002 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1003 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1004 VariantClear(&v);
1006 V_VT(&v) = VT_BSTR;
1007 V_BSTR(&v) = a2bstr("4.99");
1008 hres = IHTMLStyle_put_left(style, v);
1009 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1010 VariantClear(&v);
1012 l = 0xdeadbeef;
1013 hres = IHTMLStyle_get_pixelLeft(style, &l);
1014 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1015 ok(l == 4, "pixelLeft = %d\n", l);
1017 V_VT(&v) = VT_NULL;
1018 hres = IHTMLStyle_put_left(style, v);
1019 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1021 V_VT(&v) = VT_EMPTY;
1022 hres = IHTMLStyle_get_left(style, &v);
1023 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1024 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1025 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1026 VariantClear(&v);
1028 V_VT(&v) = VT_EMPTY;
1029 hres = IHTMLStyle_get_top(style, &v);
1030 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1031 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1032 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1033 VariantClear(&v);
1035 l = 0xdeadbeef;
1036 hres = IHTMLStyle_get_pixelLeft(style, &l);
1037 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1038 ok(!l, "pixelLeft = %d\n", l);
1040 hres = IHTMLStyle_put_pixelLeft(style, 6);
1041 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1043 l = 0xdeadbeef;
1044 hres = IHTMLStyle_get_pixelLeft(style, &l);
1045 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1046 ok(l == 6, "pixelLeft = %d\n", l);
1048 V_VT(&v) = VT_EMPTY;
1049 hres = IHTMLStyle_get_left(style, &v);
1050 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1051 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1052 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1053 VariantClear(&v);
1055 /* Test posTop */
1056 hres = IHTMLStyle_get_posTop(style, NULL);
1057 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1059 f = 1.0f;
1060 hres = IHTMLStyle_get_posTop(style, &f);
1061 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1062 ok(f == 0.0, "expected 0.0 got %f\n", f);
1064 hres = IHTMLStyle_put_posTop(style, 4.9f);
1065 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1067 hres = IHTMLStyle_get_posTop(style, &f);
1068 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1069 ok(f == 4.0 ||
1070 f == 4.9f, /* IE8 */
1071 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1073 V_VT(&v) = VT_BSTR;
1074 V_BSTR(&v) = a2bstr("3px");
1075 hres = IHTMLStyle_put_top(style, v);
1076 ok(hres == S_OK, "put_top failed: %08x\n", hres);
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(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1084 VariantClear(&v);
1086 hres = IHTMLStyle_get_posTop(style, &f);
1087 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1088 ok(f == 3.0, "expected 3.0 got %f\n", f);
1090 V_VT(&v) = VT_NULL;
1091 hres = IHTMLStyle_put_top(style, v);
1092 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1094 V_VT(&v) = VT_EMPTY;
1095 hres = IHTMLStyle_get_top(style, &v);
1096 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1097 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1098 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1099 VariantClear(&v);
1101 /* Test posHeight */
1102 hres = IHTMLStyle_get_posHeight(style, NULL);
1103 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1105 V_VT(&v) = VT_EMPTY;
1106 hres = IHTMLStyle_get_height(style, &v);
1107 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1108 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1109 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1110 VariantClear(&v);
1112 f = 1.0f;
1113 hres = IHTMLStyle_get_posHeight(style, &f);
1114 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1115 ok(f == 0.0, "expected 0.0 got %f\n", f);
1117 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1118 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1120 hres = IHTMLStyle_get_posHeight(style, &f);
1121 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1122 ok(f == 4.0 ||
1123 f == 4.9f, /* IE8 */
1124 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1126 V_VT(&v) = VT_BSTR;
1127 V_BSTR(&v) = a2bstr("70px");
1128 hres = IHTMLStyle_put_height(style, v);
1129 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1130 VariantClear(&v);
1132 V_VT(&v) = VT_EMPTY;
1133 hres = IHTMLStyle_get_height(style, &v);
1134 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1135 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1136 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1137 VariantClear(&v);
1139 V_VT(&v) = VT_BSTR;
1140 V_BSTR(&v) = NULL;
1141 hres = IHTMLStyle_put_height(style, v);
1142 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1143 VariantClear(&v);
1145 V_VT(&v) = VT_EMPTY;
1146 hres = IHTMLStyle_get_height(style, &v);
1147 ok(hres == S_OK, "get_height 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) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1150 VariantClear(&v);
1152 V_VT(&v) = VT_I4;
1153 V_I4(&v) = 64;
1154 hres = IHTMLStyle_put_height(style, v);
1155 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1157 V_VT(&v) = VT_EMPTY;
1158 hres = IHTMLStyle_get_height(style, &v);
1159 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1160 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1161 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1162 VariantClear(&v);
1164 hres = IHTMLStyle_get_posHeight(style, &f);
1165 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1166 ok(f == 64.0, "expected 64.0 got %f\n", f);
1168 str = (void*)0xdeadbeef;
1169 hres = IHTMLStyle_get_cursor(style, &str);
1170 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1171 ok(!str, "get_cursor != NULL\n");
1172 SysFreeString(str);
1174 str = a2bstr("default");
1175 hres = IHTMLStyle_put_cursor(style, str);
1176 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1177 SysFreeString(str);
1179 str = NULL;
1180 hres = IHTMLStyle_get_cursor(style, &str);
1181 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1182 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1183 SysFreeString(str);
1185 V_VT(&v) = VT_EMPTY;
1186 hres = IHTMLStyle_get_verticalAlign(style, &v);
1187 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1188 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1189 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1190 VariantClear(&v);
1192 V_VT(&v) = VT_BSTR;
1193 V_BSTR(&v) = a2bstr("middle");
1194 hres = IHTMLStyle_put_verticalAlign(style, v);
1195 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1196 VariantClear(&v);
1198 V_VT(&v) = VT_EMPTY;
1199 hres = IHTMLStyle_get_verticalAlign(style, &v);
1200 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1201 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1202 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1203 VariantClear(&v);
1205 V_VT(&v) = VT_I4;
1206 V_I4(&v) = 100;
1207 hres = IHTMLStyle_put_verticalAlign(style, v);
1208 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1209 VariantClear(&v);
1211 V_VT(&v) = VT_EMPTY;
1212 hres = IHTMLStyle_get_verticalAlign(style, &v);
1213 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1214 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1215 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1216 VariantClear(&v);
1218 str = (void*)0xdeadbeef;
1219 hres = IHTMLStyle_get_textAlign(style, &str);
1220 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1221 ok(!str, "textAlign != NULL\n");
1223 str = a2bstr("center");
1224 hres = IHTMLStyle_put_textAlign(style, str);
1225 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1226 SysFreeString(str);
1228 str = NULL;
1229 hres = IHTMLStyle_get_textAlign(style, &str);
1230 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1231 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1232 SysFreeString(str);
1234 str = (void*)0xdeadbeef;
1235 hres = IHTMLStyle_get_filter(style, &str);
1236 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1237 ok(!str, "filter != NULL\n");
1239 str = a2bstr("alpha(opacity=100)");
1240 hres = IHTMLStyle_put_filter(style, str);
1241 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1242 SysFreeString(str);
1244 V_VT(&v) = VT_EMPTY;
1245 hres = IHTMLStyle_get_zIndex(style, &v);
1246 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1247 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1248 ok(!V_I4(&v), "V_I4(v) != 0\n");
1249 VariantClear(&v);
1251 V_VT(&v) = VT_BSTR;
1252 V_BSTR(&v) = a2bstr("1");
1253 hres = IHTMLStyle_put_zIndex(style, v);
1254 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1255 VariantClear(&v);
1257 V_VT(&v) = VT_EMPTY;
1258 hres = IHTMLStyle_get_zIndex(style, &v);
1259 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1260 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1261 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1262 VariantClear(&v);
1264 /* fontStyle */
1265 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1266 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1268 str = a2bstr("test");
1269 hres = IHTMLStyle_put_fontStyle(style, str);
1270 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1271 SysFreeString(str);
1273 str = a2bstr("italic");
1274 hres = IHTMLStyle_put_fontStyle(style, str);
1275 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1276 SysFreeString(str);
1278 str = a2bstr("oblique");
1279 hres = IHTMLStyle_put_fontStyle(style, str);
1280 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1281 SysFreeString(str);
1283 str = a2bstr("normal");
1284 hres = IHTMLStyle_put_fontStyle(style, str);
1285 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1286 SysFreeString(str);
1288 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1289 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1290 SysFreeString(sDefault);
1292 /* overflow */
1293 hres = IHTMLStyle_get_overflow(style, NULL);
1294 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1296 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1297 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1299 str = a2bstr("test");
1300 hres = IHTMLStyle_put_overflow(style, str);
1301 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1302 SysFreeString(str);
1304 str = a2bstr("visible");
1305 hres = IHTMLStyle_put_overflow(style, str);
1306 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1307 SysFreeString(str);
1309 str = a2bstr("scroll");
1310 hres = IHTMLStyle_put_overflow(style, str);
1311 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1312 SysFreeString(str);
1314 str = a2bstr("hidden");
1315 hres = IHTMLStyle_put_overflow(style, str);
1316 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1317 SysFreeString(str);
1319 str = a2bstr("auto");
1320 hres = IHTMLStyle_put_overflow(style, str);
1321 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1322 SysFreeString(str);
1324 hres = IHTMLStyle_get_overflow(style, &str);
1325 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1326 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1327 SysFreeString(str);
1329 str = a2bstr("");
1330 hres = IHTMLStyle_put_overflow(style, str);
1331 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1332 SysFreeString(str);
1334 hres = IHTMLStyle_get_overflow(style, &str);
1335 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1336 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1337 SysFreeString(str);
1339 /* restore overflow default */
1340 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1341 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1342 SysFreeString(sOverflowDefault);
1344 /* Attribute Tests*/
1345 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1346 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1348 str = a2bstr("position");
1349 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1350 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1352 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1353 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1354 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1355 VariantClear(&v);
1357 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1358 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1360 V_VT(&v) = VT_BSTR;
1361 V_BSTR(&v) = a2bstr("absolute");
1362 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1363 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1364 VariantClear(&v);
1366 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1367 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1368 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1369 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1370 VariantClear(&v);
1372 V_VT(&v) = VT_BSTR;
1373 V_BSTR(&v) = NULL;
1374 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1375 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1376 VariantClear(&v);
1378 SysFreeString(str);
1380 str = a2bstr("borderLeftStyle");
1381 test_border_styles(style, str);
1382 SysFreeString(str);
1384 str = a2bstr("borderbottomstyle");
1385 test_border_styles(style, str);
1386 SysFreeString(str);
1388 str = a2bstr("borderrightstyle");
1389 test_border_styles(style, str);
1390 SysFreeString(str);
1392 str = a2bstr("bordertopstyle");
1393 test_border_styles(style, str);
1394 SysFreeString(str);
1396 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1397 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1399 str = a2bstr("none dotted dashed solid");
1400 hres = IHTMLStyle_put_borderStyle(style, str);
1401 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1402 SysFreeString(str);
1404 str = a2bstr("none dotted dashed solid");
1405 hres = IHTMLStyle_get_borderStyle(style, &str);
1406 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1407 ok(!strcmp_wa(str, "none dotted dashed solid"),
1408 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1409 SysFreeString(str);
1411 str = a2bstr("double groove ridge inset");
1412 hres = IHTMLStyle_put_borderStyle(style, str);
1413 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1414 SysFreeString(str);
1416 str = a2bstr("window-inset outset ridge inset");
1417 hres = IHTMLStyle_put_borderStyle(style, str);
1418 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1419 SysFreeString(str);
1421 str = a2bstr("window-inset");
1422 hres = IHTMLStyle_put_borderStyle(style, str);
1423 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1424 SysFreeString(str);
1426 str = a2bstr("none none none none none");
1427 hres = IHTMLStyle_put_borderStyle(style, str);
1428 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1429 SysFreeString(str);
1431 str = a2bstr("invalid none none none");
1432 hres = IHTMLStyle_put_borderStyle(style, str);
1433 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1434 SysFreeString(str);
1436 str = a2bstr("none invalid none none");
1437 hres = IHTMLStyle_put_borderStyle(style, str);
1438 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1439 SysFreeString(str);
1441 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1442 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1443 SysFreeString(sDefault);
1445 /* backgoundColor */
1446 hres = IHTMLStyle_get_backgroundColor(style, &v);
1447 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1448 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1449 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1450 VariantClear(&v);
1452 V_VT(&v) = VT_BSTR;
1453 V_BSTR(&v) = a2bstr("red");
1454 hres = IHTMLStyle_put_backgroundColor(style, v);
1455 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1456 VariantClear(&v);
1458 hres = IHTMLStyle_get_backgroundColor(style, &v);
1459 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1460 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1461 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1462 VariantClear(&v);
1464 /* padding */
1465 hres = IHTMLStyle_get_padding(style, &str);
1466 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1467 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1468 SysFreeString(str);
1470 hres = IHTMLStyle_get_paddingTop(style, &v);
1471 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1472 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1473 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1475 V_VT(&v) = VT_I4;
1476 V_I4(&v) = 6;
1477 hres = IHTMLStyle_put_paddingTop(style, v);
1478 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1480 hres = IHTMLStyle_get_paddingTop(style, &v);
1481 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1482 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1483 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1484 VariantClear(&v);
1486 hres = IHTMLStyle_get_paddingRight(style, &v);
1487 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1488 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1489 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1491 V_VT(&v) = VT_I4;
1492 V_I4(&v) = 6;
1493 hres = IHTMLStyle_put_paddingRight(style, v);
1494 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1496 hres = IHTMLStyle_get_paddingRight(style, &v);
1497 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1498 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1499 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1500 VariantClear(&v);
1502 hres = IHTMLStyle_get_paddingBottom(style, &v);
1503 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1504 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1505 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1507 V_VT(&v) = VT_I4;
1508 V_I4(&v) = 6;
1509 hres = IHTMLStyle_put_paddingBottom(style, v);
1510 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1512 hres = IHTMLStyle_get_paddingBottom(style, &v);
1513 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1514 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1515 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1516 VariantClear(&v);
1518 str = a2bstr("1");
1519 hres = IHTMLStyle_put_padding(style, str);
1520 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1521 SysFreeString(str);
1523 hres = IHTMLStyle_get_padding(style, &str);
1524 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1525 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1526 SysFreeString(str);
1528 /* PaddingLeft */
1529 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1530 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1531 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1532 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1534 V_VT(&v) = VT_BSTR;
1535 V_BSTR(&v) = a2bstr("10");
1536 hres = IHTMLStyle_put_paddingLeft(style, v);
1537 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1538 VariantClear(&v);
1540 hres = IHTMLStyle_get_paddingLeft(style, &v);
1541 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1542 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1543 VariantClear(&v);
1545 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1546 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1548 /* BackgroundRepeat */
1549 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1550 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1552 str = a2bstr("invalid");
1553 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1554 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1555 SysFreeString(str);
1557 str = a2bstr("repeat");
1558 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1559 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1560 SysFreeString(str);
1562 str = a2bstr("no-repeat");
1563 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1564 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1565 SysFreeString(str);
1567 str = a2bstr("repeat-x");
1568 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1569 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1570 SysFreeString(str);
1572 str = a2bstr("repeat-y");
1573 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1574 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1575 SysFreeString(str);
1577 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1578 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1579 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1580 SysFreeString(str);
1582 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1583 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1584 SysFreeString(sDefault);
1586 /* BorderColor */
1587 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1588 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1590 str = a2bstr("red green red blue");
1591 hres = IHTMLStyle_put_borderColor(style, str);
1592 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1593 SysFreeString(str);
1595 hres = IHTMLStyle_get_borderColor(style, &str);
1596 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1597 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1598 SysFreeString(str);
1600 hres = IHTMLStyle_put_borderColor(style, sDefault);
1601 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1602 SysFreeString(sDefault);
1604 /* BorderRight */
1605 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1606 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1608 str = a2bstr("thick dotted red");
1609 hres = IHTMLStyle_put_borderRight(style, str);
1610 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1611 SysFreeString(str);
1613 /* IHTMLStyle_get_borderRight appears to have a bug where
1614 it returns the first letter of the color. So we check
1615 each style individually.
1617 V_BSTR(&v) = NULL;
1618 hres = IHTMLStyle_get_borderRightColor(style, &v);
1619 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1620 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1621 VariantClear(&v);
1623 V_BSTR(&v) = NULL;
1624 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1625 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1626 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1627 VariantClear(&v);
1629 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1630 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1631 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1632 SysFreeString(str);
1634 hres = IHTMLStyle_put_borderRight(style, sDefault);
1635 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1636 SysFreeString(sDefault);
1638 /* BorderTop */
1639 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1640 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1642 str = a2bstr("thick dotted red");
1643 hres = IHTMLStyle_put_borderTop(style, str);
1644 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1645 SysFreeString(str);
1647 /* IHTMLStyle_get_borderTop appears to have a bug where
1648 it returns the first letter of the color. So we check
1649 each style individually.
1651 V_BSTR(&v) = NULL;
1652 hres = IHTMLStyle_get_borderTopColor(style, &v);
1653 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1654 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1655 VariantClear(&v);
1657 V_BSTR(&v) = NULL;
1658 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1659 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1660 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1661 VariantClear(&v);
1663 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1664 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1665 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1666 SysFreeString(str);
1668 hres = IHTMLStyle_put_borderTop(style, sDefault);
1669 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1670 SysFreeString(sDefault);
1672 /* BorderBottom */
1673 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1674 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1676 str = a2bstr("thick dotted red");
1677 hres = IHTMLStyle_put_borderBottom(style, str);
1678 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1679 SysFreeString(str);
1681 /* IHTMLStyle_get_borderBottom appears to have a bug where
1682 it returns the first letter of the color. So we check
1683 each style individually.
1685 V_BSTR(&v) = NULL;
1686 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1687 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1688 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1689 VariantClear(&v);
1691 V_BSTR(&v) = NULL;
1692 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1693 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1694 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1695 VariantClear(&v);
1697 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1698 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1699 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1700 SysFreeString(str);
1702 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1703 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1704 SysFreeString(sDefault);
1706 /* BorderLeft */
1707 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1708 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1710 str = a2bstr("thick dotted red");
1711 hres = IHTMLStyle_put_borderLeft(style, str);
1712 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1713 SysFreeString(str);
1715 /* IHTMLStyle_get_borderLeft appears to have a bug where
1716 it returns the first letter of the color. So we check
1717 each style individually.
1719 V_BSTR(&v) = NULL;
1720 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1721 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1722 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1723 VariantClear(&v);
1725 V_BSTR(&v) = NULL;
1726 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1727 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1728 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1729 VariantClear(&v);
1731 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1732 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1733 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1734 SysFreeString(str);
1736 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1737 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1738 SysFreeString(sDefault);
1740 /* backgroundPositionX */
1741 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1742 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1743 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1744 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1745 VariantClear(&v);
1747 V_VT(&v) = VT_BSTR;
1748 V_BSTR(&v) = a2bstr("10px");
1749 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1750 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1751 VariantClear(&v);
1753 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1754 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1755 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1756 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1757 VariantClear(&v);
1759 /* backgroundPositionY */
1760 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1761 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1762 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1763 VariantClear(&v);
1765 V_VT(&v) = VT_BSTR;
1766 V_BSTR(&v) = a2bstr("15px");
1767 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1768 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1769 VariantClear(&v);
1771 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1772 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1773 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1774 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1775 VariantClear(&v);
1777 /* backgroundPosition */
1778 str = NULL;
1779 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1780 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1781 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1782 SysFreeString(str);
1784 str = a2bstr("center 20%");
1785 hres = IHTMLStyle_put_backgroundPosition(style, str);
1786 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1787 SysFreeString(str);
1789 str = NULL;
1790 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1791 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1792 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1793 SysFreeString(str);
1795 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1796 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1797 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1798 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1799 VariantClear(&v);
1801 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1802 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1803 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1804 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1805 VariantClear(&v);
1807 /* borderTopWidth */
1808 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1809 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1811 V_VT(&v) = VT_BSTR;
1812 V_BSTR(&v) = a2bstr("10px");
1813 hres = IHTMLStyle_put_borderTopWidth(style, v);
1814 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1815 VariantClear(&v);
1817 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1818 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1819 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1820 VariantClear(&v);
1822 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1823 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1824 VariantClear(&vDefault);
1826 /* borderRightWidth */
1827 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1828 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1830 V_VT(&v) = VT_BSTR;
1831 V_BSTR(&v) = a2bstr("10");
1832 hres = IHTMLStyle_put_borderRightWidth(style, v);
1833 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1834 VariantClear(&v);
1836 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1837 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1838 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1839 VariantClear(&v);
1841 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1842 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1843 VariantClear(&vDefault);
1845 /* borderBottomWidth */
1846 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1847 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1849 V_VT(&v) = VT_BSTR;
1850 V_BSTR(&v) = a2bstr("10");
1851 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1852 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1853 VariantClear(&v);
1855 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1856 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1857 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1858 VariantClear(&v);
1860 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1861 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1862 VariantClear(&vDefault);
1864 /* borderLeftWidth */
1865 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1866 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1868 V_VT(&v) = VT_BSTR;
1869 V_BSTR(&v) = a2bstr("10");
1870 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1871 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1872 VariantClear(&v);
1874 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1875 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1876 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1877 VariantClear(&v);
1879 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1880 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1881 VariantClear(&vDefault);
1883 /* wordSpacing */
1884 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1885 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1887 V_VT(&v) = VT_BSTR;
1888 V_BSTR(&v) = a2bstr("10");
1889 hres = IHTMLStyle_put_wordSpacing(style, v);
1890 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1891 VariantClear(&v);
1893 hres = IHTMLStyle_get_wordSpacing(style, &v);
1894 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1895 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1896 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1897 VariantClear(&v);
1899 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1900 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1901 VariantClear(&vDefault);
1903 /* letterSpacing */
1904 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1905 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1907 V_VT(&v) = VT_BSTR;
1908 V_BSTR(&v) = a2bstr("11");
1909 hres = IHTMLStyle_put_letterSpacing(style, v);
1910 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1911 VariantClear(&v);
1913 hres = IHTMLStyle_get_letterSpacing(style, &v);
1914 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1915 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1916 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1917 VariantClear(&v);
1919 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1920 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1921 VariantClear(&vDefault);
1923 /* borderTopColor */
1924 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1925 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1927 V_VT(&v) = VT_BSTR;
1928 V_BSTR(&v) = a2bstr("red");
1929 hres = IHTMLStyle_put_borderTopColor(style, v);
1930 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1931 VariantClear(&v);
1933 hres = IHTMLStyle_get_borderTopColor(style, &v);
1934 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1935 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1936 VariantClear(&v);
1938 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1939 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1941 /* borderRightColor */
1942 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1943 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1945 V_VT(&v) = VT_BSTR;
1946 V_BSTR(&v) = a2bstr("blue");
1947 hres = IHTMLStyle_put_borderRightColor(style, v);
1948 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1949 VariantClear(&v);
1951 hres = IHTMLStyle_get_borderRightColor(style, &v);
1952 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1953 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1954 VariantClear(&v);
1956 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1957 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1959 /* borderBottomColor */
1960 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1961 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1963 V_VT(&v) = VT_BSTR;
1964 V_BSTR(&v) = a2bstr("cyan");
1965 hres = IHTMLStyle_put_borderBottomColor(style, v);
1966 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1967 VariantClear(&v);
1969 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1970 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1971 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1972 VariantClear(&v);
1974 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1975 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1977 /* borderLeftColor */
1978 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1979 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1981 V_VT(&v) = VT_BSTR;
1982 V_BSTR(&v) = a2bstr("cyan");
1983 hres = IHTMLStyle_put_borderLeftColor(style, v);
1984 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1985 VariantClear(&v);
1987 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1988 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1989 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1990 VariantClear(&v);
1992 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1993 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1995 /* clip */
1996 hres = IHTMLStyle_get_clip(style, &str);
1997 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1998 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2000 str = a2bstr("rect(0px 1px 500px 505px)");
2001 hres = IHTMLStyle_put_clip(style, str);
2002 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2003 SysFreeString(str);
2005 hres = IHTMLStyle_get_clip(style, &str);
2006 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2007 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
2008 SysFreeString(str);
2010 /* clear */
2011 hres = IHTMLStyle_get_clear(style, &str);
2012 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2013 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2015 str = a2bstr("both");
2016 hres = IHTMLStyle_put_clear(style, str);
2017 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2018 SysFreeString(str);
2020 hres = IHTMLStyle_get_clear(style, &str);
2021 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2022 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2023 SysFreeString(str);
2025 /* pageBreakAfter */
2026 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2027 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2028 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2030 str = a2bstr("always");
2031 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2032 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2033 SysFreeString(str);
2035 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2036 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2037 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2038 SysFreeString(str);
2040 /* pageBreakBefore */
2041 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2042 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2043 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2045 str = a2bstr("always");
2046 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2047 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2048 SysFreeString(str);
2050 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2051 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2052 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2053 SysFreeString(str);
2055 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2056 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2058 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2059 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2060 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2062 str = (void*)0xdeadbeef;
2063 hres = IHTMLStyle_get_whiteSpace(style, &str);
2064 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2065 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2067 str = a2bstr("nowrap");
2068 hres = IHTMLStyle_put_whiteSpace(style, str);
2069 SysFreeString(str);
2070 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2072 str = NULL;
2073 hres = IHTMLStyle_get_whiteSpace(style, &str);
2074 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2075 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2076 SysFreeString(str);
2078 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2079 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2080 if(SUCCEEDED(hres)) {
2081 test_style2(style2);
2082 IHTMLStyle2_Release(style2);
2085 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2086 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2087 if(SUCCEEDED(hres)) {
2088 test_style3(style3);
2089 IHTMLStyle3_Release(style3);
2092 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2093 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2094 if(SUCCEEDED(hres)) {
2095 test_style4(style4);
2096 IHTMLStyle4_Release(style4);
2099 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2100 if(SUCCEEDED(hres)) {
2101 test_style6(style6);
2102 IHTMLStyle6_Release(style6);
2103 }else {
2104 win_skip("IHTMLStyle6 not available\n");
2108 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2109 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2111 BSTR str;
2112 HRESULT hres;
2114 str = (void*)0xdeadbeef;
2115 hres = IHTMLStyle_get_filter(style, &str);
2116 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2117 if(exval)
2118 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2119 else
2120 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2122 SysFreeString(str);
2125 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2126 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2128 BSTR str;
2129 HRESULT hres;
2131 str = (void*)0xdeadbeef;
2132 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2133 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2134 if(exval)
2135 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2136 else
2137 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2139 SysFreeString(str);
2142 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2143 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2145 BSTR str = a2bstr(val);
2146 HRESULT hres;
2148 hres = IHTMLStyle_put_filter(style, str);
2149 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2150 SysFreeString(str);
2152 _test_style_filter(line, style, val);
2155 static void test_style_filters(IHTMLElement *elem)
2157 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2158 IHTMLCurrentStyle2 *current_style2;
2159 IHTMLCurrentStyle *current_style;
2160 IHTMLStyle *style;
2161 HRESULT hres;
2163 hres = IHTMLElement_get_style(elem, &style);
2164 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2166 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2167 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2169 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2171 test_style_filter(style, NULL);
2172 test_current_style_filter(current_style2, NULL);
2173 set_style_filter(style, "alpha(opacity=50.0040)");
2174 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2175 set_style_filter(style, "alpha(opacity=100)");
2177 IHTMLStyle_Release(style);
2179 hres = IHTMLElement_get_style(elem, &style);
2180 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2182 test_style_filter(style, "alpha(opacity=100)");
2183 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2184 set_style_filter(style, NULL);
2185 set_style_filter(style, "alpha(opacity=100)");
2186 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2187 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2188 test_style_filter(style, NULL);
2191 IHTMLCurrentStyle2_Release(current_style2);
2192 IHTMLStyle_Release(style);
2193 IHTMLElement2_Release(elem2);
2196 static void test_current_style(IHTMLCurrentStyle *current_style)
2198 IHTMLCurrentStyle2 *current_style2;
2199 VARIANT_BOOL b;
2200 BSTR str;
2201 HRESULT hres;
2202 VARIANT v;
2204 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2205 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2206 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2207 SysFreeString(str);
2209 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2210 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2211 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2212 SysFreeString(str);
2214 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2215 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2216 SysFreeString(str);
2218 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2219 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2220 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2221 SysFreeString(str);
2223 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2224 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2225 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2226 SysFreeString(str);
2228 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2229 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2230 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2231 SysFreeString(str);
2233 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2234 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2235 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2236 SysFreeString(str);
2238 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2239 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2240 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2241 SysFreeString(str);
2243 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2244 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2245 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2246 SysFreeString(str);
2248 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2249 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2250 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2251 SysFreeString(str);
2253 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2254 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2255 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2256 SysFreeString(str);
2258 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2259 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2260 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2261 SysFreeString(str);
2263 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2264 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2265 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2266 SysFreeString(str);
2268 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2269 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2270 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2271 SysFreeString(str);
2273 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2274 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2275 SysFreeString(str);
2277 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2278 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2279 SysFreeString(str);
2281 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2282 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2283 SysFreeString(str);
2285 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2286 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2287 SysFreeString(str);
2289 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2290 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2291 SysFreeString(str);
2293 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2294 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2295 SysFreeString(str);
2297 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2298 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2299 SysFreeString(str);
2301 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2302 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2303 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2304 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2305 VariantClear(&v);
2307 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2308 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2309 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2310 VariantClear(&v);
2312 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2313 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2314 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2315 VariantClear(&v);
2317 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2318 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2319 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2320 VariantClear(&v);
2322 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2323 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2324 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2325 VariantClear(&v);
2327 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2328 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2329 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2330 VariantClear(&v);
2332 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2333 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2334 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2335 VariantClear(&v);
2337 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2338 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2339 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2340 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2341 VariantClear(&v);
2343 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2344 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2345 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2346 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2347 VariantClear(&v);
2349 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2350 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2351 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2352 VariantClear(&v);
2354 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2355 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2356 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2357 VariantClear(&v);
2359 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2360 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2361 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2362 VariantClear(&v);
2364 V_BSTR(&v) = NULL;
2365 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2366 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2367 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2368 VariantClear(&v);
2370 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2371 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2372 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2373 VariantClear(&v);
2375 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2376 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2377 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2378 VariantClear(&v);
2380 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2381 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2382 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2383 VariantClear(&v);
2385 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2386 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2387 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2388 VariantClear(&v);
2390 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2391 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2392 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2393 VariantClear(&v);
2395 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2396 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2397 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2398 VariantClear(&v);
2400 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2401 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2402 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2403 VariantClear(&v);
2405 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2406 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2407 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2408 VariantClear(&v);
2410 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2411 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2412 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2413 VariantClear(&v);
2415 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2416 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2417 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2418 VariantClear(&v);
2420 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2421 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2422 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2423 VariantClear(&v);
2425 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2426 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2427 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2428 VariantClear(&v);
2430 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2431 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2432 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2433 VariantClear(&v);
2435 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2436 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2437 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2438 VariantClear(&v);
2440 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2441 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2442 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2443 VariantClear(&v);
2445 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2446 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2447 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2448 VariantClear(&v);
2450 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2451 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2452 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2453 VariantClear(&v);
2455 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2456 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2457 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2458 VariantClear(&v);
2460 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2462 b = 100;
2463 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2464 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2465 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2467 IHTMLCurrentStyle2_Release(current_style2);
2470 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2472 static void basic_style_test(IHTMLDocument2 *doc)
2474 IHTMLCurrentStyle *cstyle;
2475 IHTMLElement *elem;
2476 IHTMLStyle *style;
2477 HRESULT hres;
2479 hres = IHTMLDocument2_get_body(doc, &elem);
2480 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2482 hres = IHTMLElement_get_style(elem, &style);
2483 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2485 test_body_style(style);
2487 cstyle = get_current_style(elem);
2488 test_current_style(cstyle);
2489 IHTMLCurrentStyle_Release(cstyle);
2490 IHTMLElement_Release(elem);
2492 elem = get_element_by_id(doc, "divid");
2493 test_style_filters(elem);
2495 test_set_csstext(style);
2496 IHTMLStyle_Release(style);
2497 IHTMLElement_Release(elem);
2500 static const char runtimestyle_test_str[] =
2501 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2503 static void runtimestyle_test(IHTMLDocument2 *doc)
2505 IHTMLStyle *style, *runtime_style;
2506 IHTMLElement2 *elem2;
2507 IHTMLElement *elem;
2508 BSTR str;
2509 HRESULT hres;
2511 hres = IHTMLDocument2_get_body(doc, &elem);
2512 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2514 elem2 = get_elem2_iface((IUnknown*)elem);
2516 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2517 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2519 hres = IHTMLElement_get_style(elem, &style);
2520 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2522 test_text_decoration(style, NULL);
2523 test_text_decoration(runtime_style, NULL);
2524 set_text_decoration(style, "underline");
2525 test_text_decoration(style, "underline");
2527 hres = IHTMLStyle_get_textDecoration(style, &str);
2528 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2529 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2530 SysFreeString(str);
2532 set_text_decoration(runtime_style, "blink");
2533 test_text_decoration(runtime_style, "blink");
2535 hres = IHTMLStyle_get_textDecoration(style, &str);
2536 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2537 todo_wine
2538 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2539 SysFreeString(str);
2541 IHTMLStyle_Release(runtime_style);
2542 IHTMLStyle_Release(style);
2543 IHTMLElement2_Release(elem2);
2544 IHTMLElement_Release(elem);
2547 static IHTMLDocument2 *notif_doc;
2548 static BOOL doc_complete;
2550 static IHTMLDocument2 *create_document(void)
2552 IHTMLDocument2 *doc;
2553 IHTMLDocument5 *doc5;
2554 HRESULT hres;
2556 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2557 &IID_IHTMLDocument2, (void**)&doc);
2558 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2559 if(FAILED(hres))
2560 return NULL;
2562 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2563 if(FAILED(hres)) {
2564 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2565 IHTMLDocument2_Release(doc);
2566 return NULL;
2569 IHTMLDocument5_Release(doc5);
2570 return doc;
2573 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2574 REFIID riid, void**ppv)
2576 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2577 *ppv = iface;
2578 return S_OK;
2581 ok(0, "unexpected call\n");
2582 return E_NOINTERFACE;
2585 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2587 return 2;
2590 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2592 return 1;
2595 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2597 if(dispID == DISPID_READYSTATE){
2598 BSTR state;
2599 HRESULT hres;
2601 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2602 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2604 if(!strcmp_wa(state, "complete"))
2605 doc_complete = TRUE;
2607 SysFreeString(state);
2610 return S_OK;
2613 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2615 ok(0, "unexpected call\n");
2616 return E_NOTIMPL;
2619 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2620 PropertyNotifySink_QueryInterface,
2621 PropertyNotifySink_AddRef,
2622 PropertyNotifySink_Release,
2623 PropertyNotifySink_OnChanged,
2624 PropertyNotifySink_OnRequestEdit
2627 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2629 static IHTMLDocument2 *create_doc_with_string(const char *str)
2631 IPersistStreamInit *init;
2632 IStream *stream;
2633 IHTMLDocument2 *doc;
2634 HGLOBAL mem;
2635 SIZE_T len;
2637 notif_doc = doc = create_document();
2638 if(!doc)
2639 return NULL;
2641 doc_complete = FALSE;
2642 len = strlen(str);
2643 mem = GlobalAlloc(0, len);
2644 memcpy(mem, str, len);
2645 CreateStreamOnHGlobal(mem, TRUE, &stream);
2647 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2649 IPersistStreamInit_Load(init, stream);
2650 IPersistStreamInit_Release(init);
2651 IStream_Release(stream);
2653 return doc;
2656 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2658 IConnectionPointContainer *container;
2659 IConnectionPoint *cp;
2660 DWORD cookie;
2661 HRESULT hres;
2663 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2664 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2666 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2667 IConnectionPointContainer_Release(container);
2668 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2670 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2671 IConnectionPoint_Release(cp);
2672 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2675 typedef void (*style_test_t)(IHTMLDocument2*);
2677 static void run_test(const char *str, style_test_t test)
2679 IHTMLDocument2 *doc;
2680 ULONG ref;
2681 MSG msg;
2683 doc = create_doc_with_string(str);
2684 if(!doc)
2685 return;
2687 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2689 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2690 TranslateMessage(&msg);
2691 DispatchMessage(&msg);
2694 test(doc);
2696 ref = IHTMLDocument2_Release(doc);
2697 ok(!ref || broken(ref == 1), /* Vista */
2698 "ref = %d\n", ref);
2702 START_TEST(style)
2704 CoInitialize(NULL);
2706 run_test(basic_test_str, basic_style_test);
2707 run_test(runtimestyle_test_str, runtimestyle_test);
2709 CoUninitialize();