mshtml: Skip fixups in get_nsstyle_property in IE9+ mode.
[wine.git] / dlls / mshtml / tests / style.c
blob51b44fb063d4c8152b24ff5dfd0c54f53f676733
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_body_style(IHTMLStyle *style)
741 IHTMLStyle2 *style2;
742 IHTMLStyle3 *style3;
743 IHTMLStyle4 *style4;
744 IHTMLStyle5 *style5;
745 IHTMLStyle6 *style6;
746 VARIANT_BOOL b;
747 VARIANT v;
748 BSTR str;
749 HRESULT hres;
750 float f;
751 BSTR sOverflowDefault;
752 BSTR sDefault;
753 LONG l;
754 VARIANT vDefault;
756 test_style_csstext(style, NULL);
758 hres = IHTMLStyle_get_position(style, &str);
759 ok(hres == S_OK, "get_position failed: %08x\n", hres);
760 ok(!str, "str=%s\n", wine_dbgstr_w(str));
762 V_VT(&v) = VT_NULL;
763 hres = IHTMLStyle_get_marginRight(style, &v);
764 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
765 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
766 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
768 V_VT(&v) = VT_I4;
769 V_I4(&v) = 6;
770 hres = IHTMLStyle_put_marginRight(style, v);
771 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
773 V_VT(&v) = VT_NULL;
774 hres = IHTMLStyle_get_marginRight(style, &v);
775 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
776 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
777 if(compat_mode < COMPAT_IE9)
778 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
779 else
780 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
782 V_VT(&v) = VT_NULL;
783 hres = IHTMLStyle_get_marginBottom(style, &v);
784 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
785 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
786 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
788 V_VT(&v) = VT_I4;
789 V_I4(&v) = 6;
790 hres = IHTMLStyle_put_marginBottom(style, v);
791 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
793 V_VT(&v) = VT_NULL;
794 hres = IHTMLStyle_get_marginBottom(style, &v);
795 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
796 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
797 if(compat_mode < COMPAT_IE9)
798 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
799 else
800 ok(!V_BSTR(&v), "mariginBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
802 V_VT(&v) = VT_NULL;
803 hres = IHTMLStyle_get_marginLeft(style, &v);
804 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
805 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
806 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
808 V_VT(&v) = VT_I4;
809 V_I4(&v) = 6;
810 hres = IHTMLStyle_put_marginLeft(style, v);
811 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
813 V_VT(&v) = VT_NULL;
814 hres = IHTMLStyle_get_marginLeft(style, &v);
815 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
816 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
817 if(compat_mode < COMPAT_IE9)
818 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
819 else
820 ok(!V_BSTR(&v), "mariginLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
822 str = (void*)0xdeadbeef;
823 hres = IHTMLStyle_get_fontFamily(style, &str);
824 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
825 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
827 str = (void*)0xdeadbeef;
828 hres = IHTMLStyle_get_fontWeight(style, &str);
829 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
830 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
832 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
833 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
835 str = a2bstr("test");
836 hres = IHTMLStyle_put_fontWeight(style, str);
837 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
838 "put_fontWeight failed: %08x\n", hres);
839 SysFreeString(str);
841 hres = IHTMLStyle_get_fontWeight(style, &str);
842 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
843 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
844 SysFreeString(str);
846 str = a2bstr("bold");
847 hres = IHTMLStyle_put_fontWeight(style, str);
848 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
849 SysFreeString(str);
851 str = a2bstr("bolder");
852 hres = IHTMLStyle_put_fontWeight(style, str);
853 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
854 SysFreeString(str);
856 str = a2bstr("lighter");
857 hres = IHTMLStyle_put_fontWeight(style, str);
858 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
859 SysFreeString(str);
861 str = a2bstr("100");
862 hres = IHTMLStyle_put_fontWeight(style, str);
863 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
864 SysFreeString(str);
866 str = a2bstr("200");
867 hres = IHTMLStyle_put_fontWeight(style, str);
868 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
869 SysFreeString(str);
871 str = a2bstr("300");
872 hres = IHTMLStyle_put_fontWeight(style, str);
873 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
874 SysFreeString(str);
876 str = a2bstr("400");
877 hres = IHTMLStyle_put_fontWeight(style, str);
878 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
879 SysFreeString(str);
881 str = a2bstr("500");
882 hres = IHTMLStyle_put_fontWeight(style, str);
883 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
884 SysFreeString(str);
886 str = a2bstr("600");
887 hres = IHTMLStyle_put_fontWeight(style, str);
888 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
889 SysFreeString(str);
891 str = a2bstr("700");
892 hres = IHTMLStyle_put_fontWeight(style, str);
893 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
894 SysFreeString(str);
896 str = a2bstr("800");
897 hres = IHTMLStyle_put_fontWeight(style, str);
898 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
899 SysFreeString(str);
901 str = a2bstr("900");
902 hres = IHTMLStyle_put_fontWeight(style, str);
903 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
904 SysFreeString(str);
906 hres = IHTMLStyle_get_fontWeight(style, &str);
907 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
908 ok(!strcmp_wa(str, "900"), "str != style900\n");
909 SysFreeString(str);
911 str = a2bstr("");
912 hres = IHTMLStyle_put_fontWeight(style, str);
913 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
914 SysFreeString(str);
916 hres = IHTMLStyle_get_fontWeight(style, &str);
917 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
918 ok(!str, "str != NULL\n");
919 SysFreeString(str);
921 hres = IHTMLStyle_put_fontWeight(style, sDefault);
922 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
923 SysFreeString(sDefault);
925 /* font Variant */
926 hres = IHTMLStyle_get_fontVariant(style, NULL);
927 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
929 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
930 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
932 str = a2bstr("test");
933 hres = IHTMLStyle_put_fontVariant(style, str);
934 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
935 "fontVariant failed: %08x\n", hres);
936 SysFreeString(str);
938 str = a2bstr("small-caps");
939 hres = IHTMLStyle_put_fontVariant(style, str);
940 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
941 SysFreeString(str);
943 str = a2bstr("normal");
944 hres = IHTMLStyle_put_fontVariant(style, str);
945 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
946 SysFreeString(str);
948 hres = IHTMLStyle_put_fontVariant(style, sDefault);
949 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
950 SysFreeString(sDefault);
952 str = (void*)0xdeadbeef;
953 hres = IHTMLStyle_get_display(style, &str);
954 ok(hres == S_OK, "get_display failed: %08x\n", hres);
955 ok(!str, "display = %s\n", wine_dbgstr_w(str));
957 str = (void*)0xdeadbeef;
958 hres = IHTMLStyle_get_visibility(style, &str);
959 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
960 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
962 V_VT(&v) = VT_NULL;
963 hres = IHTMLStyle_get_fontSize(style, &v);
964 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
965 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
966 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
968 V_VT(&v) = VT_I4;
969 V_I4(&v) = 12;
970 hres = IHTMLStyle_put_fontSize(style, v);
971 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
973 V_VT(&v) = VT_NULL;
974 hres = IHTMLStyle_get_fontSize(style, &v);
975 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
976 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
977 if(compat_mode < COMPAT_IE9)
978 ok(!strcmp_wa(V_BSTR(&v), "12px"), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
979 else
980 ok(!V_BSTR(&v), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
982 V_VT(&v) = VT_NULL;
983 hres = IHTMLStyle_get_color(style, &v);
984 ok(hres == S_OK, "get_color failed: %08x\n", hres);
985 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
986 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
988 V_VT(&v) = VT_I4;
989 V_I4(&v) = 0xfdfd;
990 hres = IHTMLStyle_put_color(style, v);
991 ok(hres == S_OK, "put_color failed: %08x\n", hres);
993 V_VT(&v) = VT_NULL;
994 hres = IHTMLStyle_get_color(style, &v);
995 ok(hres == S_OK, "get_color failed: %08x\n", hres);
996 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
997 todo_wine
998 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1000 V_VT(&v) = VT_I4;
1001 V_I4(&v) = 3;
1002 hres = IHTMLStyle_put_lineHeight(style, v);
1003 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1005 hres = IHTMLStyle_get_lineHeight(style, &v);
1006 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1007 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1008 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1010 V_VT(&v) = VT_BSTR;
1011 V_BSTR(&v) = a2bstr("300%");
1012 hres = IHTMLStyle_put_lineHeight(style, v);
1013 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1014 VariantClear(&v);
1016 hres = IHTMLStyle_get_lineHeight(style, &v);
1017 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1018 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1019 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1020 VariantClear(&v);
1022 b = 0xfefe;
1023 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1024 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1025 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
1027 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
1028 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1030 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1031 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1032 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
1034 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
1035 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1037 b = 0xfefe;
1038 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1039 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1040 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
1042 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
1043 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1045 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1046 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1047 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
1049 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
1050 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1052 b = 0xfefe;
1053 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1054 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1055 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
1057 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
1058 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1060 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1061 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1062 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
1064 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
1065 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1067 b = 0xfefe;
1068 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1069 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1070 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
1072 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
1073 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1075 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1076 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1077 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
1079 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
1080 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1082 b = 0xfefe;
1083 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1084 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1085 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
1087 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
1088 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1090 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1091 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1092 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1094 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1095 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1097 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1098 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1100 str = a2bstr("invalid");
1101 hres = IHTMLStyle_put_textDecoration(style, str);
1102 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1103 "put_textDecoration failed: %08x\n", hres);
1104 SysFreeString(str);
1106 set_text_decoration(style, "none");
1107 test_text_decoration(style, "none");
1108 set_text_decoration(style, "underline");
1109 set_text_decoration(style, "overline");
1110 set_text_decoration(style, "line-through");
1111 set_text_decoration(style, "blink");
1112 set_text_decoration(style, "overline");
1113 set_text_decoration(style, "blink");
1114 test_text_decoration(style, "blink");
1116 str = a2bstr("invalid");
1117 hres = IHTMLStyle_put_textDecoration(style, str);
1118 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1119 "put_textDecoration failed: %08x\n", hres);
1120 SysFreeString(str);
1121 test_text_decoration(style, compat_mode < COMPAT_IE9 ? NULL : "blink");
1123 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1124 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1125 SysFreeString(sDefault);
1127 hres = IHTMLStyle_get_posWidth(style, NULL);
1128 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1130 hres = IHTMLStyle_get_posWidth(style, &f);
1131 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1132 ok(f == 0.0f, "f = %f\n", f);
1134 V_VT(&v) = VT_EMPTY;
1135 hres = IHTMLStyle_get_width(style, &v);
1136 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1137 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1138 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1140 hres = IHTMLStyle_put_posWidth(style, 2.2);
1141 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1143 hres = IHTMLStyle_get_posWidth(style, &f);
1144 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1145 ok(f == 2.0f ||
1146 f == 2.2f, /* IE8 */
1147 "f = %f\n", f);
1149 l = 0xdeadbeef;
1150 hres = IHTMLStyle_get_pixelWidth(style, &l);
1151 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1152 ok(l == 2, "pixelWidth = %d\n", l);
1154 V_VT(&v) = VT_BSTR;
1155 V_BSTR(&v) = a2bstr("auto");
1156 hres = IHTMLStyle_put_width(style, v);
1157 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1158 VariantClear(&v);
1160 V_VT(&v) = VT_EMPTY;
1161 hres = IHTMLStyle_get_width(style, &v);
1162 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1163 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1164 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1165 VariantClear(&v);
1167 l = 0xdeadbeef;
1168 hres = IHTMLStyle_get_pixelWidth(style, &l);
1169 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1170 ok(!l, "pixelWidth = %d\n", l);
1172 V_VT(&v) = VT_I4;
1173 V_I4(&v) = 100;
1174 hres = IHTMLStyle_put_width(style, v);
1175 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1177 hres = IHTMLStyle_get_width(style, &v);
1178 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1179 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "100px" : "auto");
1180 VariantClear(&v);
1182 l = 0xdeadbeef;
1183 hres = IHTMLStyle_get_pixelWidth(style, &l);
1184 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1185 ok(l == (compat_mode < COMPAT_IE9 ? 100 : 0), "pixelWidth = %d\n", l);
1187 V_VT(&v) = VT_EMPTY;
1188 hres = IHTMLStyle_get_width(style, &v);
1189 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1190 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1191 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "100px" : "auto"), "V_BSTR(v)=%s\n",
1192 wine_dbgstr_w(V_BSTR(&v)));
1193 VariantClear(&v);
1195 hres = IHTMLStyle_put_pixelWidth(style, 50);
1196 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1198 l = 0xdeadbeef;
1199 hres = IHTMLStyle_get_pixelWidth(style, &l);
1200 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1201 ok(l == 50, "pixelWidth = %d\n", l);
1203 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1204 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1206 V_VT(&v) = VT_EMPTY;
1207 hres = IHTMLStyle_get_width(style, &v);
1208 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1209 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1210 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1211 VariantClear(&v);
1213 /* margin tests */
1214 str = (void*)0xdeadbeef;
1215 hres = IHTMLStyle_get_margin(style, &str);
1216 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1217 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1219 str = a2bstr("1");
1220 hres = IHTMLStyle_put_margin(style, str);
1221 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1222 SysFreeString(str);
1224 hres = IHTMLStyle_get_margin(style, &str);
1225 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1226 if(compat_mode < COMPAT_IE9)
1227 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
1228 else
1229 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1230 SysFreeString(str);
1232 str = a2bstr("2px");
1233 hres = IHTMLStyle_put_margin(style, str);
1234 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1235 SysFreeString(str);
1237 hres = IHTMLStyle_get_margin(style, &str);
1238 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1239 ok(!strcmp_wa(str, "2px"), "margin = %s\n", wine_dbgstr_w(str));
1240 SysFreeString(str);
1242 hres = IHTMLStyle_put_margin(style, NULL);
1243 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1245 str = (void*)0xdeadbeef;
1246 hres = IHTMLStyle_get_marginTop(style, &v);
1247 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1248 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1249 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1251 V_VT(&v) = VT_BSTR;
1252 V_BSTR(&v) = a2bstr("6px");
1253 hres = IHTMLStyle_put_marginTop(style, v);
1254 SysFreeString(V_BSTR(&v));
1255 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1257 str = (void*)0xdeadbeef;
1258 hres = IHTMLStyle_get_marginTop(style, &v);
1259 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1260 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1261 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1262 VariantClear(&v);
1264 V_VT(&v) = VT_I4;
1265 V_I4(&v) = 5;
1266 hres = IHTMLStyle_put_marginTop(style, v);
1267 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1269 str = (void*)0xdeadbeef;
1270 hres = IHTMLStyle_get_marginTop(style, &v);
1271 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1272 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1273 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "5px" : "6px"),
1274 "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1275 VariantClear(&v);
1277 str = NULL;
1278 hres = IHTMLStyle_get_border(style, &str);
1279 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1280 ok(!str || !*str, "str is not empty\n");
1281 SysFreeString(str);
1283 str = a2bstr("1px");
1284 hres = IHTMLStyle_put_border(style, str);
1285 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1286 SysFreeString(str);
1288 V_VT(&v) = VT_EMPTY;
1289 hres = IHTMLStyle_get_left(style, &v);
1290 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1291 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1292 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1293 VariantClear(&v);
1295 l = 0xdeadbeef;
1296 hres = IHTMLStyle_get_pixelLeft(style, &l);
1297 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1298 ok(!l, "pixelLeft = %d\n", l);
1300 /* Test posLeft */
1301 hres = IHTMLStyle_get_posLeft(style, NULL);
1302 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1304 f = 1.0f;
1305 hres = IHTMLStyle_get_posLeft(style, &f);
1306 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1307 ok(f == 0.0, "expected 0.0 got %f\n", f);
1309 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1310 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1312 hres = IHTMLStyle_get_posLeft(style, &f);
1313 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1314 ok(f == 4.0 ||
1315 f == 4.9f, /* IE8 */
1316 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1318 /* Ensure left is updated correctly. */
1319 V_VT(&v) = VT_EMPTY;
1320 hres = IHTMLStyle_get_left(style, &v);
1321 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1322 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1323 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1324 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1325 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1326 VariantClear(&v);
1328 /* Test left */
1329 V_VT(&v) = VT_BSTR;
1330 V_BSTR(&v) = a2bstr("3px");
1331 hres = IHTMLStyle_put_left(style, v);
1332 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1333 VariantClear(&v);
1335 hres = IHTMLStyle_get_posLeft(style, &f);
1336 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1337 ok(f == 3.0, "expected 3.0 got %f\n", f);
1339 l = 0xdeadbeef;
1340 hres = IHTMLStyle_get_pixelLeft(style, &l);
1341 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1342 ok(l == 3, "pixelLeft = %d\n", l);
1344 V_VT(&v) = VT_EMPTY;
1345 hres = IHTMLStyle_get_left(style, &v);
1346 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1347 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1348 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1349 VariantClear(&v);
1351 V_VT(&v) = VT_BSTR;
1352 V_BSTR(&v) = a2bstr("4.99");
1353 hres = IHTMLStyle_put_left(style, v);
1354 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1355 VariantClear(&v);
1357 l = 0xdeadbeef;
1358 hres = IHTMLStyle_get_pixelLeft(style, &l);
1359 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1360 ok(l == (compat_mode < COMPAT_IE9 ? 4 : 3), "pixelLeft = %d\n", l);
1362 V_VT(&v) = VT_NULL;
1363 hres = IHTMLStyle_put_left(style, v);
1364 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1366 V_VT(&v) = VT_EMPTY;
1367 hres = IHTMLStyle_get_left(style, &v);
1368 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1369 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1370 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1371 VariantClear(&v);
1373 V_VT(&v) = VT_EMPTY;
1374 hres = IHTMLStyle_get_top(style, &v);
1375 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1376 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1377 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1378 VariantClear(&v);
1380 l = 0xdeadbeef;
1381 hres = IHTMLStyle_get_pixelLeft(style, &l);
1382 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1383 ok(!l, "pixelLeft = %d\n", l);
1385 hres = IHTMLStyle_put_pixelLeft(style, 6);
1386 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1388 l = 0xdeadbeef;
1389 hres = IHTMLStyle_get_pixelLeft(style, &l);
1390 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1391 ok(l == 6, "pixelLeft = %d\n", l);
1393 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1394 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
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(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1401 VariantClear(&v);
1403 /* Test posTop */
1404 hres = IHTMLStyle_get_posTop(style, NULL);
1405 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1407 f = 1.0f;
1408 hres = IHTMLStyle_get_posTop(style, &f);
1409 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1410 ok(f == 0.0, "expected 0.0 got %f\n", f);
1412 hres = IHTMLStyle_put_posTop(style, 4.9f);
1413 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1415 hres = IHTMLStyle_get_posTop(style, &f);
1416 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1417 ok(f == 4.0 ||
1418 f == 4.9f, /* IE8 */
1419 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1421 hres = IHTMLStyle_put_pixelTop(style, 6);
1422 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1424 l = 0xdeadbeef;
1425 hres = IHTMLStyle_get_pixelTop(style, &l);
1426 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1427 ok(l == 6, "pixelTop = %d\n", l);
1429 hres = IHTMLStyle_get_pixelTop(style, NULL);
1430 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1432 V_VT(&v) = VT_BSTR;
1433 V_BSTR(&v) = a2bstr("3px");
1434 hres = IHTMLStyle_put_top(style, v);
1435 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1436 VariantClear(&v);
1438 V_VT(&v) = VT_EMPTY;
1439 hres = IHTMLStyle_get_top(style, &v);
1440 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1441 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1442 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1443 VariantClear(&v);
1445 hres = IHTMLStyle_get_posTop(style, &f);
1446 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1447 ok(f == 3.0, "expected 3.0 got %f\n", f);
1449 l = 0xdeadbeef;
1450 hres = IHTMLStyle_get_pixelTop(style, &l);
1451 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1452 ok(l == 3, "pixelTop = %d\n", l);
1454 V_VT(&v) = VT_BSTR;
1455 V_BSTR(&v) = a2bstr("100%");
1456 hres = IHTMLStyle_put_top(style, v);
1457 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1458 VariantClear(&v);
1460 l = 0xdeadbeef;
1461 hres = IHTMLStyle_get_pixelTop(style, &l);
1462 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1463 ok(!l, "pixelTop = %d\n", l);
1465 V_VT(&v) = VT_NULL;
1466 hres = IHTMLStyle_put_top(style, v);
1467 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1469 V_VT(&v) = VT_EMPTY;
1470 hres = IHTMLStyle_get_top(style, &v);
1471 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1472 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1473 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1474 VariantClear(&v);
1476 l = 0xdeadbeef;
1477 hres = IHTMLStyle_get_pixelTop(style, &l);
1478 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1479 ok(!l, "pixelTop = %d\n", l);
1481 /* Test posHeight */
1482 hres = IHTMLStyle_get_posHeight(style, NULL);
1483 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1485 V_VT(&v) = VT_EMPTY;
1486 hres = IHTMLStyle_get_height(style, &v);
1487 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1488 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1489 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1490 VariantClear(&v);
1492 f = 1.0f;
1493 hres = IHTMLStyle_get_posHeight(style, &f);
1494 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1495 ok(f == 0.0, "expected 0.0 got %f\n", f);
1497 l = 0xdeadbeef;
1498 hres = IHTMLStyle_get_pixelHeight(style, &l);
1499 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1500 ok(!l, "pixelHeight = %d\n", l);
1502 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1503 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1505 hres = IHTMLStyle_get_posHeight(style, &f);
1506 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1507 ok(f == 4.0 ||
1508 f == 4.9f, /* IE8 */
1509 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1511 l = 0xdeadbeef;
1512 hres = IHTMLStyle_get_pixelHeight(style, &l);
1513 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1514 ok(l == 4 ||
1515 l == 5, /* IE8 */
1516 "pixelHeight = %d\n", l);
1518 V_VT(&v) = VT_BSTR;
1519 V_BSTR(&v) = a2bstr("70px");
1520 hres = IHTMLStyle_put_height(style, v);
1521 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1522 VariantClear(&v);
1524 V_VT(&v) = VT_EMPTY;
1525 hres = IHTMLStyle_get_height(style, &v);
1526 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1527 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1528 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1529 VariantClear(&v);
1531 l = 0xdeadbeef;
1532 hres = IHTMLStyle_get_pixelHeight(style, &l);
1533 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1534 ok(l == 70, "pixelHeight = %d\n", l);
1536 V_VT(&v) = VT_BSTR;
1537 V_BSTR(&v) = a2bstr("50%");
1538 hres = IHTMLStyle_put_height(style, v);
1539 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1540 VariantClear(&v);
1542 l = 0xdeadbeef;
1543 hres = IHTMLStyle_get_pixelHeight(style, &l);
1544 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1545 ok(!l, "pixelHeight = %d\n", l);
1547 V_VT(&v) = VT_BSTR;
1548 V_BSTR(&v) = NULL;
1549 hres = IHTMLStyle_put_height(style, v);
1550 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1551 VariantClear(&v);
1553 V_VT(&v) = VT_EMPTY;
1554 hres = IHTMLStyle_get_height(style, &v);
1555 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1556 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1557 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1558 VariantClear(&v);
1560 l = 0xdeadbeef;
1561 hres = IHTMLStyle_get_pixelHeight(style, &l);
1562 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1563 ok(!l, "pixelHeight = %d\n", l);
1565 hres = IHTMLStyle_put_pixelHeight(style, 50);
1566 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
1568 l = 0xdeadbeef;
1569 hres = IHTMLStyle_get_pixelHeight(style, &l);
1570 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1571 ok(l == 50, "pixelHeight = %d\n", l);
1573 hres = IHTMLStyle_get_pixelHeight(style, NULL);
1574 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
1576 V_VT(&v) = VT_I4;
1577 V_I4(&v) = 64;
1578 hres = IHTMLStyle_put_height(style, v);
1579 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1581 V_VT(&v) = VT_EMPTY;
1582 hres = IHTMLStyle_get_height(style, &v);
1583 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1584 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1585 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "64px" : "50px"),
1586 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1587 VariantClear(&v);
1589 hres = IHTMLStyle_get_posHeight(style, &f);
1590 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1591 ok(f == (compat_mode < COMPAT_IE9 ? 64.0 : 50), "expected 64.0 got %f\n", f);
1593 l = 0xdeadbeef;
1594 hres = IHTMLStyle_get_pixelHeight(style, &l);
1595 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1596 ok(l == (compat_mode < COMPAT_IE9 ? 64 : 50), "pixelHeight = %d\n", l);
1598 str = (void*)0xdeadbeef;
1599 hres = IHTMLStyle_get_cursor(style, &str);
1600 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1601 ok(!str, "get_cursor != NULL\n");
1602 SysFreeString(str);
1604 str = a2bstr("default");
1605 hres = IHTMLStyle_put_cursor(style, str);
1606 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1607 SysFreeString(str);
1609 str = NULL;
1610 hres = IHTMLStyle_get_cursor(style, &str);
1611 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1612 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1613 SysFreeString(str);
1615 V_VT(&v) = VT_EMPTY;
1616 hres = IHTMLStyle_get_verticalAlign(style, &v);
1617 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1618 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1619 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1620 VariantClear(&v);
1622 V_VT(&v) = VT_BSTR;
1623 V_BSTR(&v) = a2bstr("middle");
1624 hres = IHTMLStyle_put_verticalAlign(style, v);
1625 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1626 VariantClear(&v);
1628 V_VT(&v) = VT_EMPTY;
1629 hres = IHTMLStyle_get_verticalAlign(style, &v);
1630 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1631 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1632 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1633 VariantClear(&v);
1635 V_VT(&v) = VT_I4;
1636 V_I4(&v) = 100;
1637 hres = IHTMLStyle_put_verticalAlign(style, v);
1638 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1639 VariantClear(&v);
1641 V_VT(&v) = VT_EMPTY;
1642 hres = IHTMLStyle_get_verticalAlign(style, &v);
1643 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1644 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1645 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "100px" : "middle"),
1646 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1647 VariantClear(&v);
1649 str = (void*)0xdeadbeef;
1650 hres = IHTMLStyle_get_textAlign(style, &str);
1651 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1652 ok(!str, "textAlign != NULL\n");
1654 str = a2bstr("center");
1655 hres = IHTMLStyle_put_textAlign(style, str);
1656 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1657 SysFreeString(str);
1659 str = NULL;
1660 hres = IHTMLStyle_get_textAlign(style, &str);
1661 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1662 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1663 SysFreeString(str);
1665 V_VT(&v) = VT_NULL;
1666 hres = IHTMLStyle_get_textIndent(style, &v);
1667 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1668 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1669 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1671 V_VT(&v) = VT_I4;
1672 V_I4(&v) = 6;
1673 hres = IHTMLStyle_put_textIndent(style, v);
1674 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1676 V_VT(&v) = VT_NULL;
1677 hres = IHTMLStyle_get_textIndent(style, &v);
1678 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1679 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1680 if(compat_mode < COMPAT_IE9)
1681 ok(!strcmp_wa(V_BSTR(&v), "6px"), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1682 else
1683 ok(!V_BSTR(&v), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1685 str = (void*)0xdeadbeef;
1686 hres = IHTMLStyle_get_textTransform(style, &str);
1687 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1688 ok(!str, "textTransform != NULL\n");
1690 str = a2bstr("lowercase");
1691 hres = IHTMLStyle_put_textTransform(style, str);
1692 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1693 SysFreeString(str);
1695 str = NULL;
1696 hres = IHTMLStyle_get_textTransform(style, &str);
1697 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1698 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1699 SysFreeString(str);
1701 str = (void*)0xdeadbeef;
1702 hres = IHTMLStyle_get_filter(style, &str);
1703 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1704 ok(!str, "filter != NULL\n");
1706 str = a2bstr("alpha(opacity=100)");
1707 hres = IHTMLStyle_put_filter(style, str);
1708 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1709 SysFreeString(str);
1711 V_VT(&v) = VT_EMPTY;
1712 hres = IHTMLStyle_get_zIndex(style, &v);
1713 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1714 if(compat_mode < COMPAT_IE9) {
1715 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1716 ok(!V_I4(&v), "V_I4(v) != 0\n");
1717 }else {
1718 todo_wine
1719 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1720 if(V_VT(&v) == VT_BSTR) todo_wine
1721 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1723 VariantClear(&v);
1725 V_VT(&v) = VT_BSTR;
1726 V_BSTR(&v) = a2bstr("1");
1727 hres = IHTMLStyle_put_zIndex(style, v);
1728 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1729 VariantClear(&v);
1731 V_VT(&v) = VT_EMPTY;
1732 hres = IHTMLStyle_get_zIndex(style, &v);
1733 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1734 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1735 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1736 VariantClear(&v);
1738 /* fontStyle */
1739 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1740 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1742 str = a2bstr("test");
1743 hres = IHTMLStyle_put_fontStyle(style, str);
1744 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1745 "put_fontStyle failed: %08x\n", hres);
1746 SysFreeString(str);
1748 str = a2bstr("italic");
1749 hres = IHTMLStyle_put_fontStyle(style, str);
1750 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1751 SysFreeString(str);
1753 str = a2bstr("oblique");
1754 hres = IHTMLStyle_put_fontStyle(style, str);
1755 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1756 SysFreeString(str);
1758 str = a2bstr("normal");
1759 hres = IHTMLStyle_put_fontStyle(style, str);
1760 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1761 SysFreeString(str);
1763 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1764 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1765 SysFreeString(sDefault);
1767 /* overflow */
1768 hres = IHTMLStyle_get_overflow(style, NULL);
1769 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1771 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1772 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1774 str = a2bstr("test");
1775 hres = IHTMLStyle_put_overflow(style, str);
1776 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1777 "put_overflow failed: %08x\n", hres);
1778 SysFreeString(str);
1780 str = a2bstr("visible");
1781 hres = IHTMLStyle_put_overflow(style, str);
1782 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1783 SysFreeString(str);
1785 str = a2bstr("scroll");
1786 hres = IHTMLStyle_put_overflow(style, str);
1787 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1788 SysFreeString(str);
1790 str = a2bstr("hidden");
1791 hres = IHTMLStyle_put_overflow(style, str);
1792 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1793 SysFreeString(str);
1795 str = a2bstr("auto");
1796 hres = IHTMLStyle_put_overflow(style, str);
1797 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1798 SysFreeString(str);
1800 hres = IHTMLStyle_get_overflow(style, &str);
1801 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1802 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1803 SysFreeString(str);
1805 str = a2bstr("");
1806 hres = IHTMLStyle_put_overflow(style, str);
1807 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1808 SysFreeString(str);
1810 hres = IHTMLStyle_get_overflow(style, &str);
1811 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1812 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1813 SysFreeString(str);
1815 /* restore overflow default */
1816 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1817 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1818 SysFreeString(sOverflowDefault);
1820 /* Attribute Tests*/
1821 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1822 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1824 str = a2bstr("position");
1825 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1826 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1828 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1829 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1830 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1831 VariantClear(&v);
1833 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1834 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1836 V_VT(&v) = VT_BSTR;
1837 V_BSTR(&v) = a2bstr("absolute");
1838 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1839 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1840 VariantClear(&v);
1842 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1843 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1844 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1845 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1846 VariantClear(&v);
1848 V_VT(&v) = VT_BSTR;
1849 V_BSTR(&v) = NULL;
1850 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1851 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1852 VariantClear(&v);
1854 SysFreeString(str);
1856 str = a2bstr("borderLeftStyle");
1857 test_border_styles(style, str);
1858 SysFreeString(str);
1860 str = a2bstr("borderbottomstyle");
1861 test_border_styles(style, str);
1862 SysFreeString(str);
1864 str = a2bstr("borderrightstyle");
1865 test_border_styles(style, str);
1866 SysFreeString(str);
1868 str = a2bstr("bordertopstyle");
1869 test_border_styles(style, str);
1870 SysFreeString(str);
1872 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1873 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1875 str = a2bstr("none dotted dashed solid");
1876 hres = IHTMLStyle_put_borderStyle(style, str);
1877 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1878 SysFreeString(str);
1880 str = a2bstr("none dotted dashed solid");
1881 hres = IHTMLStyle_get_borderStyle(style, &str);
1882 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1883 ok(!strcmp_wa(str, "none dotted dashed solid"),
1884 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1885 SysFreeString(str);
1887 str = a2bstr("double groove ridge inset");
1888 hres = IHTMLStyle_put_borderStyle(style, str);
1889 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1890 SysFreeString(str);
1892 str = a2bstr("window-inset outset ridge inset");
1893 hres = IHTMLStyle_put_borderStyle(style, str);
1894 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1895 SysFreeString(str);
1897 str = a2bstr("window-inset");
1898 hres = IHTMLStyle_put_borderStyle(style, str);
1899 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1900 SysFreeString(str);
1902 str = a2bstr("none none none none none");
1903 hres = IHTMLStyle_put_borderStyle(style, str);
1904 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1905 SysFreeString(str);
1907 str = a2bstr("invalid none none none");
1908 hres = IHTMLStyle_put_borderStyle(style, str);
1909 todo_wine_if(compat_mode >= COMPAT_IE9)
1910 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1911 "put_borderStyle failed: %08x\n", hres);
1912 SysFreeString(str);
1914 str = a2bstr("none invalid none none");
1915 hres = IHTMLStyle_put_borderStyle(style, str);
1916 todo_wine_if(compat_mode >= COMPAT_IE9)
1917 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1918 "put_borderStyle failed: %08x\n", hres);
1919 SysFreeString(str);
1921 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1922 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1923 SysFreeString(sDefault);
1925 /* backgroundColor */
1926 hres = IHTMLStyle_get_backgroundColor(style, &v);
1927 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1928 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1929 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1930 VariantClear(&v);
1932 V_VT(&v) = VT_BSTR;
1933 V_BSTR(&v) = a2bstr("red");
1934 hres = IHTMLStyle_put_backgroundColor(style, v);
1935 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1936 VariantClear(&v);
1938 hres = IHTMLStyle_get_backgroundColor(style, &v);
1939 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1940 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1941 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1942 VariantClear(&v);
1944 str = a2bstr("fixed");
1945 hres = IHTMLStyle_put_backgroundAttachment(style, str);
1946 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
1947 SysFreeString(str);
1949 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
1950 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
1951 ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str));
1952 SysFreeString(str);
1954 /* padding */
1955 hres = IHTMLStyle_get_padding(style, &str);
1956 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1957 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1958 SysFreeString(str);
1960 hres = IHTMLStyle_get_paddingTop(style, &v);
1961 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1962 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1963 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1965 V_VT(&v) = VT_I4;
1966 V_I4(&v) = 6;
1967 hres = IHTMLStyle_put_paddingTop(style, v);
1968 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1970 hres = IHTMLStyle_get_paddingTop(style, &v);
1971 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1972 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1973 if(compat_mode < COMPAT_IE9)
1974 ok(!strcmp_wa(V_BSTR(&v), "6px"), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1975 else
1976 ok(!V_BSTR(&v), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1977 VariantClear(&v);
1979 hres = IHTMLStyle_get_paddingRight(style, &v);
1980 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1981 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1982 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1984 V_VT(&v) = VT_I4;
1985 V_I4(&v) = 6;
1986 hres = IHTMLStyle_put_paddingRight(style, v);
1987 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1989 hres = IHTMLStyle_get_paddingRight(style, &v);
1990 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1991 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1992 if(compat_mode < COMPAT_IE9)
1993 ok(!strcmp_wa(V_BSTR(&v), "6px"), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1994 else
1995 ok(!V_BSTR(&v), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1996 VariantClear(&v);
1998 hres = IHTMLStyle_get_paddingBottom(style, &v);
1999 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2000 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2001 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2003 V_VT(&v) = VT_I4;
2004 V_I4(&v) = 6;
2005 hres = IHTMLStyle_put_paddingBottom(style, v);
2006 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
2008 hres = IHTMLStyle_get_paddingBottom(style, &v);
2009 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2010 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2011 if(compat_mode < COMPAT_IE9)
2012 ok(!strcmp_wa(V_BSTR(&v), "6px"), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2013 else
2014 ok(!V_BSTR(&v), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2015 VariantClear(&v);
2017 str = a2bstr("1");
2018 hres = IHTMLStyle_put_padding(style, str);
2019 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
2020 SysFreeString(str);
2022 hres = IHTMLStyle_get_padding(style, &str);
2023 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2024 if(compat_mode < COMPAT_IE9)
2025 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
2026 else
2027 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2028 SysFreeString(str);
2030 /* PaddingLeft */
2031 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
2032 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2033 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
2034 if(compat_mode < COMPAT_IE9)
2035 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "paddingLeft = %s\n",
2036 wine_dbgstr_w(V_BSTR(&vDefault)));
2037 else
2038 ok(!V_BSTR(&vDefault), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
2040 V_VT(&v) = VT_BSTR;
2041 V_BSTR(&v) = a2bstr("10");
2042 hres = IHTMLStyle_put_paddingLeft(style, v);
2043 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2044 VariantClear(&v);
2046 hres = IHTMLStyle_get_paddingLeft(style, &v);
2047 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2048 if(compat_mode < COMPAT_IE9)
2049 ok(!strcmp_wa(V_BSTR(&v), "10px"), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2050 else
2051 ok(!V_BSTR(&v), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2052 VariantClear(&v);
2054 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
2055 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2057 /* BackgroundRepeat */
2058 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
2059 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2061 str = a2bstr("invalid");
2062 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2063 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2064 "put_backgroundRepeat failed: %08x\n", hres);
2065 SysFreeString(str);
2067 str = a2bstr("repeat");
2068 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2069 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2070 SysFreeString(str);
2072 str = a2bstr("no-repeat");
2073 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2074 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2075 SysFreeString(str);
2077 str = a2bstr("repeat-x");
2078 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2079 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2080 SysFreeString(str);
2082 str = a2bstr("repeat-y");
2083 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2084 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2085 SysFreeString(str);
2087 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
2088 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2089 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
2090 SysFreeString(str);
2092 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
2093 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2094 SysFreeString(sDefault);
2096 /* BorderColor */
2097 hres = IHTMLStyle_get_borderColor(style, &sDefault);
2098 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2100 str = a2bstr("red green red blue");
2101 hres = IHTMLStyle_put_borderColor(style, str);
2102 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2103 SysFreeString(str);
2105 hres = IHTMLStyle_get_borderColor(style, &str);
2106 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2107 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
2108 SysFreeString(str);
2110 hres = IHTMLStyle_put_borderColor(style, sDefault);
2111 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2112 SysFreeString(sDefault);
2114 /* BorderRight */
2115 hres = IHTMLStyle_get_borderRight(style, &sDefault);
2116 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
2118 str = a2bstr("thick dotted red");
2119 hres = IHTMLStyle_put_borderRight(style, str);
2120 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2121 SysFreeString(str);
2123 /* IHTMLStyle_get_borderRight appears to have a bug where
2124 it returns the first letter of the color. So we check
2125 each style individually.
2127 V_BSTR(&v) = NULL;
2128 hres = IHTMLStyle_get_borderRightColor(style, &v);
2129 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2130 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2131 VariantClear(&v);
2133 V_BSTR(&v) = NULL;
2134 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2135 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2136 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2137 VariantClear(&v);
2139 hres = IHTMLStyle_get_borderRightStyle(style, &str);
2140 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2141 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2142 SysFreeString(str);
2144 hres = IHTMLStyle_put_borderRight(style, sDefault);
2145 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2146 SysFreeString(sDefault);
2148 /* BorderTop */
2149 hres = IHTMLStyle_get_borderTop(style, &sDefault);
2150 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
2152 str = a2bstr("thick dotted red");
2153 hres = IHTMLStyle_put_borderTop(style, str);
2154 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2155 SysFreeString(str);
2157 /* IHTMLStyle_get_borderTop appears to have a bug where
2158 it returns the first letter of the color. So we check
2159 each style individually.
2161 V_BSTR(&v) = NULL;
2162 hres = IHTMLStyle_get_borderTopColor(style, &v);
2163 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2164 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2165 VariantClear(&v);
2167 V_BSTR(&v) = NULL;
2168 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2169 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2170 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2171 VariantClear(&v);
2173 hres = IHTMLStyle_get_borderTopStyle(style, &str);
2174 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2175 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2176 SysFreeString(str);
2178 hres = IHTMLStyle_put_borderTop(style, sDefault);
2179 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2180 SysFreeString(sDefault);
2182 /* BorderBottom */
2183 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2184 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2186 str = a2bstr("thick dotted red");
2187 hres = IHTMLStyle_put_borderBottom(style, str);
2188 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2189 SysFreeString(str);
2191 /* IHTMLStyle_get_borderBottom appears to have a bug where
2192 it returns the first letter of the color. So we check
2193 each style individually.
2195 V_BSTR(&v) = NULL;
2196 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2197 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2198 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2199 VariantClear(&v);
2201 V_BSTR(&v) = NULL;
2202 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2203 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2204 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2205 VariantClear(&v);
2207 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2208 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2209 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2210 SysFreeString(str);
2212 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2213 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2214 SysFreeString(sDefault);
2216 /* BorderLeft */
2217 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2218 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2220 str = a2bstr("thick dotted red");
2221 hres = IHTMLStyle_put_borderLeft(style, str);
2222 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2223 SysFreeString(str);
2225 /* IHTMLStyle_get_borderLeft appears to have a bug where
2226 it returns the first letter of the color. So we check
2227 each style individually.
2229 V_BSTR(&v) = NULL;
2230 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2231 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2232 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2233 VariantClear(&v);
2235 V_BSTR(&v) = NULL;
2236 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2237 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2238 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2239 VariantClear(&v);
2241 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2242 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2243 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2244 SysFreeString(str);
2246 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2247 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2248 SysFreeString(sDefault);
2250 /* backgroundPositionX */
2251 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2252 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2253 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2254 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2255 VariantClear(&v);
2257 V_VT(&v) = VT_BSTR;
2258 V_BSTR(&v) = a2bstr("10px");
2259 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2260 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2261 VariantClear(&v);
2263 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2264 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2265 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2266 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2267 VariantClear(&v);
2269 /* backgroundPositionY */
2270 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2271 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2272 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2273 VariantClear(&v);
2275 V_VT(&v) = VT_BSTR;
2276 V_BSTR(&v) = a2bstr("15px");
2277 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2278 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2279 VariantClear(&v);
2281 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2282 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2283 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2284 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2285 VariantClear(&v);
2287 /* backgroundPosition */
2288 str = NULL;
2289 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2290 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2291 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2292 SysFreeString(str);
2294 str = a2bstr("center 20%");
2295 hres = IHTMLStyle_put_backgroundPosition(style, str);
2296 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2297 SysFreeString(str);
2299 str = NULL;
2300 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2301 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2302 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2303 SysFreeString(str);
2305 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2306 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2307 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2308 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2309 VariantClear(&v);
2311 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2312 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2313 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2314 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2315 VariantClear(&v);
2317 /* borderTopWidth */
2318 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2319 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2321 V_VT(&v) = VT_BSTR;
2322 V_BSTR(&v) = a2bstr("10px");
2323 hres = IHTMLStyle_put_borderTopWidth(style, v);
2324 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2325 VariantClear(&v);
2327 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2328 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2329 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2330 VariantClear(&v);
2332 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2333 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2334 VariantClear(&vDefault);
2336 /* borderRightWidth */
2337 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2338 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2340 V_VT(&v) = VT_BSTR;
2341 V_BSTR(&v) = a2bstr("10");
2342 hres = IHTMLStyle_put_borderRightWidth(style, v);
2343 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2344 VariantClear(&v);
2346 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2347 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2348 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "10px" : "1px"),
2349 "borderRightWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2350 VariantClear(&v);
2352 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2353 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2354 VariantClear(&vDefault);
2356 /* borderBottomWidth */
2357 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2358 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2360 V_VT(&v) = VT_BSTR;
2361 V_BSTR(&v) = a2bstr("10");
2362 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2363 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2364 VariantClear(&v);
2366 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2367 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2368 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "10px" : "1px"),
2369 "borderBottomWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2370 VariantClear(&v);
2372 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2373 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2374 VariantClear(&vDefault);
2376 /* borderLeftWidth */
2377 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2378 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2380 V_VT(&v) = VT_BSTR;
2381 V_BSTR(&v) = a2bstr("10");
2382 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2383 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2384 VariantClear(&v);
2386 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2387 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2388 ok(!strcmp_wa(V_BSTR(&v), compat_mode < COMPAT_IE9 ? "10px" : "1px"),
2389 "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2390 VariantClear(&v);
2392 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2393 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2394 VariantClear(&vDefault);
2396 /* wordSpacing */
2397 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2398 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2400 V_VT(&v) = VT_BSTR;
2401 V_BSTR(&v) = a2bstr("10");
2402 hres = IHTMLStyle_put_wordSpacing(style, v);
2403 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2404 VariantClear(&v);
2406 hres = IHTMLStyle_get_wordSpacing(style, &v);
2407 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2408 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2409 if(compat_mode < COMPAT_IE9)
2410 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2411 else
2412 ok(!V_BSTR(&v), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2413 VariantClear(&v);
2415 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2416 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2417 VariantClear(&vDefault);
2419 /* letterSpacing */
2420 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2421 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2423 V_VT(&v) = VT_BSTR;
2424 V_BSTR(&v) = a2bstr("11");
2425 hres = IHTMLStyle_put_letterSpacing(style, v);
2426 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2427 VariantClear(&v);
2429 hres = IHTMLStyle_get_letterSpacing(style, &v);
2430 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2431 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2432 if(compat_mode < COMPAT_IE9)
2433 ok(!strcmp_wa(V_BSTR(&v), "11px"), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2434 else
2435 ok(!V_BSTR(&v), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2436 VariantClear(&v);
2438 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2439 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2440 VariantClear(&vDefault);
2442 /* borderTopColor */
2443 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2444 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2446 V_VT(&v) = VT_BSTR;
2447 V_BSTR(&v) = a2bstr("red");
2448 hres = IHTMLStyle_put_borderTopColor(style, v);
2449 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2450 VariantClear(&v);
2452 hres = IHTMLStyle_get_borderTopColor(style, &v);
2453 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2454 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2455 VariantClear(&v);
2457 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2458 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2460 /* borderRightColor */
2461 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2462 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2464 V_VT(&v) = VT_BSTR;
2465 V_BSTR(&v) = a2bstr("blue");
2466 hres = IHTMLStyle_put_borderRightColor(style, v);
2467 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2468 VariantClear(&v);
2470 hres = IHTMLStyle_get_borderRightColor(style, &v);
2471 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2472 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2473 VariantClear(&v);
2475 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2476 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2478 /* borderBottomColor */
2479 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2480 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2482 V_VT(&v) = VT_BSTR;
2483 V_BSTR(&v) = a2bstr("cyan");
2484 hres = IHTMLStyle_put_borderBottomColor(style, v);
2485 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2486 VariantClear(&v);
2488 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2489 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2490 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2491 VariantClear(&v);
2493 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2494 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2496 /* borderLeftColor */
2497 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2498 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2500 V_VT(&v) = VT_BSTR;
2501 V_BSTR(&v) = a2bstr("cyan");
2502 hres = IHTMLStyle_put_borderLeftColor(style, v);
2503 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2504 VariantClear(&v);
2506 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2507 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2508 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2509 VariantClear(&v);
2511 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2512 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2514 /* clip */
2515 hres = IHTMLStyle_get_clip(style, &str);
2516 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2517 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2519 str = a2bstr("rect(0px 1px 500px 505px)");
2520 hres = IHTMLStyle_put_clip(style, str);
2521 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2522 SysFreeString(str);
2524 hres = IHTMLStyle_get_clip(style, &str);
2525 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2526 ok(!strcmp_wa(str, compat_mode < COMPAT_IE9 ? "rect(0px 1px 500px 505px)" : "rect(0px, 1px, 500px, 505px)"),
2527 "clip = %s\n", wine_dbgstr_w(str));
2528 SysFreeString(str);
2530 /* clear */
2531 hres = IHTMLStyle_get_clear(style, &str);
2532 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2533 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2535 str = a2bstr("both");
2536 hres = IHTMLStyle_put_clear(style, str);
2537 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2538 SysFreeString(str);
2540 hres = IHTMLStyle_get_clear(style, &str);
2541 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2542 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2543 SysFreeString(str);
2545 /* pageBreakAfter */
2546 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2547 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2548 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2550 str = a2bstr("always");
2551 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2552 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2553 SysFreeString(str);
2555 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2556 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2557 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2558 SysFreeString(str);
2560 /* pageBreakBefore */
2561 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2562 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2563 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2565 str = a2bstr("always");
2566 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2567 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2568 SysFreeString(str);
2570 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2571 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2572 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2573 SysFreeString(str);
2575 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2576 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2578 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2579 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2580 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2582 str = (void*)0xdeadbeef;
2583 hres = IHTMLStyle_get_whiteSpace(style, &str);
2584 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2585 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2587 str = a2bstr("nowrap");
2588 hres = IHTMLStyle_put_whiteSpace(style, str);
2589 SysFreeString(str);
2590 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2592 str = NULL;
2593 hres = IHTMLStyle_get_whiteSpace(style, &str);
2594 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2595 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2596 SysFreeString(str);
2598 str = a2bstr("normal");
2599 hres = IHTMLStyle_put_whiteSpace(style, str);
2600 SysFreeString(str);
2601 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2603 str = NULL;
2604 hres = IHTMLStyle_get_whiteSpace(style, &str);
2605 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2606 ok(!strcmp_wa(str, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2607 SysFreeString(str);
2609 /* listStyleType */
2610 hres = IHTMLStyle_get_listStyleType(style, &str);
2611 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2612 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2614 str = a2bstr("square");
2615 hres = IHTMLStyle_put_listStyleType(style, str);
2616 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2617 SysFreeString(str);
2619 str = NULL;
2620 hres = IHTMLStyle_get_listStyleType(style, &str);
2621 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2622 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2624 str = a2bstr("inside");
2625 hres = IHTMLStyle_put_listStylePosition(style, str);
2626 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2627 SysFreeString(str);
2629 hres = IHTMLStyle_get_listStylePosition(style, &str);
2630 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2631 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2632 SysFreeString(str);
2634 str = a2bstr("decimal-leading-zero none inside");
2635 hres = IHTMLStyle_put_listStyle(style, str);
2636 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
2637 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
2638 SysFreeString(str);
2640 if (hres != E_INVALIDARG) {
2641 hres = IHTMLStyle_get_listStyle(style, &str);
2642 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
2643 ok(strstr_wa(str, "decimal-leading-zero") &&
2644 strstr_wa(str, "inside") != NULL,
2645 "listStyle = %s\n", wine_dbgstr_w(str));
2646 if(compat_mode < COMPAT_IE9)
2647 ok(strstr_wa(str, "none") != NULL, "listStyle = %s\n", wine_dbgstr_w(str));
2648 else
2649 todo_wine
2650 ok(!strstr_wa(str, "none"), "listStyle = %s\n", wine_dbgstr_w(str));
2652 SysFreeString(str);
2653 } else {
2654 win_skip("IHTMLStyle_put_listStyle already failed\n");
2657 str = (void*)0xdeadbeef;
2658 hres = IHTMLStyle_get_styleFloat(style, &str);
2659 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2660 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
2662 str = a2bstr("left");
2663 hres = IHTMLStyle_put_styleFloat(style, str);
2664 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
2665 SysFreeString(str);
2667 str = NULL;
2668 hres = IHTMLStyle_get_styleFloat(style, &str);
2669 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2670 ok(!strcmp_wa(str, "left"), "styleFloat = %s\n", wine_dbgstr_w(str));
2672 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2673 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2674 if(SUCCEEDED(hres)) {
2675 test_style2(style2);
2676 IHTMLStyle2_Release(style2);
2679 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2680 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2681 if(SUCCEEDED(hres)) {
2682 test_style3(style3);
2683 IHTMLStyle3_Release(style3);
2686 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2687 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2688 if(SUCCEEDED(hres)) {
2689 test_style4(style4);
2690 IHTMLStyle4_Release(style4);
2693 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
2694 if(SUCCEEDED(hres)) {
2695 test_style5(style5);
2696 IHTMLStyle5_Release(style5);
2697 }else {
2698 win_skip("IHTMLStyle5 not available\n");
2701 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2702 if(SUCCEEDED(hres)) {
2703 test_style6(style6);
2704 IHTMLStyle6_Release(style6);
2705 }else {
2706 win_skip("IHTMLStyle6 not available\n");
2710 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2711 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2713 BSTR str;
2714 HRESULT hres;
2716 str = (void*)0xdeadbeef;
2717 hres = IHTMLStyle_get_filter(style, &str);
2718 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2719 if(exval)
2720 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2721 else
2722 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2724 SysFreeString(str);
2727 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2728 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2730 BSTR str;
2731 HRESULT hres;
2733 str = (void*)0xdeadbeef;
2734 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2735 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2736 if(exval)
2737 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2738 else
2739 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2741 SysFreeString(str);
2744 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2745 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2747 BSTR str = a2bstr(val);
2748 HRESULT hres;
2750 hres = IHTMLStyle_put_filter(style, str);
2751 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2752 SysFreeString(str);
2754 _test_style_filter(line, style, val);
2757 static void test_style_filters(IHTMLElement *elem)
2759 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2760 IHTMLCurrentStyle2 *current_style2;
2761 IHTMLCurrentStyle *current_style;
2762 IHTMLStyle *style;
2763 HRESULT hres;
2765 hres = IHTMLElement_get_style(elem, &style);
2766 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2768 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2769 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2771 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2773 test_style_filter(style, NULL);
2774 test_current_style_filter(current_style2, NULL);
2775 set_style_filter(style, "alpha(opacity=50.0040)");
2776 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2777 set_style_filter(style, "alpha(opacity=100)");
2779 IHTMLStyle_Release(style);
2781 hres = IHTMLElement_get_style(elem, &style);
2782 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2784 test_style_filter(style, "alpha(opacity=100)");
2785 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2786 set_style_filter(style, NULL);
2787 set_style_filter(style, "alpha(opacity=100)");
2788 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2789 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2790 test_style_filter(style, NULL);
2793 IHTMLCurrentStyle2_Release(current_style2);
2794 IHTMLStyle_Release(style);
2795 IHTMLElement2_Release(elem2);
2798 static void test_current_style(IHTMLCurrentStyle *current_style)
2800 IHTMLCurrentStyle2 *current_style2;
2801 IHTMLCurrentStyle3 *current_style3;
2802 IHTMLCurrentStyle4 *current_style4;
2803 VARIANT_BOOL b;
2804 BSTR str;
2805 HRESULT hres;
2806 VARIANT v;
2808 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2809 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2810 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2811 SysFreeString(str);
2813 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2814 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2815 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2816 SysFreeString(str);
2818 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2819 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2820 SysFreeString(str);
2822 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2823 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2824 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2825 SysFreeString(str);
2827 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2828 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2829 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2830 SysFreeString(str);
2832 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2833 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2834 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2835 SysFreeString(str);
2837 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2838 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2839 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2840 SysFreeString(str);
2842 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2843 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2844 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2845 SysFreeString(str);
2847 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2848 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2849 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2850 SysFreeString(str);
2852 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2853 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2854 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2855 SysFreeString(str);
2857 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2858 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2859 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2860 SysFreeString(str);
2862 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2863 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2864 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2865 SysFreeString(str);
2867 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2868 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2869 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2870 SysFreeString(str);
2872 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2873 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2874 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2875 SysFreeString(str);
2877 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2878 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2879 SysFreeString(str);
2881 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2882 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2883 SysFreeString(str);
2885 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2886 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2887 SysFreeString(str);
2889 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2890 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2891 SysFreeString(str);
2893 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2894 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2895 SysFreeString(str);
2897 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2898 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2899 SysFreeString(str);
2901 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2902 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2903 SysFreeString(str);
2905 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2906 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2907 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2908 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2909 VariantClear(&v);
2911 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2912 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2913 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2914 VariantClear(&v);
2916 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2917 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2918 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2919 VariantClear(&v);
2921 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2922 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2923 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2924 VariantClear(&v);
2926 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2927 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2928 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2929 VariantClear(&v);
2931 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2932 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2933 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2934 VariantClear(&v);
2936 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2937 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2938 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2939 VariantClear(&v);
2941 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2942 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2943 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2944 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2945 VariantClear(&v);
2947 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2948 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2949 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? "100px" : "middle");
2950 VariantClear(&v);
2952 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2953 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2954 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2955 VariantClear(&v);
2957 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2958 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2959 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2960 VariantClear(&v);
2962 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2963 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2964 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2965 VariantClear(&v);
2967 V_BSTR(&v) = NULL;
2968 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2969 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2970 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2971 VariantClear(&v);
2973 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2974 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2975 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2976 VariantClear(&v);
2978 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2979 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2980 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2981 VariantClear(&v);
2983 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2984 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2985 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2986 VariantClear(&v);
2988 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2989 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2990 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2991 VariantClear(&v);
2993 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2994 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2995 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2996 VariantClear(&v);
2998 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2999 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
3000 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3001 VariantClear(&v);
3003 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
3004 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
3005 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3006 VariantClear(&v);
3008 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
3009 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
3010 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3011 VariantClear(&v);
3013 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
3014 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
3015 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3016 VariantClear(&v);
3018 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
3019 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
3020 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3021 VariantClear(&v);
3023 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
3024 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
3025 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3026 VariantClear(&v);
3028 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
3029 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
3030 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3031 VariantClear(&v);
3033 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
3034 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
3035 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3036 VariantClear(&v);
3038 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
3039 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
3040 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3041 VariantClear(&v);
3043 hres = IHTMLCurrentStyle_get_right(current_style, &v);
3044 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
3045 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3046 VariantClear(&v);
3048 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
3049 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
3050 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3051 VariantClear(&v);
3053 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
3054 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
3055 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3056 VariantClear(&v);
3058 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
3059 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
3060 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3061 VariantClear(&v);
3063 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
3064 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
3065 SysFreeString(str);
3067 hres = IHTMLCurrentStyle_get_styleFloat(current_style, &str);
3068 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3069 ok(!strcmp_wa(str, "none"), "styleFloat = %s\n", wine_dbgstr_w(str));
3070 SysFreeString(str);
3072 hres = IHTMLCurrentStyle_get_overflowX(current_style, &str);
3073 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
3074 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
3075 SysFreeString(str);
3077 hres = IHTMLCurrentStyle_get_overflowY(current_style, &str);
3078 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
3079 ok(!strcmp_wa(str, "hidden"), "overflowY = %s\n", wine_dbgstr_w(str));
3080 SysFreeString(str);
3082 hres = IHTMLCurrentStyle_get_direction(current_style, &str);
3083 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
3084 ok(!strcmp_wa(str, "ltr"), "direction = %s\n", wine_dbgstr_w(str));
3085 SysFreeString(str);
3087 current_style2 = get_current_style2_iface((IUnknown*)current_style);
3089 b = 100;
3090 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
3091 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
3092 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
3094 IHTMLCurrentStyle2_Release(current_style2);
3096 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle3, (void**)&current_style3);
3097 ok(hres == S_OK, "Could not get IHTMLCurrentStyle3 iface: %08x\n", hres);
3099 hres = IHTMLCurrentStyle3_get_whiteSpace(current_style3, &str);
3100 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3101 ok(!strcmp_wa(str, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3102 SysFreeString(str);
3104 IHTMLCurrentStyle3_Release(current_style3);
3106 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle4, (void**)&current_style4);
3107 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "Could not get IHTMLCurrentStyle4 iface: %08x\n", hres);
3108 if(SUCCEEDED(hres)) {
3109 hres = IHTMLCurrentStyle4_get_minWidth(current_style4, &v);
3110 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
3111 ok(V_VT(&v) == VT_BSTR, "V_VT(minWidth) = %d\n", V_VT(&v));
3112 VariantClear(&v);
3114 IHTMLCurrentStyle4_Release(current_style4);
3115 }else {
3116 win_skip("IHTMLCurrentStyle4 not supported.\n");
3120 static void basic_style_test(IHTMLDocument2 *doc)
3122 IHTMLCurrentStyle *cstyle;
3123 IHTMLElement *elem;
3124 IHTMLStyle *style;
3125 HRESULT hres;
3127 hres = IHTMLDocument2_get_body(doc, &elem);
3128 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3130 elem_set_innerhtml(elem, "<div id=\"divid\"></div>");
3132 hres = IHTMLElement_get_style(elem, &style);
3133 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3135 test_body_style(style);
3137 cstyle = get_current_style(elem);
3138 test_current_style(cstyle);
3139 IHTMLCurrentStyle_Release(cstyle);
3140 IHTMLElement_Release(elem);
3142 elem = get_element_by_id(doc, "divid");
3143 test_style_filters(elem);
3145 test_set_csstext(style);
3146 IHTMLStyle_Release(style);
3147 IHTMLElement_Release(elem);
3150 static const char runtimestyle_test_str[] =
3151 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
3153 static const char runtimestyle_ie9_test_str[] =
3154 "<!DOCTYPE html>\n"
3155 "<html>"
3156 " <head>"
3157 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
3158 " <style>body {text-decoration: auto}</style>"
3159 " </head>"
3160 " <body>"
3161 " </body>"
3162 "</html>";
3164 static void runtimestyle_test(IHTMLDocument2 *doc)
3166 IHTMLStyle *style, *runtime_style;
3167 IHTMLElement2 *elem2;
3168 IHTMLElement *elem;
3169 BSTR str;
3170 HRESULT hres;
3172 hres = IHTMLDocument2_get_body(doc, &elem);
3173 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3175 elem2 = get_elem2_iface((IUnknown*)elem);
3177 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
3178 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
3180 hres = IHTMLElement_get_style(elem, &style);
3181 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3183 test_text_decoration(style, NULL);
3184 test_text_decoration(runtime_style, NULL);
3185 set_text_decoration(style, "underline");
3186 test_text_decoration(style, "underline");
3188 hres = IHTMLStyle_get_textDecoration(style, &str);
3189 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3190 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3191 SysFreeString(str);
3193 set_text_decoration(runtime_style, "blink");
3194 test_text_decoration(runtime_style, "blink");
3196 hres = IHTMLStyle_get_textDecoration(style, &str);
3197 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3198 todo_wine
3199 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3200 SysFreeString(str);
3202 IHTMLStyle_Release(runtime_style);
3203 IHTMLStyle_Release(style);
3204 IHTMLElement2_Release(elem2);
3205 IHTMLElement_Release(elem);
3208 static IHTMLDocument2 *notif_doc;
3209 static BOOL doc_complete;
3211 static IHTMLDocument2 *create_document(void)
3213 IHTMLDocument2 *doc;
3214 IHTMLDocument5 *doc5;
3215 HRESULT hres;
3217 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3218 &IID_IHTMLDocument2, (void**)&doc);
3219 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3220 if(FAILED(hres))
3221 return NULL;
3223 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
3224 if(FAILED(hres)) {
3225 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3226 IHTMLDocument2_Release(doc);
3227 return NULL;
3230 IHTMLDocument5_Release(doc5);
3231 return doc;
3234 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
3235 REFIID riid, void**ppv)
3237 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3238 *ppv = iface;
3239 return S_OK;
3242 ok(0, "unexpected call\n");
3243 return E_NOINTERFACE;
3246 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
3248 return 2;
3251 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
3253 return 1;
3256 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
3258 if(dispID == DISPID_READYSTATE){
3259 BSTR state;
3260 HRESULT hres;
3262 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3263 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3265 if(!strcmp_wa(state, "complete"))
3266 doc_complete = TRUE;
3268 SysFreeString(state);
3271 return S_OK;
3274 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
3276 ok(0, "unexpected call\n");
3277 return E_NOTIMPL;
3280 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3281 PropertyNotifySink_QueryInterface,
3282 PropertyNotifySink_AddRef,
3283 PropertyNotifySink_Release,
3284 PropertyNotifySink_OnChanged,
3285 PropertyNotifySink_OnRequestEdit
3288 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
3290 static IHTMLDocument2 *create_doc_with_string(const char *str)
3292 IPersistStreamInit *init;
3293 IStream *stream;
3294 IHTMLDocument2 *doc;
3295 HRESULT hres;
3296 HGLOBAL mem;
3297 SIZE_T len;
3299 notif_doc = doc = create_document();
3300 if(!doc)
3301 return NULL;
3303 doc_complete = FALSE;
3304 len = strlen(str);
3305 mem = GlobalAlloc(0, len);
3306 memcpy(mem, str, len);
3307 hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
3308 ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
3310 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3311 ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
3313 IPersistStreamInit_Load(init, stream);
3314 IPersistStreamInit_Release(init);
3315 IStream_Release(stream);
3317 return doc;
3320 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3322 IConnectionPointContainer *container;
3323 IConnectionPoint *cp;
3324 DWORD cookie;
3325 HRESULT hres;
3327 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3328 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3330 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3331 IConnectionPointContainer_Release(container);
3332 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3334 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3335 IConnectionPoint_Release(cp);
3336 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3339 typedef void (*style_test_t)(IHTMLDocument2*);
3341 static void run_test(const char *str, style_test_t test)
3343 IHTMLDocument2 *doc;
3344 ULONG ref;
3345 MSG msg;
3347 doc = create_doc_with_string(str);
3348 if(!doc)
3349 return;
3351 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
3353 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3354 TranslateMessage(&msg);
3355 DispatchMessageW(&msg);
3358 test(doc);
3360 ref = IHTMLDocument2_Release(doc);
3361 ok(!ref || broken(ref == 1), /* Vista */
3362 "ref = %d\n", ref);
3365 static BOOL check_ie(void)
3367 IHTMLDocument2 *doc;
3368 IHTMLDocument7 *doc7;
3369 HRESULT hres;
3371 doc = create_document();
3372 if(!doc)
3373 return FALSE;
3375 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
3376 if(SUCCEEDED(hres)) {
3377 is_ie9plus = TRUE;
3378 IHTMLDocument7_Release(doc7);
3381 trace("is_ie9plus %x\n", is_ie9plus);
3383 IHTMLDocument2_Release(doc);
3384 return TRUE;
3387 START_TEST(style)
3389 CoInitialize(NULL);
3391 if(check_ie()) {
3392 trace("Running tests in quirks mode...\n");
3393 run_test(doc_blank, basic_style_test);
3394 run_test(runtimestyle_test_str, runtimestyle_test);
3395 if(is_ie9plus) {
3396 trace("Running tests in IE9 mode...\n");
3397 compat_mode = COMPAT_IE9;
3398 run_test(doc_blank_ie9, basic_style_test);
3399 run_test(runtimestyle_ie9_test_str, runtimestyle_test);
3403 CoUninitialize();