mshtml: Added IHTMLCSSStyleDeclaration::opacity property implementation.
[wine.git] / dlls / mshtml / tests / style.c
blob72f36900e382375646b475b96062be5617d6c118
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 BOOL is_ie9plus;
35 static enum {
36 COMPAT_NONE,
37 COMPAT_IE9
38 } compat_mode = COMPAT_NONE;
40 static const char doc_blank[] =
41 "<html></html>";
43 static const char doc_blank_ie9[] =
44 "<!DOCTYPE html>\n"
45 "<html>"
46 " <head>"
47 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
48 " </head>"
49 " <body>"
50 " </body>"
51 "</html>";
53 static int strcmp_wa(LPCWSTR strw, const char *stra)
55 CHAR buf[512];
56 if(!strw)
57 return !!stra;
58 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
59 return lstrcmpA(stra, buf);
62 static BOOL wstr_contains(const WCHAR *strw, const char *stra)
64 CHAR buf[512];
65 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
66 return strstr(buf, stra) != NULL;
69 static BSTR a2bstr(const char *str)
71 BSTR ret;
72 int len;
74 if(!str)
75 return NULL;
77 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
78 ret = SysAllocStringLen(NULL, len);
79 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
81 return ret;
84 static const WCHAR *strstr_wa(const WCHAR *str, const char *suba)
86 BSTR sub;
87 const WCHAR *ret = NULL;
88 sub = a2bstr(suba);
89 while (*str)
91 const WCHAR *p1 = str, *p2 = sub;
92 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
93 if (!*p2) {ret = str; break;}
94 str++;
96 SysFreeString(sub);
97 return ret;
100 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
101 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
103 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
104 if(expect)
105 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
106 else
107 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
110 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
111 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
113 IHTMLElement2 *elem;
114 HRESULT hres;
116 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
117 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
118 return elem;
121 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
122 static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
124 IHTMLCurrentStyle2 *current_style2;
125 HRESULT hres;
127 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
128 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
129 return current_style2;
132 #define elem_set_innerhtml(e,t) _elem_set_innerhtml(__LINE__,e,t)
133 static void _elem_set_innerhtml(unsigned line, IHTMLElement *elem, const char *inner_html)
135 BSTR html;
136 HRESULT hres;
138 html = a2bstr(inner_html);
139 hres = IHTMLElement_put_innerHTML(elem, html);
140 ok_(__FILE__,line)(hres == S_OK, "put_innerHTML failed: %08x\n", hres);
141 SysFreeString(html);
144 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
146 HRESULT hres;
147 IHTMLDocument3 *doc3;
148 IHTMLElement *result;
149 BSTR idW = a2bstr(id);
151 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
152 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
154 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
155 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
156 ok(result != NULL, "result == NULL\n");
157 SysFreeString(idW);
159 IHTMLDocument3_Release(doc3);
160 return result;
163 #define get_current_style(e) _get_current_style(__LINE__,e)
164 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
166 IHTMLCurrentStyle *cstyle;
167 IHTMLElement2 *elem2;
168 HRESULT hres;
170 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
171 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
173 cstyle = NULL;
174 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
175 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
176 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
178 IHTMLElement2_Release(elem2);
179 return cstyle;
182 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
183 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
185 HRESULT hres;
186 DISPID dispid;
188 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
189 LOCALE_USER_DEFAULT, &dispid);
190 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
191 if(hres == S_OK)
193 DISPPARAMS params = {NULL,NULL,0,0};
194 DISPID dispidNamed = DISPID_PROPERTYPUT;
195 VARIANT ret;
196 VARIANT vDefault;
197 VARIANTARG arg;
199 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
200 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
201 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
203 params.cArgs = 1;
204 params.cNamedArgs = 1;
205 params.rgdispidNamedArgs = &dispidNamed;
206 V_VT(&arg) = VT_BSTR;
207 V_BSTR(&arg) = a2bstr("none");
208 params.rgvarg = &arg;
209 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
210 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
211 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
212 VariantClear(&arg);
214 V_VT(&arg) = VT_BSTR;
215 V_BSTR(&arg) = a2bstr("dotted");
216 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
217 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
218 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
219 VariantClear(&arg);
221 V_VT(&arg) = VT_BSTR;
222 V_BSTR(&arg) = a2bstr("dashed");
223 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
224 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
225 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
226 VariantClear(&arg);
228 V_VT(&arg) = VT_BSTR;
229 V_BSTR(&arg) = a2bstr("solid");
230 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
231 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
232 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
233 VariantClear(&arg);
235 V_VT(&arg) = VT_BSTR;
236 V_BSTR(&arg) = a2bstr("double");
237 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
238 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
239 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
240 VariantClear(&arg);
242 V_VT(&arg) = VT_BSTR;
243 V_BSTR(&arg) = a2bstr("groove");
244 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
245 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
246 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
247 VariantClear(&arg);
249 V_VT(&arg) = VT_BSTR;
250 V_BSTR(&arg) = a2bstr("ridge");
251 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
252 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
253 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
254 VariantClear(&arg);
256 V_VT(&arg) = VT_BSTR;
257 V_BSTR(&arg) = a2bstr("inset");
258 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
259 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
260 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
261 VariantClear(&arg);
263 V_VT(&arg) = VT_BSTR;
264 V_BSTR(&arg) = a2bstr("outset");
265 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
266 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
267 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
268 VariantClear(&arg);
270 V_VT(&arg) = VT_BSTR;
271 V_BSTR(&arg) = a2bstr("invalid");
272 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
273 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
274 if(compat_mode < COMPAT_IE9)
275 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
276 else
277 ok_(__FILE__,line) (hres == S_OK, "invalid value returned: %08x\n", hres);
278 VariantClear(&arg);
280 params.rgvarg = &vDefault;
281 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
282 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
283 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
284 VariantClear(&vDefault);
288 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
289 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
291 BSTR text = (void*)0xdeadbeef;
292 HRESULT hres;
294 hres = IHTMLStyle_get_cssText(style, &text);
295 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
296 if(extext)
297 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
298 else
299 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
301 SysFreeString(text);
304 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
305 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
307 BSTR tmp;
308 HRESULT hres;
310 tmp = a2bstr(text);
311 hres = IHTMLStyle_put_cssText(style, tmp);
312 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
313 SysFreeString(tmp);
316 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
317 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
319 BSTR str = a2bstr(attr);
320 VARIANT_BOOL b = 100;
321 HRESULT hres;
323 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
324 SysFreeString(str);
325 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
326 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
329 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
330 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
332 BSTR str;
333 HRESULT hres;
335 str = a2bstr(v);
336 hres = IHTMLStyle_put_textDecoration(style, str);
337 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
338 SysFreeString(str);
341 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
342 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
344 BSTR str;
345 HRESULT hres;
347 hres = IHTMLStyle_get_textDecoration(style, &str);
348 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
349 if(exdec)
350 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
351 else
352 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
353 SysFreeString(str);
356 static void test_set_csstext(IHTMLStyle *style)
358 VARIANT v;
359 HRESULT hres;
361 test_style_set_csstext(style, "background-color: black;");
363 hres = IHTMLStyle_get_backgroundColor(style, &v);
364 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
365 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
366 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
367 VariantClear(&v);
370 static void test_style2(IHTMLStyle2 *style2)
372 VARIANT v;
373 BSTR str;
374 HRESULT hres;
376 str = (void*)0xdeadbeef;
377 hres = IHTMLStyle2_get_position(style2, &str);
378 ok(hres == S_OK, "get_position failed: %08x\n", hres);
379 ok(!str, "str != NULL\n");
381 str = a2bstr("absolute");
382 hres = IHTMLStyle2_put_position(style2, str);
383 ok(hres == S_OK, "put_position failed: %08x\n", hres);
384 SysFreeString(str);
386 str = NULL;
387 hres = IHTMLStyle2_get_position(style2, &str);
388 ok(hres == S_OK, "get_position failed: %08x\n", hres);
389 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
390 SysFreeString(str);
392 /* Test right */
393 V_VT(&v) = VT_EMPTY;
394 hres = IHTMLStyle2_get_right(style2, &v);
395 ok(hres == S_OK, "get_top failed: %08x\n", hres);
396 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
397 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
398 VariantClear(&v);
400 V_VT(&v) = VT_BSTR;
401 V_BSTR(&v) = a2bstr("3px");
402 hres = IHTMLStyle2_put_right(style2, v);
403 ok(hres == S_OK, "put_right failed: %08x\n", hres);
404 VariantClear(&v);
406 V_VT(&v) = VT_EMPTY;
407 hres = IHTMLStyle2_get_right(style2, &v);
408 ok(hres == S_OK, "get_right failed: %08x\n", hres);
409 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
410 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
411 VariantClear(&v);
413 /* direction */
414 str = (void*)0xdeadbeef;
415 hres = IHTMLStyle2_get_direction(style2, &str);
416 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
417 ok(!str, "str = %s\n", wine_dbgstr_w(str));
419 str = a2bstr("ltr");
420 hres = IHTMLStyle2_put_direction(style2, str);
421 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
422 SysFreeString(str);
424 str = NULL;
425 hres = IHTMLStyle2_get_direction(style2, &str);
426 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
427 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
428 SysFreeString(str);
430 /* bottom */
431 V_VT(&v) = VT_EMPTY;
432 hres = IHTMLStyle2_get_bottom(style2, &v);
433 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
434 test_var_bstr(&v, NULL);
436 V_VT(&v) = VT_I4;
437 V_I4(&v) = 4;
438 hres = IHTMLStyle2_put_bottom(style2, v);
439 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
441 V_VT(&v) = VT_EMPTY;
442 hres = IHTMLStyle2_get_bottom(style2, &v);
443 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
444 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "4px" : NULL);
446 /* overflowX */
447 str = (void*)0xdeadbeef;
448 hres = IHTMLStyle2_get_overflowX(style2, &str);
449 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
450 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
452 str = a2bstr("hidden");
453 hres = IHTMLStyle2_put_overflowX(style2, str);
454 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
455 SysFreeString(str);
457 str = NULL;
458 hres = IHTMLStyle2_get_overflowX(style2, &str);
459 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
460 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
462 /* overflowY */
463 str = (void*)0xdeadbeef;
464 hres = IHTMLStyle2_get_overflowY(style2, &str);
465 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
466 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
468 str = a2bstr("hidden");
469 hres = IHTMLStyle2_put_overflowY(style2, str);
470 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
471 SysFreeString(str);
473 str = NULL;
474 hres = IHTMLStyle2_get_overflowY(style2, &str);
475 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
476 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
478 /* tableLayout */
479 str = a2bstr("fixed");
480 hres = IHTMLStyle2_put_tableLayout(style2, str);
481 ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres);
482 SysFreeString(str);
484 str = (void*)0xdeadbeef;
485 hres = IHTMLStyle2_get_tableLayout(style2, &str);
486 ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres);
487 ok(!strcmp_wa(str, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str));
488 SysFreeString(str);
491 static void test_style3(IHTMLStyle3 *style3)
493 VARIANT v;
494 BSTR str;
495 HRESULT hres;
497 str = (void*)0xdeadbeef;
498 hres = IHTMLStyle3_get_wordWrap(style3, &str);
499 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
500 ok(!str, "str != NULL\n");
502 str = a2bstr("break-word");
503 hres = IHTMLStyle3_put_wordWrap(style3, str);
504 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
505 SysFreeString(str);
507 str = NULL;
508 hres = IHTMLStyle3_get_wordWrap(style3, &str);
509 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
510 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
511 SysFreeString(str);
513 V_VT(&v) = VT_ERROR;
514 hres = IHTMLStyle3_get_zoom(style3, &v);
515 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
516 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
517 ok(!V_BSTR(&v), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
518 VariantClear(&v);
520 V_VT(&v) = VT_BSTR;
521 V_BSTR(&v) = a2bstr("100%");
522 hres = IHTMLStyle3_put_zoom(style3, v);
523 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
525 V_VT(&v) = VT_ERROR;
526 hres = IHTMLStyle3_get_zoom(style3, &v);
527 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
528 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
529 ok(!strcmp_wa(V_BSTR(&v), "100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
530 VariantClear(&v);
532 V_VT(&v) = VT_I4;
533 V_I4(&v) = 1;
534 hres = IHTMLStyle3_put_zoom(style3, v);
535 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
537 V_VT(&v) = VT_ERROR;
538 hres = IHTMLStyle3_get_zoom(style3, &v);
539 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
540 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
541 ok(!strcmp_wa(V_BSTR(&v), "1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
542 VariantClear(&v);
545 static void test_style4(IHTMLStyle4 *style4)
547 HRESULT hres;
548 VARIANT v;
549 VARIANT vdefault;
551 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
552 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
554 V_VT(&v) = VT_BSTR;
555 V_BSTR(&v) = a2bstr("10px");
556 hres = IHTMLStyle4_put_minHeight(style4, v);
557 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
558 VariantClear(&v);
560 hres = IHTMLStyle4_get_minHeight(style4, &v);
561 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
562 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
563 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
564 VariantClear(&v);
566 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
567 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
568 VariantClear(&vdefault);
571 static void test_style5(IHTMLStyle5 *style5)
573 HRESULT hres;
574 VARIANT v;
575 VARIANT vdefault;
577 /* minWidth */
578 hres = IHTMLStyle5_get_minWidth(style5, &vdefault);
579 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
581 V_VT(&v) = VT_BSTR;
582 V_BSTR(&v) = a2bstr("12px");
583 hres = IHTMLStyle5_put_minWidth(style5, v);
584 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
585 VariantClear(&v);
587 hres = IHTMLStyle5_get_minWidth(style5, &v);
588 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
589 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
590 ok(!strcmp_wa(V_BSTR(&v), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
591 VariantClear(&v);
593 V_VT(&v) = VT_BSTR;
594 V_BSTR(&v) = a2bstr("10%");
595 hres = IHTMLStyle5_put_minWidth(style5, v);
596 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
597 VariantClear(&v);
599 hres = IHTMLStyle5_get_minWidth(style5, &v);
600 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
601 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
602 ok(!strcmp_wa(V_BSTR(&v), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
603 VariantClear(&v);
605 V_VT(&v) = VT_BSTR;
606 V_BSTR(&v) = a2bstr("10");
607 hres = IHTMLStyle5_put_minWidth(style5, v);
608 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
609 VariantClear(&v);
611 hres = IHTMLStyle5_get_minWidth(style5, &v);
612 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
613 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "10px" : "10%");
614 VariantClear(&v);
616 hres = IHTMLStyle5_put_minWidth(style5, vdefault);
617 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
618 VariantClear(&vdefault);
620 /* maxWidth */
621 hres = IHTMLStyle5_get_maxWidth(style5, &vdefault);
622 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
624 V_VT(&v) = VT_BSTR;
625 V_BSTR(&v) = a2bstr("200px");
626 hres = IHTMLStyle5_put_maxWidth(style5, v);
627 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
628 VariantClear(&v);
630 hres = IHTMLStyle5_get_maxWidth(style5, &v);
631 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
632 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n",V_VT(&v));
633 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
634 VariantClear(&v);
636 V_VT(&v) = VT_BSTR;
637 V_BSTR(&v) = a2bstr("70%");
638 hres = IHTMLStyle5_put_maxWidth(style5, v);
639 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
640 VariantClear(&v);
642 hres = IHTMLStyle5_get_maxWidth(style5, &v);
643 ok(hres == S_OK, "get maxWidth failed: %08x\n", hres);
644 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
645 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
646 VariantClear(&v);
648 hres = IHTMLStyle5_put_maxWidth(style5,vdefault);
649 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
650 VariantClear(&vdefault);
652 /* maxHeight */
653 hres = IHTMLStyle5_get_maxHeight(style5, &vdefault);
654 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
656 V_VT(&v) = VT_BSTR;
657 V_BSTR(&v) = a2bstr("200px");
658 hres = IHTMLStyle5_put_maxHeight(style5, v);
659 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
660 VariantClear(&v);
662 hres = IHTMLStyle5_get_maxHeight(style5, &v);
663 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
664 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
665 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
666 VariantClear(&v);
668 V_VT(&v) = VT_BSTR;
669 V_BSTR(&v) = a2bstr("70%");
670 hres = IHTMLStyle5_put_maxHeight(style5, v);
671 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
672 VariantClear(&v);
674 hres = IHTMLStyle5_get_maxHeight(style5, &v);
675 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
676 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
677 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
678 VariantClear(&v);
680 V_VT(&v) = VT_BSTR;
681 V_BSTR(&v) = a2bstr("100");
682 hres = IHTMLStyle5_put_maxHeight(style5, v);
683 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
684 VariantClear(&v);
686 hres = IHTMLStyle5_get_maxHeight(style5, &v);
687 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
688 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "100px" : "70%");
689 VariantClear(&v);
691 hres = IHTMLStyle5_put_maxHeight(style5, vdefault);
692 ok(hres == S_OK, "put maxHeight failed:%08x\n", hres);
693 VariantClear(&vdefault);
696 static void test_style6(IHTMLStyle6 *style)
698 BSTR str;
699 HRESULT hres;
701 str = (void*)0xdeadbeef;
702 hres = IHTMLStyle6_get_outline(style, &str);
703 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
704 if(compat_mode < COMPAT_IE9)
705 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
706 else
707 ok(!str, "outline = %s\n", wine_dbgstr_w(str));
708 SysFreeString(str);
710 str = a2bstr("1px");
711 hres = IHTMLStyle6_put_outline(style, str);
712 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
713 SysFreeString(str);
715 str = (void*)0xdeadbeef;
716 hres = IHTMLStyle6_get_outline(style, &str);
717 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
718 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
719 SysFreeString(str);
721 str = (void*)0xdeadbeef;
722 hres = IHTMLStyle6_get_boxSizing(style, &str);
723 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
724 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
725 SysFreeString(str);
727 str = a2bstr("border-box");
728 hres = IHTMLStyle6_put_boxSizing(style, str);
729 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
730 SysFreeString(str);
732 str = NULL;
733 hres = IHTMLStyle6_get_boxSizing(style, &str);
734 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
735 ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
736 SysFreeString(str);
739 static void test_css_style_declaration(IHTMLCSSStyleDeclaration *css_style)
741 VARIANT v;
742 BSTR str;
743 HRESULT hres;
745 hres = IHTMLCSSStyleDeclaration_get_backgroundClip(css_style, &str);
746 ok(hres == S_OK, "get_backgroundClip failed: %08x\n", hres);
747 ok(!str, "backgroundClip = %s\n", wine_dbgstr_w(str));
749 str = a2bstr("border-box");
750 hres = IHTMLCSSStyleDeclaration_put_backgroundClip(css_style, str);
751 ok(hres == S_OK, "put_backgroundClip failed: %08x\n", hres);
752 SysFreeString(str);
754 hres = IHTMLCSSStyleDeclaration_get_backgroundClip(css_style, &str);
755 ok(hres == S_OK, "get_backgroundClip failed: %08x\n", hres);
756 ok(!strcmp_wa(str, "border-box"), "backgroundClip = %s\n", wine_dbgstr_w(str));
757 SysFreeString(str);
759 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
760 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
761 test_var_bstr(&v, NULL);
763 V_VT(&v) = VT_I4;
764 V_I4(&v) = 0;
765 hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v);
766 ok(hres == S_OK, "put_opacity failed: %08x\n", hres);
768 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
769 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
770 test_var_bstr(&v, "0");
771 VariantClear(&v);
773 V_VT(&v) = VT_BSTR;
774 V_BSTR(&v) = a2bstr("1");
775 hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v);
776 ok(hres == S_OK, "put_opacity failed: %08x\n", hres);
777 VariantClear(&v);
779 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
780 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
781 test_var_bstr(&v, "1");
782 VariantClear(&v);
785 static void test_body_style(IHTMLStyle *style)
787 IHTMLCSSStyleDeclaration *css_style;
788 IHTMLStyle2 *style2;
789 IHTMLStyle3 *style3;
790 IHTMLStyle4 *style4;
791 IHTMLStyle5 *style5;
792 IHTMLStyle6 *style6;
793 VARIANT_BOOL b;
794 VARIANT v;
795 BSTR str;
796 HRESULT hres;
797 float f;
798 BSTR sOverflowDefault;
799 BSTR sDefault;
800 LONG l;
801 VARIANT vDefault;
803 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style);
804 ok(hres == S_OK || broken(!is_ie9plus && hres == E_NOINTERFACE),
805 "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres);
807 test_style_csstext(style, NULL);
809 hres = IHTMLStyle_get_position(style, &str);
810 ok(hres == S_OK, "get_position failed: %08x\n", hres);
811 ok(!str, "str=%s\n", wine_dbgstr_w(str));
813 V_VT(&v) = VT_NULL;
814 hres = IHTMLStyle_get_marginRight(style, &v);
815 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
816 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
817 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
819 V_VT(&v) = VT_I4;
820 V_I4(&v) = 6;
821 hres = IHTMLStyle_put_marginRight(style, v);
822 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
824 V_VT(&v) = VT_NULL;
825 hres = IHTMLStyle_get_marginRight(style, &v);
826 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
827 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
828 if(compat_mode < COMPAT_IE9)
829 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
830 else
831 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
833 if(css_style) {
834 V_VT(&v) = VT_NULL;
835 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
836 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
837 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
838 if(compat_mode < COMPAT_IE9)
839 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n",
840 wine_dbgstr_w(V_BSTR(&v)));
841 else
842 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
844 V_VT(&v) = VT_I4;
845 V_I4(&v) = 7;
846 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
847 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
849 V_VT(&v) = VT_NULL;
850 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
851 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
852 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
853 if(compat_mode < COMPAT_IE9)
854 ok(!strcmp_wa(V_BSTR(&v), "7px"), "V_BSTR(marginRight) = %s\n",
855 wine_dbgstr_w(V_BSTR(&v)));
856 else
857 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
859 V_VT(&v) = VT_BSTR;
860 V_BSTR(&v) = a2bstr("8");
861 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
862 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
863 SysFreeString(V_BSTR(&v));
865 V_VT(&v) = VT_NULL;
866 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
867 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
868 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
869 if(compat_mode < COMPAT_IE9)
870 ok(!strcmp_wa(V_BSTR(&v), "8px"), "V_BSTR(marginRight) = %s\n",
871 wine_dbgstr_w(V_BSTR(&v)));
872 else
873 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
875 V_VT(&v) = VT_BSTR;
876 V_BSTR(&v) = a2bstr("9px");
877 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
878 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
879 SysFreeString(V_BSTR(&v));
881 V_VT(&v) = VT_NULL;
882 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
883 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
884 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
885 ok(!strcmp_wa(V_BSTR(&v), "9px"), "V_BSTR(marginRight) = %s\n",
886 wine_dbgstr_w(V_BSTR(&v)));
887 SysFreeString(V_BSTR(&v));
890 V_VT(&v) = VT_NULL;
891 hres = IHTMLStyle_get_marginBottom(style, &v);
892 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
893 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
894 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
896 V_VT(&v) = VT_I4;
897 V_I4(&v) = 6;
898 hres = IHTMLStyle_put_marginBottom(style, v);
899 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
901 V_VT(&v) = VT_NULL;
902 hres = IHTMLStyle_get_marginBottom(style, &v);
903 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
904 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
905 if(compat_mode < COMPAT_IE9)
906 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
907 else
908 ok(!V_BSTR(&v), "mariginBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
910 V_VT(&v) = VT_NULL;
911 hres = IHTMLStyle_get_marginLeft(style, &v);
912 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
913 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
914 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
916 V_VT(&v) = VT_I4;
917 V_I4(&v) = 6;
918 hres = IHTMLStyle_put_marginLeft(style, v);
919 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
921 V_VT(&v) = VT_NULL;
922 hres = IHTMLStyle_get_marginLeft(style, &v);
923 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
924 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
925 if(compat_mode < COMPAT_IE9)
926 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
927 else
928 ok(!V_BSTR(&v), "mariginLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
930 str = (void*)0xdeadbeef;
931 hres = IHTMLStyle_get_fontFamily(style, &str);
932 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
933 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
935 str = (void*)0xdeadbeef;
936 hres = IHTMLStyle_get_fontWeight(style, &str);
937 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
938 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
940 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
941 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
943 str = a2bstr("test");
944 hres = IHTMLStyle_put_fontWeight(style, str);
945 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
946 "put_fontWeight failed: %08x\n", hres);
947 SysFreeString(str);
949 hres = IHTMLStyle_get_fontWeight(style, &str);
950 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
951 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
952 SysFreeString(str);
954 str = a2bstr("bold");
955 hres = IHTMLStyle_put_fontWeight(style, str);
956 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
957 SysFreeString(str);
959 str = a2bstr("bolder");
960 hres = IHTMLStyle_put_fontWeight(style, str);
961 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
962 SysFreeString(str);
964 str = a2bstr("lighter");
965 hres = IHTMLStyle_put_fontWeight(style, str);
966 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
967 SysFreeString(str);
969 str = a2bstr("100");
970 hres = IHTMLStyle_put_fontWeight(style, str);
971 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
972 SysFreeString(str);
974 str = a2bstr("200");
975 hres = IHTMLStyle_put_fontWeight(style, str);
976 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
977 SysFreeString(str);
979 str = a2bstr("300");
980 hres = IHTMLStyle_put_fontWeight(style, str);
981 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
982 SysFreeString(str);
984 str = a2bstr("400");
985 hres = IHTMLStyle_put_fontWeight(style, str);
986 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
987 SysFreeString(str);
989 str = a2bstr("500");
990 hres = IHTMLStyle_put_fontWeight(style, str);
991 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
992 SysFreeString(str);
994 str = a2bstr("600");
995 hres = IHTMLStyle_put_fontWeight(style, str);
996 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
997 SysFreeString(str);
999 str = a2bstr("700");
1000 hres = IHTMLStyle_put_fontWeight(style, str);
1001 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1002 SysFreeString(str);
1004 str = a2bstr("800");
1005 hres = IHTMLStyle_put_fontWeight(style, str);
1006 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1007 SysFreeString(str);
1009 str = a2bstr("900");
1010 hres = IHTMLStyle_put_fontWeight(style, str);
1011 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1012 SysFreeString(str);
1014 hres = IHTMLStyle_get_fontWeight(style, &str);
1015 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1016 ok(!strcmp_wa(str, "900"), "str != style900\n");
1017 SysFreeString(str);
1019 str = a2bstr("");
1020 hres = IHTMLStyle_put_fontWeight(style, str);
1021 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1022 SysFreeString(str);
1024 hres = IHTMLStyle_get_fontWeight(style, &str);
1025 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1026 ok(!str, "str != NULL\n");
1027 SysFreeString(str);
1029 hres = IHTMLStyle_put_fontWeight(style, sDefault);
1030 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1031 SysFreeString(sDefault);
1033 /* font Variant */
1034 hres = IHTMLStyle_get_fontVariant(style, NULL);
1035 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
1037 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
1038 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
1040 str = a2bstr("test");
1041 hres = IHTMLStyle_put_fontVariant(style, str);
1042 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1043 "fontVariant failed: %08x\n", hres);
1044 SysFreeString(str);
1046 str = a2bstr("small-caps");
1047 hres = IHTMLStyle_put_fontVariant(style, str);
1048 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1049 SysFreeString(str);
1051 str = a2bstr("normal");
1052 hres = IHTMLStyle_put_fontVariant(style, str);
1053 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1054 SysFreeString(str);
1056 hres = IHTMLStyle_put_fontVariant(style, sDefault);
1057 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1058 SysFreeString(sDefault);
1060 str = (void*)0xdeadbeef;
1061 hres = IHTMLStyle_get_display(style, &str);
1062 ok(hres == S_OK, "get_display failed: %08x\n", hres);
1063 ok(!str, "display = %s\n", wine_dbgstr_w(str));
1065 str = (void*)0xdeadbeef;
1066 hres = IHTMLStyle_get_visibility(style, &str);
1067 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
1068 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
1070 V_VT(&v) = VT_NULL;
1071 hres = IHTMLStyle_get_fontSize(style, &v);
1072 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1073 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
1074 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1076 V_VT(&v) = VT_I4;
1077 V_I4(&v) = 12;
1078 hres = IHTMLStyle_put_fontSize(style, v);
1079 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
1081 V_VT(&v) = VT_NULL;
1082 hres = IHTMLStyle_get_fontSize(style, &v);
1083 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1084 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
1085 if(compat_mode < COMPAT_IE9)
1086 ok(!strcmp_wa(V_BSTR(&v), "12px"), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1087 else
1088 ok(!V_BSTR(&v), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1090 V_VT(&v) = VT_NULL;
1091 hres = IHTMLStyle_get_color(style, &v);
1092 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1093 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
1094 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1096 V_VT(&v) = VT_I4;
1097 V_I4(&v) = 0xfdfd;
1098 hres = IHTMLStyle_put_color(style, v);
1099 ok(hres == S_OK, "put_color failed: %08x\n", hres);
1101 V_VT(&v) = VT_NULL;
1102 hres = IHTMLStyle_get_color(style, &v);
1103 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1104 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
1105 todo_wine
1106 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1108 V_VT(&v) = VT_I4;
1109 V_I4(&v) = 3;
1110 hres = IHTMLStyle_put_lineHeight(style, v);
1111 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1113 hres = IHTMLStyle_get_lineHeight(style, &v);
1114 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1115 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1116 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1118 V_VT(&v) = VT_BSTR;
1119 V_BSTR(&v) = a2bstr("300%");
1120 hres = IHTMLStyle_put_lineHeight(style, v);
1121 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1122 VariantClear(&v);
1124 hres = IHTMLStyle_get_lineHeight(style, &v);
1125 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1126 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1127 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1128 VariantClear(&v);
1130 b = 0xfefe;
1131 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1132 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1133 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
1135 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
1136 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1138 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1139 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1140 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
1142 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
1143 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1145 b = 0xfefe;
1146 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1147 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1148 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
1150 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
1151 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1153 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1154 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1155 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
1157 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
1158 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1160 b = 0xfefe;
1161 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1162 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1163 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
1165 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
1166 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1168 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1169 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1170 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
1172 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
1173 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1175 b = 0xfefe;
1176 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1177 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1178 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
1180 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
1181 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1183 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1184 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1185 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
1187 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
1188 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1190 b = 0xfefe;
1191 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1192 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1193 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
1195 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
1196 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1198 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1199 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1200 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1202 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1203 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1205 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1206 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1208 str = a2bstr("invalid");
1209 hres = IHTMLStyle_put_textDecoration(style, str);
1210 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1211 "put_textDecoration failed: %08x\n", hres);
1212 SysFreeString(str);
1214 set_text_decoration(style, "none");
1215 test_text_decoration(style, "none");
1216 set_text_decoration(style, "underline");
1217 set_text_decoration(style, "overline");
1218 set_text_decoration(style, "line-through");
1219 set_text_decoration(style, "blink");
1220 set_text_decoration(style, "overline");
1221 set_text_decoration(style, "blink");
1222 test_text_decoration(style, "blink");
1224 str = a2bstr("invalid");
1225 hres = IHTMLStyle_put_textDecoration(style, str);
1226 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1227 "put_textDecoration failed: %08x\n", hres);
1228 SysFreeString(str);
1229 test_text_decoration(style, compat_mode < COMPAT_IE9 ? NULL : "blink");
1231 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1232 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1233 SysFreeString(sDefault);
1235 hres = IHTMLStyle_get_posWidth(style, NULL);
1236 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1238 hres = IHTMLStyle_get_posWidth(style, &f);
1239 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1240 ok(f == 0.0f, "f = %f\n", f);
1242 V_VT(&v) = VT_EMPTY;
1243 hres = IHTMLStyle_get_width(style, &v);
1244 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1245 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1246 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1248 hres = IHTMLStyle_put_posWidth(style, 2.2);
1249 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1251 hres = IHTMLStyle_get_posWidth(style, &f);
1252 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1253 ok(f == 2.0f ||
1254 f == 2.2f, /* IE8 */
1255 "f = %f\n", f);
1257 l = 0xdeadbeef;
1258 hres = IHTMLStyle_get_pixelWidth(style, &l);
1259 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1260 ok(l == 2, "pixelWidth = %d\n", l);
1262 V_VT(&v) = VT_BSTR;
1263 V_BSTR(&v) = a2bstr("auto");
1264 hres = IHTMLStyle_put_width(style, v);
1265 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1266 VariantClear(&v);
1268 V_VT(&v) = VT_EMPTY;
1269 hres = IHTMLStyle_get_width(style, &v);
1270 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1271 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1272 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1273 VariantClear(&v);
1275 l = 0xdeadbeef;
1276 hres = IHTMLStyle_get_pixelWidth(style, &l);
1277 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1278 ok(!l, "pixelWidth = %d\n", l);
1280 V_VT(&v) = VT_I4;
1281 V_I4(&v) = 100;
1282 hres = IHTMLStyle_put_width(style, v);
1283 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1285 hres = IHTMLStyle_get_width(style, &v);
1286 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1287 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "100px" : "auto");
1288 VariantClear(&v);
1290 l = 0xdeadbeef;
1291 hres = IHTMLStyle_get_pixelWidth(style, &l);
1292 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1293 ok(l == (compat_mode < COMPAT_IE9 ? 100 : 0), "pixelWidth = %d\n", l);
1295 V_VT(&v) = VT_EMPTY;
1296 hres = IHTMLStyle_get_width(style, &v);
1297 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1298 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1299 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "100px" : "auto"), "V_BSTR(v)=%s\n",
1300 wine_dbgstr_w(V_BSTR(&v)));
1301 VariantClear(&v);
1303 hres = IHTMLStyle_put_pixelWidth(style, 50);
1304 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1306 l = 0xdeadbeef;
1307 hres = IHTMLStyle_get_pixelWidth(style, &l);
1308 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1309 ok(l == 50, "pixelWidth = %d\n", l);
1311 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1312 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1314 V_VT(&v) = VT_EMPTY;
1315 hres = IHTMLStyle_get_width(style, &v);
1316 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1317 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1318 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1319 VariantClear(&v);
1321 /* margin tests */
1322 str = (void*)0xdeadbeef;
1323 hres = IHTMLStyle_get_margin(style, &str);
1324 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1325 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1327 str = a2bstr("1");
1328 hres = IHTMLStyle_put_margin(style, str);
1329 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1330 SysFreeString(str);
1332 hres = IHTMLStyle_get_margin(style, &str);
1333 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1334 if(compat_mode < COMPAT_IE9)
1335 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
1336 else
1337 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1338 SysFreeString(str);
1340 str = a2bstr("2px");
1341 hres = IHTMLStyle_put_margin(style, str);
1342 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1343 SysFreeString(str);
1345 hres = IHTMLStyle_get_margin(style, &str);
1346 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1347 ok(!strcmp_wa(str, "2px"), "margin = %s\n", wine_dbgstr_w(str));
1348 SysFreeString(str);
1350 hres = IHTMLStyle_put_margin(style, NULL);
1351 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1353 str = (void*)0xdeadbeef;
1354 hres = IHTMLStyle_get_marginTop(style, &v);
1355 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1356 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1357 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1359 V_VT(&v) = VT_BSTR;
1360 V_BSTR(&v) = a2bstr("6px");
1361 hres = IHTMLStyle_put_marginTop(style, v);
1362 SysFreeString(V_BSTR(&v));
1363 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1365 str = (void*)0xdeadbeef;
1366 hres = IHTMLStyle_get_marginTop(style, &v);
1367 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1368 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1369 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1370 VariantClear(&v);
1372 V_VT(&v) = VT_I4;
1373 V_I4(&v) = 5;
1374 hres = IHTMLStyle_put_marginTop(style, v);
1375 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1377 str = (void*)0xdeadbeef;
1378 hres = IHTMLStyle_get_marginTop(style, &v);
1379 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1380 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1381 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "5px" : "6px"),
1382 "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1383 VariantClear(&v);
1385 str = NULL;
1386 hres = IHTMLStyle_get_border(style, &str);
1387 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1388 ok(!str || !*str, "str is not empty\n");
1389 SysFreeString(str);
1391 str = a2bstr("1px");
1392 hres = IHTMLStyle_put_border(style, str);
1393 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1394 SysFreeString(str);
1396 V_VT(&v) = VT_EMPTY;
1397 hres = IHTMLStyle_get_left(style, &v);
1398 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1399 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1400 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1401 VariantClear(&v);
1403 l = 0xdeadbeef;
1404 hres = IHTMLStyle_get_pixelLeft(style, &l);
1405 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1406 ok(!l, "pixelLeft = %d\n", l);
1408 /* Test posLeft */
1409 hres = IHTMLStyle_get_posLeft(style, NULL);
1410 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1412 f = 1.0f;
1413 hres = IHTMLStyle_get_posLeft(style, &f);
1414 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1415 ok(f == 0.0, "expected 0.0 got %f\n", f);
1417 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1418 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1420 hres = IHTMLStyle_get_posLeft(style, &f);
1421 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1422 ok(f == 4.0 ||
1423 f == 4.9f, /* IE8 */
1424 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1426 /* Ensure left is updated correctly. */
1427 V_VT(&v) = VT_EMPTY;
1428 hres = IHTMLStyle_get_left(style, &v);
1429 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1430 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1431 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1432 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1433 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1434 VariantClear(&v);
1436 /* Test left */
1437 V_VT(&v) = VT_BSTR;
1438 V_BSTR(&v) = a2bstr("3px");
1439 hres = IHTMLStyle_put_left(style, v);
1440 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1441 VariantClear(&v);
1443 hres = IHTMLStyle_get_posLeft(style, &f);
1444 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1445 ok(f == 3.0, "expected 3.0 got %f\n", f);
1447 l = 0xdeadbeef;
1448 hres = IHTMLStyle_get_pixelLeft(style, &l);
1449 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1450 ok(l == 3, "pixelLeft = %d\n", l);
1452 V_VT(&v) = VT_EMPTY;
1453 hres = IHTMLStyle_get_left(style, &v);
1454 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1455 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1456 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1457 VariantClear(&v);
1459 V_VT(&v) = VT_BSTR;
1460 V_BSTR(&v) = a2bstr("4.99");
1461 hres = IHTMLStyle_put_left(style, v);
1462 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1463 VariantClear(&v);
1465 l = 0xdeadbeef;
1466 hres = IHTMLStyle_get_pixelLeft(style, &l);
1467 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1468 ok(l == (compat_mode < COMPAT_IE9 ? 4 : 3), "pixelLeft = %d\n", l);
1470 V_VT(&v) = VT_NULL;
1471 hres = IHTMLStyle_put_left(style, v);
1472 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1474 V_VT(&v) = VT_EMPTY;
1475 hres = IHTMLStyle_get_left(style, &v);
1476 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1477 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1478 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1479 VariantClear(&v);
1481 V_VT(&v) = VT_EMPTY;
1482 hres = IHTMLStyle_get_top(style, &v);
1483 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1484 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1485 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1486 VariantClear(&v);
1488 l = 0xdeadbeef;
1489 hres = IHTMLStyle_get_pixelLeft(style, &l);
1490 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1491 ok(!l, "pixelLeft = %d\n", l);
1493 hres = IHTMLStyle_put_pixelLeft(style, 6);
1494 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1496 l = 0xdeadbeef;
1497 hres = IHTMLStyle_get_pixelLeft(style, &l);
1498 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1499 ok(l == 6, "pixelLeft = %d\n", l);
1501 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1502 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
1504 V_VT(&v) = VT_EMPTY;
1505 hres = IHTMLStyle_get_left(style, &v);
1506 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1507 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1508 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1509 VariantClear(&v);
1511 /* Test posTop */
1512 hres = IHTMLStyle_get_posTop(style, NULL);
1513 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1515 f = 1.0f;
1516 hres = IHTMLStyle_get_posTop(style, &f);
1517 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1518 ok(f == 0.0, "expected 0.0 got %f\n", f);
1520 hres = IHTMLStyle_put_posTop(style, 4.9f);
1521 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1523 hres = IHTMLStyle_get_posTop(style, &f);
1524 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1525 ok(f == 4.0 ||
1526 f == 4.9f, /* IE8 */
1527 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1529 hres = IHTMLStyle_put_pixelTop(style, 6);
1530 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1532 l = 0xdeadbeef;
1533 hres = IHTMLStyle_get_pixelTop(style, &l);
1534 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1535 ok(l == 6, "pixelTop = %d\n", l);
1537 hres = IHTMLStyle_get_pixelTop(style, NULL);
1538 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1540 V_VT(&v) = VT_BSTR;
1541 V_BSTR(&v) = a2bstr("3px");
1542 hres = IHTMLStyle_put_top(style, v);
1543 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1544 VariantClear(&v);
1546 V_VT(&v) = VT_EMPTY;
1547 hres = IHTMLStyle_get_top(style, &v);
1548 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1549 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1550 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1551 VariantClear(&v);
1553 hres = IHTMLStyle_get_posTop(style, &f);
1554 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1555 ok(f == 3.0, "expected 3.0 got %f\n", f);
1557 l = 0xdeadbeef;
1558 hres = IHTMLStyle_get_pixelTop(style, &l);
1559 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1560 ok(l == 3, "pixelTop = %d\n", l);
1562 V_VT(&v) = VT_BSTR;
1563 V_BSTR(&v) = a2bstr("100%");
1564 hres = IHTMLStyle_put_top(style, v);
1565 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1566 VariantClear(&v);
1568 l = 0xdeadbeef;
1569 hres = IHTMLStyle_get_pixelTop(style, &l);
1570 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1571 ok(!l, "pixelTop = %d\n", l);
1573 V_VT(&v) = VT_NULL;
1574 hres = IHTMLStyle_put_top(style, v);
1575 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1577 V_VT(&v) = VT_EMPTY;
1578 hres = IHTMLStyle_get_top(style, &v);
1579 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1580 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1581 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1582 VariantClear(&v);
1584 l = 0xdeadbeef;
1585 hres = IHTMLStyle_get_pixelTop(style, &l);
1586 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1587 ok(!l, "pixelTop = %d\n", l);
1589 /* Test posHeight */
1590 hres = IHTMLStyle_get_posHeight(style, NULL);
1591 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1593 V_VT(&v) = VT_EMPTY;
1594 hres = IHTMLStyle_get_height(style, &v);
1595 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1596 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1597 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1598 VariantClear(&v);
1600 f = 1.0f;
1601 hres = IHTMLStyle_get_posHeight(style, &f);
1602 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1603 ok(f == 0.0, "expected 0.0 got %f\n", f);
1605 l = 0xdeadbeef;
1606 hres = IHTMLStyle_get_pixelHeight(style, &l);
1607 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1608 ok(!l, "pixelHeight = %d\n", l);
1610 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1611 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1613 hres = IHTMLStyle_get_posHeight(style, &f);
1614 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1615 ok(f == 4.0 ||
1616 f == 4.9f, /* IE8 */
1617 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1619 l = 0xdeadbeef;
1620 hres = IHTMLStyle_get_pixelHeight(style, &l);
1621 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1622 ok(l == 4 ||
1623 l == 5, /* IE8 */
1624 "pixelHeight = %d\n", l);
1626 V_VT(&v) = VT_BSTR;
1627 V_BSTR(&v) = a2bstr("70px");
1628 hres = IHTMLStyle_put_height(style, v);
1629 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1630 VariantClear(&v);
1632 V_VT(&v) = VT_EMPTY;
1633 hres = IHTMLStyle_get_height(style, &v);
1634 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1635 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1636 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1637 VariantClear(&v);
1639 l = 0xdeadbeef;
1640 hres = IHTMLStyle_get_pixelHeight(style, &l);
1641 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1642 ok(l == 70, "pixelHeight = %d\n", l);
1644 V_VT(&v) = VT_BSTR;
1645 V_BSTR(&v) = a2bstr("50%");
1646 hres = IHTMLStyle_put_height(style, v);
1647 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1648 VariantClear(&v);
1650 l = 0xdeadbeef;
1651 hres = IHTMLStyle_get_pixelHeight(style, &l);
1652 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1653 ok(!l, "pixelHeight = %d\n", l);
1655 V_VT(&v) = VT_BSTR;
1656 V_BSTR(&v) = NULL;
1657 hres = IHTMLStyle_put_height(style, v);
1658 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1659 VariantClear(&v);
1661 V_VT(&v) = VT_EMPTY;
1662 hres = IHTMLStyle_get_height(style, &v);
1663 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1664 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1665 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1666 VariantClear(&v);
1668 l = 0xdeadbeef;
1669 hres = IHTMLStyle_get_pixelHeight(style, &l);
1670 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1671 ok(!l, "pixelHeight = %d\n", l);
1673 hres = IHTMLStyle_put_pixelHeight(style, 50);
1674 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
1676 l = 0xdeadbeef;
1677 hres = IHTMLStyle_get_pixelHeight(style, &l);
1678 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1679 ok(l == 50, "pixelHeight = %d\n", l);
1681 hres = IHTMLStyle_get_pixelHeight(style, NULL);
1682 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
1684 V_VT(&v) = VT_I4;
1685 V_I4(&v) = 64;
1686 hres = IHTMLStyle_put_height(style, v);
1687 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1689 V_VT(&v) = VT_EMPTY;
1690 hres = IHTMLStyle_get_height(style, &v);
1691 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1692 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1693 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "64px" : "50px"),
1694 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1695 VariantClear(&v);
1697 hres = IHTMLStyle_get_posHeight(style, &f);
1698 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1699 ok(f == (compat_mode < COMPAT_IE9 ? 64.0 : 50), "expected 64.0 got %f\n", f);
1701 l = 0xdeadbeef;
1702 hres = IHTMLStyle_get_pixelHeight(style, &l);
1703 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1704 ok(l == (compat_mode < COMPAT_IE9 ? 64 : 50), "pixelHeight = %d\n", l);
1706 str = (void*)0xdeadbeef;
1707 hres = IHTMLStyle_get_cursor(style, &str);
1708 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1709 ok(!str, "get_cursor != NULL\n");
1710 SysFreeString(str);
1712 str = a2bstr("default");
1713 hres = IHTMLStyle_put_cursor(style, str);
1714 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1715 SysFreeString(str);
1717 str = NULL;
1718 hres = IHTMLStyle_get_cursor(style, &str);
1719 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1720 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1721 SysFreeString(str);
1723 V_VT(&v) = VT_EMPTY;
1724 hres = IHTMLStyle_get_verticalAlign(style, &v);
1725 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1726 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1727 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1728 VariantClear(&v);
1730 V_VT(&v) = VT_BSTR;
1731 V_BSTR(&v) = a2bstr("middle");
1732 hres = IHTMLStyle_put_verticalAlign(style, v);
1733 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1734 VariantClear(&v);
1736 V_VT(&v) = VT_EMPTY;
1737 hres = IHTMLStyle_get_verticalAlign(style, &v);
1738 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1739 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1740 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1741 VariantClear(&v);
1743 V_VT(&v) = VT_I4;
1744 V_I4(&v) = 100;
1745 hres = IHTMLStyle_put_verticalAlign(style, v);
1746 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1747 VariantClear(&v);
1749 V_VT(&v) = VT_EMPTY;
1750 hres = IHTMLStyle_get_verticalAlign(style, &v);
1751 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1752 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1753 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "100px" : "middle"),
1754 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1755 VariantClear(&v);
1757 str = (void*)0xdeadbeef;
1758 hres = IHTMLStyle_get_textAlign(style, &str);
1759 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1760 ok(!str, "textAlign != NULL\n");
1762 str = a2bstr("center");
1763 hres = IHTMLStyle_put_textAlign(style, str);
1764 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1765 SysFreeString(str);
1767 str = NULL;
1768 hres = IHTMLStyle_get_textAlign(style, &str);
1769 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1770 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1771 SysFreeString(str);
1773 V_VT(&v) = VT_NULL;
1774 hres = IHTMLStyle_get_textIndent(style, &v);
1775 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1776 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1777 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1779 V_VT(&v) = VT_I4;
1780 V_I4(&v) = 6;
1781 hres = IHTMLStyle_put_textIndent(style, v);
1782 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1784 V_VT(&v) = VT_NULL;
1785 hres = IHTMLStyle_get_textIndent(style, &v);
1786 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1787 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1788 if(compat_mode < COMPAT_IE9)
1789 ok(!strcmp_wa(V_BSTR(&v), "6px"), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1790 else
1791 ok(!V_BSTR(&v), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1793 str = (void*)0xdeadbeef;
1794 hres = IHTMLStyle_get_textTransform(style, &str);
1795 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1796 ok(!str, "textTransform != NULL\n");
1798 str = a2bstr("lowercase");
1799 hres = IHTMLStyle_put_textTransform(style, str);
1800 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1801 SysFreeString(str);
1803 str = NULL;
1804 hres = IHTMLStyle_get_textTransform(style, &str);
1805 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1806 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1807 SysFreeString(str);
1809 str = (void*)0xdeadbeef;
1810 hres = IHTMLStyle_get_filter(style, &str);
1811 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1812 ok(!str, "filter != NULL\n");
1814 str = a2bstr("alpha(opacity=100)");
1815 hres = IHTMLStyle_put_filter(style, str);
1816 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1817 SysFreeString(str);
1819 hres = IHTMLStyle_put_filter(style, NULL);
1820 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1822 str = (void*)0xdeadbeef;
1823 hres = IHTMLStyle_get_filter(style, &str);
1824 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1825 ok(!str, "filter != NULL\n");
1827 V_VT(&v) = VT_EMPTY;
1828 hres = IHTMLStyle_get_zIndex(style, &v);
1829 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1830 if(compat_mode < COMPAT_IE9) {
1831 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1832 ok(!V_I4(&v), "V_I4(v) != 0\n");
1833 }else {
1834 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1835 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1837 VariantClear(&v);
1839 if(css_style) {
1840 hres = IHTMLCSSStyleDeclaration_get_zIndex(css_style, &v);
1841 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1842 if(compat_mode < COMPAT_IE9) {
1843 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1844 ok(!V_I4(&v), "V_I4(v) != 0\n");
1845 }else {
1846 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1847 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1851 V_VT(&v) = VT_BSTR;
1852 V_BSTR(&v) = a2bstr("1");
1853 hres = IHTMLStyle_put_zIndex(style, v);
1854 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1855 VariantClear(&v);
1857 V_VT(&v) = VT_EMPTY;
1858 hres = IHTMLStyle_get_zIndex(style, &v);
1859 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1860 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1861 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1862 VariantClear(&v);
1864 /* fontStyle */
1865 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1866 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1868 str = a2bstr("test");
1869 hres = IHTMLStyle_put_fontStyle(style, str);
1870 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1871 "put_fontStyle failed: %08x\n", hres);
1872 SysFreeString(str);
1874 str = a2bstr("italic");
1875 hres = IHTMLStyle_put_fontStyle(style, str);
1876 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1877 SysFreeString(str);
1879 str = a2bstr("oblique");
1880 hres = IHTMLStyle_put_fontStyle(style, str);
1881 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1882 SysFreeString(str);
1884 str = a2bstr("normal");
1885 hres = IHTMLStyle_put_fontStyle(style, str);
1886 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1887 SysFreeString(str);
1889 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1890 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1891 SysFreeString(sDefault);
1893 /* overflow */
1894 hres = IHTMLStyle_get_overflow(style, NULL);
1895 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1897 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1898 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1900 str = a2bstr("test");
1901 hres = IHTMLStyle_put_overflow(style, str);
1902 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1903 "put_overflow failed: %08x\n", hres);
1904 SysFreeString(str);
1906 str = a2bstr("visible");
1907 hres = IHTMLStyle_put_overflow(style, str);
1908 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1909 SysFreeString(str);
1911 str = a2bstr("scroll");
1912 hres = IHTMLStyle_put_overflow(style, str);
1913 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1914 SysFreeString(str);
1916 str = a2bstr("hidden");
1917 hres = IHTMLStyle_put_overflow(style, str);
1918 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1919 SysFreeString(str);
1921 str = a2bstr("auto");
1922 hres = IHTMLStyle_put_overflow(style, str);
1923 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1924 SysFreeString(str);
1926 hres = IHTMLStyle_get_overflow(style, &str);
1927 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1928 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1929 SysFreeString(str);
1931 str = a2bstr("");
1932 hres = IHTMLStyle_put_overflow(style, str);
1933 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1934 SysFreeString(str);
1936 hres = IHTMLStyle_get_overflow(style, &str);
1937 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1938 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1939 SysFreeString(str);
1941 /* restore overflow default */
1942 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1943 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1944 SysFreeString(sOverflowDefault);
1946 /* Attribute Tests*/
1947 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1948 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1950 str = a2bstr("position");
1951 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1952 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1954 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1955 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1956 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1957 VariantClear(&v);
1959 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1960 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1962 V_VT(&v) = VT_BSTR;
1963 V_BSTR(&v) = a2bstr("absolute");
1964 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1965 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1966 VariantClear(&v);
1968 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1969 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1970 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1971 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1972 VariantClear(&v);
1974 V_VT(&v) = VT_BSTR;
1975 V_BSTR(&v) = NULL;
1976 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1977 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1978 VariantClear(&v);
1980 SysFreeString(str);
1982 str = a2bstr("borderLeftStyle");
1983 test_border_styles(style, str);
1984 SysFreeString(str);
1986 str = a2bstr("borderbottomstyle");
1987 test_border_styles(style, str);
1988 SysFreeString(str);
1990 str = a2bstr("borderrightstyle");
1991 test_border_styles(style, str);
1992 SysFreeString(str);
1994 str = a2bstr("bordertopstyle");
1995 test_border_styles(style, str);
1996 SysFreeString(str);
1998 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1999 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2001 str = a2bstr("none dotted dashed solid");
2002 hres = IHTMLStyle_put_borderStyle(style, str);
2003 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2004 SysFreeString(str);
2006 str = a2bstr("none dotted dashed solid");
2007 hres = IHTMLStyle_get_borderStyle(style, &str);
2008 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2009 ok(!strcmp_wa(str, "none dotted dashed solid"),
2010 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
2011 SysFreeString(str);
2013 str = a2bstr("double groove ridge inset");
2014 hres = IHTMLStyle_put_borderStyle(style, str);
2015 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2016 SysFreeString(str);
2018 str = a2bstr("window-inset outset ridge inset");
2019 hres = IHTMLStyle_put_borderStyle(style, str);
2020 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2021 SysFreeString(str);
2023 str = a2bstr("window-inset");
2024 hres = IHTMLStyle_put_borderStyle(style, str);
2025 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2026 SysFreeString(str);
2028 str = a2bstr("none none none none none");
2029 hres = IHTMLStyle_put_borderStyle(style, str);
2030 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2031 SysFreeString(str);
2033 str = a2bstr("invalid none none none");
2034 hres = IHTMLStyle_put_borderStyle(style, str);
2035 todo_wine_if(compat_mode >= COMPAT_IE9)
2036 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2037 "put_borderStyle failed: %08x\n", hres);
2038 SysFreeString(str);
2040 str = a2bstr("none invalid none none");
2041 hres = IHTMLStyle_put_borderStyle(style, str);
2042 todo_wine_if(compat_mode >= COMPAT_IE9)
2043 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2044 "put_borderStyle failed: %08x\n", hres);
2045 SysFreeString(str);
2047 hres = IHTMLStyle_put_borderStyle(style, sDefault);
2048 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2049 SysFreeString(sDefault);
2051 /* backgroundColor */
2052 hres = IHTMLStyle_get_backgroundColor(style, &v);
2053 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
2054 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2055 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2056 VariantClear(&v);
2058 V_VT(&v) = VT_BSTR;
2059 V_BSTR(&v) = a2bstr("red");
2060 hres = IHTMLStyle_put_backgroundColor(style, v);
2061 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
2062 VariantClear(&v);
2064 hres = IHTMLStyle_get_backgroundColor(style, &v);
2065 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
2066 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2067 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2068 VariantClear(&v);
2070 str = a2bstr("fixed");
2071 hres = IHTMLStyle_put_backgroundAttachment(style, str);
2072 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
2073 SysFreeString(str);
2075 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
2076 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
2077 ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str));
2078 SysFreeString(str);
2080 /* padding */
2081 hres = IHTMLStyle_get_padding(style, &str);
2082 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2083 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2084 SysFreeString(str);
2086 hres = IHTMLStyle_get_paddingTop(style, &v);
2087 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
2088 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2089 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2091 V_VT(&v) = VT_I4;
2092 V_I4(&v) = 6;
2093 hres = IHTMLStyle_put_paddingTop(style, v);
2094 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
2096 hres = IHTMLStyle_get_paddingTop(style, &v);
2097 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
2098 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2099 if(compat_mode < COMPAT_IE9)
2100 ok(!strcmp_wa(V_BSTR(&v), "6px"), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2101 else
2102 ok(!V_BSTR(&v), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2103 VariantClear(&v);
2105 hres = IHTMLStyle_get_paddingRight(style, &v);
2106 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
2107 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2108 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2110 V_VT(&v) = VT_I4;
2111 V_I4(&v) = 6;
2112 hres = IHTMLStyle_put_paddingRight(style, v);
2113 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
2115 hres = IHTMLStyle_get_paddingRight(style, &v);
2116 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
2117 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2118 if(compat_mode < COMPAT_IE9)
2119 ok(!strcmp_wa(V_BSTR(&v), "6px"), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2120 else
2121 ok(!V_BSTR(&v), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2122 VariantClear(&v);
2124 hres = IHTMLStyle_get_paddingBottom(style, &v);
2125 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2126 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2127 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2129 V_VT(&v) = VT_I4;
2130 V_I4(&v) = 6;
2131 hres = IHTMLStyle_put_paddingBottom(style, v);
2132 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
2134 hres = IHTMLStyle_get_paddingBottom(style, &v);
2135 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2136 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2137 if(compat_mode < COMPAT_IE9)
2138 ok(!strcmp_wa(V_BSTR(&v), "6px"), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2139 else
2140 ok(!V_BSTR(&v), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2141 VariantClear(&v);
2143 str = a2bstr("1");
2144 hres = IHTMLStyle_put_padding(style, str);
2145 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
2146 SysFreeString(str);
2148 hres = IHTMLStyle_get_padding(style, &str);
2149 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2150 if(compat_mode < COMPAT_IE9)
2151 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
2152 else
2153 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2154 SysFreeString(str);
2156 /* PaddingLeft */
2157 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
2158 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2159 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
2160 if(compat_mode < COMPAT_IE9)
2161 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "paddingLeft = %s\n",
2162 wine_dbgstr_w(V_BSTR(&vDefault)));
2163 else
2164 ok(!V_BSTR(&vDefault), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
2166 V_VT(&v) = VT_BSTR;
2167 V_BSTR(&v) = a2bstr("10");
2168 hres = IHTMLStyle_put_paddingLeft(style, v);
2169 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2170 VariantClear(&v);
2172 hres = IHTMLStyle_get_paddingLeft(style, &v);
2173 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2174 if(compat_mode < COMPAT_IE9)
2175 ok(!strcmp_wa(V_BSTR(&v), "10px"), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2176 else
2177 ok(!V_BSTR(&v), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2178 VariantClear(&v);
2180 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
2181 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2183 /* BackgroundRepeat */
2184 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
2185 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2187 str = a2bstr("invalid");
2188 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2189 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2190 "put_backgroundRepeat failed: %08x\n", hres);
2191 SysFreeString(str);
2193 str = a2bstr("repeat");
2194 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2195 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2196 SysFreeString(str);
2198 str = a2bstr("no-repeat");
2199 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2200 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2201 SysFreeString(str);
2203 str = a2bstr("repeat-x");
2204 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2205 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2206 SysFreeString(str);
2208 str = a2bstr("repeat-y");
2209 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2210 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2211 SysFreeString(str);
2213 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
2214 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2215 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
2216 SysFreeString(str);
2218 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
2219 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2220 SysFreeString(sDefault);
2222 /* BorderColor */
2223 hres = IHTMLStyle_get_borderColor(style, &sDefault);
2224 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2226 str = a2bstr("red green red blue");
2227 hres = IHTMLStyle_put_borderColor(style, str);
2228 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2229 SysFreeString(str);
2231 hres = IHTMLStyle_get_borderColor(style, &str);
2232 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2233 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
2234 SysFreeString(str);
2236 hres = IHTMLStyle_put_borderColor(style, sDefault);
2237 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2238 SysFreeString(sDefault);
2240 /* BorderRight */
2241 hres = IHTMLStyle_get_borderRight(style, &sDefault);
2242 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
2244 str = a2bstr("thick dotted red");
2245 hres = IHTMLStyle_put_borderRight(style, str);
2246 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2247 SysFreeString(str);
2249 /* IHTMLStyle_get_borderRight appears to have a bug where
2250 it returns the first letter of the color. So we check
2251 each style individually.
2253 V_BSTR(&v) = NULL;
2254 hres = IHTMLStyle_get_borderRightColor(style, &v);
2255 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2256 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2257 VariantClear(&v);
2259 V_BSTR(&v) = NULL;
2260 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2261 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2262 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2263 VariantClear(&v);
2265 hres = IHTMLStyle_get_borderRightStyle(style, &str);
2266 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2267 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2268 SysFreeString(str);
2270 hres = IHTMLStyle_put_borderRight(style, sDefault);
2271 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2272 SysFreeString(sDefault);
2274 /* BorderTop */
2275 hres = IHTMLStyle_get_borderTop(style, &sDefault);
2276 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
2278 str = a2bstr("thick dotted red");
2279 hres = IHTMLStyle_put_borderTop(style, str);
2280 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2281 SysFreeString(str);
2283 /* IHTMLStyle_get_borderTop appears to have a bug where
2284 it returns the first letter of the color. So we check
2285 each style individually.
2287 V_BSTR(&v) = NULL;
2288 hres = IHTMLStyle_get_borderTopColor(style, &v);
2289 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2290 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2291 VariantClear(&v);
2293 V_BSTR(&v) = NULL;
2294 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2295 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2296 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2297 VariantClear(&v);
2299 hres = IHTMLStyle_get_borderTopStyle(style, &str);
2300 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2301 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2302 SysFreeString(str);
2304 hres = IHTMLStyle_put_borderTop(style, sDefault);
2305 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2306 SysFreeString(sDefault);
2308 /* BorderBottom */
2309 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2310 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2312 str = a2bstr("thick dotted red");
2313 hres = IHTMLStyle_put_borderBottom(style, str);
2314 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2315 SysFreeString(str);
2317 /* IHTMLStyle_get_borderBottom appears to have a bug where
2318 it returns the first letter of the color. So we check
2319 each style individually.
2321 V_BSTR(&v) = NULL;
2322 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2323 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2324 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2325 VariantClear(&v);
2327 V_BSTR(&v) = NULL;
2328 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2329 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2330 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2331 VariantClear(&v);
2333 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2334 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2335 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2336 SysFreeString(str);
2338 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2339 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2340 SysFreeString(sDefault);
2342 /* BorderLeft */
2343 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2344 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2346 str = a2bstr("thick dotted red");
2347 hres = IHTMLStyle_put_borderLeft(style, str);
2348 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2349 SysFreeString(str);
2351 /* IHTMLStyle_get_borderLeft appears to have a bug where
2352 it returns the first letter of the color. So we check
2353 each style individually.
2355 V_BSTR(&v) = NULL;
2356 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2357 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2358 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2359 VariantClear(&v);
2361 V_BSTR(&v) = NULL;
2362 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2363 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2364 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2365 VariantClear(&v);
2367 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2368 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2369 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2370 SysFreeString(str);
2372 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2373 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2374 SysFreeString(sDefault);
2376 /* backgroundPositionX */
2377 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2378 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2379 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2380 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2381 VariantClear(&v);
2383 if(css_style) {
2384 V_VT(&v) = VT_BSTR;
2385 V_BSTR(&v) = a2bstr("11px");
2386 hres = IHTMLCSSStyleDeclaration_put_backgroundPositionX(css_style, v);
2387 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2388 VariantClear(&v);
2390 hres = IHTMLCSSStyleDeclaration_get_backgroundPositionX(css_style, &v);
2391 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2392 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2393 ok(!strcmp_wa(V_BSTR(&v), "11px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2394 VariantClear(&v);
2397 V_VT(&v) = VT_BSTR;
2398 V_BSTR(&v) = a2bstr("10px");
2399 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2400 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2401 VariantClear(&v);
2403 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2404 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2405 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2406 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2407 VariantClear(&v);
2409 /* backgroundPositionY */
2410 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2411 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2412 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2413 VariantClear(&v);
2415 V_VT(&v) = VT_BSTR;
2416 V_BSTR(&v) = a2bstr("15px");
2417 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2418 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2419 VariantClear(&v);
2421 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2422 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2423 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2424 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2425 VariantClear(&v);
2427 /* backgroundPosition */
2428 str = NULL;
2429 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2430 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2431 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2432 SysFreeString(str);
2434 str = a2bstr("center 20%");
2435 hres = IHTMLStyle_put_backgroundPosition(style, str);
2436 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2437 SysFreeString(str);
2439 str = NULL;
2440 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2441 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2442 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2443 SysFreeString(str);
2445 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2446 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2447 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2448 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2449 VariantClear(&v);
2451 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2452 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2453 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2454 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2455 VariantClear(&v);
2457 if(css_style) {
2458 str = a2bstr("left 21%");
2459 hres = IHTMLCSSStyleDeclaration_put_backgroundPosition(css_style, str);
2460 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2461 SysFreeString(str);
2463 str = NULL;
2464 hres = IHTMLCSSStyleDeclaration_get_backgroundPosition(css_style, &str);
2465 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2466 ok(!strcmp_wa(str, "left 21%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2467 SysFreeString(str);
2470 /* borderTopWidth */
2471 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2472 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2474 V_VT(&v) = VT_BSTR;
2475 V_BSTR(&v) = a2bstr("10px");
2476 hres = IHTMLStyle_put_borderTopWidth(style, v);
2477 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2478 VariantClear(&v);
2480 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2481 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2482 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2483 VariantClear(&v);
2485 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2486 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2487 VariantClear(&vDefault);
2489 /* borderRightWidth */
2490 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2491 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2493 V_VT(&v) = VT_BSTR;
2494 V_BSTR(&v) = a2bstr("10");
2495 hres = IHTMLStyle_put_borderRightWidth(style, v);
2496 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2497 VariantClear(&v);
2499 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2500 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2501 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "10px" : "1px"),
2502 "borderRightWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2503 VariantClear(&v);
2505 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2506 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2507 VariantClear(&vDefault);
2509 /* borderBottomWidth */
2510 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2511 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2513 V_VT(&v) = VT_BSTR;
2514 V_BSTR(&v) = a2bstr("10");
2515 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2516 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2517 VariantClear(&v);
2519 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2520 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2521 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "10px" : "1px"),
2522 "borderBottomWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2523 VariantClear(&v);
2525 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2526 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2527 VariantClear(&vDefault);
2529 /* borderLeftWidth */
2530 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2531 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2533 V_VT(&v) = VT_BSTR;
2534 V_BSTR(&v) = a2bstr("10");
2535 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2536 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2537 VariantClear(&v);
2539 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2540 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2541 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "10px" : "1px"),
2542 "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2543 VariantClear(&v);
2545 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2546 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2547 VariantClear(&vDefault);
2549 /* wordSpacing */
2550 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2551 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2553 V_VT(&v) = VT_BSTR;
2554 V_BSTR(&v) = a2bstr("10");
2555 hres = IHTMLStyle_put_wordSpacing(style, v);
2556 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2557 VariantClear(&v);
2559 hres = IHTMLStyle_get_wordSpacing(style, &v);
2560 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2561 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2562 if(compat_mode < COMPAT_IE9)
2563 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2564 else
2565 ok(!V_BSTR(&v), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2566 VariantClear(&v);
2568 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2569 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2570 VariantClear(&vDefault);
2572 /* letterSpacing */
2573 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2574 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2576 V_VT(&v) = VT_BSTR;
2577 V_BSTR(&v) = a2bstr("11");
2578 hres = IHTMLStyle_put_letterSpacing(style, v);
2579 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2580 VariantClear(&v);
2582 hres = IHTMLStyle_get_letterSpacing(style, &v);
2583 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2584 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2585 if(compat_mode < COMPAT_IE9)
2586 ok(!strcmp_wa(V_BSTR(&v), "11px"), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2587 else
2588 ok(!V_BSTR(&v), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2589 VariantClear(&v);
2591 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2592 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2593 VariantClear(&vDefault);
2595 /* borderTopColor */
2596 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2597 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2599 V_VT(&v) = VT_BSTR;
2600 V_BSTR(&v) = a2bstr("red");
2601 hres = IHTMLStyle_put_borderTopColor(style, v);
2602 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2603 VariantClear(&v);
2605 hres = IHTMLStyle_get_borderTopColor(style, &v);
2606 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2607 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2608 VariantClear(&v);
2610 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2611 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2613 /* borderRightColor */
2614 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2615 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2617 V_VT(&v) = VT_BSTR;
2618 V_BSTR(&v) = a2bstr("blue");
2619 hres = IHTMLStyle_put_borderRightColor(style, v);
2620 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2621 VariantClear(&v);
2623 hres = IHTMLStyle_get_borderRightColor(style, &v);
2624 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2625 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2626 VariantClear(&v);
2628 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2629 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2631 /* borderBottomColor */
2632 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2633 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2635 V_VT(&v) = VT_BSTR;
2636 V_BSTR(&v) = a2bstr("cyan");
2637 hres = IHTMLStyle_put_borderBottomColor(style, v);
2638 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2639 VariantClear(&v);
2641 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2642 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2643 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2644 VariantClear(&v);
2646 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2647 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2649 /* borderLeftColor */
2650 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2651 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2653 V_VT(&v) = VT_BSTR;
2654 V_BSTR(&v) = a2bstr("cyan");
2655 hres = IHTMLStyle_put_borderLeftColor(style, v);
2656 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2657 VariantClear(&v);
2659 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2660 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2661 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2662 VariantClear(&v);
2664 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2665 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2667 /* clip */
2668 hres = IHTMLStyle_get_clip(style, &str);
2669 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2670 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2672 str = a2bstr("rect(0px 1px 500px 505px)");
2673 hres = IHTMLStyle_put_clip(style, str);
2674 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2675 SysFreeString(str);
2677 hres = IHTMLStyle_get_clip(style, &str);
2678 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2679 ok(!strcmp_wa(str, compat_mode < COMPAT_IE9 ? "rect(0px 1px 500px 505px)" : "rect(0px, 1px, 500px, 505px)"),
2680 "clip = %s\n", wine_dbgstr_w(str));
2681 SysFreeString(str);
2683 /* clear */
2684 hres = IHTMLStyle_get_clear(style, &str);
2685 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2686 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2688 str = a2bstr("both");
2689 hres = IHTMLStyle_put_clear(style, str);
2690 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2691 SysFreeString(str);
2693 hres = IHTMLStyle_get_clear(style, &str);
2694 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2695 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2696 SysFreeString(str);
2698 /* pageBreakAfter */
2699 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2700 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2701 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2703 if(css_style) {
2704 str = a2bstr("right");
2705 hres = IHTMLCSSStyleDeclaration_put_pageBreakAfter(css_style, str);
2706 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2707 SysFreeString(str);
2709 hres = IHTMLCSSStyleDeclaration_get_pageBreakAfter(css_style, &str);
2710 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2711 ok(!strcmp_wa(str, "right"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2712 SysFreeString(str);
2715 str = a2bstr("always");
2716 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2717 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2718 SysFreeString(str);
2720 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2721 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2722 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2723 SysFreeString(str);
2725 /* pageBreakBefore */
2726 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2727 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2728 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2730 str = a2bstr("always");
2731 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2732 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2733 SysFreeString(str);
2735 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2736 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2737 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2738 SysFreeString(str);
2740 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2741 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2743 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2744 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2745 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2747 str = (void*)0xdeadbeef;
2748 hres = IHTMLStyle_get_whiteSpace(style, &str);
2749 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2750 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2752 str = a2bstr("nowrap");
2753 hres = IHTMLStyle_put_whiteSpace(style, str);
2754 SysFreeString(str);
2755 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2757 str = NULL;
2758 hres = IHTMLStyle_get_whiteSpace(style, &str);
2759 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2760 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2761 SysFreeString(str);
2763 str = a2bstr("normal");
2764 hres = IHTMLStyle_put_whiteSpace(style, str);
2765 SysFreeString(str);
2766 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2768 str = NULL;
2769 hres = IHTMLStyle_get_whiteSpace(style, &str);
2770 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2771 ok(!strcmp_wa(str, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2772 SysFreeString(str);
2774 /* listStyleType */
2775 hres = IHTMLStyle_get_listStyleType(style, &str);
2776 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2777 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2779 str = a2bstr("square");
2780 hres = IHTMLStyle_put_listStyleType(style, str);
2781 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2782 SysFreeString(str);
2784 str = NULL;
2785 hres = IHTMLStyle_get_listStyleType(style, &str);
2786 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2787 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2789 str = a2bstr("inside");
2790 hres = IHTMLStyle_put_listStylePosition(style, str);
2791 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2792 SysFreeString(str);
2794 hres = IHTMLStyle_get_listStylePosition(style, &str);
2795 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2796 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2797 SysFreeString(str);
2799 str = a2bstr("decimal-leading-zero none inside");
2800 hres = IHTMLStyle_put_listStyle(style, str);
2801 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
2802 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
2803 SysFreeString(str);
2805 if (hres != E_INVALIDARG) {
2806 hres = IHTMLStyle_get_listStyle(style, &str);
2807 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
2808 ok(strstr_wa(str, "decimal-leading-zero") &&
2809 strstr_wa(str, "inside") != NULL,
2810 "listStyle = %s\n", wine_dbgstr_w(str));
2811 if(compat_mode < COMPAT_IE9)
2812 ok(strstr_wa(str, "none") != NULL, "listStyle = %s\n", wine_dbgstr_w(str));
2813 else
2814 todo_wine
2815 ok(!strstr_wa(str, "none"), "listStyle = %s\n", wine_dbgstr_w(str));
2817 SysFreeString(str);
2818 } else {
2819 win_skip("IHTMLStyle_put_listStyle already failed\n");
2822 str = (void*)0xdeadbeef;
2823 hres = IHTMLStyle_get_styleFloat(style, &str);
2824 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2825 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
2827 str = a2bstr("left");
2828 hres = IHTMLStyle_put_styleFloat(style, str);
2829 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
2830 SysFreeString(str);
2832 str = NULL;
2833 hres = IHTMLStyle_get_styleFloat(style, &str);
2834 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2835 ok(!strcmp_wa(str, "left"), "styleFloat = %s\n", wine_dbgstr_w(str));
2837 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2838 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2839 if(SUCCEEDED(hres)) {
2840 test_style2(style2);
2841 IHTMLStyle2_Release(style2);
2844 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2845 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2846 if(SUCCEEDED(hres)) {
2847 test_style3(style3);
2848 IHTMLStyle3_Release(style3);
2851 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2852 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2853 if(SUCCEEDED(hres)) {
2854 test_style4(style4);
2855 IHTMLStyle4_Release(style4);
2858 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
2859 if(SUCCEEDED(hres)) {
2860 test_style5(style5);
2861 IHTMLStyle5_Release(style5);
2862 }else {
2863 win_skip("IHTMLStyle5 not available\n");
2866 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2867 if(SUCCEEDED(hres)) {
2868 test_style6(style6);
2869 IHTMLStyle6_Release(style6);
2870 }else {
2871 win_skip("IHTMLStyle6 not available\n");
2874 if(compat_mode >= COMPAT_IE9)
2875 test_css_style_declaration(css_style);
2877 if(css_style)
2878 IHTMLCSSStyleDeclaration_Release(css_style);
2881 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2882 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2884 BSTR str;
2885 HRESULT hres;
2887 str = (void*)0xdeadbeef;
2888 hres = IHTMLStyle_get_filter(style, &str);
2889 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2890 if(exval)
2891 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2892 else
2893 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2895 SysFreeString(str);
2898 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2899 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2901 BSTR str;
2902 HRESULT hres;
2904 str = (void*)0xdeadbeef;
2905 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2906 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2907 if(exval)
2908 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2909 else
2910 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2912 SysFreeString(str);
2915 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2916 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2918 BSTR str = a2bstr(val);
2919 HRESULT hres;
2921 hres = IHTMLStyle_put_filter(style, str);
2922 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2923 SysFreeString(str);
2925 _test_style_filter(line, style, val);
2928 static void test_style_filters(IHTMLElement *elem)
2930 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2931 IHTMLCurrentStyle2 *current_style2;
2932 IHTMLCurrentStyle *current_style;
2933 IHTMLStyle *style;
2934 HRESULT hres;
2936 hres = IHTMLElement_get_style(elem, &style);
2937 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2939 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2940 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2942 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2944 test_style_filter(style, NULL);
2945 test_current_style_filter(current_style2, NULL);
2946 set_style_filter(style, "alpha(opacity=50.0040)");
2947 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2948 set_style_filter(style, "alpha(opacity=100)");
2950 IHTMLStyle_Release(style);
2952 hres = IHTMLElement_get_style(elem, &style);
2953 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2955 test_style_filter(style, "alpha(opacity=100)");
2956 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2957 set_style_filter(style, NULL);
2958 set_style_filter(style, "alpha(opacity=100)");
2959 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2960 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2961 test_style_filter(style, NULL);
2964 IHTMLCurrentStyle2_Release(current_style2);
2965 IHTMLStyle_Release(style);
2966 IHTMLElement2_Release(elem2);
2969 static void test_current_style(IHTMLCurrentStyle *current_style)
2971 IHTMLCurrentStyle2 *current_style2;
2972 IHTMLCurrentStyle3 *current_style3;
2973 IHTMLCurrentStyle4 *current_style4;
2974 VARIANT_BOOL b;
2975 BSTR str;
2976 HRESULT hres;
2977 VARIANT v;
2979 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2980 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2981 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2982 SysFreeString(str);
2984 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2985 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2986 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2987 SysFreeString(str);
2989 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2990 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2991 SysFreeString(str);
2993 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2994 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2995 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2996 SysFreeString(str);
2998 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2999 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
3000 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
3001 SysFreeString(str);
3003 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
3004 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
3005 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
3006 SysFreeString(str);
3008 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
3009 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
3010 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
3011 SysFreeString(str);
3013 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
3014 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
3015 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
3016 SysFreeString(str);
3018 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
3019 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
3020 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
3021 SysFreeString(str);
3023 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
3024 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
3025 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
3026 SysFreeString(str);
3028 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
3029 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
3030 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
3031 SysFreeString(str);
3033 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
3034 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3035 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
3036 SysFreeString(str);
3038 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
3039 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
3040 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
3041 SysFreeString(str);
3043 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
3044 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
3045 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
3046 SysFreeString(str);
3048 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
3049 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
3050 SysFreeString(str);
3052 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
3053 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
3054 SysFreeString(str);
3056 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
3057 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
3058 SysFreeString(str);
3060 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
3061 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
3062 SysFreeString(str);
3064 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
3065 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
3066 SysFreeString(str);
3068 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
3069 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
3070 SysFreeString(str);
3072 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
3073 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
3074 SysFreeString(str);
3076 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
3077 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
3078 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
3079 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
3080 VariantClear(&v);
3082 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
3083 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
3084 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3085 VariantClear(&v);
3087 hres = IHTMLCurrentStyle_get_left(current_style, &v);
3088 ok(hres == S_OK, "get_left failed: %08x\n", hres);
3089 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3090 VariantClear(&v);
3092 hres = IHTMLCurrentStyle_get_top(current_style, &v);
3093 ok(hres == S_OK, "get_top failed: %08x\n", hres);
3094 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3095 VariantClear(&v);
3097 hres = IHTMLCurrentStyle_get_width(current_style, &v);
3098 ok(hres == S_OK, "get_width failed: %08x\n", hres);
3099 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3100 VariantClear(&v);
3102 hres = IHTMLCurrentStyle_get_height(current_style, &v);
3103 ok(hres == S_OK, "get_height failed: %08x\n", hres);
3104 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3105 VariantClear(&v);
3107 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
3108 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
3109 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3110 VariantClear(&v);
3112 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
3113 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
3114 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
3115 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
3116 VariantClear(&v);
3118 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
3119 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
3120 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "100px" : "middle");
3121 VariantClear(&v);
3123 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
3124 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
3125 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3126 VariantClear(&v);
3128 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
3129 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
3130 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3131 VariantClear(&v);
3133 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
3134 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
3135 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3136 VariantClear(&v);
3138 V_BSTR(&v) = NULL;
3139 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
3140 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
3141 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3142 VariantClear(&v);
3144 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
3145 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
3146 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3147 VariantClear(&v);
3149 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
3150 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
3151 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3152 VariantClear(&v);
3154 hres = IHTMLCurrentStyle_get_color(current_style, &v);
3155 ok(hres == S_OK, "get_color failed: %08x\n", hres);
3156 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3157 VariantClear(&v);
3159 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
3160 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
3161 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3162 VariantClear(&v);
3164 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
3165 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
3166 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3167 VariantClear(&v);
3169 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
3170 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
3171 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3172 VariantClear(&v);
3174 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
3175 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
3176 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3177 VariantClear(&v);
3179 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
3180 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
3181 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3182 VariantClear(&v);
3184 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
3185 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
3186 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3187 VariantClear(&v);
3189 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
3190 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
3191 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3192 VariantClear(&v);
3194 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
3195 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
3196 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3197 VariantClear(&v);
3199 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
3200 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
3201 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3202 VariantClear(&v);
3204 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
3205 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
3206 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3207 VariantClear(&v);
3209 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
3210 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
3211 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3212 VariantClear(&v);
3214 hres = IHTMLCurrentStyle_get_right(current_style, &v);
3215 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
3216 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3217 VariantClear(&v);
3219 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
3220 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
3221 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3222 VariantClear(&v);
3224 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
3225 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
3226 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3227 VariantClear(&v);
3229 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
3230 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
3231 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3232 VariantClear(&v);
3234 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
3235 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
3236 SysFreeString(str);
3238 hres = IHTMLCurrentStyle_get_styleFloat(current_style, &str);
3239 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3240 ok(!strcmp_wa(str, "none"), "styleFloat = %s\n", wine_dbgstr_w(str));
3241 SysFreeString(str);
3243 hres = IHTMLCurrentStyle_get_overflowX(current_style, &str);
3244 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
3245 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
3246 SysFreeString(str);
3248 hres = IHTMLCurrentStyle_get_overflowY(current_style, &str);
3249 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
3250 ok(!strcmp_wa(str, "hidden"), "overflowY = %s\n", wine_dbgstr_w(str));
3251 SysFreeString(str);
3253 hres = IHTMLCurrentStyle_get_direction(current_style, &str);
3254 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
3255 ok(!strcmp_wa(str, "ltr"), "direction = %s\n", wine_dbgstr_w(str));
3256 SysFreeString(str);
3258 current_style2 = get_current_style2_iface((IUnknown*)current_style);
3260 b = 100;
3261 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
3262 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
3263 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
3265 IHTMLCurrentStyle2_Release(current_style2);
3267 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle3, (void**)&current_style3);
3268 ok(hres == S_OK, "Could not get IHTMLCurrentStyle3 iface: %08x\n", hres);
3270 hres = IHTMLCurrentStyle3_get_whiteSpace(current_style3, &str);
3271 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3272 ok(!strcmp_wa(str, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3273 SysFreeString(str);
3275 IHTMLCurrentStyle3_Release(current_style3);
3277 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle4, (void**)&current_style4);
3278 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "Could not get IHTMLCurrentStyle4 iface: %08x\n", hres);
3279 if(SUCCEEDED(hres)) {
3280 hres = IHTMLCurrentStyle4_get_minWidth(current_style4, &v);
3281 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
3282 ok(V_VT(&v) == VT_BSTR, "V_VT(minWidth) = %d\n", V_VT(&v));
3283 VariantClear(&v);
3285 IHTMLCurrentStyle4_Release(current_style4);
3286 }else {
3287 win_skip("IHTMLCurrentStyle4 not supported.\n");
3291 static void basic_style_test(IHTMLDocument2 *doc)
3293 IHTMLCurrentStyle *cstyle;
3294 IHTMLElement *elem;
3295 IHTMLStyle *style;
3296 HRESULT hres;
3298 hres = IHTMLDocument2_get_body(doc, &elem);
3299 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3301 elem_set_innerhtml(elem, "<div id=\"divid\"></div>");
3303 hres = IHTMLElement_get_style(elem, &style);
3304 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3306 test_body_style(style);
3308 cstyle = get_current_style(elem);
3309 test_current_style(cstyle);
3310 IHTMLCurrentStyle_Release(cstyle);
3311 IHTMLElement_Release(elem);
3313 elem = get_element_by_id(doc, "divid");
3314 test_style_filters(elem);
3316 test_set_csstext(style);
3317 IHTMLStyle_Release(style);
3318 IHTMLElement_Release(elem);
3321 static const char runtimestyle_test_str[] =
3322 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
3324 static const char runtimestyle_ie9_test_str[] =
3325 "<!DOCTYPE html>\n"
3326 "<html>"
3327 " <head>"
3328 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
3329 " <style>body {text-decoration: auto}</style>"
3330 " </head>"
3331 " <body>"
3332 " </body>"
3333 "</html>";
3335 static void runtimestyle_test(IHTMLDocument2 *doc)
3337 IHTMLStyle *style, *runtime_style;
3338 IHTMLElement2 *elem2;
3339 IHTMLElement *elem;
3340 BSTR str;
3341 HRESULT hres;
3343 hres = IHTMLDocument2_get_body(doc, &elem);
3344 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3346 elem2 = get_elem2_iface((IUnknown*)elem);
3348 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
3349 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
3351 hres = IHTMLElement_get_style(elem, &style);
3352 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3354 test_text_decoration(style, NULL);
3355 test_text_decoration(runtime_style, NULL);
3356 set_text_decoration(style, "underline");
3357 test_text_decoration(style, "underline");
3359 hres = IHTMLStyle_get_textDecoration(style, &str);
3360 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3361 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3362 SysFreeString(str);
3364 set_text_decoration(runtime_style, "blink");
3365 test_text_decoration(runtime_style, "blink");
3367 hres = IHTMLStyle_get_textDecoration(style, &str);
3368 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3369 todo_wine
3370 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3371 SysFreeString(str);
3373 IHTMLStyle_Release(runtime_style);
3374 IHTMLStyle_Release(style);
3375 IHTMLElement2_Release(elem2);
3376 IHTMLElement_Release(elem);
3379 static IHTMLDocument2 *notif_doc;
3380 static BOOL doc_complete;
3382 static IHTMLDocument2 *create_document(void)
3384 IHTMLDocument2 *doc;
3385 IHTMLDocument5 *doc5;
3386 HRESULT hres;
3388 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3389 &IID_IHTMLDocument2, (void**)&doc);
3390 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3391 if(FAILED(hres))
3392 return NULL;
3394 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
3395 if(FAILED(hres)) {
3396 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3397 IHTMLDocument2_Release(doc);
3398 return NULL;
3401 IHTMLDocument5_Release(doc5);
3402 return doc;
3405 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
3406 REFIID riid, void**ppv)
3408 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3409 *ppv = iface;
3410 return S_OK;
3413 ok(0, "unexpected call\n");
3414 return E_NOINTERFACE;
3417 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
3419 return 2;
3422 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
3424 return 1;
3427 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
3429 if(dispID == DISPID_READYSTATE){
3430 BSTR state;
3431 HRESULT hres;
3433 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3434 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3436 if(!strcmp_wa(state, "complete"))
3437 doc_complete = TRUE;
3439 SysFreeString(state);
3442 return S_OK;
3445 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
3447 ok(0, "unexpected call\n");
3448 return E_NOTIMPL;
3451 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3452 PropertyNotifySink_QueryInterface,
3453 PropertyNotifySink_AddRef,
3454 PropertyNotifySink_Release,
3455 PropertyNotifySink_OnChanged,
3456 PropertyNotifySink_OnRequestEdit
3459 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
3461 static IHTMLDocument2 *create_doc_with_string(const char *str)
3463 IPersistStreamInit *init;
3464 IStream *stream;
3465 IHTMLDocument2 *doc;
3466 HRESULT hres;
3467 HGLOBAL mem;
3468 SIZE_T len;
3470 notif_doc = doc = create_document();
3471 if(!doc)
3472 return NULL;
3474 doc_complete = FALSE;
3475 len = strlen(str);
3476 mem = GlobalAlloc(0, len);
3477 memcpy(mem, str, len);
3478 hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
3479 ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
3481 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3482 ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
3484 IPersistStreamInit_Load(init, stream);
3485 IPersistStreamInit_Release(init);
3486 IStream_Release(stream);
3488 return doc;
3491 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3493 IConnectionPointContainer *container;
3494 IConnectionPoint *cp;
3495 DWORD cookie;
3496 HRESULT hres;
3498 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3499 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3501 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3502 IConnectionPointContainer_Release(container);
3503 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3505 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3506 IConnectionPoint_Release(cp);
3507 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3510 typedef void (*style_test_t)(IHTMLDocument2*);
3512 static void run_test(const char *str, style_test_t test)
3514 IHTMLDocument2 *doc;
3515 ULONG ref;
3516 MSG msg;
3518 doc = create_doc_with_string(str);
3519 if(!doc)
3520 return;
3522 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
3524 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3525 TranslateMessage(&msg);
3526 DispatchMessageW(&msg);
3529 test(doc);
3531 ref = IHTMLDocument2_Release(doc);
3532 ok(!ref || broken(ref == 1), /* Vista */
3533 "ref = %d\n", ref);
3536 static BOOL check_ie(void)
3538 IHTMLDocument2 *doc;
3539 IHTMLDocument7 *doc7;
3540 HRESULT hres;
3542 doc = create_document();
3543 if(!doc)
3544 return FALSE;
3546 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
3547 if(SUCCEEDED(hres)) {
3548 is_ie9plus = TRUE;
3549 IHTMLDocument7_Release(doc7);
3552 trace("is_ie9plus %x\n", is_ie9plus);
3554 IHTMLDocument2_Release(doc);
3555 return TRUE;
3558 START_TEST(style)
3560 CoInitialize(NULL);
3562 if(check_ie()) {
3563 trace("Running tests in quirks mode...\n");
3564 run_test(doc_blank, basic_style_test);
3565 run_test(runtimestyle_test_str, runtimestyle_test);
3566 if(is_ie9plus) {
3567 trace("Running tests in IE9 mode...\n");
3568 compat_mode = COMPAT_IE9;
3569 run_test(doc_blank_ie9, basic_style_test);
3570 run_test(runtimestyle_ie9_test_str, runtimestyle_test);
3574 CoUninitialize();