wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / mshtml / tests / style.c
blob255dc7f79000fb4529bbf27e875876227d5c6013
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 <stdarg.h>
23 #include <stdio.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "ole2.h"
28 #include "mshtml.h"
29 #include "mshtmhst.h"
30 #include "docobj.h"
31 #include "wine/test.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 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
54 static void _test_var_bstr(unsigned line, const VARIANT *v, const WCHAR *expect)
56 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
57 if(expect)
58 ok_(__FILE__,line)(!lstrcmpW(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), wine_dbgstr_w(expect));
59 else
60 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
63 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
64 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
66 IHTMLElement2 *elem;
67 HRESULT hres;
69 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
70 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
71 return elem;
74 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
75 static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
77 IHTMLCurrentStyle2 *current_style2;
78 HRESULT hres;
80 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
81 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
82 return current_style2;
85 #define elem_set_innerhtml(e,t) _elem_set_innerhtml(__LINE__,e,t)
86 static void _elem_set_innerhtml(unsigned line, IHTMLElement *elem, const WCHAR *inner_html)
88 BSTR html;
89 HRESULT hres;
91 html = SysAllocString(inner_html);
92 hres = IHTMLElement_put_innerHTML(elem, html);
93 ok_(__FILE__,line)(hres == S_OK, "put_innerHTML failed: %08x\n", hres);
94 SysFreeString(html);
97 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const WCHAR *id)
99 HRESULT hres;
100 IHTMLDocument3 *doc3;
101 IHTMLElement *result;
102 BSTR str;
104 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
105 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
107 str = SysAllocString(id);
108 hres = IHTMLDocument3_getElementById(doc3, str, &result);
109 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
110 ok(result != NULL, "result == NULL\n");
111 SysFreeString(str);
113 IHTMLDocument3_Release(doc3);
114 return result;
117 #define get_current_style(e) _get_current_style(__LINE__,e)
118 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
120 IHTMLCurrentStyle *cstyle;
121 IHTMLElement2 *elem2;
122 HRESULT hres;
124 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
125 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
127 cstyle = NULL;
128 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
129 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
130 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
132 IHTMLElement2_Release(elem2);
133 return cstyle;
136 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
137 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
139 HRESULT hres;
140 DISPID dispid;
142 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
143 LOCALE_USER_DEFAULT, &dispid);
144 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
145 if(hres == S_OK)
147 DISPPARAMS params = {NULL,NULL,0,0};
148 DISPID dispidNamed = DISPID_PROPERTYPUT;
149 VARIANT ret;
150 VARIANT vDefault;
151 VARIANTARG arg;
153 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
154 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
155 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
157 params.cArgs = 1;
158 params.cNamedArgs = 1;
159 params.rgdispidNamedArgs = &dispidNamed;
160 V_VT(&arg) = VT_BSTR;
161 V_BSTR(&arg) = SysAllocString(L"none");
162 params.rgvarg = &arg;
163 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
164 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
165 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
166 VariantClear(&arg);
168 V_VT(&arg) = VT_BSTR;
169 V_BSTR(&arg) = SysAllocString(L"dotted");
170 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
171 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
172 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
173 VariantClear(&arg);
175 V_VT(&arg) = VT_BSTR;
176 V_BSTR(&arg) = SysAllocString(L"dashed");
177 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
178 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
179 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
180 VariantClear(&arg);
182 V_VT(&arg) = VT_BSTR;
183 V_BSTR(&arg) = SysAllocString(L"solid");
184 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
185 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
186 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
187 VariantClear(&arg);
189 V_VT(&arg) = VT_BSTR;
190 V_BSTR(&arg) = SysAllocString(L"double");
191 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
192 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
193 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
194 VariantClear(&arg);
196 V_VT(&arg) = VT_BSTR;
197 V_BSTR(&arg) = SysAllocString(L"groove");
198 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
199 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
200 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
201 VariantClear(&arg);
203 V_VT(&arg) = VT_BSTR;
204 V_BSTR(&arg) = SysAllocString(L"ridge");
205 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
206 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
207 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
208 VariantClear(&arg);
210 V_VT(&arg) = VT_BSTR;
211 V_BSTR(&arg) = SysAllocString(L"inset");
212 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
213 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
214 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
215 VariantClear(&arg);
217 V_VT(&arg) = VT_BSTR;
218 V_BSTR(&arg) = SysAllocString(L"outset");
219 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
220 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
221 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
222 VariantClear(&arg);
224 V_VT(&arg) = VT_BSTR;
225 V_BSTR(&arg) = SysAllocString(L"invalid");
226 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
227 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
228 if(compat_mode < COMPAT_IE9)
229 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
230 else
231 ok_(__FILE__,line) (hres == S_OK, "invalid value returned: %08x\n", hres);
232 VariantClear(&arg);
234 params.rgvarg = &vDefault;
235 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
236 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
237 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
238 VariantClear(&vDefault);
242 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
243 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const WCHAR *extext)
245 BSTR text = (void*)0xdeadbeef;
246 HRESULT hres;
248 hres = IHTMLStyle_get_cssText(style, &text);
249 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
250 if(extext)
251 ok_(__FILE__,line)(!lstrcmpW(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
252 else
253 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
255 SysFreeString(text);
258 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
259 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const WCHAR *text)
261 BSTR str;
262 HRESULT hres;
264 str = SysAllocString(text);
265 hres = IHTMLStyle_put_cssText(style, str);
266 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
267 SysFreeString(str);
270 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
271 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const WCHAR *attr, VARIANT_BOOL exb)
273 BSTR str;
274 VARIANT_BOOL b = 100;
275 HRESULT hres;
277 str = SysAllocString(attr);
278 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
279 SysFreeString(str);
280 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
281 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
284 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
285 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const WCHAR *v)
287 BSTR str;
288 HRESULT hres;
290 str = SysAllocString(v);
291 hres = IHTMLStyle_put_textDecoration(style, str);
292 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
293 SysFreeString(str);
296 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
297 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const WCHAR *exdec)
299 BSTR str;
300 HRESULT hres;
302 hres = IHTMLStyle_get_textDecoration(style, &str);
303 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
304 if(exdec)
305 ok_(__FILE__,line)(!lstrcmpW(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(exdec));
306 else
307 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
308 SysFreeString(str);
311 static void test_set_csstext(IHTMLStyle *style)
313 IHTMLCSSStyleDeclaration *css_style;
314 VARIANT v;
315 BSTR str;
316 HRESULT hres;
318 test_style_set_csstext(style, L"background-color: black;");
320 hres = IHTMLStyle_get_backgroundColor(style, &v);
321 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
322 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
323 ok(!lstrcmpW(V_BSTR(&v), L"black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
324 VariantClear(&v);
326 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style);
327 ok(hres == S_OK || broken(!is_ie9plus && hres == E_NOINTERFACE),
328 "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres);
329 if(FAILED(hres))
330 return;
332 str = SysAllocString(L"float: left;");
333 hres = IHTMLCSSStyleDeclaration_put_cssText(css_style, str);
334 ok(hres == S_OK, "put_cssText failed: %08x\n", hres);
335 SysFreeString(str);
337 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
338 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
339 ok(!lstrcmpW(str, L"left"), "cssFloat = %s\n", wine_dbgstr_w(str));
340 SysFreeString(str);
342 hres = IHTMLCSSStyleDeclaration_get_cssText(css_style, &str);
343 ok(hres == S_OK, "get_cssText failed: %08x\n", hres);
344 todo_wine_if(compat_mode < COMPAT_IE9)
345 ok(!lstrcmpW(str, compat_mode >= COMPAT_IE9 ? L"float: left;" : L"FLOAT: left"),
346 "cssFloat = %s\n", wine_dbgstr_w(str));
347 SysFreeString(str);
349 hres = IHTMLCSSStyleDeclaration_put_cssText(css_style, NULL);
350 ok(hres == S_OK, "put_cssText failed: %08x\n", hres);
352 IHTMLCSSStyleDeclaration_Release(css_style);
355 static void test_style2(IHTMLStyle2 *style2)
357 VARIANT v;
358 BSTR str;
359 HRESULT hres;
361 str = (void*)0xdeadbeef;
362 hres = IHTMLStyle2_get_position(style2, &str);
363 ok(hres == S_OK, "get_position failed: %08x\n", hres);
364 ok(!str, "str != NULL\n");
366 str = SysAllocString(L"absolute");
367 hres = IHTMLStyle2_put_position(style2, str);
368 ok(hres == S_OK, "put_position failed: %08x\n", hres);
369 SysFreeString(str);
371 str = NULL;
372 hres = IHTMLStyle2_get_position(style2, &str);
373 ok(hres == S_OK, "get_position failed: %08x\n", hres);
374 ok(!lstrcmpW(str, L"absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
375 SysFreeString(str);
377 /* Test right */
378 V_VT(&v) = VT_EMPTY;
379 hres = IHTMLStyle2_get_right(style2, &v);
380 ok(hres == S_OK, "get_top failed: %08x\n", hres);
381 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
382 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
383 VariantClear(&v);
385 V_VT(&v) = VT_BSTR;
386 V_BSTR(&v) = SysAllocString(L"3px");
387 hres = IHTMLStyle2_put_right(style2, v);
388 ok(hres == S_OK, "put_right failed: %08x\n", hres);
389 VariantClear(&v);
391 V_VT(&v) = VT_EMPTY;
392 hres = IHTMLStyle2_get_right(style2, &v);
393 ok(hres == S_OK, "get_right failed: %08x\n", hres);
394 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
395 ok(!lstrcmpW(V_BSTR(&v), L"3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
396 VariantClear(&v);
398 /* direction */
399 str = (void*)0xdeadbeef;
400 hres = IHTMLStyle2_get_direction(style2, &str);
401 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
402 ok(!str, "str = %s\n", wine_dbgstr_w(str));
404 str = SysAllocString(L"ltr");
405 hres = IHTMLStyle2_put_direction(style2, str);
406 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
407 SysFreeString(str);
409 str = NULL;
410 hres = IHTMLStyle2_get_direction(style2, &str);
411 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
412 ok(!lstrcmpW(str, L"ltr"), "str = %s\n", wine_dbgstr_w(str));
413 SysFreeString(str);
415 /* bottom */
416 V_VT(&v) = VT_EMPTY;
417 hres = IHTMLStyle2_get_bottom(style2, &v);
418 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
419 test_var_bstr(&v, NULL);
421 V_VT(&v) = VT_I4;
422 V_I4(&v) = 4;
423 hres = IHTMLStyle2_put_bottom(style2, v);
424 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
426 V_VT(&v) = VT_EMPTY;
427 hres = IHTMLStyle2_get_bottom(style2, &v);
428 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
429 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"4px" : NULL);
431 /* overflowX */
432 str = (void*)0xdeadbeef;
433 hres = IHTMLStyle2_get_overflowX(style2, &str);
434 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
435 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
437 str = SysAllocString(L"hidden");
438 hres = IHTMLStyle2_put_overflowX(style2, str);
439 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
440 SysFreeString(str);
442 str = NULL;
443 hres = IHTMLStyle2_get_overflowX(style2, &str);
444 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
445 ok(!lstrcmpW(str, L"hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
447 /* overflowY */
448 str = (void*)0xdeadbeef;
449 hres = IHTMLStyle2_get_overflowY(style2, &str);
450 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
451 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
453 str = SysAllocString(L"hidden");
454 hres = IHTMLStyle2_put_overflowY(style2, str);
455 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
456 SysFreeString(str);
458 str = NULL;
459 hres = IHTMLStyle2_get_overflowY(style2, &str);
460 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
461 ok(!lstrcmpW(str, L"hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
463 /* tableLayout */
464 str = SysAllocString(L"fixed");
465 hres = IHTMLStyle2_put_tableLayout(style2, str);
466 ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres);
467 SysFreeString(str);
469 str = (void*)0xdeadbeef;
470 hres = IHTMLStyle2_get_tableLayout(style2, &str);
471 ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres);
472 ok(!lstrcmpW(str, L"fixed"), "tableLayout = %s\n", wine_dbgstr_w(str));
473 SysFreeString(str);
475 /* borderCollapse */
476 str = (void*)0xdeadbeef;
477 hres = IHTMLStyle2_get_borderCollapse(style2, &str);
478 ok(hres == S_OK, "get_borderCollapse failed: %08x\n", hres);
479 ok(!str, "borderCollapse = %s\n", wine_dbgstr_w(str));
481 str = SysAllocString(L"separate");
482 hres = IHTMLStyle2_put_borderCollapse(style2, str);
483 ok(hres == S_OK, "put_borderCollapse failed: %08x\n", hres);
484 SysFreeString(str);
486 hres = IHTMLStyle2_get_borderCollapse(style2, &str);
487 ok(hres == S_OK, "get_borderCollapse failed: %08x\n", hres);
488 ok(!lstrcmpW(str, L"separate"), "borderCollapse = %s\n", wine_dbgstr_w(str));
489 SysFreeString(str);
492 static void test_style3(IHTMLStyle3 *style3, IHTMLCSSStyleDeclaration *css_style)
494 VARIANT v;
495 BSTR str;
496 HRESULT hres;
498 str = (void*)0xdeadbeef;
499 hres = IHTMLStyle3_get_wordWrap(style3, &str);
500 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
501 ok(!str, "str != NULL\n");
503 str = SysAllocString(L"break-word");
504 hres = IHTMLStyle3_put_wordWrap(style3, str);
505 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
506 SysFreeString(str);
508 str = NULL;
509 hres = IHTMLStyle3_get_wordWrap(style3, &str);
510 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
511 ok(!lstrcmpW(str, L"break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
512 SysFreeString(str);
514 V_VT(&v) = VT_ERROR;
515 hres = IHTMLStyle3_get_zoom(style3, &v);
516 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
517 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
518 ok(!V_BSTR(&v), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
519 VariantClear(&v);
521 V_VT(&v) = VT_BSTR;
522 V_BSTR(&v) = SysAllocString(L"100%");
523 hres = IHTMLStyle3_put_zoom(style3, v);
524 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
525 VariantClear(&v);
527 V_VT(&v) = VT_ERROR;
528 hres = IHTMLStyle3_get_zoom(style3, &v);
529 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
530 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
531 ok(!lstrcmpW(V_BSTR(&v), L"100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
532 VariantClear(&v);
534 if(css_style) {
535 hres = IHTMLCSSStyleDeclaration_get_zoom(css_style, &v);
536 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
537 test_var_bstr(&v, L"100%");
538 VariantClear(&v);
541 V_VT(&v) = VT_I4;
542 V_I4(&v) = 1;
543 hres = IHTMLStyle3_put_zoom(style3, v);
544 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
546 V_VT(&v) = VT_ERROR;
547 hres = IHTMLStyle3_get_zoom(style3, &v);
548 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
549 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
550 ok(!lstrcmpW(V_BSTR(&v), L"1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
551 VariantClear(&v);
553 if(css_style) {
554 V_VT(&v) = VT_BSTR;
555 V_BSTR(&v) = SysAllocString(L"100%");
556 hres = IHTMLCSSStyleDeclaration_put_zoom(css_style, v);
557 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
558 VariantClear(&v);
560 hres = IHTMLCSSStyleDeclaration_get_zoom(css_style, &v);
561 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
562 test_var_bstr(&v, L"100%");
563 VariantClear(&v);
567 static void test_style4(IHTMLStyle4 *style4)
569 HRESULT hres;
570 VARIANT v;
571 VARIANT vdefault;
573 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
574 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
576 V_VT(&v) = VT_BSTR;
577 V_BSTR(&v) = SysAllocString(L"10px");
578 hres = IHTMLStyle4_put_minHeight(style4, v);
579 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
580 VariantClear(&v);
582 hres = IHTMLStyle4_get_minHeight(style4, &v);
583 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
584 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
585 ok( !lstrcmpW(V_BSTR(&v), L"10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
586 VariantClear(&v);
588 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
589 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
590 VariantClear(&vdefault);
593 static void test_style5(IHTMLStyle5 *style5)
595 HRESULT hres;
596 VARIANT v;
597 VARIANT vdefault;
599 /* minWidth */
600 hres = IHTMLStyle5_get_minWidth(style5, &vdefault);
601 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
603 V_VT(&v) = VT_BSTR;
604 V_BSTR(&v) = SysAllocString(L"12px");
605 hres = IHTMLStyle5_put_minWidth(style5, v);
606 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
607 VariantClear(&v);
609 hres = IHTMLStyle5_get_minWidth(style5, &v);
610 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
611 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
612 ok(!lstrcmpW(V_BSTR(&v), L"12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
613 VariantClear(&v);
615 V_VT(&v) = VT_BSTR;
616 V_BSTR(&v) = SysAllocString(L"10%");
617 hres = IHTMLStyle5_put_minWidth(style5, v);
618 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
619 VariantClear(&v);
621 hres = IHTMLStyle5_get_minWidth(style5, &v);
622 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
623 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
624 ok(!lstrcmpW(V_BSTR(&v), L"10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
625 VariantClear(&v);
627 V_VT(&v) = VT_BSTR;
628 V_BSTR(&v) = SysAllocString(L"10");
629 hres = IHTMLStyle5_put_minWidth(style5, v);
630 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
631 VariantClear(&v);
633 hres = IHTMLStyle5_get_minWidth(style5, &v);
634 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
635 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"10px" : L"10%");
636 VariantClear(&v);
638 hres = IHTMLStyle5_put_minWidth(style5, vdefault);
639 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
640 VariantClear(&vdefault);
642 /* maxWidth */
643 hres = IHTMLStyle5_get_maxWidth(style5, &vdefault);
644 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
646 V_VT(&v) = VT_BSTR;
647 V_BSTR(&v) = SysAllocString(L"200px");
648 hres = IHTMLStyle5_put_maxWidth(style5, v);
649 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
650 VariantClear(&v);
652 hres = IHTMLStyle5_get_maxWidth(style5, &v);
653 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
654 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n",V_VT(&v));
655 ok(!lstrcmpW(V_BSTR(&v), L"200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
656 VariantClear(&v);
658 V_VT(&v) = VT_BSTR;
659 V_BSTR(&v) = SysAllocString(L"70%");
660 hres = IHTMLStyle5_put_maxWidth(style5, v);
661 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
662 VariantClear(&v);
664 hres = IHTMLStyle5_get_maxWidth(style5, &v);
665 ok(hres == S_OK, "get maxWidth failed: %08x\n", hres);
666 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
667 ok(!lstrcmpW(V_BSTR(&v), L"70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
668 VariantClear(&v);
670 hres = IHTMLStyle5_put_maxWidth(style5,vdefault);
671 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
672 VariantClear(&vdefault);
674 /* maxHeight */
675 hres = IHTMLStyle5_get_maxHeight(style5, &vdefault);
676 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
678 V_VT(&v) = VT_BSTR;
679 V_BSTR(&v) = SysAllocString(L"200px");
680 hres = IHTMLStyle5_put_maxHeight(style5, v);
681 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
682 VariantClear(&v);
684 hres = IHTMLStyle5_get_maxHeight(style5, &v);
685 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
686 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
687 ok(!lstrcmpW(V_BSTR(&v), L"200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
688 VariantClear(&v);
690 V_VT(&v) = VT_BSTR;
691 V_BSTR(&v) = SysAllocString(L"70%");
692 hres = IHTMLStyle5_put_maxHeight(style5, v);
693 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
694 VariantClear(&v);
696 hres = IHTMLStyle5_get_maxHeight(style5, &v);
697 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
698 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
699 ok(!lstrcmpW(V_BSTR(&v), L"70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
700 VariantClear(&v);
702 V_VT(&v) = VT_BSTR;
703 V_BSTR(&v) = SysAllocString(L"100");
704 hres = IHTMLStyle5_put_maxHeight(style5, v);
705 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
706 VariantClear(&v);
708 hres = IHTMLStyle5_get_maxHeight(style5, &v);
709 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
710 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"100px" : L"70%");
711 VariantClear(&v);
713 hres = IHTMLStyle5_put_maxHeight(style5, vdefault);
714 ok(hres == S_OK, "put maxHeight failed:%08x\n", hres);
715 VariantClear(&vdefault);
718 static void test_style6(IHTMLStyle6 *style)
720 BSTR str;
721 HRESULT hres;
723 str = (void*)0xdeadbeef;
724 hres = IHTMLStyle6_get_outline(style, &str);
725 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
726 if(compat_mode < COMPAT_IE9)
727 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
728 else
729 ok(!str, "outline = %s\n", wine_dbgstr_w(str));
730 SysFreeString(str);
732 str = SysAllocString(L"1px");
733 hres = IHTMLStyle6_put_outline(style, str);
734 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
735 SysFreeString(str);
737 str = (void*)0xdeadbeef;
738 hres = IHTMLStyle6_get_outline(style, &str);
739 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
740 ok(wcsstr(str, L"1px") != NULL, "outline = %s\n", wine_dbgstr_w(str));
741 SysFreeString(str);
743 str = (void*)0xdeadbeef;
744 hres = IHTMLStyle6_get_boxSizing(style, &str);
745 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
746 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
747 SysFreeString(str);
749 str = SysAllocString(L"border-box");
750 hres = IHTMLStyle6_put_boxSizing(style, str);
751 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
752 SysFreeString(str);
754 str = NULL;
755 hres = IHTMLStyle6_get_boxSizing(style, &str);
756 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
757 ok(!lstrcmpW(str, L"border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
758 SysFreeString(str);
760 hres = IHTMLStyle6_get_borderSpacing(style, &str);
761 ok(hres == S_OK, "get_borderSpacing failed: %08x\n", hres);
762 ok(!str, "borderSpacing = %s\n", wine_dbgstr_w(str));
764 str = SysAllocString(L"10px");
765 hres = IHTMLStyle6_put_borderSpacing(style, str);
766 ok(hres == S_OK, "put_borderSpacing failed: %08x\n", hres);
767 SysFreeString(str);
769 str = NULL;
770 hres = IHTMLStyle6_get_borderSpacing(style, &str);
771 ok(hres == S_OK, "get_borderSpacing failed: %08x\n", hres);
772 ok(!lstrcmpW(str, L"10px"), "borderSpacing = %s\n", wine_dbgstr_w(str));
773 SysFreeString(str);
776 static void test_css_style_declaration(IHTMLCSSStyleDeclaration *css_style)
778 VARIANT v;
779 BSTR str;
780 HRESULT hres;
782 hres = IHTMLCSSStyleDeclaration_get_backgroundClip(css_style, &str);
783 ok(hres == S_OK, "get_backgroundClip failed: %08x\n", hres);
784 ok(!str, "backgroundClip = %s\n", wine_dbgstr_w(str));
786 str = SysAllocString(L"border-box");
787 hres = IHTMLCSSStyleDeclaration_put_backgroundClip(css_style, str);
788 ok(hres == S_OK, "put_backgroundClip failed: %08x\n", hres);
789 SysFreeString(str);
791 hres = IHTMLCSSStyleDeclaration_get_backgroundClip(css_style, &str);
792 ok(hres == S_OK, "get_backgroundClip failed: %08x\n", hres);
793 ok(!lstrcmpW(str, L"border-box"), "backgroundClip = %s\n", wine_dbgstr_w(str));
794 SysFreeString(str);
796 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
797 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
798 test_var_bstr(&v, NULL);
800 V_VT(&v) = VT_I4;
801 V_I4(&v) = 0;
802 hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v);
803 ok(hres == S_OK, "put_opacity failed: %08x\n", hres);
805 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
806 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
807 test_var_bstr(&v, L"0");
808 VariantClear(&v);
810 V_VT(&v) = VT_R8;
811 V_R8(&v) = 0.5;
812 hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v);
813 ok(hres == S_OK, "put_opacity failed: %08x\n", hres);
815 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
816 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
817 test_var_bstr(&v, L"0.5");
818 VariantClear(&v);
820 V_VT(&v) = VT_BSTR;
821 V_BSTR(&v) = SysAllocString(L"1");
822 hres = IHTMLCSSStyleDeclaration_put_opacity(css_style, v);
823 ok(hres == S_OK, "put_opacity failed: %08x\n", hres);
824 VariantClear(&v);
826 hres = IHTMLCSSStyleDeclaration_get_opacity(css_style, &v);
827 ok(hres == S_OK, "get_opacity failed: %08x\n", hres);
828 test_var_bstr(&v, L"1");
829 VariantClear(&v);
832 static void test_css_style_declaration2(IHTMLCSSStyleDeclaration2 *css_style)
834 VARIANT v;
835 BSTR str;
836 HRESULT hres;
838 str = SysAllocString(L"translate(30px, 20px)");
839 hres = IHTMLCSSStyleDeclaration2_put_transform(css_style, str);
840 ok(hres == S_OK, "put_transform failed: %08x\n", hres);
841 SysFreeString(str);
843 str = NULL;
844 hres = IHTMLCSSStyleDeclaration2_get_transform(css_style, &str);
845 ok(hres == S_OK, "get_transform failed: %08x\n", hres);
846 ok(!lstrcmpW(str, L"translate(30px, 20px)"), "transform = %s\n", wine_dbgstr_w(str));
847 SysFreeString(str);
849 str = SysAllocString(L"none");
850 hres = IHTMLCSSStyleDeclaration2_put_transform(css_style, str);
851 ok(hres == S_OK, "put_transform failed: %08x\n", hres);
852 SysFreeString(str);
854 str = NULL;
855 hres = IHTMLCSSStyleDeclaration2_get_transform(css_style, &str);
856 ok(hres == S_OK, "get_transform failed: %08x\n", hres);
857 ok(!lstrcmpW(str, L"none"), "transform = %s\n", wine_dbgstr_w(str));
858 SysFreeString(str);
860 str = NULL;
861 hres = IHTMLCSSStyleDeclaration2_get_animationName(css_style, &str);
862 ok(hres == S_OK, "get_animationName failed: %08x\n", hres);
863 ok(!str, "animationName = %s\n", wine_dbgstr_w(str));
864 SysFreeString(str);
866 str = SysAllocString(L"none");
867 hres = IHTMLCSSStyleDeclaration2_put_animationName(css_style, str);
868 ok(hres == S_OK, "put_animationName failed: %08x\n", hres);
869 SysFreeString(str);
871 str = NULL;
872 hres = IHTMLCSSStyleDeclaration2_get_animationName(css_style, &str);
873 ok(hres == S_OK, "get_animationName failed: %08x\n", hres);
874 ok(!lstrcmpW(str, L"none"), "animationName = %s\n", wine_dbgstr_w(str));
875 SysFreeString(str);
877 str = NULL;
878 hres = IHTMLCSSStyleDeclaration2_get_transition(css_style, &str);
879 ok(hres == S_OK, "get_transition failed: %08x\n", hres);
880 ok(!str, "transition = %s\n", wine_dbgstr_w(str));
881 SysFreeString(str);
883 str = SysAllocString(L"marigin-right 1s ease-out");
884 hres = IHTMLCSSStyleDeclaration2_put_transition(css_style, str);
885 ok(hres == S_OK, "put_transition failed: %08x\n", hres);
886 SysFreeString(str);
888 str = NULL;
889 hres = IHTMLCSSStyleDeclaration2_get_transition(css_style, &str);
890 ok(hres == S_OK, "get_transition failed: %08x\n", hres);
891 ok(!wcsncmp(str, L"marigin-right 1s", wcslen(L"marigin-right 1s")), "transition = %s\n", wine_dbgstr_w(str));
892 SysFreeString(str);
894 V_VT(&v) = VT_ERROR;
895 hres = IHTMLCSSStyleDeclaration2_get_columnCount(css_style, &v);
896 ok(hres == S_OK, "get_columnCount failed: %08x\n", hres);
897 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnCount = %s\n", wine_dbgstr_variant(&v));
898 VariantClear(&v);
900 V_VT(&v) = VT_I4;
901 V_I4(&v) = 2;
902 hres = IHTMLCSSStyleDeclaration2_put_columnCount(css_style, v);
903 ok(hres == S_OK, "put_columnCount failed: %08x\n", hres);
905 V_VT(&v) = VT_ERROR;
906 hres = IHTMLCSSStyleDeclaration2_get_columnCount(css_style, &v);
907 ok(hres == S_OK, "get_columnCount failed: %08x\n", hres);
908 todo_wine
909 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"2"), "columnCount = %s\n", wine_dbgstr_variant(&v));
910 VariantClear(&v);
912 V_VT(&v) = VT_BSTR;
913 V_BSTR(&v) = SysAllocString(L"auto");
914 hres = IHTMLCSSStyleDeclaration2_put_columnCount(css_style, v);
915 ok(hres == S_OK, "put_columnCount failed: %08x\n", hres);
916 VariantClear(&v);
918 V_VT(&v) = VT_ERROR;
919 hres = IHTMLCSSStyleDeclaration2_get_columnCount(css_style, &v);
920 ok(hres == S_OK, "get_columnCount failed: %08x\n", hres);
921 todo_wine
922 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"auto"), "columnCount = %s\n", wine_dbgstr_variant(&v));
923 VariantClear(&v);
925 V_VT(&v) = VT_ERROR;
926 hres = IHTMLCSSStyleDeclaration2_get_columnWidth(css_style, &v);
927 ok(hres == S_OK, "get_columnWidth failed: %08x\n", hres);
928 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnWidth = %s\n", wine_dbgstr_variant(&v));
929 VariantClear(&v);
931 V_VT(&v) = VT_I4;
932 V_I4(&v) = 20;
933 hres = IHTMLCSSStyleDeclaration2_put_columnWidth(css_style, v);
934 ok(hres == S_OK, "put_columnWidth failed: %08x\n", hres);
936 V_VT(&v) = VT_ERROR;
937 hres = IHTMLCSSStyleDeclaration2_get_columnWidth(css_style, &v);
938 ok(hres == S_OK, "get_columnWidth failed: %08x\n", hres);
939 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnWidth = %s\n", wine_dbgstr_variant(&v));
940 VariantClear(&v);
942 V_VT(&v) = VT_BSTR;
943 V_BSTR(&v) = SysAllocString(L"20px");
944 hres = IHTMLCSSStyleDeclaration2_put_columnWidth(css_style, v);
945 ok(hres == S_OK, "put_columnWidth failed: %08x\n", hres);
946 VariantClear(&v);
948 V_VT(&v) = VT_ERROR;
949 hres = IHTMLCSSStyleDeclaration2_get_columnWidth(css_style, &v);
950 ok(hres == S_OK, "get_columnWidth failed: %08x\n", hres);
951 todo_wine
952 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"20px"), "columnWidth = %s\n", wine_dbgstr_variant(&v));
953 VariantClear(&v);
955 V_VT(&v) = VT_ERROR;
956 hres = IHTMLCSSStyleDeclaration2_get_columnGap(css_style, &v);
957 ok(hres == S_OK, "get_columnGap failed: %08x\n", hres);
958 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnGap = %s\n", wine_dbgstr_variant(&v));
959 VariantClear(&v);
961 V_VT(&v) = VT_I4;
962 V_I4(&v) = 20;
963 hres = IHTMLCSSStyleDeclaration2_put_columnGap(css_style, v);
964 ok(hres == S_OK, "put_columnGap failed: %08x\n", hres);
966 V_VT(&v) = VT_ERROR;
967 hres = IHTMLCSSStyleDeclaration2_get_columnGap(css_style, &v);
968 ok(hres == S_OK, "get_columnGap failed: %08x\n", hres);
969 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnGap = %s\n", wine_dbgstr_variant(&v));
970 VariantClear(&v);
972 V_VT(&v) = VT_BSTR;
973 V_BSTR(&v) = SysAllocString(L"20px");
974 hres = IHTMLCSSStyleDeclaration2_put_columnGap(css_style, v);
975 ok(hres == S_OK, "put_columnGap failed: %08x\n", hres);
976 VariantClear(&v);
978 V_VT(&v) = VT_ERROR;
979 hres = IHTMLCSSStyleDeclaration2_get_columnGap(css_style, &v);
980 ok(hres == S_OK, "get_columnGap failed: %08x\n", hres);
981 todo_wine
982 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"20px"), "columnGap = %s\n", wine_dbgstr_variant(&v));
983 VariantClear(&v);
985 str = NULL;
986 hres = IHTMLCSSStyleDeclaration2_get_columnFill(css_style, &str);
987 ok(hres == S_OK, "get_columnFill failed: %08x\n", hres);
988 ok(!str, "columnFill = %s\n", wine_dbgstr_w(str));
989 SysFreeString(str);
991 str = SysAllocString(L"auto");
992 hres = IHTMLCSSStyleDeclaration2_put_columnFill(css_style, str);
993 ok(hres == S_OK, "put_columnFill failed: %08x\n", hres);
994 SysFreeString(str);
996 str = NULL;
997 hres = IHTMLCSSStyleDeclaration2_get_columnFill(css_style, &str);
998 ok(hres == S_OK, "get_columnFill failed: %08x\n", hres);
999 todo_wine
1000 ok(str && !lstrcmpW(str, L"auto"), "columnFill = %s\n", wine_dbgstr_w(str));
1001 SysFreeString(str);
1003 str = NULL;
1004 hres = IHTMLCSSStyleDeclaration2_get_columnSpan(css_style, &str);
1005 ok(hres == S_OK, "get_columnSpan failed: %08x\n", hres);
1006 ok(!str, "columnSpan = %s\n", wine_dbgstr_w(str));
1007 SysFreeString(str);
1009 str = SysAllocString(L"all");
1010 hres = IHTMLCSSStyleDeclaration2_put_columnSpan(css_style, str);
1011 ok(hres == S_OK, "put_columnSpan failed: %08x\n", hres);
1012 SysFreeString(str);
1014 str = NULL;
1015 hres = IHTMLCSSStyleDeclaration2_get_columnSpan(css_style, &str);
1016 ok(hres == S_OK, "get_columnSpan failed: %08x\n", hres);
1017 todo_wine
1018 ok(str && !lstrcmpW(str, L"all"), "columnSpan = %s\n", wine_dbgstr_w(str));
1019 SysFreeString(str);
1021 V_VT(&v) = VT_ERROR;
1022 hres = IHTMLCSSStyleDeclaration2_get_columnRuleColor(css_style, &v);
1023 ok(hres == S_OK, "get_columnRuleColor failed: %08x\n", hres);
1024 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnRuleColor = %s\n", wine_dbgstr_variant(&v));
1025 VariantClear(&v);
1027 V_VT(&v) = VT_BSTR;
1028 V_BSTR(&v) = SysAllocString(L"red");
1029 hres = IHTMLCSSStyleDeclaration2_put_columnRuleColor(css_style, v);
1030 ok(hres == S_OK, "put_columnRuleColor failed: %08x\n", hres);
1031 VariantClear(&v);
1033 V_VT(&v) = VT_ERROR;
1034 hres = IHTMLCSSStyleDeclaration2_get_columnRuleColor(css_style, &v);
1035 ok(hres == S_OK, "get_columnRuleColor failed: %08x\n", hres);
1036 todo_wine
1037 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"red"), "columnRuleColor = %s\n", wine_dbgstr_variant(&v));
1038 VariantClear(&v);
1040 str = NULL;
1041 hres = IHTMLCSSStyleDeclaration2_get_columnRuleStyle(css_style, &str);
1042 ok(hres == S_OK, "get_columnRuleStyle failed: %08x\n", hres);
1043 ok(!str, "columnRuleStyle = %s\n", wine_dbgstr_w(str));
1044 SysFreeString(str);
1046 str = SysAllocString(L"solid");
1047 hres = IHTMLCSSStyleDeclaration2_put_columnRuleStyle(css_style, str);
1048 ok(hres == S_OK, "put_columnRuleStyle failed: %08x\n", hres);
1049 SysFreeString(str);
1051 str = NULL;
1052 hres = IHTMLCSSStyleDeclaration2_get_columnRuleStyle(css_style, &str);
1053 ok(hres == S_OK, "get_columnRuleStyle failed: %08x\n", hres);
1054 todo_wine
1055 ok(str && !lstrcmpW(str, L"solid"), "columnRuleStyle = %s\n", wine_dbgstr_w(str));
1056 SysFreeString(str);
1058 V_VT(&v) = VT_ERROR;
1059 hres = IHTMLCSSStyleDeclaration2_get_columnRuleWidth(css_style, &v);
1060 ok(hres == S_OK, "get_columnRuleWidth failed: %08x\n", hres);
1061 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "columnRuleWidth = %s\n", wine_dbgstr_variant(&v));
1062 VariantClear(&v);
1064 V_VT(&v) = VT_BSTR;
1065 V_BSTR(&v) = SysAllocString(L"10px");
1066 hres = IHTMLCSSStyleDeclaration2_put_columnRuleWidth(css_style, v);
1067 ok(hres == S_OK, "put_columnRuleWidth failed: %08x\n", hres);
1068 VariantClear(&v);
1070 V_VT(&v) = VT_ERROR;
1071 hres = IHTMLCSSStyleDeclaration2_get_columnRuleWidth(css_style, &v);
1072 ok(hres == S_OK, "get_columnRuleWidth failed: %08x\n", hres);
1073 todo_wine
1074 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"10px"), "columnRuleWidth = %s\n", wine_dbgstr_variant(&v));
1075 VariantClear(&v);
1077 str = NULL;
1078 hres = IHTMLCSSStyleDeclaration2_get_columnRule(css_style, &str);
1079 ok(hres == S_OK, "get_columnRule failed: %08x\n", hres);
1080 todo_wine
1081 ok(str && !lstrcmpW(str, L"10px solid red"), "columnRule = %s\n", wine_dbgstr_w(str));
1082 SysFreeString(str);
1084 hres = IHTMLCSSStyleDeclaration2_put_columnRule(css_style, NULL);
1085 ok(hres == S_OK, "put_columnRule failed: %08x\n", hres);
1087 str = (void*)0xdeadbeef;
1088 hres = IHTMLCSSStyleDeclaration2_get_columnRule(css_style, &str);
1089 ok(hres == S_OK, "get_columnRule failed: %08x\n", hres);
1090 ok(!str, "columnRule = %s\n", wine_dbgstr_w(str));
1092 V_VT(&v) = VT_ERROR;
1093 hres = IHTMLCSSStyleDeclaration2_get_perspective(css_style, &v);
1094 ok(hres == S_OK, "get_perspective failed: %08x\n", hres);
1095 ok(V_VT(&v) == VT_BSTR && !V_BSTR(&v), "perspective = %s\n", wine_dbgstr_variant(&v));
1096 VariantClear(&v);
1098 V_VT(&v) = VT_BSTR;
1099 V_BSTR(&v) = SysAllocString(L"100px");
1100 hres = IHTMLCSSStyleDeclaration2_put_perspective(css_style, v);
1101 ok(hres == S_OK, "put_perspective failed: %08x\n", hres);
1102 VariantClear(&v);
1104 V_VT(&v) = VT_ERROR;
1105 hres = IHTMLCSSStyleDeclaration2_get_perspective(css_style, &v);
1106 ok(hres == S_OK, "get_perspective failed: %08x\n", hres);
1107 ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) && !lstrcmpW(V_BSTR(&v), L"100px"), "perspective = %s\n", wine_dbgstr_variant(&v));
1108 VariantClear(&v);
1110 /* animation property */
1111 hres = IHTMLCSSStyleDeclaration2_put_animation(css_style, NULL);
1112 ok(hres == S_OK, "put_animation failed: %08x\n", hres);
1114 str = (void*)0xdeadbeef;
1115 hres = IHTMLCSSStyleDeclaration2_get_animation(css_style, &str);
1116 ok(hres == S_OK, "get_animation failed: %08x\n", hres);
1117 ok(!str, "animation = %s\n", wine_dbgstr_w(str));
1119 str = SysAllocString(L"test");
1120 hres = IHTMLCSSStyleDeclaration2_put_animation(css_style, str);
1121 ok(hres == S_OK, "put_animation failed: %08x\n", hres);
1122 SysFreeString(str);
1124 str = (void*)0xdeadbeef;
1125 hres = IHTMLCSSStyleDeclaration2_get_animation(css_style, &str);
1126 ok(hres == S_OK, "get_animation failed: %08x\n", hres);
1127 todo_wine
1128 ok(!lstrcmpW(str, L"test"), "animation = %s\n", wine_dbgstr_w(str));
1130 str = (void*)0xdeadbeef;
1131 hres = IHTMLCSSStyleDeclaration2_get_animationName(css_style, &str);
1132 ok(hres == S_OK, "get_animationName failed: %08x\n", hres);
1133 ok(!lstrcmpW(str, L"test"), "animationName = %s\n", wine_dbgstr_w(str));
1135 str = SysAllocString(L"test");
1136 hres = IHTMLCSSStyleDeclaration2_put_animation(css_style, NULL);
1137 ok(hres == S_OK, "put_animation failed: %08x\n", hres);
1138 SysFreeString(str);
1141 static void test_body_style(IHTMLStyle *style)
1143 IHTMLCSSStyleDeclaration *css_style;
1144 IHTMLCSSStyleDeclaration2 *css_style2 = NULL;
1145 IHTMLStyle2 *style2;
1146 IHTMLStyle3 *style3;
1147 IHTMLStyle4 *style4;
1148 IHTMLStyle5 *style5;
1149 IHTMLStyle6 *style6;
1150 VARIANT_BOOL b;
1151 VARIANT v;
1152 BSTR str;
1153 HRESULT hres;
1154 float f;
1155 BSTR sOverflowDefault;
1156 BSTR sDefault;
1157 LONG l;
1158 VARIANT vDefault;
1160 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style);
1161 ok(hres == S_OK || broken(!is_ie9plus && hres == E_NOINTERFACE),
1162 "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres);
1164 if(css_style) {
1165 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration2, (void**)&css_style2);
1166 ok(hres == S_OK || broken(hres == E_NOINTERFACE),
1167 "Could not get IHTMLCSSStyleDeclaration2 interface: %08x\n", hres);
1170 test_style_csstext(style, NULL);
1172 hres = IHTMLStyle_get_position(style, &str);
1173 ok(hres == S_OK, "get_position failed: %08x\n", hres);
1174 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1176 V_VT(&v) = VT_NULL;
1177 hres = IHTMLStyle_get_marginRight(style, &v);
1178 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1179 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1180 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1182 V_VT(&v) = VT_I4;
1183 V_I4(&v) = 6;
1184 hres = IHTMLStyle_put_marginRight(style, v);
1185 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1187 V_VT(&v) = VT_NULL;
1188 hres = IHTMLStyle_get_marginRight(style, &v);
1189 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1190 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1191 if(compat_mode < COMPAT_IE9)
1192 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1193 else
1194 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1195 VariantClear(&v);
1197 V_VT(&v) = VT_BSTR;
1198 V_BSTR(&v) = SysAllocString(L"5");
1199 hres = IHTMLStyle_put_marginRight(style, v);
1200 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1202 V_VT(&v) = VT_NULL;
1203 hres = IHTMLStyle_get_marginRight(style, &v);
1204 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1205 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1206 if(compat_mode < COMPAT_IE9)
1207 ok(!lstrcmpW(V_BSTR(&v), L"5px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1208 else
1209 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1210 VariantClear(&v);
1212 if(css_style) {
1213 V_VT(&v) = VT_NULL;
1214 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1215 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1216 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1217 if(compat_mode < COMPAT_IE9)
1218 ok(!lstrcmpW(V_BSTR(&v), L"5px"), "V_BSTR(marginRight) = %s\n",
1219 wine_dbgstr_w(V_BSTR(&v)));
1220 else
1221 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1223 V_VT(&v) = VT_I4;
1224 V_I4(&v) = 7;
1225 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
1226 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1228 V_VT(&v) = VT_NULL;
1229 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1230 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1231 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1232 if(compat_mode < COMPAT_IE9)
1233 ok(!lstrcmpW(V_BSTR(&v), L"7px"), "V_BSTR(marginRight) = %s\n",
1234 wine_dbgstr_w(V_BSTR(&v)));
1235 else
1236 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1238 V_VT(&v) = VT_BSTR;
1239 V_BSTR(&v) = SysAllocString(L"8");
1240 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
1241 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1242 SysFreeString(V_BSTR(&v));
1244 V_VT(&v) = VT_NULL;
1245 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1246 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1247 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1248 if(compat_mode < COMPAT_IE9)
1249 ok(!lstrcmpW(V_BSTR(&v), L"8px"), "V_BSTR(marginRight) = %s\n",
1250 wine_dbgstr_w(V_BSTR(&v)));
1251 else
1252 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1254 V_VT(&v) = VT_BSTR;
1255 V_BSTR(&v) = SysAllocString(L"9px");
1256 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
1257 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1258 SysFreeString(V_BSTR(&v));
1260 V_VT(&v) = VT_NULL;
1261 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1262 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1263 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1264 ok(!lstrcmpW(V_BSTR(&v), L"9px"), "V_BSTR(marginRight) = %s\n",
1265 wine_dbgstr_w(V_BSTR(&v)));
1266 SysFreeString(V_BSTR(&v));
1269 V_VT(&v) = VT_NULL;
1270 hres = IHTMLStyle_get_marginBottom(style, &v);
1271 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
1272 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
1273 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1275 V_VT(&v) = VT_I4;
1276 V_I4(&v) = 6;
1277 hres = IHTMLStyle_put_marginBottom(style, v);
1278 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
1280 V_VT(&v) = VT_NULL;
1281 hres = IHTMLStyle_get_marginBottom(style, &v);
1282 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
1283 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
1284 if(compat_mode < COMPAT_IE9)
1285 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1286 else
1287 ok(!V_BSTR(&v), "mariginBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1289 V_VT(&v) = VT_NULL;
1290 hres = IHTMLStyle_get_marginLeft(style, &v);
1291 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
1292 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
1293 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1295 V_VT(&v) = VT_I4;
1296 V_I4(&v) = 6;
1297 hres = IHTMLStyle_put_marginLeft(style, v);
1298 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
1300 V_VT(&v) = VT_NULL;
1301 hres = IHTMLStyle_get_marginLeft(style, &v);
1302 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
1303 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
1304 if(compat_mode < COMPAT_IE9)
1305 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1306 else
1307 ok(!V_BSTR(&v), "mariginLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1309 str = (void*)0xdeadbeef;
1310 hres = IHTMLStyle_get_fontFamily(style, &str);
1311 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
1312 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
1314 str = (void*)0xdeadbeef;
1315 hres = IHTMLStyle_get_fontWeight(style, &str);
1316 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1317 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
1319 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
1320 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1322 str = SysAllocString(L"test");
1323 hres = IHTMLStyle_put_fontWeight(style, str);
1324 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1325 "put_fontWeight failed: %08x\n", hres);
1326 SysFreeString(str);
1328 hres = IHTMLStyle_get_fontWeight(style, &str);
1329 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1330 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
1331 SysFreeString(str);
1333 str = SysAllocString(L"bold");
1334 hres = IHTMLStyle_put_fontWeight(style, str);
1335 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1336 SysFreeString(str);
1338 str = SysAllocString(L"bolder");
1339 hres = IHTMLStyle_put_fontWeight(style, str);
1340 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1341 SysFreeString(str);
1343 str = SysAllocString(L"lighter");
1344 hres = IHTMLStyle_put_fontWeight(style, str);
1345 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1346 SysFreeString(str);
1348 str = SysAllocString(L"100");
1349 hres = IHTMLStyle_put_fontWeight(style, str);
1350 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1351 SysFreeString(str);
1353 str = SysAllocString(L"200");
1354 hres = IHTMLStyle_put_fontWeight(style, str);
1355 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1356 SysFreeString(str);
1358 str = SysAllocString(L"300");
1359 hres = IHTMLStyle_put_fontWeight(style, str);
1360 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1361 SysFreeString(str);
1363 str = SysAllocString(L"400");
1364 hres = IHTMLStyle_put_fontWeight(style, str);
1365 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1366 SysFreeString(str);
1368 str = SysAllocString(L"500");
1369 hres = IHTMLStyle_put_fontWeight(style, str);
1370 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1371 SysFreeString(str);
1373 str = SysAllocString(L"600");
1374 hres = IHTMLStyle_put_fontWeight(style, str);
1375 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1376 SysFreeString(str);
1378 str = SysAllocString(L"700");
1379 hres = IHTMLStyle_put_fontWeight(style, str);
1380 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1381 SysFreeString(str);
1383 str = SysAllocString(L"800");
1384 hres = IHTMLStyle_put_fontWeight(style, str);
1385 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1386 SysFreeString(str);
1388 str = SysAllocString(L"900");
1389 hres = IHTMLStyle_put_fontWeight(style, str);
1390 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1391 SysFreeString(str);
1393 hres = IHTMLStyle_get_fontWeight(style, &str);
1394 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1395 ok(!lstrcmpW(str, L"900"), "str != style900\n");
1396 SysFreeString(str);
1398 str = SysAllocString(L"");
1399 hres = IHTMLStyle_put_fontWeight(style, str);
1400 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1401 SysFreeString(str);
1403 hres = IHTMLStyle_get_fontWeight(style, &str);
1404 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1405 ok(!str, "str != NULL\n");
1406 SysFreeString(str);
1408 hres = IHTMLStyle_put_fontWeight(style, sDefault);
1409 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1410 SysFreeString(sDefault);
1412 /* font Variant */
1413 hres = IHTMLStyle_get_fontVariant(style, NULL);
1414 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
1416 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
1417 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
1419 str = SysAllocString(L"test");
1420 hres = IHTMLStyle_put_fontVariant(style, str);
1421 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1422 "fontVariant failed: %08x\n", hres);
1423 SysFreeString(str);
1425 str = SysAllocString(L"small-caps");
1426 hres = IHTMLStyle_put_fontVariant(style, str);
1427 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1428 SysFreeString(str);
1430 str = SysAllocString(L"normal");
1431 hres = IHTMLStyle_put_fontVariant(style, str);
1432 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1433 SysFreeString(str);
1435 hres = IHTMLStyle_put_fontVariant(style, sDefault);
1436 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1437 SysFreeString(sDefault);
1439 str = (void*)0xdeadbeef;
1440 hres = IHTMLStyle_get_display(style, &str);
1441 ok(hres == S_OK, "get_display failed: %08x\n", hres);
1442 ok(!str, "display = %s\n", wine_dbgstr_w(str));
1444 str = (void*)0xdeadbeef;
1445 hres = IHTMLStyle_get_visibility(style, &str);
1446 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
1447 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
1449 V_VT(&v) = VT_NULL;
1450 hres = IHTMLStyle_get_fontSize(style, &v);
1451 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1452 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
1453 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1455 V_VT(&v) = VT_I4;
1456 V_I4(&v) = 12;
1457 hres = IHTMLStyle_put_fontSize(style, v);
1458 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
1460 V_VT(&v) = VT_NULL;
1461 hres = IHTMLStyle_get_fontSize(style, &v);
1462 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1463 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
1464 if(compat_mode < COMPAT_IE9)
1465 ok(!lstrcmpW(V_BSTR(&v), L"12px"), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1466 else
1467 ok(!V_BSTR(&v), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1469 V_VT(&v) = VT_NULL;
1470 hres = IHTMLStyle_get_color(style, &v);
1471 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1472 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
1473 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1475 V_VT(&v) = VT_I4;
1476 V_I4(&v) = 0xfdfd;
1477 hres = IHTMLStyle_put_color(style, v);
1478 ok(hres == S_OK, "put_color failed: %08x\n", hres);
1480 V_VT(&v) = VT_NULL;
1481 hres = IHTMLStyle_get_color(style, &v);
1482 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1483 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
1484 todo_wine
1485 ok(!lstrcmpW(V_BSTR(&v), L"#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1487 V_VT(&v) = VT_I4;
1488 V_I4(&v) = 3;
1489 hres = IHTMLStyle_put_lineHeight(style, v);
1490 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1492 hres = IHTMLStyle_get_lineHeight(style, &v);
1493 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1494 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1495 ok(!lstrcmpW(V_BSTR(&v), L"3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1497 V_VT(&v) = VT_BSTR;
1498 V_BSTR(&v) = SysAllocString(L"300%");
1499 hres = IHTMLStyle_put_lineHeight(style, v);
1500 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1501 VariantClear(&v);
1503 hres = IHTMLStyle_get_lineHeight(style, &v);
1504 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1505 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1506 ok(!lstrcmpW(V_BSTR(&v), L"300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1507 VariantClear(&v);
1509 b = 0xfefe;
1510 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1511 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1512 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
1514 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
1515 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1517 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1518 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1519 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
1521 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
1522 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1524 b = 0xfefe;
1525 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1526 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1527 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
1529 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
1530 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1532 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1533 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1534 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
1536 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
1537 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1539 b = 0xfefe;
1540 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1541 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1542 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
1544 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
1545 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1547 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1548 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1549 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
1551 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
1552 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1554 b = 0xfefe;
1555 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1556 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1557 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
1559 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
1560 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1562 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1563 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1564 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
1566 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
1567 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1569 b = 0xfefe;
1570 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1571 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1572 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
1574 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
1575 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1577 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1578 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1579 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1581 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1582 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1584 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1585 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1587 str = SysAllocString(L"invalid");
1588 hres = IHTMLStyle_put_textDecoration(style, str);
1589 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1590 "put_textDecoration failed: %08x\n", hres);
1591 SysFreeString(str);
1593 set_text_decoration(style, L"none");
1594 test_text_decoration(style, L"none");
1595 set_text_decoration(style, L"underline");
1596 set_text_decoration(style, L"overline");
1597 set_text_decoration(style, L"line-through");
1598 set_text_decoration(style, L"blink");
1599 set_text_decoration(style, L"overline");
1600 set_text_decoration(style, L"blink");
1601 test_text_decoration(style, L"blink");
1603 str = SysAllocString(L"invalid");
1604 hres = IHTMLStyle_put_textDecoration(style, str);
1605 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1606 "put_textDecoration failed: %08x\n", hres);
1607 SysFreeString(str);
1608 test_text_decoration(style, compat_mode < COMPAT_IE9 ? NULL : L"blink");
1610 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1611 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1612 SysFreeString(sDefault);
1614 hres = IHTMLStyle_get_posWidth(style, NULL);
1615 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1617 hres = IHTMLStyle_get_posWidth(style, &f);
1618 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1619 ok(f == 0.0f, "f = %f\n", f);
1621 V_VT(&v) = VT_EMPTY;
1622 hres = IHTMLStyle_get_width(style, &v);
1623 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1624 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1625 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1627 hres = IHTMLStyle_put_posWidth(style, 2.2);
1628 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1630 hres = IHTMLStyle_get_posWidth(style, &f);
1631 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1632 ok(f == 2.0f ||
1633 f == 2.2f, /* IE8 */
1634 "f = %f\n", f);
1636 l = 0xdeadbeef;
1637 hres = IHTMLStyle_get_pixelWidth(style, &l);
1638 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1639 ok(l == 2, "pixelWidth = %d\n", l);
1641 V_VT(&v) = VT_BSTR;
1642 V_BSTR(&v) = SysAllocString(L"auto");
1643 hres = IHTMLStyle_put_width(style, v);
1644 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1645 VariantClear(&v);
1647 V_VT(&v) = VT_EMPTY;
1648 hres = IHTMLStyle_get_width(style, &v);
1649 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1650 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1651 ok(!lstrcmpW(V_BSTR(&v), L"auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1652 VariantClear(&v);
1654 l = 0xdeadbeef;
1655 hres = IHTMLStyle_get_pixelWidth(style, &l);
1656 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1657 ok(!l, "pixelWidth = %d\n", l);
1659 V_VT(&v) = VT_I4;
1660 V_I4(&v) = 100;
1661 hres = IHTMLStyle_put_width(style, v);
1662 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1664 hres = IHTMLStyle_get_width(style, &v);
1665 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1666 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"100px" : L"auto");
1667 VariantClear(&v);
1669 l = 0xdeadbeef;
1670 hres = IHTMLStyle_get_pixelWidth(style, &l);
1671 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1672 ok(l == (compat_mode < COMPAT_IE9 ? 100 : 0), "pixelWidth = %d\n", l);
1674 V_VT(&v) = VT_EMPTY;
1675 hres = IHTMLStyle_get_width(style, &v);
1676 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1677 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1678 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"100px" : L"auto"), "V_BSTR(v)=%s\n",
1679 wine_dbgstr_w(V_BSTR(&v)));
1680 VariantClear(&v);
1682 hres = IHTMLStyle_put_pixelWidth(style, 50);
1683 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1685 l = 0xdeadbeef;
1686 hres = IHTMLStyle_get_pixelWidth(style, &l);
1687 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1688 ok(l == 50, "pixelWidth = %d\n", l);
1690 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1691 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1693 V_VT(&v) = VT_EMPTY;
1694 hres = IHTMLStyle_get_width(style, &v);
1695 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1696 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1697 ok(!lstrcmpW(V_BSTR(&v), L"50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1698 VariantClear(&v);
1700 /* margin tests */
1701 str = (void*)0xdeadbeef;
1702 hres = IHTMLStyle_get_margin(style, &str);
1703 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1704 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1706 str = SysAllocString(L"1");
1707 hres = IHTMLStyle_put_margin(style, str);
1708 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1709 SysFreeString(str);
1711 hres = IHTMLStyle_get_margin(style, &str);
1712 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1713 if(compat_mode < COMPAT_IE9)
1714 ok(!lstrcmpW(str, L"1px"), "margin = %s\n", wine_dbgstr_w(str));
1715 else
1716 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1717 SysFreeString(str);
1719 str = SysAllocString(L"2px");
1720 hres = IHTMLStyle_put_margin(style, str);
1721 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1722 SysFreeString(str);
1724 hres = IHTMLStyle_get_margin(style, &str);
1725 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1726 ok(!lstrcmpW(str, L"2px"), "margin = %s\n", wine_dbgstr_w(str));
1727 SysFreeString(str);
1729 hres = IHTMLStyle_put_margin(style, NULL);
1730 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1732 str = (void*)0xdeadbeef;
1733 hres = IHTMLStyle_get_marginTop(style, &v);
1734 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1735 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1736 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1738 V_VT(&v) = VT_BSTR;
1739 V_BSTR(&v) = SysAllocString(L"6px");
1740 hres = IHTMLStyle_put_marginTop(style, v);
1741 SysFreeString(V_BSTR(&v));
1742 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1744 str = (void*)0xdeadbeef;
1745 hres = IHTMLStyle_get_marginTop(style, &v);
1746 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1747 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1748 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1749 VariantClear(&v);
1751 V_VT(&v) = VT_I4;
1752 V_I4(&v) = 5;
1753 hres = IHTMLStyle_put_marginTop(style, v);
1754 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1756 str = (void*)0xdeadbeef;
1757 hres = IHTMLStyle_get_marginTop(style, &v);
1758 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1759 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1760 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"5px" : L"6px"),
1761 "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1762 VariantClear(&v);
1764 str = NULL;
1765 hres = IHTMLStyle_get_border(style, &str);
1766 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1767 ok(!str || !*str, "str is not empty\n");
1768 SysFreeString(str);
1770 str = SysAllocString(L"1px");
1771 hres = IHTMLStyle_put_border(style, str);
1772 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1773 SysFreeString(str);
1775 V_VT(&v) = VT_EMPTY;
1776 hres = IHTMLStyle_get_left(style, &v);
1777 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1778 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1779 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1780 VariantClear(&v);
1782 l = 0xdeadbeef;
1783 hres = IHTMLStyle_get_pixelLeft(style, &l);
1784 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1785 ok(!l, "pixelLeft = %d\n", l);
1787 /* Test posLeft */
1788 hres = IHTMLStyle_get_posLeft(style, NULL);
1789 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1791 f = 1.0f;
1792 hres = IHTMLStyle_get_posLeft(style, &f);
1793 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1794 ok(f == 0.0, "expected 0.0 got %f\n", f);
1796 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1797 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1799 hres = IHTMLStyle_get_posLeft(style, &f);
1800 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1801 ok(f == 4.0 ||
1802 f == 4.9f, /* IE8 */
1803 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1805 /* Ensure left is updated correctly. */
1806 V_VT(&v) = VT_EMPTY;
1807 hres = IHTMLStyle_get_left(style, &v);
1808 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1809 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1810 ok(!lstrcmpW(V_BSTR(&v), L"4px") ||
1811 !lstrcmpW(V_BSTR(&v), L"4.9px"), /* IE8 */
1812 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1813 VariantClear(&v);
1815 /* Test left */
1816 V_VT(&v) = VT_BSTR;
1817 V_BSTR(&v) = SysAllocString(L"3px");
1818 hres = IHTMLStyle_put_left(style, v);
1819 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1820 VariantClear(&v);
1822 hres = IHTMLStyle_get_posLeft(style, &f);
1823 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1824 ok(f == 3.0, "expected 3.0 got %f\n", f);
1826 l = 0xdeadbeef;
1827 hres = IHTMLStyle_get_pixelLeft(style, &l);
1828 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1829 ok(l == 3, "pixelLeft = %d\n", l);
1831 V_VT(&v) = VT_EMPTY;
1832 hres = IHTMLStyle_get_left(style, &v);
1833 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1834 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1835 ok(!lstrcmpW(V_BSTR(&v), L"3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1836 VariantClear(&v);
1838 V_VT(&v) = VT_BSTR;
1839 V_BSTR(&v) = SysAllocString(L"4.99");
1840 hres = IHTMLStyle_put_left(style, v);
1841 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1842 VariantClear(&v);
1844 l = 0xdeadbeef;
1845 hres = IHTMLStyle_get_pixelLeft(style, &l);
1846 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1847 ok(l == (compat_mode < COMPAT_IE9 ? 4 : 3), "pixelLeft = %d\n", l);
1849 V_VT(&v) = VT_NULL;
1850 hres = IHTMLStyle_put_left(style, v);
1851 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1853 V_VT(&v) = VT_EMPTY;
1854 hres = IHTMLStyle_get_left(style, &v);
1855 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1856 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1857 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1858 VariantClear(&v);
1860 V_VT(&v) = VT_EMPTY;
1861 hres = IHTMLStyle_get_top(style, &v);
1862 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1863 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1864 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1865 VariantClear(&v);
1867 l = 0xdeadbeef;
1868 hres = IHTMLStyle_get_pixelLeft(style, &l);
1869 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1870 ok(!l, "pixelLeft = %d\n", l);
1872 hres = IHTMLStyle_put_pixelLeft(style, 6);
1873 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1875 l = 0xdeadbeef;
1876 hres = IHTMLStyle_get_pixelLeft(style, &l);
1877 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1878 ok(l == 6, "pixelLeft = %d\n", l);
1880 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1881 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
1883 V_VT(&v) = VT_EMPTY;
1884 hres = IHTMLStyle_get_left(style, &v);
1885 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1886 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1887 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1888 VariantClear(&v);
1890 /* Test posTop */
1891 hres = IHTMLStyle_get_posTop(style, NULL);
1892 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1894 f = 1.0f;
1895 hres = IHTMLStyle_get_posTop(style, &f);
1896 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1897 ok(f == 0.0, "expected 0.0 got %f\n", f);
1899 hres = IHTMLStyle_put_posTop(style, 4.9f);
1900 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1902 hres = IHTMLStyle_get_posTop(style, &f);
1903 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1904 ok(f == 4.0 ||
1905 f == 4.9f, /* IE8 */
1906 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1908 hres = IHTMLStyle_put_pixelTop(style, 6);
1909 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1911 l = 0xdeadbeef;
1912 hres = IHTMLStyle_get_pixelTop(style, &l);
1913 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1914 ok(l == 6, "pixelTop = %d\n", l);
1916 hres = IHTMLStyle_get_pixelTop(style, NULL);
1917 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1919 V_VT(&v) = VT_BSTR;
1920 V_BSTR(&v) = SysAllocString(L"3px");
1921 hres = IHTMLStyle_put_top(style, v);
1922 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1923 VariantClear(&v);
1925 V_VT(&v) = VT_EMPTY;
1926 hres = IHTMLStyle_get_top(style, &v);
1927 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1928 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1929 ok(!lstrcmpW(V_BSTR(&v), L"3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1930 VariantClear(&v);
1932 hres = IHTMLStyle_get_posTop(style, &f);
1933 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1934 ok(f == 3.0, "expected 3.0 got %f\n", f);
1936 l = 0xdeadbeef;
1937 hres = IHTMLStyle_get_pixelTop(style, &l);
1938 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1939 ok(l == 3, "pixelTop = %d\n", l);
1941 V_VT(&v) = VT_BSTR;
1942 V_BSTR(&v) = SysAllocString(L"100%");
1943 hres = IHTMLStyle_put_top(style, v);
1944 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1945 VariantClear(&v);
1947 l = 0xdeadbeef;
1948 hres = IHTMLStyle_get_pixelTop(style, &l);
1949 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1950 ok(!l, "pixelTop = %d\n", l);
1952 V_VT(&v) = VT_NULL;
1953 hres = IHTMLStyle_put_top(style, v);
1954 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1956 V_VT(&v) = VT_EMPTY;
1957 hres = IHTMLStyle_get_top(style, &v);
1958 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1959 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1960 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1961 VariantClear(&v);
1963 l = 0xdeadbeef;
1964 hres = IHTMLStyle_get_pixelTop(style, &l);
1965 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1966 ok(!l, "pixelTop = %d\n", l);
1968 /* Test posHeight */
1969 hres = IHTMLStyle_get_posHeight(style, NULL);
1970 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1972 V_VT(&v) = VT_EMPTY;
1973 hres = IHTMLStyle_get_height(style, &v);
1974 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1975 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1976 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1977 VariantClear(&v);
1979 f = 1.0f;
1980 hres = IHTMLStyle_get_posHeight(style, &f);
1981 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1982 ok(f == 0.0, "expected 0.0 got %f\n", f);
1984 l = 0xdeadbeef;
1985 hres = IHTMLStyle_get_pixelHeight(style, &l);
1986 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1987 ok(!l, "pixelHeight = %d\n", l);
1989 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1990 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1992 hres = IHTMLStyle_get_posHeight(style, &f);
1993 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1994 ok(f == 4.0 ||
1995 f == 4.9f, /* IE8 */
1996 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1998 l = 0xdeadbeef;
1999 hres = IHTMLStyle_get_pixelHeight(style, &l);
2000 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2001 ok(l == 4 ||
2002 l == 5, /* IE8 */
2003 "pixelHeight = %d\n", l);
2005 V_VT(&v) = VT_BSTR;
2006 V_BSTR(&v) = SysAllocString(L"70px");
2007 hres = IHTMLStyle_put_height(style, v);
2008 ok(hres == S_OK, "put_height failed: %08x\n", hres);
2009 VariantClear(&v);
2011 V_VT(&v) = VT_EMPTY;
2012 hres = IHTMLStyle_get_height(style, &v);
2013 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2014 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2015 ok(!lstrcmpW(V_BSTR(&v), L"70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2016 VariantClear(&v);
2018 l = 0xdeadbeef;
2019 hres = IHTMLStyle_get_pixelHeight(style, &l);
2020 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2021 ok(l == 70, "pixelHeight = %d\n", l);
2023 V_VT(&v) = VT_BSTR;
2024 V_BSTR(&v) = SysAllocString(L"50%");
2025 hres = IHTMLStyle_put_height(style, v);
2026 ok(hres == S_OK, "put_height failed: %08x\n", hres);
2027 VariantClear(&v);
2029 l = 0xdeadbeef;
2030 hres = IHTMLStyle_get_pixelHeight(style, &l);
2031 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2032 ok(!l, "pixelHeight = %d\n", l);
2034 V_VT(&v) = VT_BSTR;
2035 V_BSTR(&v) = NULL;
2036 hres = IHTMLStyle_put_height(style, v);
2037 ok(hres == S_OK, "put_height failed: %08x\n", hres);
2038 VariantClear(&v);
2040 V_VT(&v) = VT_EMPTY;
2041 hres = IHTMLStyle_get_height(style, &v);
2042 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2043 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2044 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
2045 VariantClear(&v);
2047 l = 0xdeadbeef;
2048 hres = IHTMLStyle_get_pixelHeight(style, &l);
2049 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2050 ok(!l, "pixelHeight = %d\n", l);
2052 hres = IHTMLStyle_put_pixelHeight(style, 50);
2053 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
2055 l = 0xdeadbeef;
2056 hres = IHTMLStyle_get_pixelHeight(style, &l);
2057 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2058 ok(l == 50, "pixelHeight = %d\n", l);
2060 hres = IHTMLStyle_get_pixelHeight(style, NULL);
2061 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
2063 V_VT(&v) = VT_I4;
2064 V_I4(&v) = 64;
2065 hres = IHTMLStyle_put_height(style, v);
2066 ok(hres == S_OK, "put_height failed: %08x\n", hres);
2068 V_VT(&v) = VT_EMPTY;
2069 hres = IHTMLStyle_get_height(style, &v);
2070 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2071 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2072 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"64px" : L"50px"),
2073 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2074 VariantClear(&v);
2076 hres = IHTMLStyle_get_posHeight(style, &f);
2077 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
2078 ok(f == (compat_mode < COMPAT_IE9 ? 64.0 : 50), "expected 64.0 got %f\n", f);
2080 l = 0xdeadbeef;
2081 hres = IHTMLStyle_get_pixelHeight(style, &l);
2082 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2083 ok(l == (compat_mode < COMPAT_IE9 ? 64 : 50), "pixelHeight = %d\n", l);
2085 str = (void*)0xdeadbeef;
2086 hres = IHTMLStyle_get_cursor(style, &str);
2087 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2088 ok(!str, "get_cursor != NULL\n");
2089 SysFreeString(str);
2091 str = SysAllocString(L"default");
2092 hres = IHTMLStyle_put_cursor(style, str);
2093 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
2094 SysFreeString(str);
2096 str = NULL;
2097 hres = IHTMLStyle_get_cursor(style, &str);
2098 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2099 ok(!lstrcmpW(str, L"default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2100 SysFreeString(str);
2102 V_VT(&v) = VT_EMPTY;
2103 hres = IHTMLStyle_get_verticalAlign(style, &v);
2104 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
2105 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2106 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
2107 VariantClear(&v);
2109 V_VT(&v) = VT_BSTR;
2110 V_BSTR(&v) = SysAllocString(L"middle");
2111 hres = IHTMLStyle_put_verticalAlign(style, v);
2112 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
2113 VariantClear(&v);
2115 V_VT(&v) = VT_EMPTY;
2116 hres = IHTMLStyle_get_verticalAlign(style, &v);
2117 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2118 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2119 ok(!lstrcmpW(V_BSTR(&v), L"middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2120 VariantClear(&v);
2122 V_VT(&v) = VT_I4;
2123 V_I4(&v) = 100;
2124 hres = IHTMLStyle_put_verticalAlign(style, v);
2125 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
2126 VariantClear(&v);
2128 V_VT(&v) = VT_EMPTY;
2129 hres = IHTMLStyle_get_verticalAlign(style, &v);
2130 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2131 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2132 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"100px" : L"middle"),
2133 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2134 VariantClear(&v);
2136 str = (void*)0xdeadbeef;
2137 hres = IHTMLStyle_get_textAlign(style, &str);
2138 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2139 ok(!str, "textAlign != NULL\n");
2141 str = SysAllocString(L"center");
2142 hres = IHTMLStyle_put_textAlign(style, str);
2143 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
2144 SysFreeString(str);
2146 str = NULL;
2147 hres = IHTMLStyle_get_textAlign(style, &str);
2148 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2149 ok(!lstrcmpW(str, L"center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2150 SysFreeString(str);
2152 V_VT(&v) = VT_NULL;
2153 hres = IHTMLStyle_get_textIndent(style, &v);
2154 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2155 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
2156 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2158 V_VT(&v) = VT_I4;
2159 V_I4(&v) = 6;
2160 hres = IHTMLStyle_put_textIndent(style, v);
2161 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
2163 V_VT(&v) = VT_NULL;
2164 hres = IHTMLStyle_get_textIndent(style, &v);
2165 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2166 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
2167 if(compat_mode < COMPAT_IE9)
2168 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2169 else
2170 ok(!V_BSTR(&v), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2172 str = (void*)0xdeadbeef;
2173 hres = IHTMLStyle_get_textTransform(style, &str);
2174 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2175 ok(!str, "textTransform != NULL\n");
2177 str = SysAllocString(L"lowercase");
2178 hres = IHTMLStyle_put_textTransform(style, str);
2179 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
2180 SysFreeString(str);
2182 str = NULL;
2183 hres = IHTMLStyle_get_textTransform(style, &str);
2184 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2185 ok(!lstrcmpW(str, L"lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2186 SysFreeString(str);
2188 str = (void*)0xdeadbeef;
2189 hres = IHTMLStyle_get_filter(style, &str);
2190 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
2191 ok(!str, "filter != NULL\n");
2193 str = SysAllocString(L"alpha(opacity=100)");
2194 hres = IHTMLStyle_put_filter(style, str);
2195 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
2196 SysFreeString(str);
2198 hres = IHTMLStyle_put_filter(style, NULL);
2199 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
2201 str = (void*)0xdeadbeef;
2202 hres = IHTMLStyle_get_filter(style, &str);
2203 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
2204 ok(!str, "filter != NULL\n");
2206 V_VT(&v) = VT_EMPTY;
2207 hres = IHTMLStyle_get_zIndex(style, &v);
2208 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2209 if(compat_mode < COMPAT_IE9) {
2210 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
2211 ok(!V_I4(&v), "V_I4(v) != 0\n");
2212 }else {
2213 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2214 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2216 VariantClear(&v);
2218 if(css_style) {
2219 hres = IHTMLCSSStyleDeclaration_get_zIndex(css_style, &v);
2220 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2221 if(compat_mode < COMPAT_IE9) {
2222 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
2223 ok(!V_I4(&v), "V_I4(v) != 0\n");
2224 }else {
2225 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2226 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2230 V_VT(&v) = VT_BSTR;
2231 V_BSTR(&v) = SysAllocString(L"1");
2232 hres = IHTMLStyle_put_zIndex(style, v);
2233 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
2234 VariantClear(&v);
2236 V_VT(&v) = VT_EMPTY;
2237 hres = IHTMLStyle_get_zIndex(style, &v);
2238 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2239 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
2240 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
2241 VariantClear(&v);
2243 /* fontStyle */
2244 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
2245 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2247 str = SysAllocString(L"test");
2248 hres = IHTMLStyle_put_fontStyle(style, str);
2249 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2250 "put_fontStyle failed: %08x\n", hres);
2251 SysFreeString(str);
2253 str = SysAllocString(L"italic");
2254 hres = IHTMLStyle_put_fontStyle(style, str);
2255 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2256 SysFreeString(str);
2258 str = SysAllocString(L"oblique");
2259 hres = IHTMLStyle_put_fontStyle(style, str);
2260 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2261 SysFreeString(str);
2263 str = SysAllocString(L"normal");
2264 hres = IHTMLStyle_put_fontStyle(style, str);
2265 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2266 SysFreeString(str);
2268 hres = IHTMLStyle_put_fontStyle(style, sDefault);
2269 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2270 SysFreeString(sDefault);
2272 /* overflow */
2273 hres = IHTMLStyle_get_overflow(style, NULL);
2274 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
2276 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
2277 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2279 str = SysAllocString(L"test");
2280 hres = IHTMLStyle_put_overflow(style, str);
2281 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2282 "put_overflow failed: %08x\n", hres);
2283 SysFreeString(str);
2285 str = SysAllocString(L"visible");
2286 hres = IHTMLStyle_put_overflow(style, str);
2287 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2288 SysFreeString(str);
2290 str = SysAllocString(L"scroll");
2291 hres = IHTMLStyle_put_overflow(style, str);
2292 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2293 SysFreeString(str);
2295 str = SysAllocString(L"hidden");
2296 hres = IHTMLStyle_put_overflow(style, str);
2297 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2298 SysFreeString(str);
2300 str = SysAllocString(L"auto");
2301 hres = IHTMLStyle_put_overflow(style, str);
2302 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2303 SysFreeString(str);
2305 hres = IHTMLStyle_get_overflow(style, &str);
2306 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2307 ok(!lstrcmpW(str, L"auto"), "str=%s\n", wine_dbgstr_w(str));
2308 SysFreeString(str);
2310 str = SysAllocString(L"");
2311 hres = IHTMLStyle_put_overflow(style, str);
2312 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2313 SysFreeString(str);
2315 hres = IHTMLStyle_get_overflow(style, &str);
2316 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2317 ok(!str, "str=%s\n", wine_dbgstr_w(str));
2318 SysFreeString(str);
2320 /* restore overflow default */
2321 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
2322 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2323 SysFreeString(sOverflowDefault);
2325 /* Attribute Tests*/
2326 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
2327 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
2329 str = SysAllocString(L"position");
2330 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
2331 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
2333 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
2334 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
2335 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2336 VariantClear(&v);
2338 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
2339 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
2341 V_VT(&v) = VT_BSTR;
2342 V_BSTR(&v) = SysAllocString(L"absolute");
2343 hres = IHTMLStyle_setAttribute(style, str, v, 1);
2344 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
2345 VariantClear(&v);
2347 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
2348 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
2349 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2350 ok(!lstrcmpW(V_BSTR(&v), L"absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2351 VariantClear(&v);
2353 V_VT(&v) = VT_BSTR;
2354 V_BSTR(&v) = NULL;
2355 hres = IHTMLStyle_setAttribute(style, str, v, 1);
2356 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
2357 VariantClear(&v);
2359 SysFreeString(str);
2361 str = SysAllocString(L"borderLeftStyle");
2362 test_border_styles(style, str);
2363 SysFreeString(str);
2365 str = SysAllocString(L"borderbottomstyle");
2366 test_border_styles(style, str);
2367 SysFreeString(str);
2369 str = SysAllocString(L"borderrightstyle");
2370 test_border_styles(style, str);
2371 SysFreeString(str);
2373 str = SysAllocString(L"bordertopstyle");
2374 test_border_styles(style, str);
2375 SysFreeString(str);
2377 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
2378 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2380 str = SysAllocString(L"none dotted dashed solid");
2381 hres = IHTMLStyle_put_borderStyle(style, str);
2382 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2383 SysFreeString(str);
2385 str = SysAllocString(L"none dotted dashed solid");
2386 hres = IHTMLStyle_get_borderStyle(style, &str);
2387 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2388 ok(!lstrcmpW(str, L"none dotted dashed solid"),
2389 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
2390 SysFreeString(str);
2392 str = SysAllocString(L"double groove ridge inset");
2393 hres = IHTMLStyle_put_borderStyle(style, str);
2394 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2395 SysFreeString(str);
2397 str = SysAllocString(L"window-inset outset ridge inset");
2398 hres = IHTMLStyle_put_borderStyle(style, str);
2399 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2400 SysFreeString(str);
2402 str = SysAllocString(L"window-inset");
2403 hres = IHTMLStyle_put_borderStyle(style, str);
2404 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2405 SysFreeString(str);
2407 str = SysAllocString(L"none none none none none");
2408 hres = IHTMLStyle_put_borderStyle(style, str);
2409 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2410 SysFreeString(str);
2412 str = SysAllocString(L"invalid none none none");
2413 hres = IHTMLStyle_put_borderStyle(style, str);
2414 todo_wine_if(compat_mode >= COMPAT_IE9)
2415 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2416 "put_borderStyle failed: %08x\n", hres);
2417 SysFreeString(str);
2419 str = SysAllocString(L"none invalid none none");
2420 hres = IHTMLStyle_put_borderStyle(style, str);
2421 todo_wine_if(compat_mode >= COMPAT_IE9)
2422 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2423 "put_borderStyle failed: %08x\n", hres);
2424 SysFreeString(str);
2426 hres = IHTMLStyle_put_borderStyle(style, sDefault);
2427 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2428 SysFreeString(sDefault);
2430 /* backgroundColor */
2431 hres = IHTMLStyle_get_backgroundColor(style, &v);
2432 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
2433 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2434 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2435 VariantClear(&v);
2437 V_VT(&v) = VT_BSTR;
2438 V_BSTR(&v) = SysAllocString(L"red");
2439 hres = IHTMLStyle_put_backgroundColor(style, v);
2440 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
2441 VariantClear(&v);
2443 hres = IHTMLStyle_get_backgroundColor(style, &v);
2444 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
2445 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2446 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2447 VariantClear(&v);
2449 str = SysAllocString(L"fixed");
2450 hres = IHTMLStyle_put_backgroundAttachment(style, str);
2451 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
2452 SysFreeString(str);
2454 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
2455 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
2456 ok(!lstrcmpW(str, L"fixed"), "ret = %s\n", wine_dbgstr_w(str));
2457 SysFreeString(str);
2459 /* padding */
2460 hres = IHTMLStyle_get_padding(style, &str);
2461 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2462 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2463 SysFreeString(str);
2465 hres = IHTMLStyle_get_paddingTop(style, &v);
2466 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
2467 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2468 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2470 V_VT(&v) = VT_I4;
2471 V_I4(&v) = 6;
2472 hres = IHTMLStyle_put_paddingTop(style, v);
2473 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
2475 hres = IHTMLStyle_get_paddingTop(style, &v);
2476 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
2477 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2478 if(compat_mode < COMPAT_IE9)
2479 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2480 else
2481 ok(!V_BSTR(&v), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2482 VariantClear(&v);
2484 hres = IHTMLStyle_get_paddingRight(style, &v);
2485 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
2486 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2487 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2489 V_VT(&v) = VT_I4;
2490 V_I4(&v) = 6;
2491 hres = IHTMLStyle_put_paddingRight(style, v);
2492 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
2494 hres = IHTMLStyle_get_paddingRight(style, &v);
2495 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
2496 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2497 if(compat_mode < COMPAT_IE9)
2498 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2499 else
2500 ok(!V_BSTR(&v), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2501 VariantClear(&v);
2503 hres = IHTMLStyle_get_paddingBottom(style, &v);
2504 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2505 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2506 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2508 V_VT(&v) = VT_I4;
2509 V_I4(&v) = 6;
2510 hres = IHTMLStyle_put_paddingBottom(style, v);
2511 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
2513 hres = IHTMLStyle_get_paddingBottom(style, &v);
2514 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2515 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2516 if(compat_mode < COMPAT_IE9)
2517 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2518 else
2519 ok(!V_BSTR(&v), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2520 VariantClear(&v);
2522 str = SysAllocString(L"1");
2523 hres = IHTMLStyle_put_padding(style, str);
2524 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
2525 SysFreeString(str);
2527 hres = IHTMLStyle_get_padding(style, &str);
2528 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2529 if(compat_mode < COMPAT_IE9)
2530 ok(!lstrcmpW(str, L"1px"), "padding = %s\n", wine_dbgstr_w(str));
2531 else
2532 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2533 SysFreeString(str);
2535 /* PaddingLeft */
2536 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
2537 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2538 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
2539 if(compat_mode < COMPAT_IE9)
2540 ok(!lstrcmpW(V_BSTR(&vDefault), L"1px"), "paddingLeft = %s\n",
2541 wine_dbgstr_w(V_BSTR(&vDefault)));
2542 else
2543 ok(!V_BSTR(&vDefault), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
2545 V_VT(&v) = VT_BSTR;
2546 V_BSTR(&v) = SysAllocString(L"10");
2547 hres = IHTMLStyle_put_paddingLeft(style, v);
2548 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2549 VariantClear(&v);
2551 hres = IHTMLStyle_get_paddingLeft(style, &v);
2552 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2553 if(compat_mode < COMPAT_IE9)
2554 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2555 else
2556 ok(!V_BSTR(&v), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2557 VariantClear(&v);
2559 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
2560 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2562 /* BackgroundRepeat */
2563 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
2564 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2566 str = SysAllocString(L"invalid");
2567 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2568 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2569 "put_backgroundRepeat failed: %08x\n", hres);
2570 SysFreeString(str);
2572 str = SysAllocString(L"repeat");
2573 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2574 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2575 SysFreeString(str);
2577 str = SysAllocString(L"no-repeat");
2578 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2579 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2580 SysFreeString(str);
2582 str = SysAllocString(L"repeat-x");
2583 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2584 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2585 SysFreeString(str);
2587 str = SysAllocString(L"repeat-y");
2588 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2589 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2590 SysFreeString(str);
2592 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
2593 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2594 ok(!lstrcmpW(str, L"repeat-y"), "str=%s\n", wine_dbgstr_w(str));
2595 SysFreeString(str);
2597 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
2598 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2599 SysFreeString(sDefault);
2601 /* BorderColor */
2602 hres = IHTMLStyle_get_borderColor(style, &sDefault);
2603 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2605 str = SysAllocString(L"red green red blue");
2606 hres = IHTMLStyle_put_borderColor(style, str);
2607 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2608 SysFreeString(str);
2610 hres = IHTMLStyle_get_borderColor(style, &str);
2611 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2612 ok(!lstrcmpW(str, L"red green red blue"), "str=%s\n", wine_dbgstr_w(str));
2613 SysFreeString(str);
2615 hres = IHTMLStyle_put_borderColor(style, sDefault);
2616 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2617 SysFreeString(sDefault);
2619 /* BorderRight */
2620 hres = IHTMLStyle_get_borderRight(style, &sDefault);
2621 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
2623 str = SysAllocString(L"thick dotted red");
2624 hres = IHTMLStyle_put_borderRight(style, str);
2625 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2626 SysFreeString(str);
2628 /* IHTMLStyle_get_borderRight appears to have a bug where
2629 it returns the first letter of the color. So we check
2630 each style individually.
2632 V_BSTR(&v) = NULL;
2633 hres = IHTMLStyle_get_borderRightColor(style, &v);
2634 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2635 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2636 VariantClear(&v);
2638 V_BSTR(&v) = NULL;
2639 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2640 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2641 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2642 VariantClear(&v);
2644 hres = IHTMLStyle_get_borderRightStyle(style, &str);
2645 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2646 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2647 SysFreeString(str);
2649 hres = IHTMLStyle_put_borderRight(style, sDefault);
2650 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2651 SysFreeString(sDefault);
2653 /* BorderTop */
2654 hres = IHTMLStyle_get_borderTop(style, &sDefault);
2655 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
2657 str = SysAllocString(L"thick dotted red");
2658 hres = IHTMLStyle_put_borderTop(style, str);
2659 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2660 SysFreeString(str);
2662 /* IHTMLStyle_get_borderTop appears to have a bug where
2663 it returns the first letter of the color. So we check
2664 each style individually.
2666 V_BSTR(&v) = NULL;
2667 hres = IHTMLStyle_get_borderTopColor(style, &v);
2668 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2669 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2670 VariantClear(&v);
2672 V_BSTR(&v) = NULL;
2673 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2674 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2675 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2676 VariantClear(&v);
2678 hres = IHTMLStyle_get_borderTopStyle(style, &str);
2679 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2680 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2681 SysFreeString(str);
2683 hres = IHTMLStyle_put_borderTop(style, sDefault);
2684 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2685 SysFreeString(sDefault);
2687 /* BorderBottom */
2688 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2689 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2691 str = SysAllocString(L"thick dotted red");
2692 hres = IHTMLStyle_put_borderBottom(style, str);
2693 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2694 SysFreeString(str);
2696 /* IHTMLStyle_get_borderBottom appears to have a bug where
2697 it returns the first letter of the color. So we check
2698 each style individually.
2700 V_BSTR(&v) = NULL;
2701 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2702 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2703 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2704 VariantClear(&v);
2706 V_BSTR(&v) = NULL;
2707 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2708 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2709 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2710 VariantClear(&v);
2712 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2713 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2714 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2715 SysFreeString(str);
2717 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2718 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2719 SysFreeString(sDefault);
2721 /* BorderLeft */
2722 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2723 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2725 str = SysAllocString(L"thick dotted red");
2726 hres = IHTMLStyle_put_borderLeft(style, str);
2727 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2728 SysFreeString(str);
2730 /* IHTMLStyle_get_borderLeft appears to have a bug where
2731 it returns the first letter of the color. So we check
2732 each style individually.
2734 V_BSTR(&v) = NULL;
2735 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2736 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2737 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2738 VariantClear(&v);
2740 V_BSTR(&v) = NULL;
2741 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2742 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2743 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2744 VariantClear(&v);
2746 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2747 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2748 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2749 SysFreeString(str);
2751 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2752 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2753 SysFreeString(sDefault);
2755 /* backgroundPositionX */
2756 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2757 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2758 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2759 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2760 VariantClear(&v);
2762 if(css_style) {
2763 V_VT(&v) = VT_BSTR;
2764 V_BSTR(&v) = SysAllocString(L"11px");
2765 hres = IHTMLCSSStyleDeclaration_put_backgroundPositionX(css_style, v);
2766 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2767 VariantClear(&v);
2769 hres = IHTMLCSSStyleDeclaration_get_backgroundPositionX(css_style, &v);
2770 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2771 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2772 ok(!lstrcmpW(V_BSTR(&v), L"11px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2773 VariantClear(&v);
2776 V_VT(&v) = VT_BSTR;
2777 V_BSTR(&v) = SysAllocString(L"10px");
2778 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2779 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2780 VariantClear(&v);
2782 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2783 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2784 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2785 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2786 VariantClear(&v);
2788 /* backgroundPositionY */
2789 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2790 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2791 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2792 VariantClear(&v);
2794 V_VT(&v) = VT_BSTR;
2795 V_BSTR(&v) = SysAllocString(L"15px");
2796 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2797 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2798 VariantClear(&v);
2800 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2801 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2802 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2803 ok(!lstrcmpW(V_BSTR(&v), L"15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2804 VariantClear(&v);
2806 /* backgroundPosition */
2807 str = NULL;
2808 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2809 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2810 ok(!lstrcmpW(str, L"10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2811 SysFreeString(str);
2813 str = SysAllocString(L"center 20%");
2814 hres = IHTMLStyle_put_backgroundPosition(style, str);
2815 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2816 SysFreeString(str);
2818 str = NULL;
2819 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2820 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2821 ok(!lstrcmpW(str, L"center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2822 SysFreeString(str);
2824 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2825 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2826 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2827 ok(!lstrcmpW(V_BSTR(&v), L"center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2828 VariantClear(&v);
2830 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2831 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2832 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2833 ok(!lstrcmpW(V_BSTR(&v), L"20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2834 VariantClear(&v);
2836 if(css_style) {
2837 str = SysAllocString(L"left 21%");
2838 hres = IHTMLCSSStyleDeclaration_put_backgroundPosition(css_style, str);
2839 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2840 SysFreeString(str);
2842 str = NULL;
2843 hres = IHTMLCSSStyleDeclaration_get_backgroundPosition(css_style, &str);
2844 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2845 ok(!lstrcmpW(str, L"left 21%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2846 SysFreeString(str);
2849 /* borderTopWidth */
2850 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2851 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2853 V_VT(&v) = VT_BSTR;
2854 V_BSTR(&v) = SysAllocString(L"10px");
2855 hres = IHTMLStyle_put_borderTopWidth(style, v);
2856 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2857 VariantClear(&v);
2859 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2860 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2861 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2862 VariantClear(&v);
2864 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2865 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2866 VariantClear(&vDefault);
2868 /* borderRightWidth */
2869 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2870 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2872 V_VT(&v) = VT_BSTR;
2873 V_BSTR(&v) = SysAllocString(L"10");
2874 hres = IHTMLStyle_put_borderRightWidth(style, v);
2875 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2876 VariantClear(&v);
2878 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2879 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2880 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"10px" : L"1px"),
2881 "borderRightWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2882 VariantClear(&v);
2884 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2885 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2886 VariantClear(&vDefault);
2888 /* borderBottomWidth */
2889 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2890 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2892 V_VT(&v) = VT_BSTR;
2893 V_BSTR(&v) = SysAllocString(L"10");
2894 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2895 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2896 VariantClear(&v);
2898 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2899 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2900 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"10px" : L"1px"),
2901 "borderBottomWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2902 VariantClear(&v);
2904 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2905 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2906 VariantClear(&vDefault);
2908 /* borderLeftWidth */
2909 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2910 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2912 V_VT(&v) = VT_BSTR;
2913 V_BSTR(&v) = SysAllocString(L"10");
2914 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2915 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2916 VariantClear(&v);
2918 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2919 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2920 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"10px" : L"1px"),
2921 "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2922 VariantClear(&v);
2924 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2925 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2926 VariantClear(&vDefault);
2928 /* wordSpacing */
2929 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2930 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2932 V_VT(&v) = VT_BSTR;
2933 V_BSTR(&v) = SysAllocString(L"10");
2934 hres = IHTMLStyle_put_wordSpacing(style, v);
2935 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2936 VariantClear(&v);
2938 hres = IHTMLStyle_get_wordSpacing(style, &v);
2939 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2940 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2941 if(compat_mode < COMPAT_IE9)
2942 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2943 else
2944 ok(!V_BSTR(&v), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2945 VariantClear(&v);
2947 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2948 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2949 VariantClear(&vDefault);
2951 /* letterSpacing */
2952 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2953 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2955 V_VT(&v) = VT_BSTR;
2956 V_BSTR(&v) = SysAllocString(L"11");
2957 hres = IHTMLStyle_put_letterSpacing(style, v);
2958 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2959 VariantClear(&v);
2961 hres = IHTMLStyle_get_letterSpacing(style, &v);
2962 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2963 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2964 if(compat_mode < COMPAT_IE9)
2965 ok(!lstrcmpW(V_BSTR(&v), L"11px"), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2966 else
2967 ok(!V_BSTR(&v), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2968 VariantClear(&v);
2970 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2971 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2972 VariantClear(&vDefault);
2974 /* borderTopColor */
2975 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2976 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2978 V_VT(&v) = VT_BSTR;
2979 V_BSTR(&v) = SysAllocString(L"red");
2980 hres = IHTMLStyle_put_borderTopColor(style, v);
2981 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2982 VariantClear(&v);
2984 hres = IHTMLStyle_get_borderTopColor(style, &v);
2985 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2986 ok(!lstrcmpW(V_BSTR(&v), L"red"), "expected red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2987 VariantClear(&v);
2989 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2990 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2992 /* borderRightColor */
2993 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2994 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2996 V_VT(&v) = VT_BSTR;
2997 V_BSTR(&v) = SysAllocString(L"blue");
2998 hres = IHTMLStyle_put_borderRightColor(style, v);
2999 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
3000 VariantClear(&v);
3002 hres = IHTMLStyle_get_borderRightColor(style, &v);
3003 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
3004 ok(!lstrcmpW(V_BSTR(&v), L"blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
3005 VariantClear(&v);
3007 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
3008 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
3010 /* borderBottomColor */
3011 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
3012 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
3014 V_VT(&v) = VT_BSTR;
3015 V_BSTR(&v) = SysAllocString(L"cyan");
3016 hres = IHTMLStyle_put_borderBottomColor(style, v);
3017 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
3018 VariantClear(&v);
3020 hres = IHTMLStyle_get_borderBottomColor(style, &v);
3021 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
3022 ok(!lstrcmpW(V_BSTR(&v), L"cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
3023 VariantClear(&v);
3025 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
3026 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
3028 /* borderLeftColor */
3029 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
3030 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
3032 V_VT(&v) = VT_BSTR;
3033 V_BSTR(&v) = SysAllocString(L"cyan");
3034 hres = IHTMLStyle_put_borderLeftColor(style, v);
3035 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
3036 VariantClear(&v);
3038 hres = IHTMLStyle_get_borderLeftColor(style, &v);
3039 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
3040 ok(!lstrcmpW(V_BSTR(&v), L"cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
3041 VariantClear(&v);
3043 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
3044 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
3046 /* clip */
3047 hres = IHTMLStyle_get_clip(style, &str);
3048 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
3049 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
3051 str = SysAllocString(L"rect(0px 1px 500px 505px)");
3052 hres = IHTMLStyle_put_clip(style, str);
3053 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
3054 SysFreeString(str);
3056 hres = IHTMLStyle_get_clip(style, &str);
3057 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
3058 ok(!lstrcmpW(str, compat_mode < COMPAT_IE9 ? L"rect(0px 1px 500px 505px)" : L"rect(0px, 1px, 500px, 505px)"),
3059 "clip = %s\n", wine_dbgstr_w(str));
3060 SysFreeString(str);
3062 /* clear */
3063 hres = IHTMLStyle_get_clear(style, &str);
3064 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
3065 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
3067 str = SysAllocString(L"both");
3068 hres = IHTMLStyle_put_clear(style, str);
3069 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
3070 SysFreeString(str);
3072 hres = IHTMLStyle_get_clear(style, &str);
3073 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
3074 ok(!lstrcmpW(str, L"both"), "clear = %s\n", wine_dbgstr_w(str));
3075 SysFreeString(str);
3077 /* pageBreakAfter */
3078 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
3079 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
3080 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
3082 if(css_style) {
3083 str = SysAllocString(L"right");
3084 hres = IHTMLCSSStyleDeclaration_put_pageBreakAfter(css_style, str);
3085 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
3086 SysFreeString(str);
3088 hres = IHTMLCSSStyleDeclaration_get_pageBreakAfter(css_style, &str);
3089 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
3090 ok(!lstrcmpW(str, L"right"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
3091 SysFreeString(str);
3094 str = SysAllocString(L"always");
3095 hres = IHTMLStyle_put_pageBreakAfter(style, str);
3096 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
3097 SysFreeString(str);
3099 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
3100 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
3101 ok(!lstrcmpW(str, L"always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
3102 SysFreeString(str);
3104 /* pageBreakBefore */
3105 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
3106 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
3107 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
3109 str = SysAllocString(L"always");
3110 hres = IHTMLStyle_put_pageBreakBefore(style, str);
3111 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
3112 SysFreeString(str);
3114 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
3115 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
3116 ok(!lstrcmpW(str, L"always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
3117 SysFreeString(str);
3119 test_style_remove_attribute(style, L"pageBreakBefore", VARIANT_TRUE);
3120 test_style_remove_attribute(style, L"pageBreakBefore", VARIANT_FALSE);
3122 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
3123 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
3124 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
3126 str = (void*)0xdeadbeef;
3127 hres = IHTMLStyle_get_whiteSpace(style, &str);
3128 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3129 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
3131 str = SysAllocString(L"nowrap");
3132 hres = IHTMLStyle_put_whiteSpace(style, str);
3133 SysFreeString(str);
3134 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
3136 str = NULL;
3137 hres = IHTMLStyle_get_whiteSpace(style, &str);
3138 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3139 ok(!lstrcmpW(str, L"nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3140 SysFreeString(str);
3142 str = SysAllocString(L"normal");
3143 hres = IHTMLStyle_put_whiteSpace(style, str);
3144 SysFreeString(str);
3145 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
3147 str = NULL;
3148 hres = IHTMLStyle_get_whiteSpace(style, &str);
3149 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3150 ok(!lstrcmpW(str, L"normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3151 SysFreeString(str);
3153 /* listStyleType */
3154 hres = IHTMLStyle_get_listStyleType(style, &str);
3155 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
3156 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
3158 str = SysAllocString(L"square");
3159 hres = IHTMLStyle_put_listStyleType(style, str);
3160 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
3161 SysFreeString(str);
3163 str = NULL;
3164 hres = IHTMLStyle_get_listStyleType(style, &str);
3165 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
3166 ok(!lstrcmpW(str, L"square"), "listStyleType = %s\n", wine_dbgstr_w(str));
3168 str = SysAllocString(L"inside");
3169 hres = IHTMLStyle_put_listStylePosition(style, str);
3170 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
3171 SysFreeString(str);
3173 hres = IHTMLStyle_get_listStylePosition(style, &str);
3174 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
3175 ok(!lstrcmpW(str, L"inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
3176 SysFreeString(str);
3178 str = SysAllocString(L"decimal-leading-zero none inside");
3179 hres = IHTMLStyle_put_listStyle(style, str);
3180 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
3181 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
3182 SysFreeString(str);
3184 if (hres != E_INVALIDARG) {
3185 hres = IHTMLStyle_get_listStyle(style, &str);
3186 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
3187 ok(wcsstr(str, L"decimal-leading-zero") && wcsstr(str, L"inside"),
3188 "listStyle = %s\n", wine_dbgstr_w(str));
3189 if(compat_mode < COMPAT_IE9)
3190 ok(wcsstr(str, L"none") != NULL, "listStyle = %s\n", wine_dbgstr_w(str));
3191 else
3192 todo_wine
3193 ok(!wcsstr(str, L"none"), "listStyle = %s\n", wine_dbgstr_w(str));
3195 SysFreeString(str);
3196 } else {
3197 win_skip("IHTMLStyle_put_listStyle already failed\n");
3200 str = (void*)0xdeadbeef;
3201 hres = IHTMLStyle_get_styleFloat(style, &str);
3202 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3203 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
3205 str = SysAllocString(L"left");
3206 hres = IHTMLStyle_put_styleFloat(style, str);
3207 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
3208 SysFreeString(str);
3210 str = NULL;
3211 hres = IHTMLStyle_get_styleFloat(style, &str);
3212 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3213 ok(!lstrcmpW(str, L"left"), "styleFloat = %s\n", wine_dbgstr_w(str));
3214 SysFreeString(str);
3216 if(css_style) {
3217 str = NULL;
3218 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
3219 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
3220 ok(!lstrcmpW(str, L"left"), "cssFloat = %s\n", wine_dbgstr_w(str));
3221 SysFreeString(str);
3223 str = NULL;
3224 hres = IHTMLCSSStyleDeclaration_get_styleFloat(css_style, &str);
3225 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3226 ok(!lstrcmpW(str, L"left"), "styleFloat = %s\n", wine_dbgstr_w(str));
3227 SysFreeString(str);
3229 str = SysAllocString(L"right");
3230 hres = IHTMLCSSStyleDeclaration_put_cssFloat(css_style, str);
3231 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
3232 SysFreeString(str);
3234 str = NULL;
3235 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
3236 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
3237 ok(!lstrcmpW(str, L"right"), "styleFloat = %s\n", wine_dbgstr_w(str));
3238 SysFreeString(str);
3240 str = SysAllocString(L"left");
3241 hres = IHTMLCSSStyleDeclaration_put_styleFloat(css_style, str);
3242 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
3243 SysFreeString(str);
3245 str = NULL;
3246 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
3247 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
3248 ok(!lstrcmpW(str, L"left"), "styleFloat = %s\n", wine_dbgstr_w(str));
3249 SysFreeString(str);
3252 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
3253 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
3254 if(SUCCEEDED(hres)) {
3255 test_style2(style2);
3256 IHTMLStyle2_Release(style2);
3259 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
3260 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
3261 if(SUCCEEDED(hres)) {
3262 test_style3(style3, css_style);
3263 IHTMLStyle3_Release(style3);
3266 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
3267 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
3268 if(SUCCEEDED(hres)) {
3269 test_style4(style4);
3270 IHTMLStyle4_Release(style4);
3273 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
3274 if(SUCCEEDED(hres)) {
3275 test_style5(style5);
3276 IHTMLStyle5_Release(style5);
3277 }else {
3278 win_skip("IHTMLStyle5 not available\n");
3281 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
3282 if(SUCCEEDED(hres)) {
3283 test_style6(style6);
3284 IHTMLStyle6_Release(style6);
3285 }else {
3286 win_skip("IHTMLStyle6 not available\n");
3289 if(compat_mode >= COMPAT_IE9) {
3290 test_css_style_declaration(css_style);
3291 if(css_style2)
3292 test_css_style_declaration2(css_style2);
3295 if(css_style2)
3296 IHTMLCSSStyleDeclaration2_Release(css_style2);
3297 if(css_style)
3298 IHTMLCSSStyleDeclaration_Release(css_style);
3301 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
3302 static void _test_style_filter(unsigned line, IHTMLStyle *style, const WCHAR *exval)
3304 BSTR str;
3305 HRESULT hres;
3307 str = (void*)0xdeadbeef;
3308 hres = IHTMLStyle_get_filter(style, &str);
3309 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
3310 if(exval)
3311 ok_(__FILE__,line)(str && !wcscmp(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(exval));
3312 else
3313 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
3315 SysFreeString(str);
3318 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
3319 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const WCHAR *exval)
3321 BSTR str;
3322 HRESULT hres;
3324 str = (void*)0xdeadbeef;
3325 hres = IHTMLCurrentStyle2_get_filter(style, &str);
3326 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
3327 if(exval)
3328 ok_(__FILE__,line)(str && !lstrcmpW(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(exval));
3329 else
3330 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
3332 SysFreeString(str);
3335 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
3336 static void _set_style_filter(unsigned line, IHTMLStyle *style, const WCHAR *val)
3338 BSTR str;
3339 HRESULT hres;
3341 str = SysAllocString(val);
3342 hres = IHTMLStyle_put_filter(style, str);
3343 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
3344 SysFreeString(str);
3346 _test_style_filter(line, style, val);
3349 static void test_style_filters(IHTMLElement *elem)
3351 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
3352 IHTMLCurrentStyle2 *current_style2;
3353 IHTMLCurrentStyle *current_style;
3354 IHTMLStyle *style;
3355 HRESULT hres;
3357 hres = IHTMLElement_get_style(elem, &style);
3358 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3360 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
3361 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3363 current_style2 = get_current_style2_iface((IUnknown*)current_style);
3365 test_style_filter(style, NULL);
3366 test_current_style_filter(current_style2, NULL);
3367 set_style_filter(style, L"alpha(opacity=50.0040)");
3368 test_current_style_filter(current_style2, L"alpha(opacity=50.0040)");
3369 set_style_filter(style, L"alpha(opacity=100)");
3371 IHTMLStyle_Release(style);
3373 hres = IHTMLElement_get_style(elem, &style);
3374 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3376 test_style_filter(style, L"alpha(opacity=100)");
3377 set_style_filter(style, L"xxx(a,b,c) alpha(opacity=100)");
3378 set_style_filter(style, NULL);
3379 set_style_filter(style, L"alpha(opacity=100)");
3380 test_style_remove_attribute(style, L"filter", VARIANT_TRUE);
3381 test_style_remove_attribute(style, L"filter", VARIANT_FALSE);
3382 test_style_filter(style, NULL);
3385 IHTMLCurrentStyle2_Release(current_style2);
3386 IHTMLStyle_Release(style);
3387 IHTMLElement2_Release(elem2);
3390 static void test_current_style(IHTMLCurrentStyle *current_style)
3392 IHTMLCurrentStyle2 *current_style2;
3393 IHTMLCurrentStyle3 *current_style3;
3394 IHTMLCurrentStyle4 *current_style4;
3395 VARIANT_BOOL b;
3396 BSTR str;
3397 HRESULT hres;
3398 VARIANT v;
3400 hres = IHTMLCurrentStyle_get_display(current_style, &str);
3401 ok(hres == S_OK, "get_display failed: %08x\n", hres);
3402 ok(!lstrcmpW(str, L"block"), "get_display returned %s\n", wine_dbgstr_w(str));
3403 SysFreeString(str);
3405 hres = IHTMLCurrentStyle_get_position(current_style, &str);
3406 ok(hres == S_OK, "get_position failed: %08x\n", hres);
3407 ok(!lstrcmpW(str, L"absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
3408 SysFreeString(str);
3410 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
3411 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
3412 SysFreeString(str);
3414 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
3415 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
3416 ok(!lstrcmpW(str, L"normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
3417 SysFreeString(str);
3419 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
3420 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
3421 ok(!lstrcmpW(str, L"none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
3422 SysFreeString(str);
3424 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
3425 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
3426 ok(!lstrcmpW(str, L"normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
3427 SysFreeString(str);
3429 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
3430 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
3431 ok(!lstrcmpW(str, L"none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
3432 SysFreeString(str);
3434 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
3435 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
3436 ok(!lstrcmpW(str, L"none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
3437 SysFreeString(str);
3439 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
3440 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
3441 ok(!lstrcmpW(str, L"none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
3442 SysFreeString(str);
3444 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
3445 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
3446 ok(!lstrcmpW(str, L"none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
3447 SysFreeString(str);
3449 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
3450 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
3451 ok(!lstrcmpW(str, L"center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
3452 SysFreeString(str);
3454 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
3455 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3456 ok(!lstrcmpW(str, L"none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
3457 SysFreeString(str);
3459 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
3460 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
3461 ok(!lstrcmpW(str, L"default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
3462 SysFreeString(str);
3464 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
3465 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
3466 ok(!lstrcmpW(str, L"repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
3467 SysFreeString(str);
3469 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
3470 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
3471 SysFreeString(str);
3473 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
3474 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
3475 SysFreeString(str);
3477 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
3478 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
3479 SysFreeString(str);
3481 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
3482 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
3483 SysFreeString(str);
3485 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
3486 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
3487 SysFreeString(str);
3489 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
3490 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
3491 SysFreeString(str);
3493 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
3494 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
3495 SysFreeString(str);
3497 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
3498 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
3499 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
3500 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
3501 VariantClear(&v);
3503 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
3504 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
3505 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3506 VariantClear(&v);
3508 hres = IHTMLCurrentStyle_get_left(current_style, &v);
3509 ok(hres == S_OK, "get_left failed: %08x\n", hres);
3510 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3511 VariantClear(&v);
3513 hres = IHTMLCurrentStyle_get_top(current_style, &v);
3514 ok(hres == S_OK, "get_top failed: %08x\n", hres);
3515 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3516 VariantClear(&v);
3518 hres = IHTMLCurrentStyle_get_width(current_style, &v);
3519 ok(hres == S_OK, "get_width failed: %08x\n", hres);
3520 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3521 VariantClear(&v);
3523 hres = IHTMLCurrentStyle_get_height(current_style, &v);
3524 ok(hres == S_OK, "get_height failed: %08x\n", hres);
3525 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3526 VariantClear(&v);
3528 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
3529 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
3530 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3531 VariantClear(&v);
3533 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
3534 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
3535 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
3536 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
3537 VariantClear(&v);
3539 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
3540 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
3541 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"100px" : L"middle");
3542 VariantClear(&v);
3544 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
3545 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
3546 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3547 VariantClear(&v);
3549 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
3550 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
3551 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3552 VariantClear(&v);
3554 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
3555 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
3556 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3557 VariantClear(&v);
3559 V_BSTR(&v) = NULL;
3560 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
3561 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
3562 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3563 VariantClear(&v);
3565 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
3566 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
3567 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3568 VariantClear(&v);
3570 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
3571 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
3572 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3573 VariantClear(&v);
3575 hres = IHTMLCurrentStyle_get_color(current_style, &v);
3576 ok(hres == S_OK, "get_color failed: %08x\n", hres);
3577 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3578 VariantClear(&v);
3580 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
3581 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
3582 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3583 VariantClear(&v);
3585 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
3586 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
3587 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3588 VariantClear(&v);
3590 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
3591 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
3592 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3593 VariantClear(&v);
3595 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
3596 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
3597 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3598 VariantClear(&v);
3600 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
3601 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
3602 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3603 VariantClear(&v);
3605 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
3606 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
3607 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3608 VariantClear(&v);
3610 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
3611 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
3612 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3613 VariantClear(&v);
3615 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
3616 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
3617 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3618 VariantClear(&v);
3620 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
3621 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
3622 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3623 VariantClear(&v);
3625 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
3626 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
3627 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3628 VariantClear(&v);
3630 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
3631 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
3632 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3633 VariantClear(&v);
3635 hres = IHTMLCurrentStyle_get_right(current_style, &v);
3636 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
3637 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3638 VariantClear(&v);
3640 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
3641 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
3642 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3643 VariantClear(&v);
3645 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
3646 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
3647 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3648 VariantClear(&v);
3650 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
3651 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
3652 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3653 VariantClear(&v);
3655 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
3656 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
3657 SysFreeString(str);
3659 hres = IHTMLCurrentStyle_get_styleFloat(current_style, &str);
3660 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3661 ok(!lstrcmpW(str, L"none"), "styleFloat = %s\n", wine_dbgstr_w(str));
3662 SysFreeString(str);
3664 hres = IHTMLCurrentStyle_get_overflowX(current_style, &str);
3665 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
3666 ok(!lstrcmpW(str, L"hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
3667 SysFreeString(str);
3669 hres = IHTMLCurrentStyle_get_overflowY(current_style, &str);
3670 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
3671 ok(!lstrcmpW(str, L"hidden"), "overflowY = %s\n", wine_dbgstr_w(str));
3672 SysFreeString(str);
3674 hres = IHTMLCurrentStyle_get_direction(current_style, &str);
3675 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
3676 ok(!lstrcmpW(str, L"ltr"), "direction = %s\n", wine_dbgstr_w(str));
3677 SysFreeString(str);
3679 current_style2 = get_current_style2_iface((IUnknown*)current_style);
3681 b = 100;
3682 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
3683 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
3684 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
3686 IHTMLCurrentStyle2_Release(current_style2);
3688 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle3, (void**)&current_style3);
3689 ok(hres == S_OK, "Could not get IHTMLCurrentStyle3 iface: %08x\n", hres);
3691 hres = IHTMLCurrentStyle3_get_whiteSpace(current_style3, &str);
3692 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3693 ok(!lstrcmpW(str, L"normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3694 SysFreeString(str);
3696 IHTMLCurrentStyle3_Release(current_style3);
3698 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle4, (void**)&current_style4);
3699 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "Could not get IHTMLCurrentStyle4 iface: %08x\n", hres);
3700 if(SUCCEEDED(hres)) {
3701 hres = IHTMLCurrentStyle4_get_minWidth(current_style4, &v);
3702 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
3703 ok(V_VT(&v) == VT_BSTR, "V_VT(minWidth) = %d\n", V_VT(&v));
3704 VariantClear(&v);
3706 IHTMLCurrentStyle4_Release(current_style4);
3707 }else {
3708 win_skip("IHTMLCurrentStyle4 not supported.\n");
3712 static void basic_style_test(IHTMLDocument2 *doc)
3714 IHTMLCurrentStyle *cstyle;
3715 IHTMLElement *elem;
3716 IHTMLStyle *style;
3717 HRESULT hres;
3719 hres = IHTMLDocument2_get_body(doc, &elem);
3720 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3722 elem_set_innerhtml(elem, L"<div id=\"divid\"></div>");
3724 hres = IHTMLElement_get_style(elem, &style);
3725 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3727 test_body_style(style);
3729 cstyle = get_current_style(elem);
3730 test_current_style(cstyle);
3731 IHTMLCurrentStyle_Release(cstyle);
3732 IHTMLElement_Release(elem);
3734 elem = get_element_by_id(doc, L"divid");
3735 test_style_filters(elem);
3737 test_set_csstext(style);
3738 IHTMLStyle_Release(style);
3739 IHTMLElement_Release(elem);
3742 static const char runtimestyle_test_str[] =
3743 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
3745 static const char runtimestyle_ie9_test_str[] =
3746 "<!DOCTYPE html>\n"
3747 "<html>"
3748 " <head>"
3749 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
3750 " <style>body {text-decoration: auto}</style>"
3751 " </head>"
3752 " <body>"
3753 " </body>"
3754 "</html>";
3756 static void runtimestyle_test(IHTMLDocument2 *doc)
3758 IHTMLStyle *style, *runtime_style;
3759 IHTMLElement2 *elem2;
3760 IHTMLElement *elem;
3761 BSTR str;
3762 HRESULT hres;
3764 hres = IHTMLDocument2_get_body(doc, &elem);
3765 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3767 elem2 = get_elem2_iface((IUnknown*)elem);
3769 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
3770 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
3772 hres = IHTMLElement_get_style(elem, &style);
3773 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3775 test_text_decoration(style, NULL);
3776 test_text_decoration(runtime_style, NULL);
3777 set_text_decoration(style, L"underline");
3778 test_text_decoration(style, L"underline");
3780 hres = IHTMLStyle_get_textDecoration(style, &str);
3781 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3782 ok(broken(!str) || !lstrcmpW(str, L"underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3783 SysFreeString(str);
3785 set_text_decoration(runtime_style, L"blink");
3786 test_text_decoration(runtime_style, L"blink");
3788 hres = IHTMLStyle_get_textDecoration(style, &str);
3789 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3790 todo_wine
3791 ok(!lstrcmpW(str, L"underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3792 SysFreeString(str);
3794 IHTMLStyle_Release(runtime_style);
3795 IHTMLStyle_Release(style);
3796 IHTMLElement2_Release(elem2);
3797 IHTMLElement_Release(elem);
3800 static IHTMLDocument2 *notif_doc;
3801 static BOOL doc_complete;
3803 static IHTMLDocument2 *create_document(void)
3805 IHTMLDocument2 *doc;
3806 IHTMLDocument5 *doc5;
3807 HRESULT hres;
3809 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3810 &IID_IHTMLDocument2, (void**)&doc);
3811 #if !defined(__i386__) && !defined(__x86_64__)
3812 todo_wine
3813 #endif
3814 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3815 if(FAILED(hres))
3816 return NULL;
3818 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
3819 if(FAILED(hres)) {
3820 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3821 IHTMLDocument2_Release(doc);
3822 return NULL;
3825 IHTMLDocument5_Release(doc5);
3826 return doc;
3829 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
3830 REFIID riid, void**ppv)
3832 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3833 *ppv = iface;
3834 return S_OK;
3837 ok(0, "unexpected call\n");
3838 return E_NOINTERFACE;
3841 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
3843 return 2;
3846 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
3848 return 1;
3851 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
3853 if(dispID == DISPID_READYSTATE){
3854 BSTR state;
3855 HRESULT hres;
3857 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3858 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3860 if(!lstrcmpW(state, L"complete"))
3861 doc_complete = TRUE;
3863 SysFreeString(state);
3866 return S_OK;
3869 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
3871 ok(0, "unexpected call\n");
3872 return E_NOTIMPL;
3875 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3876 PropertyNotifySink_QueryInterface,
3877 PropertyNotifySink_AddRef,
3878 PropertyNotifySink_Release,
3879 PropertyNotifySink_OnChanged,
3880 PropertyNotifySink_OnRequestEdit
3883 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
3885 static IHTMLDocument2 *create_doc_with_string(const char *str)
3887 IPersistStreamInit *init;
3888 IStream *stream;
3889 IHTMLDocument2 *doc;
3890 HRESULT hres;
3891 HGLOBAL mem;
3892 SIZE_T len;
3894 notif_doc = doc = create_document();
3895 if(!doc)
3896 return NULL;
3898 doc_complete = FALSE;
3899 len = strlen(str);
3900 mem = GlobalAlloc(0, len);
3901 memcpy(mem, str, len);
3902 hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
3903 ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
3905 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3906 ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
3908 IPersistStreamInit_Load(init, stream);
3909 IPersistStreamInit_Release(init);
3910 IStream_Release(stream);
3912 return doc;
3915 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3917 IConnectionPointContainer *container;
3918 IConnectionPoint *cp;
3919 DWORD cookie;
3920 HRESULT hres;
3922 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3923 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3925 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3926 IConnectionPointContainer_Release(container);
3927 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3929 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3930 IConnectionPoint_Release(cp);
3931 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3934 typedef void (*style_test_t)(IHTMLDocument2*);
3936 static void run_test(const char *str, style_test_t test)
3938 IHTMLDocument2 *doc;
3939 ULONG ref;
3940 MSG msg;
3942 doc = create_doc_with_string(str);
3943 if(!doc)
3944 return;
3946 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
3948 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3949 TranslateMessage(&msg);
3950 DispatchMessageW(&msg);
3953 test(doc);
3955 ref = IHTMLDocument2_Release(doc);
3956 ok(!ref || broken(ref == 1), /* Vista */
3957 "ref = %d\n", ref);
3960 static BOOL check_ie(void)
3962 IHTMLDocument2 *doc;
3963 IHTMLDocument7 *doc7;
3964 HRESULT hres;
3966 doc = create_document();
3967 if(!doc)
3968 return FALSE;
3970 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
3971 if(SUCCEEDED(hres)) {
3972 is_ie9plus = TRUE;
3973 IHTMLDocument7_Release(doc7);
3976 trace("is_ie9plus %x\n", is_ie9plus);
3978 IHTMLDocument2_Release(doc);
3979 return TRUE;
3982 START_TEST(style)
3984 CoInitialize(NULL);
3986 if(check_ie()) {
3987 trace("Running tests in quirks mode...\n");
3988 run_test(doc_blank, basic_style_test);
3989 run_test(runtimestyle_test_str, runtimestyle_test);
3990 if(is_ie9plus) {
3991 trace("Running tests in IE9 mode...\n");
3992 compat_mode = COMPAT_IE9;
3993 run_test(doc_blank_ie9, basic_style_test);
3994 run_test(runtimestyle_ie9_test_str, runtimestyle_test);
3998 CoUninitialize();