directmanipulation: Return S_OK form viewport_SetViewportOptions stub.
[wine/zf.git] / dlls / mshtml / tests / style.c
blob69f1e61cac1a0d1cf13382312eaea5a9c1c2ce29
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);
1111 static void test_body_style(IHTMLStyle *style)
1113 IHTMLCSSStyleDeclaration *css_style;
1114 IHTMLCSSStyleDeclaration2 *css_style2 = NULL;
1115 IHTMLStyle2 *style2;
1116 IHTMLStyle3 *style3;
1117 IHTMLStyle4 *style4;
1118 IHTMLStyle5 *style5;
1119 IHTMLStyle6 *style6;
1120 VARIANT_BOOL b;
1121 VARIANT v;
1122 BSTR str;
1123 HRESULT hres;
1124 float f;
1125 BSTR sOverflowDefault;
1126 BSTR sDefault;
1127 LONG l;
1128 VARIANT vDefault;
1130 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style);
1131 ok(hres == S_OK || broken(!is_ie9plus && hres == E_NOINTERFACE),
1132 "Could not get IHTMLCSSStyleDeclaration interface: %08x\n", hres);
1134 if(css_style) {
1135 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLCSSStyleDeclaration2, (void**)&css_style2);
1136 ok(hres == S_OK || broken(hres == E_NOINTERFACE),
1137 "Could not get IHTMLCSSStyleDeclaration2 interface: %08x\n", hres);
1140 test_style_csstext(style, NULL);
1142 hres = IHTMLStyle_get_position(style, &str);
1143 ok(hres == S_OK, "get_position failed: %08x\n", hres);
1144 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1146 V_VT(&v) = VT_NULL;
1147 hres = IHTMLStyle_get_marginRight(style, &v);
1148 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1149 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1150 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1152 V_VT(&v) = VT_I4;
1153 V_I4(&v) = 6;
1154 hres = IHTMLStyle_put_marginRight(style, v);
1155 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1157 V_VT(&v) = VT_NULL;
1158 hres = IHTMLStyle_get_marginRight(style, &v);
1159 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1160 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1161 if(compat_mode < COMPAT_IE9)
1162 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1163 else
1164 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1165 VariantClear(&v);
1167 V_VT(&v) = VT_BSTR;
1168 V_BSTR(&v) = SysAllocString(L"5");
1169 hres = IHTMLStyle_put_marginRight(style, v);
1170 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1172 V_VT(&v) = VT_NULL;
1173 hres = IHTMLStyle_get_marginRight(style, &v);
1174 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1175 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1176 if(compat_mode < COMPAT_IE9)
1177 ok(!lstrcmpW(V_BSTR(&v), L"5px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1178 else
1179 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1180 VariantClear(&v);
1182 if(css_style) {
1183 V_VT(&v) = VT_NULL;
1184 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1185 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1186 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1187 if(compat_mode < COMPAT_IE9)
1188 ok(!lstrcmpW(V_BSTR(&v), L"5px"), "V_BSTR(marginRight) = %s\n",
1189 wine_dbgstr_w(V_BSTR(&v)));
1190 else
1191 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1193 V_VT(&v) = VT_I4;
1194 V_I4(&v) = 7;
1195 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
1196 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1198 V_VT(&v) = VT_NULL;
1199 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1200 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1201 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1202 if(compat_mode < COMPAT_IE9)
1203 ok(!lstrcmpW(V_BSTR(&v), L"7px"), "V_BSTR(marginRight) = %s\n",
1204 wine_dbgstr_w(V_BSTR(&v)));
1205 else
1206 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1208 V_VT(&v) = VT_BSTR;
1209 V_BSTR(&v) = SysAllocString(L"8");
1210 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
1211 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1212 SysFreeString(V_BSTR(&v));
1214 V_VT(&v) = VT_NULL;
1215 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1216 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1217 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1218 if(compat_mode < COMPAT_IE9)
1219 ok(!lstrcmpW(V_BSTR(&v), L"8px"), "V_BSTR(marginRight) = %s\n",
1220 wine_dbgstr_w(V_BSTR(&v)));
1221 else
1222 ok(!V_BSTR(&v), "mariginRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1224 V_VT(&v) = VT_BSTR;
1225 V_BSTR(&v) = SysAllocString(L"9px");
1226 hres = IHTMLCSSStyleDeclaration_put_marginRight(css_style, v);
1227 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
1228 SysFreeString(V_BSTR(&v));
1230 V_VT(&v) = VT_NULL;
1231 hres = IHTMLCSSStyleDeclaration_get_marginRight(css_style, &v);
1232 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
1233 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
1234 ok(!lstrcmpW(V_BSTR(&v), L"9px"), "V_BSTR(marginRight) = %s\n",
1235 wine_dbgstr_w(V_BSTR(&v)));
1236 SysFreeString(V_BSTR(&v));
1239 V_VT(&v) = VT_NULL;
1240 hres = IHTMLStyle_get_marginBottom(style, &v);
1241 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
1242 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
1243 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1245 V_VT(&v) = VT_I4;
1246 V_I4(&v) = 6;
1247 hres = IHTMLStyle_put_marginBottom(style, v);
1248 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
1250 V_VT(&v) = VT_NULL;
1251 hres = IHTMLStyle_get_marginBottom(style, &v);
1252 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
1253 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
1254 if(compat_mode < COMPAT_IE9)
1255 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1256 else
1257 ok(!V_BSTR(&v), "mariginBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1259 V_VT(&v) = VT_NULL;
1260 hres = IHTMLStyle_get_marginLeft(style, &v);
1261 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
1262 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
1263 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1265 V_VT(&v) = VT_I4;
1266 V_I4(&v) = 6;
1267 hres = IHTMLStyle_put_marginLeft(style, v);
1268 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
1270 V_VT(&v) = VT_NULL;
1271 hres = IHTMLStyle_get_marginLeft(style, &v);
1272 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
1273 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
1274 if(compat_mode < COMPAT_IE9)
1275 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1276 else
1277 ok(!V_BSTR(&v), "mariginLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1279 str = (void*)0xdeadbeef;
1280 hres = IHTMLStyle_get_fontFamily(style, &str);
1281 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
1282 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
1284 str = (void*)0xdeadbeef;
1285 hres = IHTMLStyle_get_fontWeight(style, &str);
1286 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1287 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
1289 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
1290 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1292 str = SysAllocString(L"test");
1293 hres = IHTMLStyle_put_fontWeight(style, str);
1294 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1295 "put_fontWeight failed: %08x\n", hres);
1296 SysFreeString(str);
1298 hres = IHTMLStyle_get_fontWeight(style, &str);
1299 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1300 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
1301 SysFreeString(str);
1303 str = SysAllocString(L"bold");
1304 hres = IHTMLStyle_put_fontWeight(style, str);
1305 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1306 SysFreeString(str);
1308 str = SysAllocString(L"bolder");
1309 hres = IHTMLStyle_put_fontWeight(style, str);
1310 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1311 SysFreeString(str);
1313 str = SysAllocString(L"lighter");
1314 hres = IHTMLStyle_put_fontWeight(style, str);
1315 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1316 SysFreeString(str);
1318 str = SysAllocString(L"100");
1319 hres = IHTMLStyle_put_fontWeight(style, str);
1320 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1321 SysFreeString(str);
1323 str = SysAllocString(L"200");
1324 hres = IHTMLStyle_put_fontWeight(style, str);
1325 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1326 SysFreeString(str);
1328 str = SysAllocString(L"300");
1329 hres = IHTMLStyle_put_fontWeight(style, str);
1330 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1331 SysFreeString(str);
1333 str = SysAllocString(L"400");
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"500");
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"600");
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"700");
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"800");
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"900");
1359 hres = IHTMLStyle_put_fontWeight(style, str);
1360 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1361 SysFreeString(str);
1363 hres = IHTMLStyle_get_fontWeight(style, &str);
1364 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1365 ok(!lstrcmpW(str, L"900"), "str != style900\n");
1366 SysFreeString(str);
1368 str = SysAllocString(L"");
1369 hres = IHTMLStyle_put_fontWeight(style, str);
1370 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1371 SysFreeString(str);
1373 hres = IHTMLStyle_get_fontWeight(style, &str);
1374 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
1375 ok(!str, "str != NULL\n");
1376 SysFreeString(str);
1378 hres = IHTMLStyle_put_fontWeight(style, sDefault);
1379 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
1380 SysFreeString(sDefault);
1382 /* font Variant */
1383 hres = IHTMLStyle_get_fontVariant(style, NULL);
1384 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
1386 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
1387 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
1389 str = SysAllocString(L"test");
1390 hres = IHTMLStyle_put_fontVariant(style, str);
1391 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1392 "fontVariant failed: %08x\n", hres);
1393 SysFreeString(str);
1395 str = SysAllocString(L"small-caps");
1396 hres = IHTMLStyle_put_fontVariant(style, str);
1397 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1398 SysFreeString(str);
1400 str = SysAllocString(L"normal");
1401 hres = IHTMLStyle_put_fontVariant(style, str);
1402 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1403 SysFreeString(str);
1405 hres = IHTMLStyle_put_fontVariant(style, sDefault);
1406 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
1407 SysFreeString(sDefault);
1409 str = (void*)0xdeadbeef;
1410 hres = IHTMLStyle_get_display(style, &str);
1411 ok(hres == S_OK, "get_display failed: %08x\n", hres);
1412 ok(!str, "display = %s\n", wine_dbgstr_w(str));
1414 str = (void*)0xdeadbeef;
1415 hres = IHTMLStyle_get_visibility(style, &str);
1416 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
1417 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
1419 V_VT(&v) = VT_NULL;
1420 hres = IHTMLStyle_get_fontSize(style, &v);
1421 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1422 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
1423 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1425 V_VT(&v) = VT_I4;
1426 V_I4(&v) = 12;
1427 hres = IHTMLStyle_put_fontSize(style, v);
1428 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
1430 V_VT(&v) = VT_NULL;
1431 hres = IHTMLStyle_get_fontSize(style, &v);
1432 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
1433 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
1434 if(compat_mode < COMPAT_IE9)
1435 ok(!lstrcmpW(V_BSTR(&v), L"12px"), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1436 else
1437 ok(!V_BSTR(&v), "fontSize = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1439 V_VT(&v) = VT_NULL;
1440 hres = IHTMLStyle_get_color(style, &v);
1441 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1442 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
1443 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1445 V_VT(&v) = VT_I4;
1446 V_I4(&v) = 0xfdfd;
1447 hres = IHTMLStyle_put_color(style, v);
1448 ok(hres == S_OK, "put_color failed: %08x\n", hres);
1450 V_VT(&v) = VT_NULL;
1451 hres = IHTMLStyle_get_color(style, &v);
1452 ok(hres == S_OK, "get_color failed: %08x\n", hres);
1453 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
1454 todo_wine
1455 ok(!lstrcmpW(V_BSTR(&v), L"#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1457 V_VT(&v) = VT_I4;
1458 V_I4(&v) = 3;
1459 hres = IHTMLStyle_put_lineHeight(style, v);
1460 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1462 hres = IHTMLStyle_get_lineHeight(style, &v);
1463 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1464 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1465 ok(!lstrcmpW(V_BSTR(&v), L"3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1467 V_VT(&v) = VT_BSTR;
1468 V_BSTR(&v) = SysAllocString(L"300%");
1469 hres = IHTMLStyle_put_lineHeight(style, v);
1470 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
1471 VariantClear(&v);
1473 hres = IHTMLStyle_get_lineHeight(style, &v);
1474 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
1475 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
1476 ok(!lstrcmpW(V_BSTR(&v), L"300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1477 VariantClear(&v);
1479 b = 0xfefe;
1480 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1481 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1482 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
1484 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
1485 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1487 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
1488 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
1489 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
1491 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
1492 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
1494 b = 0xfefe;
1495 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1496 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1497 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
1499 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
1500 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1502 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
1503 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
1504 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
1506 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
1507 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
1509 b = 0xfefe;
1510 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1511 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1512 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
1514 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
1515 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1517 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1518 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1519 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
1521 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
1522 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1524 b = 0xfefe;
1525 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1526 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1527 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
1529 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
1530 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1532 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1533 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1534 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
1536 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
1537 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1539 b = 0xfefe;
1540 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1541 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1542 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
1544 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
1545 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1547 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1548 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1549 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1551 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1552 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1554 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1555 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1557 str = SysAllocString(L"invalid");
1558 hres = IHTMLStyle_put_textDecoration(style, str);
1559 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1560 "put_textDecoration failed: %08x\n", hres);
1561 SysFreeString(str);
1563 set_text_decoration(style, L"none");
1564 test_text_decoration(style, L"none");
1565 set_text_decoration(style, L"underline");
1566 set_text_decoration(style, L"overline");
1567 set_text_decoration(style, L"line-through");
1568 set_text_decoration(style, L"blink");
1569 set_text_decoration(style, L"overline");
1570 set_text_decoration(style, L"blink");
1571 test_text_decoration(style, L"blink");
1573 str = SysAllocString(L"invalid");
1574 hres = IHTMLStyle_put_textDecoration(style, str);
1575 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
1576 "put_textDecoration failed: %08x\n", hres);
1577 SysFreeString(str);
1578 test_text_decoration(style, compat_mode < COMPAT_IE9 ? NULL : L"blink");
1580 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1581 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1582 SysFreeString(sDefault);
1584 hres = IHTMLStyle_get_posWidth(style, NULL);
1585 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1587 hres = IHTMLStyle_get_posWidth(style, &f);
1588 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1589 ok(f == 0.0f, "f = %f\n", f);
1591 V_VT(&v) = VT_EMPTY;
1592 hres = IHTMLStyle_get_width(style, &v);
1593 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1594 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1595 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1597 hres = IHTMLStyle_put_posWidth(style, 2.2);
1598 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1600 hres = IHTMLStyle_get_posWidth(style, &f);
1601 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1602 ok(f == 2.0f ||
1603 f == 2.2f, /* IE8 */
1604 "f = %f\n", f);
1606 l = 0xdeadbeef;
1607 hres = IHTMLStyle_get_pixelWidth(style, &l);
1608 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1609 ok(l == 2, "pixelWidth = %d\n", l);
1611 V_VT(&v) = VT_BSTR;
1612 V_BSTR(&v) = SysAllocString(L"auto");
1613 hres = IHTMLStyle_put_width(style, v);
1614 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1615 VariantClear(&v);
1617 V_VT(&v) = VT_EMPTY;
1618 hres = IHTMLStyle_get_width(style, &v);
1619 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1620 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1621 ok(!lstrcmpW(V_BSTR(&v), L"auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1622 VariantClear(&v);
1624 l = 0xdeadbeef;
1625 hres = IHTMLStyle_get_pixelWidth(style, &l);
1626 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1627 ok(!l, "pixelWidth = %d\n", l);
1629 V_VT(&v) = VT_I4;
1630 V_I4(&v) = 100;
1631 hres = IHTMLStyle_put_width(style, v);
1632 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1634 hres = IHTMLStyle_get_width(style, &v);
1635 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1636 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"100px" : L"auto");
1637 VariantClear(&v);
1639 l = 0xdeadbeef;
1640 hres = IHTMLStyle_get_pixelWidth(style, &l);
1641 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1642 ok(l == (compat_mode < COMPAT_IE9 ? 100 : 0), "pixelWidth = %d\n", l);
1644 V_VT(&v) = VT_EMPTY;
1645 hres = IHTMLStyle_get_width(style, &v);
1646 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1647 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1648 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"100px" : L"auto"), "V_BSTR(v)=%s\n",
1649 wine_dbgstr_w(V_BSTR(&v)));
1650 VariantClear(&v);
1652 hres = IHTMLStyle_put_pixelWidth(style, 50);
1653 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1655 l = 0xdeadbeef;
1656 hres = IHTMLStyle_get_pixelWidth(style, &l);
1657 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1658 ok(l == 50, "pixelWidth = %d\n", l);
1660 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1661 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1663 V_VT(&v) = VT_EMPTY;
1664 hres = IHTMLStyle_get_width(style, &v);
1665 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1666 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1667 ok(!lstrcmpW(V_BSTR(&v), L"50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1668 VariantClear(&v);
1670 /* margin tests */
1671 str = (void*)0xdeadbeef;
1672 hres = IHTMLStyle_get_margin(style, &str);
1673 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1674 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1676 str = SysAllocString(L"1");
1677 hres = IHTMLStyle_put_margin(style, str);
1678 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1679 SysFreeString(str);
1681 hres = IHTMLStyle_get_margin(style, &str);
1682 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1683 if(compat_mode < COMPAT_IE9)
1684 ok(!lstrcmpW(str, L"1px"), "margin = %s\n", wine_dbgstr_w(str));
1685 else
1686 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1687 SysFreeString(str);
1689 str = SysAllocString(L"2px");
1690 hres = IHTMLStyle_put_margin(style, str);
1691 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1692 SysFreeString(str);
1694 hres = IHTMLStyle_get_margin(style, &str);
1695 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1696 ok(!lstrcmpW(str, L"2px"), "margin = %s\n", wine_dbgstr_w(str));
1697 SysFreeString(str);
1699 hres = IHTMLStyle_put_margin(style, NULL);
1700 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1702 str = (void*)0xdeadbeef;
1703 hres = IHTMLStyle_get_marginTop(style, &v);
1704 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1705 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1706 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1708 V_VT(&v) = VT_BSTR;
1709 V_BSTR(&v) = SysAllocString(L"6px");
1710 hres = IHTMLStyle_put_marginTop(style, v);
1711 SysFreeString(V_BSTR(&v));
1712 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1714 str = (void*)0xdeadbeef;
1715 hres = IHTMLStyle_get_marginTop(style, &v);
1716 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1717 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1718 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1719 VariantClear(&v);
1721 V_VT(&v) = VT_I4;
1722 V_I4(&v) = 5;
1723 hres = IHTMLStyle_put_marginTop(style, v);
1724 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1726 str = (void*)0xdeadbeef;
1727 hres = IHTMLStyle_get_marginTop(style, &v);
1728 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1729 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1730 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"5px" : L"6px"),
1731 "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1732 VariantClear(&v);
1734 str = NULL;
1735 hres = IHTMLStyle_get_border(style, &str);
1736 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1737 ok(!str || !*str, "str is not empty\n");
1738 SysFreeString(str);
1740 str = SysAllocString(L"1px");
1741 hres = IHTMLStyle_put_border(style, str);
1742 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1743 SysFreeString(str);
1745 V_VT(&v) = VT_EMPTY;
1746 hres = IHTMLStyle_get_left(style, &v);
1747 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1748 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1749 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1750 VariantClear(&v);
1752 l = 0xdeadbeef;
1753 hres = IHTMLStyle_get_pixelLeft(style, &l);
1754 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1755 ok(!l, "pixelLeft = %d\n", l);
1757 /* Test posLeft */
1758 hres = IHTMLStyle_get_posLeft(style, NULL);
1759 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1761 f = 1.0f;
1762 hres = IHTMLStyle_get_posLeft(style, &f);
1763 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1764 ok(f == 0.0, "expected 0.0 got %f\n", f);
1766 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1767 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1769 hres = IHTMLStyle_get_posLeft(style, &f);
1770 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1771 ok(f == 4.0 ||
1772 f == 4.9f, /* IE8 */
1773 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1775 /* Ensure left is updated correctly. */
1776 V_VT(&v) = VT_EMPTY;
1777 hres = IHTMLStyle_get_left(style, &v);
1778 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1779 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1780 ok(!lstrcmpW(V_BSTR(&v), L"4px") ||
1781 !lstrcmpW(V_BSTR(&v), L"4.9px"), /* IE8 */
1782 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1783 VariantClear(&v);
1785 /* Test left */
1786 V_VT(&v) = VT_BSTR;
1787 V_BSTR(&v) = SysAllocString(L"3px");
1788 hres = IHTMLStyle_put_left(style, v);
1789 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1790 VariantClear(&v);
1792 hres = IHTMLStyle_get_posLeft(style, &f);
1793 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1794 ok(f == 3.0, "expected 3.0 got %f\n", f);
1796 l = 0xdeadbeef;
1797 hres = IHTMLStyle_get_pixelLeft(style, &l);
1798 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1799 ok(l == 3, "pixelLeft = %d\n", l);
1801 V_VT(&v) = VT_EMPTY;
1802 hres = IHTMLStyle_get_left(style, &v);
1803 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1804 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1805 ok(!lstrcmpW(V_BSTR(&v), L"3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1806 VariantClear(&v);
1808 V_VT(&v) = VT_BSTR;
1809 V_BSTR(&v) = SysAllocString(L"4.99");
1810 hres = IHTMLStyle_put_left(style, v);
1811 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1812 VariantClear(&v);
1814 l = 0xdeadbeef;
1815 hres = IHTMLStyle_get_pixelLeft(style, &l);
1816 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1817 ok(l == (compat_mode < COMPAT_IE9 ? 4 : 3), "pixelLeft = %d\n", l);
1819 V_VT(&v) = VT_NULL;
1820 hres = IHTMLStyle_put_left(style, v);
1821 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1823 V_VT(&v) = VT_EMPTY;
1824 hres = IHTMLStyle_get_left(style, &v);
1825 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1826 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1827 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1828 VariantClear(&v);
1830 V_VT(&v) = VT_EMPTY;
1831 hres = IHTMLStyle_get_top(style, &v);
1832 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1833 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1834 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1835 VariantClear(&v);
1837 l = 0xdeadbeef;
1838 hres = IHTMLStyle_get_pixelLeft(style, &l);
1839 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1840 ok(!l, "pixelLeft = %d\n", l);
1842 hres = IHTMLStyle_put_pixelLeft(style, 6);
1843 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1845 l = 0xdeadbeef;
1846 hres = IHTMLStyle_get_pixelLeft(style, &l);
1847 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1848 ok(l == 6, "pixelLeft = %d\n", l);
1850 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1851 ok(hres == E_POINTER, "get_pixelLeft 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(!lstrcmpW(V_BSTR(&v), L"6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1858 VariantClear(&v);
1860 /* Test posTop */
1861 hres = IHTMLStyle_get_posTop(style, NULL);
1862 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1864 f = 1.0f;
1865 hres = IHTMLStyle_get_posTop(style, &f);
1866 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1867 ok(f == 0.0, "expected 0.0 got %f\n", f);
1869 hres = IHTMLStyle_put_posTop(style, 4.9f);
1870 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1872 hres = IHTMLStyle_get_posTop(style, &f);
1873 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1874 ok(f == 4.0 ||
1875 f == 4.9f, /* IE8 */
1876 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1878 hres = IHTMLStyle_put_pixelTop(style, 6);
1879 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1881 l = 0xdeadbeef;
1882 hres = IHTMLStyle_get_pixelTop(style, &l);
1883 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1884 ok(l == 6, "pixelTop = %d\n", l);
1886 hres = IHTMLStyle_get_pixelTop(style, NULL);
1887 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1889 V_VT(&v) = VT_BSTR;
1890 V_BSTR(&v) = SysAllocString(L"3px");
1891 hres = IHTMLStyle_put_top(style, v);
1892 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1893 VariantClear(&v);
1895 V_VT(&v) = VT_EMPTY;
1896 hres = IHTMLStyle_get_top(style, &v);
1897 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1898 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1899 ok(!lstrcmpW(V_BSTR(&v), L"3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1900 VariantClear(&v);
1902 hres = IHTMLStyle_get_posTop(style, &f);
1903 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1904 ok(f == 3.0, "expected 3.0 got %f\n", f);
1906 l = 0xdeadbeef;
1907 hres = IHTMLStyle_get_pixelTop(style, &l);
1908 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1909 ok(l == 3, "pixelTop = %d\n", l);
1911 V_VT(&v) = VT_BSTR;
1912 V_BSTR(&v) = SysAllocString(L"100%");
1913 hres = IHTMLStyle_put_top(style, v);
1914 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1915 VariantClear(&v);
1917 l = 0xdeadbeef;
1918 hres = IHTMLStyle_get_pixelTop(style, &l);
1919 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1920 ok(!l, "pixelTop = %d\n", l);
1922 V_VT(&v) = VT_NULL;
1923 hres = IHTMLStyle_put_top(style, v);
1924 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1926 V_VT(&v) = VT_EMPTY;
1927 hres = IHTMLStyle_get_top(style, &v);
1928 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1929 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1930 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1931 VariantClear(&v);
1933 l = 0xdeadbeef;
1934 hres = IHTMLStyle_get_pixelTop(style, &l);
1935 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1936 ok(!l, "pixelTop = %d\n", l);
1938 /* Test posHeight */
1939 hres = IHTMLStyle_get_posHeight(style, NULL);
1940 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1942 V_VT(&v) = VT_EMPTY;
1943 hres = IHTMLStyle_get_height(style, &v);
1944 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1945 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1946 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1947 VariantClear(&v);
1949 f = 1.0f;
1950 hres = IHTMLStyle_get_posHeight(style, &f);
1951 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1952 ok(f == 0.0, "expected 0.0 got %f\n", f);
1954 l = 0xdeadbeef;
1955 hres = IHTMLStyle_get_pixelHeight(style, &l);
1956 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1957 ok(!l, "pixelHeight = %d\n", l);
1959 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1960 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1962 hres = IHTMLStyle_get_posHeight(style, &f);
1963 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1964 ok(f == 4.0 ||
1965 f == 4.9f, /* IE8 */
1966 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1968 l = 0xdeadbeef;
1969 hres = IHTMLStyle_get_pixelHeight(style, &l);
1970 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1971 ok(l == 4 ||
1972 l == 5, /* IE8 */
1973 "pixelHeight = %d\n", l);
1975 V_VT(&v) = VT_BSTR;
1976 V_BSTR(&v) = SysAllocString(L"70px");
1977 hres = IHTMLStyle_put_height(style, v);
1978 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1979 VariantClear(&v);
1981 V_VT(&v) = VT_EMPTY;
1982 hres = IHTMLStyle_get_height(style, &v);
1983 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1984 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1985 ok(!lstrcmpW(V_BSTR(&v), L"70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1986 VariantClear(&v);
1988 l = 0xdeadbeef;
1989 hres = IHTMLStyle_get_pixelHeight(style, &l);
1990 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1991 ok(l == 70, "pixelHeight = %d\n", l);
1993 V_VT(&v) = VT_BSTR;
1994 V_BSTR(&v) = SysAllocString(L"50%");
1995 hres = IHTMLStyle_put_height(style, v);
1996 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1997 VariantClear(&v);
1999 l = 0xdeadbeef;
2000 hres = IHTMLStyle_get_pixelHeight(style, &l);
2001 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2002 ok(!l, "pixelHeight = %d\n", l);
2004 V_VT(&v) = VT_BSTR;
2005 V_BSTR(&v) = NULL;
2006 hres = IHTMLStyle_put_height(style, v);
2007 ok(hres == S_OK, "put_height failed: %08x\n", hres);
2008 VariantClear(&v);
2010 V_VT(&v) = VT_EMPTY;
2011 hres = IHTMLStyle_get_height(style, &v);
2012 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2013 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2014 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
2015 VariantClear(&v);
2017 l = 0xdeadbeef;
2018 hres = IHTMLStyle_get_pixelHeight(style, &l);
2019 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2020 ok(!l, "pixelHeight = %d\n", l);
2022 hres = IHTMLStyle_put_pixelHeight(style, 50);
2023 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
2025 l = 0xdeadbeef;
2026 hres = IHTMLStyle_get_pixelHeight(style, &l);
2027 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2028 ok(l == 50, "pixelHeight = %d\n", l);
2030 hres = IHTMLStyle_get_pixelHeight(style, NULL);
2031 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
2033 V_VT(&v) = VT_I4;
2034 V_I4(&v) = 64;
2035 hres = IHTMLStyle_put_height(style, v);
2036 ok(hres == S_OK, "put_height failed: %08x\n", hres);
2038 V_VT(&v) = VT_EMPTY;
2039 hres = IHTMLStyle_get_height(style, &v);
2040 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2041 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2042 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"64px" : L"50px"),
2043 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2044 VariantClear(&v);
2046 hres = IHTMLStyle_get_posHeight(style, &f);
2047 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
2048 ok(f == (compat_mode < COMPAT_IE9 ? 64.0 : 50), "expected 64.0 got %f\n", f);
2050 l = 0xdeadbeef;
2051 hres = IHTMLStyle_get_pixelHeight(style, &l);
2052 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
2053 ok(l == (compat_mode < COMPAT_IE9 ? 64 : 50), "pixelHeight = %d\n", l);
2055 str = (void*)0xdeadbeef;
2056 hres = IHTMLStyle_get_cursor(style, &str);
2057 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2058 ok(!str, "get_cursor != NULL\n");
2059 SysFreeString(str);
2061 str = SysAllocString(L"default");
2062 hres = IHTMLStyle_put_cursor(style, str);
2063 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
2064 SysFreeString(str);
2066 str = NULL;
2067 hres = IHTMLStyle_get_cursor(style, &str);
2068 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2069 ok(!lstrcmpW(str, L"default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2070 SysFreeString(str);
2072 V_VT(&v) = VT_EMPTY;
2073 hres = IHTMLStyle_get_verticalAlign(style, &v);
2074 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
2075 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2076 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
2077 VariantClear(&v);
2079 V_VT(&v) = VT_BSTR;
2080 V_BSTR(&v) = SysAllocString(L"middle");
2081 hres = IHTMLStyle_put_verticalAlign(style, v);
2082 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
2083 VariantClear(&v);
2085 V_VT(&v) = VT_EMPTY;
2086 hres = IHTMLStyle_get_verticalAlign(style, &v);
2087 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2088 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2089 ok(!lstrcmpW(V_BSTR(&v), L"middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2090 VariantClear(&v);
2092 V_VT(&v) = VT_I4;
2093 V_I4(&v) = 100;
2094 hres = IHTMLStyle_put_verticalAlign(style, v);
2095 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
2096 VariantClear(&v);
2098 V_VT(&v) = VT_EMPTY;
2099 hres = IHTMLStyle_get_verticalAlign(style, &v);
2100 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2101 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2102 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"100px" : L"middle"),
2103 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2104 VariantClear(&v);
2106 str = (void*)0xdeadbeef;
2107 hres = IHTMLStyle_get_textAlign(style, &str);
2108 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2109 ok(!str, "textAlign != NULL\n");
2111 str = SysAllocString(L"center");
2112 hres = IHTMLStyle_put_textAlign(style, str);
2113 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
2114 SysFreeString(str);
2116 str = NULL;
2117 hres = IHTMLStyle_get_textAlign(style, &str);
2118 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2119 ok(!lstrcmpW(str, L"center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2120 SysFreeString(str);
2122 V_VT(&v) = VT_NULL;
2123 hres = IHTMLStyle_get_textIndent(style, &v);
2124 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2125 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
2126 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2128 V_VT(&v) = VT_I4;
2129 V_I4(&v) = 6;
2130 hres = IHTMLStyle_put_textIndent(style, v);
2131 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
2133 V_VT(&v) = VT_NULL;
2134 hres = IHTMLStyle_get_textIndent(style, &v);
2135 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2136 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
2137 if(compat_mode < COMPAT_IE9)
2138 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2139 else
2140 ok(!V_BSTR(&v), "textIndent = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2142 str = (void*)0xdeadbeef;
2143 hres = IHTMLStyle_get_textTransform(style, &str);
2144 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2145 ok(!str, "textTransform != NULL\n");
2147 str = SysAllocString(L"lowercase");
2148 hres = IHTMLStyle_put_textTransform(style, str);
2149 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
2150 SysFreeString(str);
2152 str = NULL;
2153 hres = IHTMLStyle_get_textTransform(style, &str);
2154 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2155 ok(!lstrcmpW(str, L"lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2156 SysFreeString(str);
2158 str = (void*)0xdeadbeef;
2159 hres = IHTMLStyle_get_filter(style, &str);
2160 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
2161 ok(!str, "filter != NULL\n");
2163 str = SysAllocString(L"alpha(opacity=100)");
2164 hres = IHTMLStyle_put_filter(style, str);
2165 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
2166 SysFreeString(str);
2168 hres = IHTMLStyle_put_filter(style, NULL);
2169 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
2171 str = (void*)0xdeadbeef;
2172 hres = IHTMLStyle_get_filter(style, &str);
2173 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
2174 ok(!str, "filter != NULL\n");
2176 V_VT(&v) = VT_EMPTY;
2177 hres = IHTMLStyle_get_zIndex(style, &v);
2178 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2179 if(compat_mode < COMPAT_IE9) {
2180 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
2181 ok(!V_I4(&v), "V_I4(v) != 0\n");
2182 }else {
2183 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2184 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2186 VariantClear(&v);
2188 if(css_style) {
2189 hres = IHTMLCSSStyleDeclaration_get_zIndex(css_style, &v);
2190 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2191 if(compat_mode < COMPAT_IE9) {
2192 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
2193 ok(!V_I4(&v), "V_I4(v) != 0\n");
2194 }else {
2195 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2196 ok(!V_BSTR(&v), "zIndex = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2200 V_VT(&v) = VT_BSTR;
2201 V_BSTR(&v) = SysAllocString(L"1");
2202 hres = IHTMLStyle_put_zIndex(style, v);
2203 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
2204 VariantClear(&v);
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 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
2210 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
2211 VariantClear(&v);
2213 /* fontStyle */
2214 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
2215 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2217 str = SysAllocString(L"test");
2218 hres = IHTMLStyle_put_fontStyle(style, str);
2219 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2220 "put_fontStyle failed: %08x\n", hres);
2221 SysFreeString(str);
2223 str = SysAllocString(L"italic");
2224 hres = IHTMLStyle_put_fontStyle(style, str);
2225 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2226 SysFreeString(str);
2228 str = SysAllocString(L"oblique");
2229 hres = IHTMLStyle_put_fontStyle(style, str);
2230 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2231 SysFreeString(str);
2233 str = SysAllocString(L"normal");
2234 hres = IHTMLStyle_put_fontStyle(style, str);
2235 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2236 SysFreeString(str);
2238 hres = IHTMLStyle_put_fontStyle(style, sDefault);
2239 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
2240 SysFreeString(sDefault);
2242 /* overflow */
2243 hres = IHTMLStyle_get_overflow(style, NULL);
2244 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
2246 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
2247 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2249 str = SysAllocString(L"test");
2250 hres = IHTMLStyle_put_overflow(style, str);
2251 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2252 "put_overflow failed: %08x\n", hres);
2253 SysFreeString(str);
2255 str = SysAllocString(L"visible");
2256 hres = IHTMLStyle_put_overflow(style, str);
2257 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2258 SysFreeString(str);
2260 str = SysAllocString(L"scroll");
2261 hres = IHTMLStyle_put_overflow(style, str);
2262 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2263 SysFreeString(str);
2265 str = SysAllocString(L"hidden");
2266 hres = IHTMLStyle_put_overflow(style, str);
2267 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2268 SysFreeString(str);
2270 str = SysAllocString(L"auto");
2271 hres = IHTMLStyle_put_overflow(style, str);
2272 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2273 SysFreeString(str);
2275 hres = IHTMLStyle_get_overflow(style, &str);
2276 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2277 ok(!lstrcmpW(str, L"auto"), "str=%s\n", wine_dbgstr_w(str));
2278 SysFreeString(str);
2280 str = SysAllocString(L"");
2281 hres = IHTMLStyle_put_overflow(style, str);
2282 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2283 SysFreeString(str);
2285 hres = IHTMLStyle_get_overflow(style, &str);
2286 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2287 ok(!str, "str=%s\n", wine_dbgstr_w(str));
2288 SysFreeString(str);
2290 /* restore overflow default */
2291 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
2292 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
2293 SysFreeString(sOverflowDefault);
2295 /* Attribute Tests*/
2296 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
2297 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
2299 str = SysAllocString(L"position");
2300 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
2301 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
2303 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
2304 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
2305 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2306 VariantClear(&v);
2308 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
2309 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
2311 V_VT(&v) = VT_BSTR;
2312 V_BSTR(&v) = SysAllocString(L"absolute");
2313 hres = IHTMLStyle_setAttribute(style, str, v, 1);
2314 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
2315 VariantClear(&v);
2317 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
2318 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
2319 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2320 ok(!lstrcmpW(V_BSTR(&v), L"absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2321 VariantClear(&v);
2323 V_VT(&v) = VT_BSTR;
2324 V_BSTR(&v) = NULL;
2325 hres = IHTMLStyle_setAttribute(style, str, v, 1);
2326 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
2327 VariantClear(&v);
2329 SysFreeString(str);
2331 str = SysAllocString(L"borderLeftStyle");
2332 test_border_styles(style, str);
2333 SysFreeString(str);
2335 str = SysAllocString(L"borderbottomstyle");
2336 test_border_styles(style, str);
2337 SysFreeString(str);
2339 str = SysAllocString(L"borderrightstyle");
2340 test_border_styles(style, str);
2341 SysFreeString(str);
2343 str = SysAllocString(L"bordertopstyle");
2344 test_border_styles(style, str);
2345 SysFreeString(str);
2347 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
2348 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2350 str = SysAllocString(L"none dotted dashed solid");
2351 hres = IHTMLStyle_put_borderStyle(style, str);
2352 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2353 SysFreeString(str);
2355 str = SysAllocString(L"none dotted dashed solid");
2356 hres = IHTMLStyle_get_borderStyle(style, &str);
2357 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2358 ok(!lstrcmpW(str, L"none dotted dashed solid"),
2359 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
2360 SysFreeString(str);
2362 str = SysAllocString(L"double groove ridge inset");
2363 hres = IHTMLStyle_put_borderStyle(style, str);
2364 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2365 SysFreeString(str);
2367 str = SysAllocString(L"window-inset outset ridge inset");
2368 hres = IHTMLStyle_put_borderStyle(style, str);
2369 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2370 SysFreeString(str);
2372 str = SysAllocString(L"window-inset");
2373 hres = IHTMLStyle_put_borderStyle(style, str);
2374 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2375 SysFreeString(str);
2377 str = SysAllocString(L"none none none none none");
2378 hres = IHTMLStyle_put_borderStyle(style, str);
2379 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2380 SysFreeString(str);
2382 str = SysAllocString(L"invalid none none none");
2383 hres = IHTMLStyle_put_borderStyle(style, str);
2384 todo_wine_if(compat_mode >= COMPAT_IE9)
2385 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2386 "put_borderStyle failed: %08x\n", hres);
2387 SysFreeString(str);
2389 str = SysAllocString(L"none invalid none none");
2390 hres = IHTMLStyle_put_borderStyle(style, str);
2391 todo_wine_if(compat_mode >= COMPAT_IE9)
2392 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2393 "put_borderStyle failed: %08x\n", hres);
2394 SysFreeString(str);
2396 hres = IHTMLStyle_put_borderStyle(style, sDefault);
2397 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
2398 SysFreeString(sDefault);
2400 /* backgroundColor */
2401 hres = IHTMLStyle_get_backgroundColor(style, &v);
2402 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
2403 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2404 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2405 VariantClear(&v);
2407 V_VT(&v) = VT_BSTR;
2408 V_BSTR(&v) = SysAllocString(L"red");
2409 hres = IHTMLStyle_put_backgroundColor(style, v);
2410 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
2411 VariantClear(&v);
2413 hres = IHTMLStyle_get_backgroundColor(style, &v);
2414 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
2415 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
2416 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2417 VariantClear(&v);
2419 str = SysAllocString(L"fixed");
2420 hres = IHTMLStyle_put_backgroundAttachment(style, str);
2421 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
2422 SysFreeString(str);
2424 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
2425 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
2426 ok(!lstrcmpW(str, L"fixed"), "ret = %s\n", wine_dbgstr_w(str));
2427 SysFreeString(str);
2429 /* padding */
2430 hres = IHTMLStyle_get_padding(style, &str);
2431 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2432 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2433 SysFreeString(str);
2435 hres = IHTMLStyle_get_paddingTop(style, &v);
2436 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
2437 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2438 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2440 V_VT(&v) = VT_I4;
2441 V_I4(&v) = 6;
2442 hres = IHTMLStyle_put_paddingTop(style, v);
2443 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
2445 hres = IHTMLStyle_get_paddingTop(style, &v);
2446 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
2447 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2448 if(compat_mode < COMPAT_IE9)
2449 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2450 else
2451 ok(!V_BSTR(&v), "paddingTop = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2452 VariantClear(&v);
2454 hres = IHTMLStyle_get_paddingRight(style, &v);
2455 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
2456 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2457 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2459 V_VT(&v) = VT_I4;
2460 V_I4(&v) = 6;
2461 hres = IHTMLStyle_put_paddingRight(style, v);
2462 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
2464 hres = IHTMLStyle_get_paddingRight(style, &v);
2465 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
2466 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2467 if(compat_mode < COMPAT_IE9)
2468 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2469 else
2470 ok(!V_BSTR(&v), "paddingRight = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2471 VariantClear(&v);
2473 hres = IHTMLStyle_get_paddingBottom(style, &v);
2474 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2475 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2476 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2478 V_VT(&v) = VT_I4;
2479 V_I4(&v) = 6;
2480 hres = IHTMLStyle_put_paddingBottom(style, v);
2481 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
2483 hres = IHTMLStyle_get_paddingBottom(style, &v);
2484 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
2485 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2486 if(compat_mode < COMPAT_IE9)
2487 ok(!lstrcmpW(V_BSTR(&v), L"6px"), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2488 else
2489 ok(!V_BSTR(&v), "paddingBottom = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2490 VariantClear(&v);
2492 str = SysAllocString(L"1");
2493 hres = IHTMLStyle_put_padding(style, str);
2494 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
2495 SysFreeString(str);
2497 hres = IHTMLStyle_get_padding(style, &str);
2498 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2499 if(compat_mode < COMPAT_IE9)
2500 ok(!lstrcmpW(str, L"1px"), "padding = %s\n", wine_dbgstr_w(str));
2501 else
2502 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
2503 SysFreeString(str);
2505 /* PaddingLeft */
2506 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
2507 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2508 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
2509 if(compat_mode < COMPAT_IE9)
2510 ok(!lstrcmpW(V_BSTR(&vDefault), L"1px"), "paddingLeft = %s\n",
2511 wine_dbgstr_w(V_BSTR(&vDefault)));
2512 else
2513 ok(!V_BSTR(&vDefault), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
2515 V_VT(&v) = VT_BSTR;
2516 V_BSTR(&v) = SysAllocString(L"10");
2517 hres = IHTMLStyle_put_paddingLeft(style, v);
2518 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2519 VariantClear(&v);
2521 hres = IHTMLStyle_get_paddingLeft(style, &v);
2522 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
2523 if(compat_mode < COMPAT_IE9)
2524 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2525 else
2526 ok(!V_BSTR(&v), "paddingLeft = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2527 VariantClear(&v);
2529 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
2530 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
2532 /* BackgroundRepeat */
2533 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
2534 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2536 str = SysAllocString(L"invalid");
2537 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2538 ok(hres == (compat_mode < COMPAT_IE9 ? E_INVALIDARG : S_OK),
2539 "put_backgroundRepeat failed: %08x\n", hres);
2540 SysFreeString(str);
2542 str = SysAllocString(L"repeat");
2543 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2544 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2545 SysFreeString(str);
2547 str = SysAllocString(L"no-repeat");
2548 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2549 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2550 SysFreeString(str);
2552 str = SysAllocString(L"repeat-x");
2553 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2554 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2555 SysFreeString(str);
2557 str = SysAllocString(L"repeat-y");
2558 hres = IHTMLStyle_put_backgroundRepeat(style, str);
2559 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2560 SysFreeString(str);
2562 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
2563 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2564 ok(!lstrcmpW(str, L"repeat-y"), "str=%s\n", wine_dbgstr_w(str));
2565 SysFreeString(str);
2567 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
2568 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
2569 SysFreeString(sDefault);
2571 /* BorderColor */
2572 hres = IHTMLStyle_get_borderColor(style, &sDefault);
2573 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2575 str = SysAllocString(L"red green red blue");
2576 hres = IHTMLStyle_put_borderColor(style, str);
2577 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2578 SysFreeString(str);
2580 hres = IHTMLStyle_get_borderColor(style, &str);
2581 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2582 ok(!lstrcmpW(str, L"red green red blue"), "str=%s\n", wine_dbgstr_w(str));
2583 SysFreeString(str);
2585 hres = IHTMLStyle_put_borderColor(style, sDefault);
2586 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
2587 SysFreeString(sDefault);
2589 /* BorderRight */
2590 hres = IHTMLStyle_get_borderRight(style, &sDefault);
2591 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
2593 str = SysAllocString(L"thick dotted red");
2594 hres = IHTMLStyle_put_borderRight(style, str);
2595 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2596 SysFreeString(str);
2598 /* IHTMLStyle_get_borderRight appears to have a bug where
2599 it returns the first letter of the color. So we check
2600 each style individually.
2602 V_BSTR(&v) = NULL;
2603 hres = IHTMLStyle_get_borderRightColor(style, &v);
2604 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2605 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2606 VariantClear(&v);
2608 V_BSTR(&v) = NULL;
2609 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2610 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2611 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2612 VariantClear(&v);
2614 hres = IHTMLStyle_get_borderRightStyle(style, &str);
2615 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2616 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2617 SysFreeString(str);
2619 hres = IHTMLStyle_put_borderRight(style, sDefault);
2620 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
2621 SysFreeString(sDefault);
2623 /* BorderTop */
2624 hres = IHTMLStyle_get_borderTop(style, &sDefault);
2625 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
2627 str = SysAllocString(L"thick dotted red");
2628 hres = IHTMLStyle_put_borderTop(style, str);
2629 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2630 SysFreeString(str);
2632 /* IHTMLStyle_get_borderTop appears to have a bug where
2633 it returns the first letter of the color. So we check
2634 each style individually.
2636 V_BSTR(&v) = NULL;
2637 hres = IHTMLStyle_get_borderTopColor(style, &v);
2638 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2639 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2640 VariantClear(&v);
2642 V_BSTR(&v) = NULL;
2643 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2644 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2645 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2646 VariantClear(&v);
2648 hres = IHTMLStyle_get_borderTopStyle(style, &str);
2649 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2650 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2651 SysFreeString(str);
2653 hres = IHTMLStyle_put_borderTop(style, sDefault);
2654 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2655 SysFreeString(sDefault);
2657 /* BorderBottom */
2658 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2659 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2661 str = SysAllocString(L"thick dotted red");
2662 hres = IHTMLStyle_put_borderBottom(style, str);
2663 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2664 SysFreeString(str);
2666 /* IHTMLStyle_get_borderBottom appears to have a bug where
2667 it returns the first letter of the color. So we check
2668 each style individually.
2670 V_BSTR(&v) = NULL;
2671 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2672 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2673 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2674 VariantClear(&v);
2676 V_BSTR(&v) = NULL;
2677 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2678 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2679 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2680 VariantClear(&v);
2682 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2683 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2684 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2685 SysFreeString(str);
2687 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2688 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2689 SysFreeString(sDefault);
2691 /* BorderLeft */
2692 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2693 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2695 str = SysAllocString(L"thick dotted red");
2696 hres = IHTMLStyle_put_borderLeft(style, str);
2697 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2698 SysFreeString(str);
2700 /* IHTMLStyle_get_borderLeft appears to have a bug where
2701 it returns the first letter of the color. So we check
2702 each style individually.
2704 V_BSTR(&v) = NULL;
2705 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2706 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2707 ok(!lstrcmpW(V_BSTR(&v), L"red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2708 VariantClear(&v);
2710 V_BSTR(&v) = NULL;
2711 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2712 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2713 ok(!lstrcmpW(V_BSTR(&v), L"thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2714 VariantClear(&v);
2716 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2717 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2718 ok(!lstrcmpW(str, L"dotted"), "str=%s\n", wine_dbgstr_w(str));
2719 SysFreeString(str);
2721 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2722 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2723 SysFreeString(sDefault);
2725 /* backgroundPositionX */
2726 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2727 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2728 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2729 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2730 VariantClear(&v);
2732 if(css_style) {
2733 V_VT(&v) = VT_BSTR;
2734 V_BSTR(&v) = SysAllocString(L"11px");
2735 hres = IHTMLCSSStyleDeclaration_put_backgroundPositionX(css_style, v);
2736 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2737 VariantClear(&v);
2739 hres = IHTMLCSSStyleDeclaration_get_backgroundPositionX(css_style, &v);
2740 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2741 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2742 ok(!lstrcmpW(V_BSTR(&v), L"11px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2743 VariantClear(&v);
2746 V_VT(&v) = VT_BSTR;
2747 V_BSTR(&v) = SysAllocString(L"10px");
2748 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2749 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2750 VariantClear(&v);
2752 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2753 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2754 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2755 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2756 VariantClear(&v);
2758 /* backgroundPositionY */
2759 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2760 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2761 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2762 VariantClear(&v);
2764 V_VT(&v) = VT_BSTR;
2765 V_BSTR(&v) = SysAllocString(L"15px");
2766 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2767 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2768 VariantClear(&v);
2770 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2771 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2772 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2773 ok(!lstrcmpW(V_BSTR(&v), L"15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2774 VariantClear(&v);
2776 /* backgroundPosition */
2777 str = NULL;
2778 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2779 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2780 ok(!lstrcmpW(str, L"10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2781 SysFreeString(str);
2783 str = SysAllocString(L"center 20%");
2784 hres = IHTMLStyle_put_backgroundPosition(style, str);
2785 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2786 SysFreeString(str);
2788 str = NULL;
2789 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2790 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2791 ok(!lstrcmpW(str, L"center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2792 SysFreeString(str);
2794 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2795 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2796 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2797 ok(!lstrcmpW(V_BSTR(&v), L"center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
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"20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2804 VariantClear(&v);
2806 if(css_style) {
2807 str = SysAllocString(L"left 21%");
2808 hres = IHTMLCSSStyleDeclaration_put_backgroundPosition(css_style, str);
2809 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2810 SysFreeString(str);
2812 str = NULL;
2813 hres = IHTMLCSSStyleDeclaration_get_backgroundPosition(css_style, &str);
2814 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2815 ok(!lstrcmpW(str, L"left 21%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2816 SysFreeString(str);
2819 /* borderTopWidth */
2820 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2821 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2823 V_VT(&v) = VT_BSTR;
2824 V_BSTR(&v) = SysAllocString(L"10px");
2825 hres = IHTMLStyle_put_borderTopWidth(style, v);
2826 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2827 VariantClear(&v);
2829 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2830 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2831 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2832 VariantClear(&v);
2834 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2835 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2836 VariantClear(&vDefault);
2838 /* borderRightWidth */
2839 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2840 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2842 V_VT(&v) = VT_BSTR;
2843 V_BSTR(&v) = SysAllocString(L"10");
2844 hres = IHTMLStyle_put_borderRightWidth(style, v);
2845 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2846 VariantClear(&v);
2848 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2849 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2850 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"10px" : L"1px"),
2851 "borderRightWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2852 VariantClear(&v);
2854 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2855 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2856 VariantClear(&vDefault);
2858 /* borderBottomWidth */
2859 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2860 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2862 V_VT(&v) = VT_BSTR;
2863 V_BSTR(&v) = SysAllocString(L"10");
2864 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2865 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2866 VariantClear(&v);
2868 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2869 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2870 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"10px" : L"1px"),
2871 "borderBottomWidth = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2872 VariantClear(&v);
2874 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2875 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2876 VariantClear(&vDefault);
2878 /* borderLeftWidth */
2879 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2880 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2882 V_VT(&v) = VT_BSTR;
2883 V_BSTR(&v) = SysAllocString(L"10");
2884 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2885 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2886 VariantClear(&v);
2888 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2889 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2890 ok(!lstrcmpW(V_BSTR(&v), compat_mode < COMPAT_IE9 ? L"10px" : L"1px"),
2891 "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2892 VariantClear(&v);
2894 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2895 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2896 VariantClear(&vDefault);
2898 /* wordSpacing */
2899 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2900 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2902 V_VT(&v) = VT_BSTR;
2903 V_BSTR(&v) = SysAllocString(L"10");
2904 hres = IHTMLStyle_put_wordSpacing(style, v);
2905 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2906 VariantClear(&v);
2908 hres = IHTMLStyle_get_wordSpacing(style, &v);
2909 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2910 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2911 if(compat_mode < COMPAT_IE9)
2912 ok(!lstrcmpW(V_BSTR(&v), L"10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2913 else
2914 ok(!V_BSTR(&v), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2915 VariantClear(&v);
2917 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2918 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2919 VariantClear(&vDefault);
2921 /* letterSpacing */
2922 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2923 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2925 V_VT(&v) = VT_BSTR;
2926 V_BSTR(&v) = SysAllocString(L"11");
2927 hres = IHTMLStyle_put_letterSpacing(style, v);
2928 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2929 VariantClear(&v);
2931 hres = IHTMLStyle_get_letterSpacing(style, &v);
2932 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2933 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2934 if(compat_mode < COMPAT_IE9)
2935 ok(!lstrcmpW(V_BSTR(&v), L"11px"), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2936 else
2937 ok(!V_BSTR(&v), "letterSpacing = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2938 VariantClear(&v);
2940 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2941 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2942 VariantClear(&vDefault);
2944 /* borderTopColor */
2945 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2946 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2948 V_VT(&v) = VT_BSTR;
2949 V_BSTR(&v) = SysAllocString(L"red");
2950 hres = IHTMLStyle_put_borderTopColor(style, v);
2951 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2952 VariantClear(&v);
2954 hres = IHTMLStyle_get_borderTopColor(style, &v);
2955 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2956 ok(!lstrcmpW(V_BSTR(&v), L"red"), "expected red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2957 VariantClear(&v);
2959 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2960 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2962 /* borderRightColor */
2963 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2964 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2966 V_VT(&v) = VT_BSTR;
2967 V_BSTR(&v) = SysAllocString(L"blue");
2968 hres = IHTMLStyle_put_borderRightColor(style, v);
2969 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2970 VariantClear(&v);
2972 hres = IHTMLStyle_get_borderRightColor(style, &v);
2973 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2974 ok(!lstrcmpW(V_BSTR(&v), L"blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2975 VariantClear(&v);
2977 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2978 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2980 /* borderBottomColor */
2981 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2982 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2984 V_VT(&v) = VT_BSTR;
2985 V_BSTR(&v) = SysAllocString(L"cyan");
2986 hres = IHTMLStyle_put_borderBottomColor(style, v);
2987 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2988 VariantClear(&v);
2990 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2991 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2992 ok(!lstrcmpW(V_BSTR(&v), L"cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2993 VariantClear(&v);
2995 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2996 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2998 /* borderLeftColor */
2999 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
3000 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
3002 V_VT(&v) = VT_BSTR;
3003 V_BSTR(&v) = SysAllocString(L"cyan");
3004 hres = IHTMLStyle_put_borderLeftColor(style, v);
3005 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
3006 VariantClear(&v);
3008 hres = IHTMLStyle_get_borderLeftColor(style, &v);
3009 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
3010 ok(!lstrcmpW(V_BSTR(&v), L"cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
3011 VariantClear(&v);
3013 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
3014 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
3016 /* clip */
3017 hres = IHTMLStyle_get_clip(style, &str);
3018 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
3019 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
3021 str = SysAllocString(L"rect(0px 1px 500px 505px)");
3022 hres = IHTMLStyle_put_clip(style, str);
3023 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
3024 SysFreeString(str);
3026 hres = IHTMLStyle_get_clip(style, &str);
3027 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
3028 ok(!lstrcmpW(str, compat_mode < COMPAT_IE9 ? L"rect(0px 1px 500px 505px)" : L"rect(0px, 1px, 500px, 505px)"),
3029 "clip = %s\n", wine_dbgstr_w(str));
3030 SysFreeString(str);
3032 /* clear */
3033 hres = IHTMLStyle_get_clear(style, &str);
3034 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
3035 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
3037 str = SysAllocString(L"both");
3038 hres = IHTMLStyle_put_clear(style, str);
3039 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
3040 SysFreeString(str);
3042 hres = IHTMLStyle_get_clear(style, &str);
3043 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
3044 ok(!lstrcmpW(str, L"both"), "clear = %s\n", wine_dbgstr_w(str));
3045 SysFreeString(str);
3047 /* pageBreakAfter */
3048 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
3049 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
3050 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
3052 if(css_style) {
3053 str = SysAllocString(L"right");
3054 hres = IHTMLCSSStyleDeclaration_put_pageBreakAfter(css_style, str);
3055 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
3056 SysFreeString(str);
3058 hres = IHTMLCSSStyleDeclaration_get_pageBreakAfter(css_style, &str);
3059 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
3060 ok(!lstrcmpW(str, L"right"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
3061 SysFreeString(str);
3064 str = SysAllocString(L"always");
3065 hres = IHTMLStyle_put_pageBreakAfter(style, str);
3066 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
3067 SysFreeString(str);
3069 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
3070 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
3071 ok(!lstrcmpW(str, L"always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
3072 SysFreeString(str);
3074 /* pageBreakBefore */
3075 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
3076 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
3077 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
3079 str = SysAllocString(L"always");
3080 hres = IHTMLStyle_put_pageBreakBefore(style, str);
3081 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
3082 SysFreeString(str);
3084 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
3085 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
3086 ok(!lstrcmpW(str, L"always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
3087 SysFreeString(str);
3089 test_style_remove_attribute(style, L"pageBreakBefore", VARIANT_TRUE);
3090 test_style_remove_attribute(style, L"pageBreakBefore", VARIANT_FALSE);
3092 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
3093 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
3094 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
3096 str = (void*)0xdeadbeef;
3097 hres = IHTMLStyle_get_whiteSpace(style, &str);
3098 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3099 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
3101 str = SysAllocString(L"nowrap");
3102 hres = IHTMLStyle_put_whiteSpace(style, str);
3103 SysFreeString(str);
3104 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
3106 str = NULL;
3107 hres = IHTMLStyle_get_whiteSpace(style, &str);
3108 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3109 ok(!lstrcmpW(str, L"nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3110 SysFreeString(str);
3112 str = SysAllocString(L"normal");
3113 hres = IHTMLStyle_put_whiteSpace(style, str);
3114 SysFreeString(str);
3115 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
3117 str = NULL;
3118 hres = IHTMLStyle_get_whiteSpace(style, &str);
3119 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3120 ok(!lstrcmpW(str, L"normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3121 SysFreeString(str);
3123 /* listStyleType */
3124 hres = IHTMLStyle_get_listStyleType(style, &str);
3125 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
3126 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
3128 str = SysAllocString(L"square");
3129 hres = IHTMLStyle_put_listStyleType(style, str);
3130 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
3131 SysFreeString(str);
3133 str = NULL;
3134 hres = IHTMLStyle_get_listStyleType(style, &str);
3135 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
3136 ok(!lstrcmpW(str, L"square"), "listStyleType = %s\n", wine_dbgstr_w(str));
3138 str = SysAllocString(L"inside");
3139 hres = IHTMLStyle_put_listStylePosition(style, str);
3140 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
3141 SysFreeString(str);
3143 hres = IHTMLStyle_get_listStylePosition(style, &str);
3144 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
3145 ok(!lstrcmpW(str, L"inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
3146 SysFreeString(str);
3148 str = SysAllocString(L"decimal-leading-zero none inside");
3149 hres = IHTMLStyle_put_listStyle(style, str);
3150 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
3151 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
3152 SysFreeString(str);
3154 if (hres != E_INVALIDARG) {
3155 hres = IHTMLStyle_get_listStyle(style, &str);
3156 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
3157 ok(wcsstr(str, L"decimal-leading-zero") && wcsstr(str, L"inside"),
3158 "listStyle = %s\n", wine_dbgstr_w(str));
3159 if(compat_mode < COMPAT_IE9)
3160 ok(wcsstr(str, L"none") != NULL, "listStyle = %s\n", wine_dbgstr_w(str));
3161 else
3162 todo_wine
3163 ok(!wcsstr(str, L"none"), "listStyle = %s\n", wine_dbgstr_w(str));
3165 SysFreeString(str);
3166 } else {
3167 win_skip("IHTMLStyle_put_listStyle already failed\n");
3170 str = (void*)0xdeadbeef;
3171 hres = IHTMLStyle_get_styleFloat(style, &str);
3172 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3173 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
3175 str = SysAllocString(L"left");
3176 hres = IHTMLStyle_put_styleFloat(style, str);
3177 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
3178 SysFreeString(str);
3180 str = NULL;
3181 hres = IHTMLStyle_get_styleFloat(style, &str);
3182 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3183 ok(!lstrcmpW(str, L"left"), "styleFloat = %s\n", wine_dbgstr_w(str));
3184 SysFreeString(str);
3186 if(css_style) {
3187 str = NULL;
3188 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
3189 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
3190 ok(!lstrcmpW(str, L"left"), "cssFloat = %s\n", wine_dbgstr_w(str));
3191 SysFreeString(str);
3193 str = NULL;
3194 hres = IHTMLCSSStyleDeclaration_get_styleFloat(css_style, &str);
3195 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3196 ok(!lstrcmpW(str, L"left"), "styleFloat = %s\n", wine_dbgstr_w(str));
3197 SysFreeString(str);
3199 str = SysAllocString(L"right");
3200 hres = IHTMLCSSStyleDeclaration_put_cssFloat(css_style, str);
3201 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
3202 SysFreeString(str);
3204 str = NULL;
3205 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
3206 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
3207 ok(!lstrcmpW(str, L"right"), "styleFloat = %s\n", wine_dbgstr_w(str));
3208 SysFreeString(str);
3210 str = SysAllocString(L"left");
3211 hres = IHTMLCSSStyleDeclaration_put_styleFloat(css_style, str);
3212 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
3213 SysFreeString(str);
3215 str = NULL;
3216 hres = IHTMLCSSStyleDeclaration_get_cssFloat(css_style, &str);
3217 ok(hres == S_OK, "get_cssFloat failed: %08x\n", hres);
3218 ok(!lstrcmpW(str, L"left"), "styleFloat = %s\n", wine_dbgstr_w(str));
3219 SysFreeString(str);
3222 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
3223 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
3224 if(SUCCEEDED(hres)) {
3225 test_style2(style2);
3226 IHTMLStyle2_Release(style2);
3229 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
3230 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
3231 if(SUCCEEDED(hres)) {
3232 test_style3(style3, css_style);
3233 IHTMLStyle3_Release(style3);
3236 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
3237 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
3238 if(SUCCEEDED(hres)) {
3239 test_style4(style4);
3240 IHTMLStyle4_Release(style4);
3243 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
3244 if(SUCCEEDED(hres)) {
3245 test_style5(style5);
3246 IHTMLStyle5_Release(style5);
3247 }else {
3248 win_skip("IHTMLStyle5 not available\n");
3251 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
3252 if(SUCCEEDED(hres)) {
3253 test_style6(style6);
3254 IHTMLStyle6_Release(style6);
3255 }else {
3256 win_skip("IHTMLStyle6 not available\n");
3259 if(compat_mode >= COMPAT_IE9) {
3260 test_css_style_declaration(css_style);
3261 if(css_style2)
3262 test_css_style_declaration2(css_style2);
3265 if(css_style2)
3266 IHTMLCSSStyleDeclaration2_Release(css_style2);
3267 if(css_style)
3268 IHTMLCSSStyleDeclaration_Release(css_style);
3271 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
3272 static void _test_style_filter(unsigned line, IHTMLStyle *style, const WCHAR *exval)
3274 BSTR str;
3275 HRESULT hres;
3277 str = (void*)0xdeadbeef;
3278 hres = IHTMLStyle_get_filter(style, &str);
3279 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
3280 if(exval)
3281 ok_(__FILE__,line)(str && !wcscmp(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(exval));
3282 else
3283 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
3285 SysFreeString(str);
3288 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
3289 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const WCHAR *exval)
3291 BSTR str;
3292 HRESULT hres;
3294 str = (void*)0xdeadbeef;
3295 hres = IHTMLCurrentStyle2_get_filter(style, &str);
3296 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
3297 if(exval)
3298 ok_(__FILE__,line)(str && !lstrcmpW(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(exval));
3299 else
3300 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
3302 SysFreeString(str);
3305 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
3306 static void _set_style_filter(unsigned line, IHTMLStyle *style, const WCHAR *val)
3308 BSTR str;
3309 HRESULT hres;
3311 str = SysAllocString(val);
3312 hres = IHTMLStyle_put_filter(style, str);
3313 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
3314 SysFreeString(str);
3316 _test_style_filter(line, style, val);
3319 static void test_style_filters(IHTMLElement *elem)
3321 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
3322 IHTMLCurrentStyle2 *current_style2;
3323 IHTMLCurrentStyle *current_style;
3324 IHTMLStyle *style;
3325 HRESULT hres;
3327 hres = IHTMLElement_get_style(elem, &style);
3328 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3330 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
3331 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3333 current_style2 = get_current_style2_iface((IUnknown*)current_style);
3335 test_style_filter(style, NULL);
3336 test_current_style_filter(current_style2, NULL);
3337 set_style_filter(style, L"alpha(opacity=50.0040)");
3338 test_current_style_filter(current_style2, L"alpha(opacity=50.0040)");
3339 set_style_filter(style, L"alpha(opacity=100)");
3341 IHTMLStyle_Release(style);
3343 hres = IHTMLElement_get_style(elem, &style);
3344 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3346 test_style_filter(style, L"alpha(opacity=100)");
3347 set_style_filter(style, L"xxx(a,b,c) alpha(opacity=100)");
3348 set_style_filter(style, NULL);
3349 set_style_filter(style, L"alpha(opacity=100)");
3350 test_style_remove_attribute(style, L"filter", VARIANT_TRUE);
3351 test_style_remove_attribute(style, L"filter", VARIANT_FALSE);
3352 test_style_filter(style, NULL);
3355 IHTMLCurrentStyle2_Release(current_style2);
3356 IHTMLStyle_Release(style);
3357 IHTMLElement2_Release(elem2);
3360 static void test_current_style(IHTMLCurrentStyle *current_style)
3362 IHTMLCurrentStyle2 *current_style2;
3363 IHTMLCurrentStyle3 *current_style3;
3364 IHTMLCurrentStyle4 *current_style4;
3365 VARIANT_BOOL b;
3366 BSTR str;
3367 HRESULT hres;
3368 VARIANT v;
3370 hres = IHTMLCurrentStyle_get_display(current_style, &str);
3371 ok(hres == S_OK, "get_display failed: %08x\n", hres);
3372 ok(!lstrcmpW(str, L"block"), "get_display returned %s\n", wine_dbgstr_w(str));
3373 SysFreeString(str);
3375 hres = IHTMLCurrentStyle_get_position(current_style, &str);
3376 ok(hres == S_OK, "get_position failed: %08x\n", hres);
3377 ok(!lstrcmpW(str, L"absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
3378 SysFreeString(str);
3380 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
3381 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
3382 SysFreeString(str);
3384 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
3385 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
3386 ok(!lstrcmpW(str, L"normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
3387 SysFreeString(str);
3389 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
3390 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
3391 ok(!lstrcmpW(str, L"none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
3392 SysFreeString(str);
3394 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
3395 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
3396 ok(!lstrcmpW(str, L"normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
3397 SysFreeString(str);
3399 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
3400 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
3401 ok(!lstrcmpW(str, L"none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
3402 SysFreeString(str);
3404 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
3405 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
3406 ok(!lstrcmpW(str, L"none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
3407 SysFreeString(str);
3409 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
3410 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
3411 ok(!lstrcmpW(str, L"none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
3412 SysFreeString(str);
3414 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
3415 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
3416 ok(!lstrcmpW(str, L"none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
3417 SysFreeString(str);
3419 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
3420 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
3421 ok(!lstrcmpW(str, L"center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
3422 SysFreeString(str);
3424 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
3425 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3426 ok(!lstrcmpW(str, L"none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
3427 SysFreeString(str);
3429 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
3430 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
3431 ok(!lstrcmpW(str, L"default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
3432 SysFreeString(str);
3434 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
3435 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
3436 ok(!lstrcmpW(str, L"repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
3437 SysFreeString(str);
3439 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
3440 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
3441 SysFreeString(str);
3443 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
3444 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
3445 SysFreeString(str);
3447 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
3448 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
3449 SysFreeString(str);
3451 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
3452 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
3453 SysFreeString(str);
3455 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
3456 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
3457 SysFreeString(str);
3459 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
3460 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
3461 SysFreeString(str);
3463 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
3464 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
3465 SysFreeString(str);
3467 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
3468 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
3469 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
3470 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
3471 VariantClear(&v);
3473 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
3474 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
3475 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3476 VariantClear(&v);
3478 hres = IHTMLCurrentStyle_get_left(current_style, &v);
3479 ok(hres == S_OK, "get_left failed: %08x\n", hres);
3480 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3481 VariantClear(&v);
3483 hres = IHTMLCurrentStyle_get_top(current_style, &v);
3484 ok(hres == S_OK, "get_top failed: %08x\n", hres);
3485 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3486 VariantClear(&v);
3488 hres = IHTMLCurrentStyle_get_width(current_style, &v);
3489 ok(hres == S_OK, "get_width failed: %08x\n", hres);
3490 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3491 VariantClear(&v);
3493 hres = IHTMLCurrentStyle_get_height(current_style, &v);
3494 ok(hres == S_OK, "get_height failed: %08x\n", hres);
3495 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3496 VariantClear(&v);
3498 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
3499 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
3500 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3501 VariantClear(&v);
3503 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
3504 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
3505 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
3506 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
3507 VariantClear(&v);
3509 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
3510 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
3511 test_var_bstr(&v, compat_mode < COMPAT_IE9 ? L"100px" : L"middle");
3512 VariantClear(&v);
3514 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
3515 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
3516 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3517 VariantClear(&v);
3519 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
3520 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
3521 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3522 VariantClear(&v);
3524 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
3525 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
3526 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3527 VariantClear(&v);
3529 V_BSTR(&v) = NULL;
3530 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
3531 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
3532 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3533 VariantClear(&v);
3535 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
3536 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
3537 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3538 VariantClear(&v);
3540 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
3541 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
3542 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3543 VariantClear(&v);
3545 hres = IHTMLCurrentStyle_get_color(current_style, &v);
3546 ok(hres == S_OK, "get_color failed: %08x\n", hres);
3547 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3548 VariantClear(&v);
3550 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
3551 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
3552 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3553 VariantClear(&v);
3555 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
3556 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
3557 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
3558 VariantClear(&v);
3560 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
3561 ok(hres == S_OK, "get_borderTopColor 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_borderRightColor(current_style, &v);
3566 ok(hres == S_OK, "get_borderRightColor 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_borderBottomColor(current_style, &v);
3571 ok(hres == S_OK, "get_borderBottomColor 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_paddingTop(current_style, &v);
3576 ok(hres == S_OK, "get_paddingTop 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_paddingRight(current_style, &v);
3581 ok(hres == S_OK, "get_paddingRight 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_paddingBottom(current_style, &v);
3586 ok(hres == S_OK, "get_paddingRight 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_letterSpacing(current_style, &v);
3591 ok(hres == S_OK, "get_letterSpacing 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_marginTop(current_style, &v);
3596 ok(hres == S_OK, "get_marginTop 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_marginBottom(current_style, &v);
3601 ok(hres == S_OK, "get_marginBottom 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_right(current_style, &v);
3606 ok(hres == S_OK, "get_Right 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_bottom(current_style, &v);
3611 ok(hres == S_OK, "get_bottom 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_lineHeight(current_style, &v);
3616 ok(hres == S_OK, "get_lineHeight 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_textIndent(current_style, &v);
3621 ok(hres == S_OK, "get_textIndent 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_textTransform(current_style, &str);
3626 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
3627 SysFreeString(str);
3629 hres = IHTMLCurrentStyle_get_styleFloat(current_style, &str);
3630 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
3631 ok(!lstrcmpW(str, L"none"), "styleFloat = %s\n", wine_dbgstr_w(str));
3632 SysFreeString(str);
3634 hres = IHTMLCurrentStyle_get_overflowX(current_style, &str);
3635 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
3636 ok(!lstrcmpW(str, L"hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
3637 SysFreeString(str);
3639 hres = IHTMLCurrentStyle_get_overflowY(current_style, &str);
3640 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
3641 ok(!lstrcmpW(str, L"hidden"), "overflowY = %s\n", wine_dbgstr_w(str));
3642 SysFreeString(str);
3644 hres = IHTMLCurrentStyle_get_direction(current_style, &str);
3645 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
3646 ok(!lstrcmpW(str, L"ltr"), "direction = %s\n", wine_dbgstr_w(str));
3647 SysFreeString(str);
3649 current_style2 = get_current_style2_iface((IUnknown*)current_style);
3651 b = 100;
3652 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
3653 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
3654 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
3656 IHTMLCurrentStyle2_Release(current_style2);
3658 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle3, (void**)&current_style3);
3659 ok(hres == S_OK, "Could not get IHTMLCurrentStyle3 iface: %08x\n", hres);
3661 hres = IHTMLCurrentStyle3_get_whiteSpace(current_style3, &str);
3662 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
3663 ok(!lstrcmpW(str, L"normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
3664 SysFreeString(str);
3666 IHTMLCurrentStyle3_Release(current_style3);
3668 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle4, (void**)&current_style4);
3669 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "Could not get IHTMLCurrentStyle4 iface: %08x\n", hres);
3670 if(SUCCEEDED(hres)) {
3671 hres = IHTMLCurrentStyle4_get_minWidth(current_style4, &v);
3672 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
3673 ok(V_VT(&v) == VT_BSTR, "V_VT(minWidth) = %d\n", V_VT(&v));
3674 VariantClear(&v);
3676 IHTMLCurrentStyle4_Release(current_style4);
3677 }else {
3678 win_skip("IHTMLCurrentStyle4 not supported.\n");
3682 static void basic_style_test(IHTMLDocument2 *doc)
3684 IHTMLCurrentStyle *cstyle;
3685 IHTMLElement *elem;
3686 IHTMLStyle *style;
3687 HRESULT hres;
3689 hres = IHTMLDocument2_get_body(doc, &elem);
3690 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3692 elem_set_innerhtml(elem, L"<div id=\"divid\"></div>");
3694 hres = IHTMLElement_get_style(elem, &style);
3695 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3697 test_body_style(style);
3699 cstyle = get_current_style(elem);
3700 test_current_style(cstyle);
3701 IHTMLCurrentStyle_Release(cstyle);
3702 IHTMLElement_Release(elem);
3704 elem = get_element_by_id(doc, L"divid");
3705 test_style_filters(elem);
3707 test_set_csstext(style);
3708 IHTMLStyle_Release(style);
3709 IHTMLElement_Release(elem);
3712 static const char runtimestyle_test_str[] =
3713 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
3715 static const char runtimestyle_ie9_test_str[] =
3716 "<!DOCTYPE html>\n"
3717 "<html>"
3718 " <head>"
3719 " <meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" />"
3720 " <style>body {text-decoration: auto}</style>"
3721 " </head>"
3722 " <body>"
3723 " </body>"
3724 "</html>";
3726 static void runtimestyle_test(IHTMLDocument2 *doc)
3728 IHTMLStyle *style, *runtime_style;
3729 IHTMLElement2 *elem2;
3730 IHTMLElement *elem;
3731 BSTR str;
3732 HRESULT hres;
3734 hres = IHTMLDocument2_get_body(doc, &elem);
3735 ok(hres == S_OK, "get_body failed: %08x\n", hres);
3737 elem2 = get_elem2_iface((IUnknown*)elem);
3739 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
3740 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
3742 hres = IHTMLElement_get_style(elem, &style);
3743 ok(hres == S_OK, "get_style failed: %08x\n", hres);
3745 test_text_decoration(style, NULL);
3746 test_text_decoration(runtime_style, NULL);
3747 set_text_decoration(style, L"underline");
3748 test_text_decoration(style, L"underline");
3750 hres = IHTMLStyle_get_textDecoration(style, &str);
3751 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3752 ok(broken(!str) || !lstrcmpW(str, L"underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3753 SysFreeString(str);
3755 set_text_decoration(runtime_style, L"blink");
3756 test_text_decoration(runtime_style, L"blink");
3758 hres = IHTMLStyle_get_textDecoration(style, &str);
3759 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
3760 todo_wine
3761 ok(!lstrcmpW(str, L"underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
3762 SysFreeString(str);
3764 IHTMLStyle_Release(runtime_style);
3765 IHTMLStyle_Release(style);
3766 IHTMLElement2_Release(elem2);
3767 IHTMLElement_Release(elem);
3770 static IHTMLDocument2 *notif_doc;
3771 static BOOL doc_complete;
3773 static IHTMLDocument2 *create_document(void)
3775 IHTMLDocument2 *doc;
3776 IHTMLDocument5 *doc5;
3777 HRESULT hres;
3779 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3780 &IID_IHTMLDocument2, (void**)&doc);
3781 #if !defined(__i386__) && !defined(__x86_64__)
3782 todo_wine
3783 #endif
3784 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3785 if(FAILED(hres))
3786 return NULL;
3788 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
3789 if(FAILED(hres)) {
3790 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3791 IHTMLDocument2_Release(doc);
3792 return NULL;
3795 IHTMLDocument5_Release(doc5);
3796 return doc;
3799 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
3800 REFIID riid, void**ppv)
3802 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3803 *ppv = iface;
3804 return S_OK;
3807 ok(0, "unexpected call\n");
3808 return E_NOINTERFACE;
3811 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
3813 return 2;
3816 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
3818 return 1;
3821 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
3823 if(dispID == DISPID_READYSTATE){
3824 BSTR state;
3825 HRESULT hres;
3827 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3828 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3830 if(!lstrcmpW(state, L"complete"))
3831 doc_complete = TRUE;
3833 SysFreeString(state);
3836 return S_OK;
3839 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
3841 ok(0, "unexpected call\n");
3842 return E_NOTIMPL;
3845 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3846 PropertyNotifySink_QueryInterface,
3847 PropertyNotifySink_AddRef,
3848 PropertyNotifySink_Release,
3849 PropertyNotifySink_OnChanged,
3850 PropertyNotifySink_OnRequestEdit
3853 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
3855 static IHTMLDocument2 *create_doc_with_string(const char *str)
3857 IPersistStreamInit *init;
3858 IStream *stream;
3859 IHTMLDocument2 *doc;
3860 HRESULT hres;
3861 HGLOBAL mem;
3862 SIZE_T len;
3864 notif_doc = doc = create_document();
3865 if(!doc)
3866 return NULL;
3868 doc_complete = FALSE;
3869 len = strlen(str);
3870 mem = GlobalAlloc(0, len);
3871 memcpy(mem, str, len);
3872 hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
3873 ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
3875 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3876 ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
3878 IPersistStreamInit_Load(init, stream);
3879 IPersistStreamInit_Release(init);
3880 IStream_Release(stream);
3882 return doc;
3885 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3887 IConnectionPointContainer *container;
3888 IConnectionPoint *cp;
3889 DWORD cookie;
3890 HRESULT hres;
3892 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3893 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3895 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3896 IConnectionPointContainer_Release(container);
3897 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3899 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3900 IConnectionPoint_Release(cp);
3901 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3904 typedef void (*style_test_t)(IHTMLDocument2*);
3906 static void run_test(const char *str, style_test_t test)
3908 IHTMLDocument2 *doc;
3909 ULONG ref;
3910 MSG msg;
3912 doc = create_doc_with_string(str);
3913 if(!doc)
3914 return;
3916 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
3918 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3919 TranslateMessage(&msg);
3920 DispatchMessageW(&msg);
3923 test(doc);
3925 ref = IHTMLDocument2_Release(doc);
3926 ok(!ref || broken(ref == 1), /* Vista */
3927 "ref = %d\n", ref);
3930 static BOOL check_ie(void)
3932 IHTMLDocument2 *doc;
3933 IHTMLDocument7 *doc7;
3934 HRESULT hres;
3936 doc = create_document();
3937 if(!doc)
3938 return FALSE;
3940 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
3941 if(SUCCEEDED(hres)) {
3942 is_ie9plus = TRUE;
3943 IHTMLDocument7_Release(doc7);
3946 trace("is_ie9plus %x\n", is_ie9plus);
3948 IHTMLDocument2_Release(doc);
3949 return TRUE;
3952 START_TEST(style)
3954 CoInitialize(NULL);
3956 if(check_ie()) {
3957 trace("Running tests in quirks mode...\n");
3958 run_test(doc_blank, basic_style_test);
3959 run_test(runtimestyle_test_str, runtimestyle_test);
3960 if(is_ie9plus) {
3961 trace("Running tests in IE9 mode...\n");
3962 compat_mode = COMPAT_IE9;
3963 run_test(doc_blank_ie9, basic_style_test);
3964 run_test(runtimestyle_ie9_test_str, runtimestyle_test);
3968 CoUninitialize();