mshtml: Improved IHTMLStyle3::zoom stub.
[wine.git] / dlls / mshtml / tests / style.c
blobfffade02daaf203cf07c30de0137b313cb7a2183
1 /*
2 * Copyright 2007-2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
20 #define CONST_VTABLE
22 #include <wine/test.h>
23 #include <stdarg.h>
24 #include <stdio.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ole2.h"
29 #include "mshtml.h"
30 #include "mshtmhst.h"
31 #include "docobj.h"
33 static int strcmp_wa(LPCWSTR strw, const char *stra)
35 CHAR buf[512];
36 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
37 return lstrcmpA(stra, buf);
40 static BOOL wstr_contains(const WCHAR *strw, const char *stra)
42 CHAR buf[512];
43 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
44 return strstr(buf, stra) != NULL;
47 static BSTR a2bstr(const char *str)
49 BSTR ret;
50 int len;
52 if(!str)
53 return NULL;
55 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
56 ret = SysAllocStringLen(NULL, len);
57 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
59 return ret;
62 static const WCHAR *strstr_wa(const WCHAR *str, const char *suba)
64 BSTR sub;
65 const WCHAR *ret = NULL;
66 sub = a2bstr(suba);
67 while (*str)
69 const WCHAR *p1 = str, *p2 = sub;
70 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
71 if (!*p2) {ret = str; break;}
72 str++;
74 SysFreeString(sub);
75 return ret;
78 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
79 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
81 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
82 if(expect)
83 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
84 else
85 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
88 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
89 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
91 IHTMLElement2 *elem;
92 HRESULT hres;
94 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
95 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
96 return elem;
99 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
100 static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
102 IHTMLCurrentStyle2 *current_style2;
103 HRESULT hres;
105 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
106 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
107 return current_style2;
110 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
112 HRESULT hres;
113 IHTMLDocument3 *doc3;
114 IHTMLElement *result;
115 BSTR idW = a2bstr(id);
117 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
118 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
120 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
121 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
122 ok(result != NULL, "result == NULL\n");
123 SysFreeString(idW);
125 IHTMLDocument3_Release(doc3);
126 return result;
129 #define get_current_style(e) _get_current_style(__LINE__,e)
130 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
132 IHTMLCurrentStyle *cstyle;
133 IHTMLElement2 *elem2;
134 HRESULT hres;
136 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
137 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
139 cstyle = NULL;
140 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
141 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
142 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
144 IHTMLElement2_Release(elem2);
145 return cstyle;
148 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
149 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
151 HRESULT hres;
152 DISPID dispid;
154 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
155 LOCALE_USER_DEFAULT, &dispid);
156 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
157 if(hres == S_OK)
159 DISPPARAMS params = {NULL,NULL,0,0};
160 DISPID dispidNamed = DISPID_PROPERTYPUT;
161 VARIANT ret;
162 VARIANT vDefault;
163 VARIANTARG arg;
165 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
166 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
167 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
169 params.cArgs = 1;
170 params.cNamedArgs = 1;
171 params.rgdispidNamedArgs = &dispidNamed;
172 V_VT(&arg) = VT_BSTR;
173 V_BSTR(&arg) = a2bstr("none");
174 params.rgvarg = &arg;
175 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
176 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
177 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
178 VariantClear(&arg);
180 V_VT(&arg) = VT_BSTR;
181 V_BSTR(&arg) = a2bstr("dotted");
182 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
183 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
184 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
185 VariantClear(&arg);
187 V_VT(&arg) = VT_BSTR;
188 V_BSTR(&arg) = a2bstr("dashed");
189 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
190 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
191 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
192 VariantClear(&arg);
194 V_VT(&arg) = VT_BSTR;
195 V_BSTR(&arg) = a2bstr("solid");
196 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
197 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
198 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
199 VariantClear(&arg);
201 V_VT(&arg) = VT_BSTR;
202 V_BSTR(&arg) = a2bstr("double");
203 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
204 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
205 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
206 VariantClear(&arg);
208 V_VT(&arg) = VT_BSTR;
209 V_BSTR(&arg) = a2bstr("groove");
210 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
211 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
212 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
213 VariantClear(&arg);
215 V_VT(&arg) = VT_BSTR;
216 V_BSTR(&arg) = a2bstr("ridge");
217 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
218 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
219 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
220 VariantClear(&arg);
222 V_VT(&arg) = VT_BSTR;
223 V_BSTR(&arg) = a2bstr("inset");
224 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
225 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
226 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
227 VariantClear(&arg);
229 V_VT(&arg) = VT_BSTR;
230 V_BSTR(&arg) = a2bstr("outset");
231 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
232 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
233 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
234 VariantClear(&arg);
236 V_VT(&arg) = VT_BSTR;
237 V_BSTR(&arg) = a2bstr("invalid");
238 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
239 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
240 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
241 VariantClear(&arg);
243 params.rgvarg = &vDefault;
244 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
245 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
246 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
247 VariantClear(&vDefault);
251 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
252 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
254 BSTR text = (void*)0xdeadbeef;
255 HRESULT hres;
257 hres = IHTMLStyle_get_cssText(style, &text);
258 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
259 if(extext)
260 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
261 else
262 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
264 SysFreeString(text);
267 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
268 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
270 BSTR tmp;
271 HRESULT hres;
273 tmp = a2bstr(text);
274 hres = IHTMLStyle_put_cssText(style, tmp);
275 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
276 SysFreeString(tmp);
279 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
280 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
282 BSTR str = a2bstr(attr);
283 VARIANT_BOOL b = 100;
284 HRESULT hres;
286 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
287 SysFreeString(str);
288 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
289 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
292 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
293 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
295 BSTR str;
296 HRESULT hres;
298 str = a2bstr(v);
299 hres = IHTMLStyle_put_textDecoration(style, str);
300 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
301 SysFreeString(str);
304 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
305 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
307 BSTR str;
308 HRESULT hres;
310 hres = IHTMLStyle_get_textDecoration(style, &str);
311 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
312 if(exdec)
313 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
314 else
315 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
316 SysFreeString(str);
319 static void test_set_csstext(IHTMLStyle *style)
321 VARIANT v;
322 HRESULT hres;
324 test_style_set_csstext(style, "background-color: black;");
326 hres = IHTMLStyle_get_backgroundColor(style, &v);
327 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
328 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
329 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
330 VariantClear(&v);
333 static void test_style2(IHTMLStyle2 *style2)
335 VARIANT v;
336 BSTR str;
337 HRESULT hres;
339 str = (void*)0xdeadbeef;
340 hres = IHTMLStyle2_get_position(style2, &str);
341 ok(hres == S_OK, "get_position failed: %08x\n", hres);
342 ok(!str, "str != NULL\n");
344 str = a2bstr("absolute");
345 hres = IHTMLStyle2_put_position(style2, str);
346 ok(hres == S_OK, "put_position failed: %08x\n", hres);
347 SysFreeString(str);
349 str = NULL;
350 hres = IHTMLStyle2_get_position(style2, &str);
351 ok(hres == S_OK, "get_position failed: %08x\n", hres);
352 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
353 SysFreeString(str);
355 /* Test right */
356 V_VT(&v) = VT_EMPTY;
357 hres = IHTMLStyle2_get_right(style2, &v);
358 ok(hres == S_OK, "get_top failed: %08x\n", hres);
359 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
360 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
361 VariantClear(&v);
363 V_VT(&v) = VT_BSTR;
364 V_BSTR(&v) = a2bstr("3px");
365 hres = IHTMLStyle2_put_right(style2, v);
366 ok(hres == S_OK, "put_right failed: %08x\n", hres);
367 VariantClear(&v);
369 V_VT(&v) = VT_EMPTY;
370 hres = IHTMLStyle2_get_right(style2, &v);
371 ok(hres == S_OK, "get_right failed: %08x\n", hres);
372 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
373 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
374 VariantClear(&v);
376 /* direction */
377 str = (void*)0xdeadbeef;
378 hres = IHTMLStyle2_get_direction(style2, &str);
379 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
380 ok(!str, "str = %s\n", wine_dbgstr_w(str));
382 str = a2bstr("ltr");
383 hres = IHTMLStyle2_put_direction(style2, str);
384 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
385 SysFreeString(str);
387 str = NULL;
388 hres = IHTMLStyle2_get_direction(style2, &str);
389 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
390 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
391 SysFreeString(str);
393 /* bottom */
394 V_VT(&v) = VT_EMPTY;
395 hres = IHTMLStyle2_get_bottom(style2, &v);
396 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
397 test_var_bstr(&v, NULL);
399 V_VT(&v) = VT_I4;
400 V_I4(&v) = 4;
401 hres = IHTMLStyle2_put_bottom(style2, v);
402 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
404 V_VT(&v) = VT_EMPTY;
405 hres = IHTMLStyle2_get_bottom(style2, &v);
406 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
407 test_var_bstr(&v, "4px");
409 /* overflowX */
410 str = (void*)0xdeadbeef;
411 hres = IHTMLStyle2_get_overflowX(style2, &str);
412 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
413 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
415 str = a2bstr("hidden");
416 hres = IHTMLStyle2_put_overflowX(style2, str);
417 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
418 SysFreeString(str);
420 str = NULL;
421 hres = IHTMLStyle2_get_overflowX(style2, &str);
422 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
423 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
425 /* overflowY */
426 str = (void*)0xdeadbeef;
427 hres = IHTMLStyle2_get_overflowY(style2, &str);
428 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
429 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
431 str = a2bstr("hidden");
432 hres = IHTMLStyle2_put_overflowY(style2, str);
433 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
434 SysFreeString(str);
436 str = NULL;
437 hres = IHTMLStyle2_get_overflowY(style2, &str);
438 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
439 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
441 /* tableLayout */
442 str = a2bstr("fixed");
443 hres = IHTMLStyle2_put_tableLayout(style2, str);
444 ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres);
445 SysFreeString(str);
447 str = (void*)0xdeadbeef;
448 hres = IHTMLStyle2_get_tableLayout(style2, &str);
449 ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres);
450 ok(!strcmp_wa(str, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str));
451 SysFreeString(str);
454 static void test_style3(IHTMLStyle3 *style3)
456 VARIANT v;
457 BSTR str;
458 HRESULT hres;
460 str = (void*)0xdeadbeef;
461 hres = IHTMLStyle3_get_wordWrap(style3, &str);
462 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
463 ok(!str, "str != NULL\n");
465 str = a2bstr("break-word");
466 hres = IHTMLStyle3_put_wordWrap(style3, str);
467 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
468 SysFreeString(str);
470 str = NULL;
471 hres = IHTMLStyle3_get_wordWrap(style3, &str);
472 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
473 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
474 SysFreeString(str);
476 V_VT(&v) = VT_ERROR;
477 hres = IHTMLStyle3_get_zoom(style3, &v);
478 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
479 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
480 ok(!V_BSTR(&v), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
481 VariantClear(&v);
483 V_VT(&v) = VT_BSTR;
484 V_BSTR(&v) = a2bstr("100%");
485 hres = IHTMLStyle3_put_zoom(style3, v);
486 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
488 V_VT(&v) = VT_ERROR;
489 hres = IHTMLStyle3_get_zoom(style3, &v);
490 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
491 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
492 ok(!strcmp_wa(V_BSTR(&v), "100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
493 VariantClear(&v);
495 V_VT(&v) = VT_I4;
496 V_I4(&v) = 1;
497 hres = IHTMLStyle3_put_zoom(style3, v);
498 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
500 V_VT(&v) = VT_ERROR;
501 hres = IHTMLStyle3_get_zoom(style3, &v);
502 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
503 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
504 ok(!strcmp_wa(V_BSTR(&v), "1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
505 VariantClear(&v);
508 static void test_style4(IHTMLStyle4 *style4)
510 HRESULT hres;
511 VARIANT v;
512 VARIANT vdefault;
514 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
515 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
517 V_VT(&v) = VT_BSTR;
518 V_BSTR(&v) = a2bstr("10px");
519 hres = IHTMLStyle4_put_minHeight(style4, v);
520 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
521 VariantClear(&v);
523 hres = IHTMLStyle4_get_minHeight(style4, &v);
524 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
525 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
526 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
527 VariantClear(&v);
529 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
530 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
531 VariantClear(&vdefault);
534 static void test_style5(IHTMLStyle5 *style5)
536 HRESULT hres;
537 VARIANT v;
538 VARIANT vdefault;
540 /* minWidth */
541 hres = IHTMLStyle5_get_minWidth(style5, &vdefault);
542 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
544 V_VT(&v) = VT_BSTR;
545 V_BSTR(&v) = a2bstr("12px");
546 hres = IHTMLStyle5_put_minWidth(style5, v);
547 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
548 VariantClear(&v);
550 hres = IHTMLStyle5_get_minWidth(style5, &v);
551 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
552 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
553 ok(!strcmp_wa(V_BSTR(&v), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
554 VariantClear(&v);
556 V_VT(&v) = VT_BSTR;
557 V_BSTR(&v) = a2bstr("10%");
558 hres = IHTMLStyle5_put_minWidth(style5, v);
559 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
560 VariantClear(&v);
562 hres = IHTMLStyle5_get_minWidth(style5, &v);
563 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
564 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
565 ok(!strcmp_wa(V_BSTR(&v), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
566 VariantClear(&v);
568 V_VT(&v) = VT_BSTR;
569 V_BSTR(&v) = a2bstr("10");
570 hres = IHTMLStyle5_put_minWidth(style5, v);
571 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
572 VariantClear(&v);
574 hres = IHTMLStyle5_get_minWidth(style5, &v);
575 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
576 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
577 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
578 VariantClear(&v);
580 hres = IHTMLStyle5_put_minWidth(style5, vdefault);
581 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
582 VariantClear(&vdefault);
584 /* maxWidth */
585 hres = IHTMLStyle5_get_maxWidth(style5, &vdefault);
586 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
588 V_VT(&v) = VT_BSTR;
589 V_BSTR(&v) = a2bstr("200px");
590 hres = IHTMLStyle5_put_maxWidth(style5, v);
591 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
592 VariantClear(&v);
594 hres = IHTMLStyle5_get_maxWidth(style5, &v);
595 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
596 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n",V_VT(&v));
597 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
598 VariantClear(&v);
600 V_VT(&v) = VT_BSTR;
601 V_BSTR(&v) = a2bstr("70%");
602 hres = IHTMLStyle5_put_maxWidth(style5, v);
603 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
604 VariantClear(&v);
606 hres = IHTMLStyle5_get_maxWidth(style5, &v);
607 ok(hres == S_OK, "get maxWidth failed: %08x\n", hres);
608 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
609 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
610 VariantClear(&v);
612 hres = IHTMLStyle5_put_maxWidth(style5,vdefault);
613 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
614 VariantClear(&vdefault);
616 /* maxHeight */
617 hres = IHTMLStyle5_get_maxHeight(style5, &vdefault);
618 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
620 V_VT(&v) = VT_BSTR;
621 V_BSTR(&v) = a2bstr("200px");
622 hres = IHTMLStyle5_put_maxHeight(style5, v);
623 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
624 VariantClear(&v);
626 hres = IHTMLStyle5_get_maxHeight(style5, &v);
627 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
628 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
629 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
630 VariantClear(&v);
632 V_VT(&v) = VT_BSTR;
633 V_BSTR(&v) = a2bstr("70%");
634 hres = IHTMLStyle5_put_maxHeight(style5, v);
635 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
636 VariantClear(&v);
638 hres = IHTMLStyle5_get_maxHeight(style5, &v);
639 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
640 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
641 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
642 VariantClear(&v);
644 V_VT(&v) = VT_BSTR;
645 V_BSTR(&v) = a2bstr("100");
646 hres = IHTMLStyle5_put_maxHeight(style5, v);
647 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
648 VariantClear(&v);
650 hres = IHTMLStyle5_get_maxHeight(style5, &v);
651 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
652 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
653 ok(!strcmp_wa(V_BSTR(&v), "100px"), "expect 100 got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
654 VariantClear(&v);
656 hres = IHTMLStyle5_put_maxHeight(style5, vdefault);
657 ok(hres == S_OK, "put maxHeight failed:%08x\n", hres);
658 VariantClear(&vdefault);
661 static void test_style6(IHTMLStyle6 *style)
663 BSTR str;
664 HRESULT hres;
666 str = (void*)0xdeadbeef;
667 hres = IHTMLStyle6_get_outline(style, &str);
668 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
669 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
670 SysFreeString(str);
672 str = a2bstr("1px");
673 hres = IHTMLStyle6_put_outline(style, str);
674 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
675 SysFreeString(str);
677 str = (void*)0xdeadbeef;
678 hres = IHTMLStyle6_get_outline(style, &str);
679 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
680 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
681 SysFreeString(str);
683 str = (void*)0xdeadbeef;
684 hres = IHTMLStyle6_get_boxSizing(style, &str);
685 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
686 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
687 SysFreeString(str);
689 str = a2bstr("border-box");
690 hres = IHTMLStyle6_put_boxSizing(style, str);
691 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
692 SysFreeString(str);
694 str = NULL;
695 hres = IHTMLStyle6_get_boxSizing(style, &str);
696 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
697 ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
698 SysFreeString(str);
701 static void test_body_style(IHTMLStyle *style)
703 IHTMLStyle2 *style2;
704 IHTMLStyle3 *style3;
705 IHTMLStyle4 *style4;
706 IHTMLStyle5 *style5;
707 IHTMLStyle6 *style6;
708 VARIANT_BOOL b;
709 VARIANT v;
710 BSTR str;
711 HRESULT hres;
712 float f;
713 BSTR sOverflowDefault;
714 BSTR sDefault;
715 LONG l;
716 VARIANT vDefault;
718 test_style_csstext(style, NULL);
720 hres = IHTMLStyle_get_position(style, &str);
721 ok(hres == S_OK, "get_position failed: %08x\n", hres);
722 ok(!str, "str=%s\n", wine_dbgstr_w(str));
724 V_VT(&v) = VT_NULL;
725 hres = IHTMLStyle_get_marginRight(style, &v);
726 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
727 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
728 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
730 V_VT(&v) = VT_I4;
731 V_I4(&v) = 6;
732 hres = IHTMLStyle_put_marginRight(style, v);
733 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
735 V_VT(&v) = VT_NULL;
736 hres = IHTMLStyle_get_marginRight(style, &v);
737 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
738 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
739 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
741 V_VT(&v) = VT_NULL;
742 hres = IHTMLStyle_get_marginBottom(style, &v);
743 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
744 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
745 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
747 V_VT(&v) = VT_I4;
748 V_I4(&v) = 6;
749 hres = IHTMLStyle_put_marginBottom(style, v);
750 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
752 V_VT(&v) = VT_NULL;
753 hres = IHTMLStyle_get_marginBottom(style, &v);
754 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
755 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
756 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
758 V_VT(&v) = VT_NULL;
759 hres = IHTMLStyle_get_marginLeft(style, &v);
760 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
761 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
762 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
764 V_VT(&v) = VT_I4;
765 V_I4(&v) = 6;
766 hres = IHTMLStyle_put_marginLeft(style, v);
767 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
769 V_VT(&v) = VT_NULL;
770 hres = IHTMLStyle_get_marginLeft(style, &v);
771 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
772 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
773 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
775 str = (void*)0xdeadbeef;
776 hres = IHTMLStyle_get_fontFamily(style, &str);
777 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
778 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
780 str = (void*)0xdeadbeef;
781 hres = IHTMLStyle_get_fontWeight(style, &str);
782 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
783 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
785 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
786 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
788 str = a2bstr("test");
789 hres = IHTMLStyle_put_fontWeight(style, str);
790 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
791 SysFreeString(str);
793 str = a2bstr("bold");
794 hres = IHTMLStyle_put_fontWeight(style, str);
795 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
796 SysFreeString(str);
798 str = a2bstr("bolder");
799 hres = IHTMLStyle_put_fontWeight(style, str);
800 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
801 SysFreeString(str);
803 str = a2bstr("lighter");
804 hres = IHTMLStyle_put_fontWeight(style, str);
805 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
806 SysFreeString(str);
808 str = a2bstr("100");
809 hres = IHTMLStyle_put_fontWeight(style, str);
810 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
811 SysFreeString(str);
813 str = a2bstr("200");
814 hres = IHTMLStyle_put_fontWeight(style, str);
815 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
816 SysFreeString(str);
818 str = a2bstr("300");
819 hres = IHTMLStyle_put_fontWeight(style, str);
820 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
821 SysFreeString(str);
823 str = a2bstr("400");
824 hres = IHTMLStyle_put_fontWeight(style, str);
825 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
826 SysFreeString(str);
828 str = a2bstr("500");
829 hres = IHTMLStyle_put_fontWeight(style, str);
830 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
831 SysFreeString(str);
833 str = a2bstr("600");
834 hres = IHTMLStyle_put_fontWeight(style, str);
835 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
836 SysFreeString(str);
838 str = a2bstr("700");
839 hres = IHTMLStyle_put_fontWeight(style, str);
840 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
841 SysFreeString(str);
843 str = a2bstr("800");
844 hres = IHTMLStyle_put_fontWeight(style, str);
845 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
846 SysFreeString(str);
848 str = a2bstr("900");
849 hres = IHTMLStyle_put_fontWeight(style, str);
850 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
851 SysFreeString(str);
853 hres = IHTMLStyle_get_fontWeight(style, &str);
854 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
855 ok(!strcmp_wa(str, "900"), "str != style900\n");
856 SysFreeString(str);
858 str = a2bstr("");
859 hres = IHTMLStyle_put_fontWeight(style, str);
860 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
861 SysFreeString(str);
863 hres = IHTMLStyle_get_fontWeight(style, &str);
864 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
865 ok(!str, "str != NULL\n");
866 SysFreeString(str);
868 hres = IHTMLStyle_put_fontWeight(style, sDefault);
869 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
870 SysFreeString(sDefault);
872 /* font Variant */
873 hres = IHTMLStyle_get_fontVariant(style, NULL);
874 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
876 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
877 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
879 str = a2bstr("test");
880 hres = IHTMLStyle_put_fontVariant(style, str);
881 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
882 SysFreeString(str);
884 str = a2bstr("small-caps");
885 hres = IHTMLStyle_put_fontVariant(style, str);
886 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
887 SysFreeString(str);
889 str = a2bstr("normal");
890 hres = IHTMLStyle_put_fontVariant(style, str);
891 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
892 SysFreeString(str);
894 hres = IHTMLStyle_put_fontVariant(style, sDefault);
895 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
896 SysFreeString(sDefault);
898 str = (void*)0xdeadbeef;
899 hres = IHTMLStyle_get_display(style, &str);
900 ok(hres == S_OK, "get_display failed: %08x\n", hres);
901 ok(!str, "display = %s\n", wine_dbgstr_w(str));
903 str = (void*)0xdeadbeef;
904 hres = IHTMLStyle_get_visibility(style, &str);
905 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
906 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
908 V_VT(&v) = VT_NULL;
909 hres = IHTMLStyle_get_fontSize(style, &v);
910 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
911 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
912 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
914 V_VT(&v) = VT_I4;
915 V_I4(&v) = 12;
916 hres = IHTMLStyle_put_fontSize(style, v);
917 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
919 V_VT(&v) = VT_NULL;
920 hres = IHTMLStyle_get_fontSize(style, &v);
921 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
922 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
923 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
925 V_VT(&v) = VT_NULL;
926 hres = IHTMLStyle_get_color(style, &v);
927 ok(hres == S_OK, "get_color failed: %08x\n", hres);
928 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
929 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
931 V_VT(&v) = VT_I4;
932 V_I4(&v) = 0xfdfd;
933 hres = IHTMLStyle_put_color(style, v);
934 ok(hres == S_OK, "put_color failed: %08x\n", hres);
936 V_VT(&v) = VT_NULL;
937 hres = IHTMLStyle_get_color(style, &v);
938 ok(hres == S_OK, "get_color failed: %08x\n", hres);
939 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
940 todo_wine
941 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
943 V_VT(&v) = VT_I4;
944 V_I4(&v) = 3;
945 hres = IHTMLStyle_put_lineHeight(style, v);
946 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
948 hres = IHTMLStyle_get_lineHeight(style, &v);
949 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
950 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
951 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
953 V_VT(&v) = VT_BSTR;
954 V_BSTR(&v) = a2bstr("300%");
955 hres = IHTMLStyle_put_lineHeight(style, v);
956 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
957 VariantClear(&v);
959 hres = IHTMLStyle_get_lineHeight(style, &v);
960 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
961 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
962 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
963 VariantClear(&v);
965 b = 0xfefe;
966 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
967 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
968 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
970 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
971 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
973 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
974 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
975 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
977 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
978 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
980 b = 0xfefe;
981 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
982 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
983 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
985 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
986 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
988 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
989 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
990 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
992 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
993 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
995 b = 0xfefe;
996 hres = IHTMLStyle_get_textDecorationNone(style, &b);
997 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
998 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
1000 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
1001 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1003 hres = IHTMLStyle_get_textDecorationNone(style, &b);
1004 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
1005 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
1007 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
1008 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
1010 b = 0xfefe;
1011 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1012 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1013 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
1015 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
1016 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1018 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1019 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1020 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
1022 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
1023 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1025 b = 0xfefe;
1026 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1027 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1028 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
1030 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
1031 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1033 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1034 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1035 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1037 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1038 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1040 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1041 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1043 str = a2bstr("invalid");
1044 hres = IHTMLStyle_put_textDecoration(style, str);
1045 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
1046 SysFreeString(str);
1048 set_text_decoration(style, "none");
1049 test_text_decoration(style, "none");
1050 set_text_decoration(style, "underline");
1051 set_text_decoration(style, "overline");
1052 set_text_decoration(style, "line-through");
1053 set_text_decoration(style, "blink");
1054 set_text_decoration(style, "overline");
1055 set_text_decoration(style, "blink");
1056 test_text_decoration(style, "blink");
1058 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1059 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1060 SysFreeString(sDefault);
1062 hres = IHTMLStyle_get_posWidth(style, NULL);
1063 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1065 hres = IHTMLStyle_get_posWidth(style, &f);
1066 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1067 ok(f == 0.0f, "f = %f\n", f);
1069 V_VT(&v) = VT_EMPTY;
1070 hres = IHTMLStyle_get_width(style, &v);
1071 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1072 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1073 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1075 hres = IHTMLStyle_put_posWidth(style, 2.2);
1076 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1078 hres = IHTMLStyle_get_posWidth(style, &f);
1079 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1080 ok(f == 2.0f ||
1081 f == 2.2f, /* IE8 */
1082 "f = %f\n", f);
1084 l = 0xdeadbeef;
1085 hres = IHTMLStyle_get_pixelWidth(style, &l);
1086 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1087 ok(l == 2, "pixelWidth = %d\n", l);
1089 V_VT(&v) = VT_BSTR;
1090 V_BSTR(&v) = a2bstr("auto");
1091 hres = IHTMLStyle_put_width(style, v);
1092 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1093 VariantClear(&v);
1095 V_VT(&v) = VT_EMPTY;
1096 hres = IHTMLStyle_get_width(style, &v);
1097 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1098 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1099 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1100 VariantClear(&v);
1102 V_VT(&v) = VT_I4;
1103 V_I4(&v) = 100;
1104 hres = IHTMLStyle_put_width(style, v);
1105 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1107 l = 0xdeadbeef;
1108 hres = IHTMLStyle_get_pixelWidth(style, &l);
1109 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1110 ok(l == 100, "pixelWidth = %d\n", l);
1112 V_VT(&v) = VT_EMPTY;
1113 hres = IHTMLStyle_get_width(style, &v);
1114 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1115 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1116 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1117 VariantClear(&v);
1119 hres = IHTMLStyle_put_pixelWidth(style, 50);
1120 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1122 l = 0xdeadbeef;
1123 hres = IHTMLStyle_get_pixelWidth(style, &l);
1124 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1125 ok(l == 50, "pixelWidth = %d\n", l);
1127 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1128 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1130 V_VT(&v) = VT_EMPTY;
1131 hres = IHTMLStyle_get_width(style, &v);
1132 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1133 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1134 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1135 VariantClear(&v);
1137 /* margin tests */
1138 str = (void*)0xdeadbeef;
1139 hres = IHTMLStyle_get_margin(style, &str);
1140 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1141 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1143 str = a2bstr("1");
1144 hres = IHTMLStyle_put_margin(style, str);
1145 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1146 SysFreeString(str);
1148 hres = IHTMLStyle_get_margin(style, &str);
1149 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1150 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
1151 SysFreeString(str);
1153 hres = IHTMLStyle_put_margin(style, NULL);
1154 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1156 str = (void*)0xdeadbeef;
1157 hres = IHTMLStyle_get_marginTop(style, &v);
1158 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1159 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1160 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1162 V_VT(&v) = VT_BSTR;
1163 V_BSTR(&v) = a2bstr("6px");
1164 hres = IHTMLStyle_put_marginTop(style, v);
1165 SysFreeString(V_BSTR(&v));
1166 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1168 str = (void*)0xdeadbeef;
1169 hres = IHTMLStyle_get_marginTop(style, &v);
1170 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1171 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1172 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1173 VariantClear(&v);
1175 V_VT(&v) = VT_I4;
1176 V_I4(&v) = 5;
1177 hres = IHTMLStyle_put_marginTop(style, v);
1178 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1180 str = (void*)0xdeadbeef;
1181 hres = IHTMLStyle_get_marginTop(style, &v);
1182 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1183 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1184 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1185 VariantClear(&v);
1187 str = NULL;
1188 hres = IHTMLStyle_get_border(style, &str);
1189 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1190 ok(!str || !*str, "str is not empty\n");
1191 SysFreeString(str);
1193 str = a2bstr("1px");
1194 hres = IHTMLStyle_put_border(style, str);
1195 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1196 SysFreeString(str);
1198 V_VT(&v) = VT_EMPTY;
1199 hres = IHTMLStyle_get_left(style, &v);
1200 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1201 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1202 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1203 VariantClear(&v);
1205 l = 0xdeadbeef;
1206 hres = IHTMLStyle_get_pixelLeft(style, &l);
1207 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1208 ok(!l, "pixelLeft = %d\n", l);
1210 /* Test posLeft */
1211 hres = IHTMLStyle_get_posLeft(style, NULL);
1212 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1214 f = 1.0f;
1215 hres = IHTMLStyle_get_posLeft(style, &f);
1216 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1217 ok(f == 0.0, "expected 0.0 got %f\n", f);
1219 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1220 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1222 hres = IHTMLStyle_get_posLeft(style, &f);
1223 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1224 ok(f == 4.0 ||
1225 f == 4.9f, /* IE8 */
1226 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1228 /* Ensure left is updated correctly. */
1229 V_VT(&v) = VT_EMPTY;
1230 hres = IHTMLStyle_get_left(style, &v);
1231 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1232 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1233 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1234 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1235 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1236 VariantClear(&v);
1238 /* Test left */
1239 V_VT(&v) = VT_BSTR;
1240 V_BSTR(&v) = a2bstr("3px");
1241 hres = IHTMLStyle_put_left(style, v);
1242 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1243 VariantClear(&v);
1245 hres = IHTMLStyle_get_posLeft(style, &f);
1246 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1247 ok(f == 3.0, "expected 3.0 got %f\n", f);
1249 l = 0xdeadbeef;
1250 hres = IHTMLStyle_get_pixelLeft(style, &l);
1251 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1252 ok(l == 3, "pixelLeft = %d\n", l);
1254 V_VT(&v) = VT_EMPTY;
1255 hres = IHTMLStyle_get_left(style, &v);
1256 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1257 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1258 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1259 VariantClear(&v);
1261 V_VT(&v) = VT_BSTR;
1262 V_BSTR(&v) = a2bstr("4.99");
1263 hres = IHTMLStyle_put_left(style, v);
1264 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1265 VariantClear(&v);
1267 l = 0xdeadbeef;
1268 hres = IHTMLStyle_get_pixelLeft(style, &l);
1269 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1270 ok(l == 4, "pixelLeft = %d\n", l);
1272 V_VT(&v) = VT_NULL;
1273 hres = IHTMLStyle_put_left(style, v);
1274 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1276 V_VT(&v) = VT_EMPTY;
1277 hres = IHTMLStyle_get_left(style, &v);
1278 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1279 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1280 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1281 VariantClear(&v);
1283 V_VT(&v) = VT_EMPTY;
1284 hres = IHTMLStyle_get_top(style, &v);
1285 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1286 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1287 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1288 VariantClear(&v);
1290 l = 0xdeadbeef;
1291 hres = IHTMLStyle_get_pixelLeft(style, &l);
1292 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1293 ok(!l, "pixelLeft = %d\n", l);
1295 hres = IHTMLStyle_put_pixelLeft(style, 6);
1296 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1298 l = 0xdeadbeef;
1299 hres = IHTMLStyle_get_pixelLeft(style, &l);
1300 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1301 ok(l == 6, "pixelLeft = %d\n", l);
1303 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1304 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
1306 V_VT(&v) = VT_EMPTY;
1307 hres = IHTMLStyle_get_left(style, &v);
1308 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1309 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1310 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1311 VariantClear(&v);
1313 /* Test posTop */
1314 hres = IHTMLStyle_get_posTop(style, NULL);
1315 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1317 f = 1.0f;
1318 hres = IHTMLStyle_get_posTop(style, &f);
1319 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1320 ok(f == 0.0, "expected 0.0 got %f\n", f);
1322 hres = IHTMLStyle_put_posTop(style, 4.9f);
1323 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1325 hres = IHTMLStyle_get_posTop(style, &f);
1326 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1327 ok(f == 4.0 ||
1328 f == 4.9f, /* IE8 */
1329 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1331 hres = IHTMLStyle_put_pixelTop(style, 6);
1332 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1334 l = 0xdeadbeef;
1335 hres = IHTMLStyle_get_pixelTop(style, &l);
1336 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1337 ok(l == 6, "pixelTop = %d\n", l);
1339 hres = IHTMLStyle_get_pixelTop(style, NULL);
1340 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1342 V_VT(&v) = VT_BSTR;
1343 V_BSTR(&v) = a2bstr("3px");
1344 hres = IHTMLStyle_put_top(style, v);
1345 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1346 VariantClear(&v);
1348 V_VT(&v) = VT_EMPTY;
1349 hres = IHTMLStyle_get_top(style, &v);
1350 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1351 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1352 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1353 VariantClear(&v);
1355 hres = IHTMLStyle_get_posTop(style, &f);
1356 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1357 ok(f == 3.0, "expected 3.0 got %f\n", f);
1359 l = 0xdeadbeef;
1360 hres = IHTMLStyle_get_pixelTop(style, &l);
1361 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1362 ok(l == 3, "pixelTop = %d\n", l);
1364 V_VT(&v) = VT_NULL;
1365 hres = IHTMLStyle_put_top(style, v);
1366 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1368 V_VT(&v) = VT_EMPTY;
1369 hres = IHTMLStyle_get_top(style, &v);
1370 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1371 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1372 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1373 VariantClear(&v);
1375 l = 0xdeadbeef;
1376 hres = IHTMLStyle_get_pixelTop(style, &l);
1377 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1378 ok(!l, "pixelTop = %d\n", l);
1380 /* Test posHeight */
1381 hres = IHTMLStyle_get_posHeight(style, NULL);
1382 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1384 V_VT(&v) = VT_EMPTY;
1385 hres = IHTMLStyle_get_height(style, &v);
1386 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1387 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1388 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1389 VariantClear(&v);
1391 f = 1.0f;
1392 hres = IHTMLStyle_get_posHeight(style, &f);
1393 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1394 ok(f == 0.0, "expected 0.0 got %f\n", f);
1396 l = 0xdeadbeef;
1397 hres = IHTMLStyle_get_pixelHeight(style, &l);
1398 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1399 ok(!l, "pixelHeight = %d\n", l);
1401 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1402 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1404 hres = IHTMLStyle_get_posHeight(style, &f);
1405 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1406 ok(f == 4.0 ||
1407 f == 4.9f, /* IE8 */
1408 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1410 l = 0xdeadbeef;
1411 hres = IHTMLStyle_get_pixelHeight(style, &l);
1412 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1413 ok(l == 4 ||
1414 l == 5, /* IE8 */
1415 "pixelHeight = %d\n", l);
1417 V_VT(&v) = VT_BSTR;
1418 V_BSTR(&v) = a2bstr("70px");
1419 hres = IHTMLStyle_put_height(style, v);
1420 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1421 VariantClear(&v);
1423 V_VT(&v) = VT_EMPTY;
1424 hres = IHTMLStyle_get_height(style, &v);
1425 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1426 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1427 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1428 VariantClear(&v);
1430 l = 0xdeadbeef;
1431 hres = IHTMLStyle_get_pixelHeight(style, &l);
1432 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1433 ok(l == 70, "pixelHeight = %d\n", l);
1435 V_VT(&v) = VT_BSTR;
1436 V_BSTR(&v) = NULL;
1437 hres = IHTMLStyle_put_height(style, v);
1438 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1439 VariantClear(&v);
1441 V_VT(&v) = VT_EMPTY;
1442 hres = IHTMLStyle_get_height(style, &v);
1443 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1444 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1445 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1446 VariantClear(&v);
1448 l = 0xdeadbeef;
1449 hres = IHTMLStyle_get_pixelHeight(style, &l);
1450 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1451 ok(!l, "pixelHeight = %d\n", l);
1453 hres = IHTMLStyle_put_pixelHeight(style, 50);
1454 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
1456 l = 0xdeadbeef;
1457 hres = IHTMLStyle_get_pixelHeight(style, &l);
1458 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1459 ok(l == 50, "pixelHeight = %d\n", l);
1461 hres = IHTMLStyle_get_pixelHeight(style, NULL);
1462 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
1464 V_VT(&v) = VT_I4;
1465 V_I4(&v) = 64;
1466 hres = IHTMLStyle_put_height(style, v);
1467 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1469 V_VT(&v) = VT_EMPTY;
1470 hres = IHTMLStyle_get_height(style, &v);
1471 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1472 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1473 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1474 VariantClear(&v);
1476 hres = IHTMLStyle_get_posHeight(style, &f);
1477 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1478 ok(f == 64.0, "expected 64.0 got %f\n", f);
1480 l = 0xdeadbeef;
1481 hres = IHTMLStyle_get_pixelHeight(style, &l);
1482 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1483 ok(l == 64, "pixelHeight = %d\n", l);
1485 str = (void*)0xdeadbeef;
1486 hres = IHTMLStyle_get_cursor(style, &str);
1487 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1488 ok(!str, "get_cursor != NULL\n");
1489 SysFreeString(str);
1491 str = a2bstr("default");
1492 hres = IHTMLStyle_put_cursor(style, str);
1493 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1494 SysFreeString(str);
1496 str = NULL;
1497 hres = IHTMLStyle_get_cursor(style, &str);
1498 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1499 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1500 SysFreeString(str);
1502 V_VT(&v) = VT_EMPTY;
1503 hres = IHTMLStyle_get_verticalAlign(style, &v);
1504 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1505 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1506 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1507 VariantClear(&v);
1509 V_VT(&v) = VT_BSTR;
1510 V_BSTR(&v) = a2bstr("middle");
1511 hres = IHTMLStyle_put_verticalAlign(style, v);
1512 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1513 VariantClear(&v);
1515 V_VT(&v) = VT_EMPTY;
1516 hres = IHTMLStyle_get_verticalAlign(style, &v);
1517 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1518 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1519 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1520 VariantClear(&v);
1522 V_VT(&v) = VT_I4;
1523 V_I4(&v) = 100;
1524 hres = IHTMLStyle_put_verticalAlign(style, v);
1525 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1526 VariantClear(&v);
1528 V_VT(&v) = VT_EMPTY;
1529 hres = IHTMLStyle_get_verticalAlign(style, &v);
1530 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1531 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1532 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1533 VariantClear(&v);
1535 str = (void*)0xdeadbeef;
1536 hres = IHTMLStyle_get_textAlign(style, &str);
1537 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1538 ok(!str, "textAlign != NULL\n");
1540 str = a2bstr("center");
1541 hres = IHTMLStyle_put_textAlign(style, str);
1542 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1543 SysFreeString(str);
1545 str = NULL;
1546 hres = IHTMLStyle_get_textAlign(style, &str);
1547 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1548 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1549 SysFreeString(str);
1551 V_VT(&v) = VT_NULL;
1552 hres = IHTMLStyle_get_textIndent(style, &v);
1553 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1554 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1555 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1557 V_VT(&v) = VT_I4;
1558 V_I4(&v) = 6;
1559 hres = IHTMLStyle_put_textIndent(style, v);
1560 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1562 V_VT(&v) = VT_NULL;
1563 hres = IHTMLStyle_get_textIndent(style, &v);
1564 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1565 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1566 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1568 str = (void*)0xdeadbeef;
1569 hres = IHTMLStyle_get_textTransform(style, &str);
1570 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1571 ok(!str, "textTransform != NULL\n");
1573 str = a2bstr("lowercase");
1574 hres = IHTMLStyle_put_textTransform(style, str);
1575 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1576 SysFreeString(str);
1578 str = NULL;
1579 hres = IHTMLStyle_get_textTransform(style, &str);
1580 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1581 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1582 SysFreeString(str);
1584 str = (void*)0xdeadbeef;
1585 hres = IHTMLStyle_get_filter(style, &str);
1586 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1587 ok(!str, "filter != NULL\n");
1589 str = a2bstr("alpha(opacity=100)");
1590 hres = IHTMLStyle_put_filter(style, str);
1591 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1592 SysFreeString(str);
1594 V_VT(&v) = VT_EMPTY;
1595 hres = IHTMLStyle_get_zIndex(style, &v);
1596 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1597 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1598 ok(!V_I4(&v), "V_I4(v) != 0\n");
1599 VariantClear(&v);
1601 V_VT(&v) = VT_BSTR;
1602 V_BSTR(&v) = a2bstr("1");
1603 hres = IHTMLStyle_put_zIndex(style, v);
1604 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1605 VariantClear(&v);
1607 V_VT(&v) = VT_EMPTY;
1608 hres = IHTMLStyle_get_zIndex(style, &v);
1609 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1610 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1611 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1612 VariantClear(&v);
1614 /* fontStyle */
1615 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1616 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1618 str = a2bstr("test");
1619 hres = IHTMLStyle_put_fontStyle(style, str);
1620 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1621 SysFreeString(str);
1623 str = a2bstr("italic");
1624 hres = IHTMLStyle_put_fontStyle(style, str);
1625 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1626 SysFreeString(str);
1628 str = a2bstr("oblique");
1629 hres = IHTMLStyle_put_fontStyle(style, str);
1630 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1631 SysFreeString(str);
1633 str = a2bstr("normal");
1634 hres = IHTMLStyle_put_fontStyle(style, str);
1635 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1636 SysFreeString(str);
1638 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1639 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1640 SysFreeString(sDefault);
1642 /* overflow */
1643 hres = IHTMLStyle_get_overflow(style, NULL);
1644 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1646 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1647 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1649 str = a2bstr("test");
1650 hres = IHTMLStyle_put_overflow(style, str);
1651 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1652 SysFreeString(str);
1654 str = a2bstr("visible");
1655 hres = IHTMLStyle_put_overflow(style, str);
1656 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1657 SysFreeString(str);
1659 str = a2bstr("scroll");
1660 hres = IHTMLStyle_put_overflow(style, str);
1661 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1662 SysFreeString(str);
1664 str = a2bstr("hidden");
1665 hres = IHTMLStyle_put_overflow(style, str);
1666 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1667 SysFreeString(str);
1669 str = a2bstr("auto");
1670 hres = IHTMLStyle_put_overflow(style, str);
1671 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1672 SysFreeString(str);
1674 hres = IHTMLStyle_get_overflow(style, &str);
1675 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1676 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1677 SysFreeString(str);
1679 str = a2bstr("");
1680 hres = IHTMLStyle_put_overflow(style, str);
1681 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1682 SysFreeString(str);
1684 hres = IHTMLStyle_get_overflow(style, &str);
1685 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1686 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1687 SysFreeString(str);
1689 /* restore overflow default */
1690 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1691 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1692 SysFreeString(sOverflowDefault);
1694 /* Attribute Tests*/
1695 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1696 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1698 str = a2bstr("position");
1699 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1700 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1702 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1703 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1704 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1705 VariantClear(&v);
1707 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1708 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1710 V_VT(&v) = VT_BSTR;
1711 V_BSTR(&v) = a2bstr("absolute");
1712 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1713 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1714 VariantClear(&v);
1716 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1717 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1718 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1719 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1720 VariantClear(&v);
1722 V_VT(&v) = VT_BSTR;
1723 V_BSTR(&v) = NULL;
1724 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1725 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1726 VariantClear(&v);
1728 SysFreeString(str);
1730 str = a2bstr("borderLeftStyle");
1731 test_border_styles(style, str);
1732 SysFreeString(str);
1734 str = a2bstr("borderbottomstyle");
1735 test_border_styles(style, str);
1736 SysFreeString(str);
1738 str = a2bstr("borderrightstyle");
1739 test_border_styles(style, str);
1740 SysFreeString(str);
1742 str = a2bstr("bordertopstyle");
1743 test_border_styles(style, str);
1744 SysFreeString(str);
1746 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1747 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1749 str = a2bstr("none dotted dashed solid");
1750 hres = IHTMLStyle_put_borderStyle(style, str);
1751 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1752 SysFreeString(str);
1754 str = a2bstr("none dotted dashed solid");
1755 hres = IHTMLStyle_get_borderStyle(style, &str);
1756 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1757 ok(!strcmp_wa(str, "none dotted dashed solid"),
1758 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1759 SysFreeString(str);
1761 str = a2bstr("double groove ridge inset");
1762 hres = IHTMLStyle_put_borderStyle(style, str);
1763 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1764 SysFreeString(str);
1766 str = a2bstr("window-inset outset ridge inset");
1767 hres = IHTMLStyle_put_borderStyle(style, str);
1768 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1769 SysFreeString(str);
1771 str = a2bstr("window-inset");
1772 hres = IHTMLStyle_put_borderStyle(style, str);
1773 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1774 SysFreeString(str);
1776 str = a2bstr("none none none none none");
1777 hres = IHTMLStyle_put_borderStyle(style, str);
1778 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1779 SysFreeString(str);
1781 str = a2bstr("invalid none none none");
1782 hres = IHTMLStyle_put_borderStyle(style, str);
1783 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1784 SysFreeString(str);
1786 str = a2bstr("none invalid none none");
1787 hres = IHTMLStyle_put_borderStyle(style, str);
1788 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1789 SysFreeString(str);
1791 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1792 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1793 SysFreeString(sDefault);
1795 /* backgoundColor */
1796 hres = IHTMLStyle_get_backgroundColor(style, &v);
1797 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1798 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1799 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1800 VariantClear(&v);
1802 V_VT(&v) = VT_BSTR;
1803 V_BSTR(&v) = a2bstr("red");
1804 hres = IHTMLStyle_put_backgroundColor(style, v);
1805 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1806 VariantClear(&v);
1808 hres = IHTMLStyle_get_backgroundColor(style, &v);
1809 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1810 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1811 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1812 VariantClear(&v);
1814 str = a2bstr("fixed");
1815 hres = IHTMLStyle_put_backgroundAttachment(style, str);
1816 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
1817 SysFreeString(str);
1819 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
1820 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
1821 ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str));
1822 SysFreeString(str);
1824 /* padding */
1825 hres = IHTMLStyle_get_padding(style, &str);
1826 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1827 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1828 SysFreeString(str);
1830 hres = IHTMLStyle_get_paddingTop(style, &v);
1831 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1832 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1833 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1835 V_VT(&v) = VT_I4;
1836 V_I4(&v) = 6;
1837 hres = IHTMLStyle_put_paddingTop(style, v);
1838 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1840 hres = IHTMLStyle_get_paddingTop(style, &v);
1841 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1842 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1843 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1844 VariantClear(&v);
1846 hres = IHTMLStyle_get_paddingRight(style, &v);
1847 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1848 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1849 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1851 V_VT(&v) = VT_I4;
1852 V_I4(&v) = 6;
1853 hres = IHTMLStyle_put_paddingRight(style, v);
1854 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1856 hres = IHTMLStyle_get_paddingRight(style, &v);
1857 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1858 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1859 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1860 VariantClear(&v);
1862 hres = IHTMLStyle_get_paddingBottom(style, &v);
1863 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1864 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1865 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1867 V_VT(&v) = VT_I4;
1868 V_I4(&v) = 6;
1869 hres = IHTMLStyle_put_paddingBottom(style, v);
1870 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1872 hres = IHTMLStyle_get_paddingBottom(style, &v);
1873 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1874 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1875 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1876 VariantClear(&v);
1878 str = a2bstr("1");
1879 hres = IHTMLStyle_put_padding(style, str);
1880 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1881 SysFreeString(str);
1883 hres = IHTMLStyle_get_padding(style, &str);
1884 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1885 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1886 SysFreeString(str);
1888 /* PaddingLeft */
1889 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1890 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1891 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1892 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1894 V_VT(&v) = VT_BSTR;
1895 V_BSTR(&v) = a2bstr("10");
1896 hres = IHTMLStyle_put_paddingLeft(style, v);
1897 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1898 VariantClear(&v);
1900 hres = IHTMLStyle_get_paddingLeft(style, &v);
1901 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1902 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1903 VariantClear(&v);
1905 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1906 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1908 /* BackgroundRepeat */
1909 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1910 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1912 str = a2bstr("invalid");
1913 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1914 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1915 SysFreeString(str);
1917 str = a2bstr("repeat");
1918 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1919 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1920 SysFreeString(str);
1922 str = a2bstr("no-repeat");
1923 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1924 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1925 SysFreeString(str);
1927 str = a2bstr("repeat-x");
1928 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1929 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1930 SysFreeString(str);
1932 str = a2bstr("repeat-y");
1933 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1934 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1935 SysFreeString(str);
1937 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1938 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1939 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1940 SysFreeString(str);
1942 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1943 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1944 SysFreeString(sDefault);
1946 /* BorderColor */
1947 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1948 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1950 str = a2bstr("red green red blue");
1951 hres = IHTMLStyle_put_borderColor(style, str);
1952 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1953 SysFreeString(str);
1955 hres = IHTMLStyle_get_borderColor(style, &str);
1956 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1957 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1958 SysFreeString(str);
1960 hres = IHTMLStyle_put_borderColor(style, sDefault);
1961 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1962 SysFreeString(sDefault);
1964 /* BorderRight */
1965 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1966 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1968 str = a2bstr("thick dotted red");
1969 hres = IHTMLStyle_put_borderRight(style, str);
1970 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1971 SysFreeString(str);
1973 /* IHTMLStyle_get_borderRight appears to have a bug where
1974 it returns the first letter of the color. So we check
1975 each style individually.
1977 V_BSTR(&v) = NULL;
1978 hres = IHTMLStyle_get_borderRightColor(style, &v);
1979 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1980 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1981 VariantClear(&v);
1983 V_BSTR(&v) = NULL;
1984 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1985 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1986 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1987 VariantClear(&v);
1989 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1990 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1991 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1992 SysFreeString(str);
1994 hres = IHTMLStyle_put_borderRight(style, sDefault);
1995 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1996 SysFreeString(sDefault);
1998 /* BorderTop */
1999 hres = IHTMLStyle_get_borderTop(style, &sDefault);
2000 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
2002 str = a2bstr("thick dotted red");
2003 hres = IHTMLStyle_put_borderTop(style, str);
2004 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2005 SysFreeString(str);
2007 /* IHTMLStyle_get_borderTop appears to have a bug where
2008 it returns the first letter of the color. So we check
2009 each style individually.
2011 V_BSTR(&v) = NULL;
2012 hres = IHTMLStyle_get_borderTopColor(style, &v);
2013 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2014 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2015 VariantClear(&v);
2017 V_BSTR(&v) = NULL;
2018 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2019 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2020 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2021 VariantClear(&v);
2023 hres = IHTMLStyle_get_borderTopStyle(style, &str);
2024 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2025 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2026 SysFreeString(str);
2028 hres = IHTMLStyle_put_borderTop(style, sDefault);
2029 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2030 SysFreeString(sDefault);
2032 /* BorderBottom */
2033 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2034 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2036 str = a2bstr("thick dotted red");
2037 hres = IHTMLStyle_put_borderBottom(style, str);
2038 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2039 SysFreeString(str);
2041 /* IHTMLStyle_get_borderBottom appears to have a bug where
2042 it returns the first letter of the color. So we check
2043 each style individually.
2045 V_BSTR(&v) = NULL;
2046 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2047 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2048 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2049 VariantClear(&v);
2051 V_BSTR(&v) = NULL;
2052 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2053 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2054 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2055 VariantClear(&v);
2057 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2058 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2059 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2060 SysFreeString(str);
2062 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2063 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2064 SysFreeString(sDefault);
2066 /* BorderLeft */
2067 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2068 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2070 str = a2bstr("thick dotted red");
2071 hres = IHTMLStyle_put_borderLeft(style, str);
2072 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2073 SysFreeString(str);
2075 /* IHTMLStyle_get_borderLeft appears to have a bug where
2076 it returns the first letter of the color. So we check
2077 each style individually.
2079 V_BSTR(&v) = NULL;
2080 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2081 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2082 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2083 VariantClear(&v);
2085 V_BSTR(&v) = NULL;
2086 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2087 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2088 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2089 VariantClear(&v);
2091 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2092 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2093 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2094 SysFreeString(str);
2096 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2097 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2098 SysFreeString(sDefault);
2100 /* backgroundPositionX */
2101 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2102 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2103 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2104 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2105 VariantClear(&v);
2107 V_VT(&v) = VT_BSTR;
2108 V_BSTR(&v) = a2bstr("10px");
2109 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2110 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2111 VariantClear(&v);
2113 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2114 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2115 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2116 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2117 VariantClear(&v);
2119 /* backgroundPositionY */
2120 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2121 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2122 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2123 VariantClear(&v);
2125 V_VT(&v) = VT_BSTR;
2126 V_BSTR(&v) = a2bstr("15px");
2127 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2128 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2129 VariantClear(&v);
2131 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2132 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2133 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2134 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2135 VariantClear(&v);
2137 /* backgroundPosition */
2138 str = NULL;
2139 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2140 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2141 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2142 SysFreeString(str);
2144 str = a2bstr("center 20%");
2145 hres = IHTMLStyle_put_backgroundPosition(style, str);
2146 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2147 SysFreeString(str);
2149 str = NULL;
2150 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2151 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2152 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2153 SysFreeString(str);
2155 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2156 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2157 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2158 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2159 VariantClear(&v);
2161 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2162 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2163 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2164 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2165 VariantClear(&v);
2167 /* borderTopWidth */
2168 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2169 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2171 V_VT(&v) = VT_BSTR;
2172 V_BSTR(&v) = a2bstr("10px");
2173 hres = IHTMLStyle_put_borderTopWidth(style, v);
2174 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2175 VariantClear(&v);
2177 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2178 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2179 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2180 VariantClear(&v);
2182 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2183 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2184 VariantClear(&vDefault);
2186 /* borderRightWidth */
2187 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2188 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2190 V_VT(&v) = VT_BSTR;
2191 V_BSTR(&v) = a2bstr("10");
2192 hres = IHTMLStyle_put_borderRightWidth(style, v);
2193 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2194 VariantClear(&v);
2196 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2197 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2198 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2199 VariantClear(&v);
2201 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2202 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2203 VariantClear(&vDefault);
2205 /* borderBottomWidth */
2206 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2207 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2209 V_VT(&v) = VT_BSTR;
2210 V_BSTR(&v) = a2bstr("10");
2211 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2212 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2213 VariantClear(&v);
2215 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2216 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2217 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2218 VariantClear(&v);
2220 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2221 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2222 VariantClear(&vDefault);
2224 /* borderLeftWidth */
2225 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2226 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2228 V_VT(&v) = VT_BSTR;
2229 V_BSTR(&v) = a2bstr("10");
2230 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2231 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2232 VariantClear(&v);
2234 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2235 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2236 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2237 VariantClear(&v);
2239 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2240 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2241 VariantClear(&vDefault);
2243 /* wordSpacing */
2244 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2245 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2247 V_VT(&v) = VT_BSTR;
2248 V_BSTR(&v) = a2bstr("10");
2249 hres = IHTMLStyle_put_wordSpacing(style, v);
2250 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2251 VariantClear(&v);
2253 hres = IHTMLStyle_get_wordSpacing(style, &v);
2254 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2255 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2256 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2257 VariantClear(&v);
2259 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2260 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2261 VariantClear(&vDefault);
2263 /* letterSpacing */
2264 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2265 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2267 V_VT(&v) = VT_BSTR;
2268 V_BSTR(&v) = a2bstr("11");
2269 hres = IHTMLStyle_put_letterSpacing(style, v);
2270 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2271 VariantClear(&v);
2273 hres = IHTMLStyle_get_letterSpacing(style, &v);
2274 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2275 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2276 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2277 VariantClear(&v);
2279 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2280 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2281 VariantClear(&vDefault);
2283 /* borderTopColor */
2284 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2285 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2287 V_VT(&v) = VT_BSTR;
2288 V_BSTR(&v) = a2bstr("red");
2289 hres = IHTMLStyle_put_borderTopColor(style, v);
2290 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2291 VariantClear(&v);
2293 hres = IHTMLStyle_get_borderTopColor(style, &v);
2294 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2295 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2296 VariantClear(&v);
2298 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2299 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2301 /* borderRightColor */
2302 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2303 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2305 V_VT(&v) = VT_BSTR;
2306 V_BSTR(&v) = a2bstr("blue");
2307 hres = IHTMLStyle_put_borderRightColor(style, v);
2308 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2309 VariantClear(&v);
2311 hres = IHTMLStyle_get_borderRightColor(style, &v);
2312 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2313 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2314 VariantClear(&v);
2316 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2317 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2319 /* borderBottomColor */
2320 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2321 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2323 V_VT(&v) = VT_BSTR;
2324 V_BSTR(&v) = a2bstr("cyan");
2325 hres = IHTMLStyle_put_borderBottomColor(style, v);
2326 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2327 VariantClear(&v);
2329 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2330 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2331 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2332 VariantClear(&v);
2334 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2335 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2337 /* borderLeftColor */
2338 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2339 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2341 V_VT(&v) = VT_BSTR;
2342 V_BSTR(&v) = a2bstr("cyan");
2343 hres = IHTMLStyle_put_borderLeftColor(style, v);
2344 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2345 VariantClear(&v);
2347 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2348 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2349 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2350 VariantClear(&v);
2352 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2353 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2355 /* clip */
2356 hres = IHTMLStyle_get_clip(style, &str);
2357 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2358 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2360 str = a2bstr("rect(0px 1px 500px 505px)");
2361 hres = IHTMLStyle_put_clip(style, str);
2362 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2363 SysFreeString(str);
2365 hres = IHTMLStyle_get_clip(style, &str);
2366 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2367 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
2368 SysFreeString(str);
2370 /* clear */
2371 hres = IHTMLStyle_get_clear(style, &str);
2372 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2373 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2375 str = a2bstr("both");
2376 hres = IHTMLStyle_put_clear(style, str);
2377 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2378 SysFreeString(str);
2380 hres = IHTMLStyle_get_clear(style, &str);
2381 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2382 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2383 SysFreeString(str);
2385 /* pageBreakAfter */
2386 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2387 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2388 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2390 str = a2bstr("always");
2391 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2392 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2393 SysFreeString(str);
2395 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2396 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2397 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2398 SysFreeString(str);
2400 /* pageBreakBefore */
2401 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2402 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2403 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2405 str = a2bstr("always");
2406 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2407 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2408 SysFreeString(str);
2410 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2411 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2412 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2413 SysFreeString(str);
2415 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2416 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2418 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2419 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2420 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2422 str = (void*)0xdeadbeef;
2423 hres = IHTMLStyle_get_whiteSpace(style, &str);
2424 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2425 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2427 str = a2bstr("nowrap");
2428 hres = IHTMLStyle_put_whiteSpace(style, str);
2429 SysFreeString(str);
2430 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2432 str = NULL;
2433 hres = IHTMLStyle_get_whiteSpace(style, &str);
2434 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2435 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2436 SysFreeString(str);
2438 /* listStyleType */
2439 hres = IHTMLStyle_get_listStyleType(style, &str);
2440 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2441 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2443 str = a2bstr("square");
2444 hres = IHTMLStyle_put_listStyleType(style, str);
2445 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2446 SysFreeString(str);
2448 str = NULL;
2449 hres = IHTMLStyle_get_listStyleType(style, &str);
2450 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2451 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2453 str = a2bstr("inside");
2454 hres = IHTMLStyle_put_listStylePosition(style, str);
2455 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2456 SysFreeString(str);
2458 hres = IHTMLStyle_get_listStylePosition(style, &str);
2459 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2460 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2461 SysFreeString(str);
2463 str = a2bstr("decimal-leading-zero none inside");
2464 hres = IHTMLStyle_put_listStyle(style, str);
2465 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
2466 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
2467 SysFreeString(str);
2469 if (hres != E_INVALIDARG) {
2470 hres = IHTMLStyle_get_listStyle(style, &str);
2471 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
2472 ok(strstr_wa(str, "decimal-leading-zero") &&
2473 strstr_wa(str, "none") != NULL &&
2474 strstr_wa(str, "inside") != NULL,
2475 "listStyle = %s\n", wine_dbgstr_w(str));
2476 SysFreeString(str);
2477 } else {
2478 win_skip("IHTMLStyle_put_listStyle already failed\n");
2481 str = (void*)0xdeadbeef;
2482 hres = IHTMLStyle_get_styleFloat(style, &str);
2483 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2484 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
2486 str = a2bstr("left");
2487 hres = IHTMLStyle_put_styleFloat(style, str);
2488 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
2489 SysFreeString(str);
2491 str = NULL;
2492 hres = IHTMLStyle_get_styleFloat(style, &str);
2493 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2494 ok(!strcmp_wa(str, "left"), "styleFloat = %s\n", wine_dbgstr_w(str));
2496 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2497 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2498 if(SUCCEEDED(hres)) {
2499 test_style2(style2);
2500 IHTMLStyle2_Release(style2);
2503 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2504 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2505 if(SUCCEEDED(hres)) {
2506 test_style3(style3);
2507 IHTMLStyle3_Release(style3);
2510 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2511 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2512 if(SUCCEEDED(hres)) {
2513 test_style4(style4);
2514 IHTMLStyle4_Release(style4);
2517 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
2518 if(SUCCEEDED(hres)) {
2519 test_style5(style5);
2520 IHTMLStyle5_Release(style5);
2521 }else {
2522 win_skip("IHTMLStyle5 not available\n");
2525 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2526 if(SUCCEEDED(hres)) {
2527 test_style6(style6);
2528 IHTMLStyle6_Release(style6);
2529 }else {
2530 win_skip("IHTMLStyle6 not available\n");
2534 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2535 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2537 BSTR str;
2538 HRESULT hres;
2540 str = (void*)0xdeadbeef;
2541 hres = IHTMLStyle_get_filter(style, &str);
2542 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2543 if(exval)
2544 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2545 else
2546 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2548 SysFreeString(str);
2551 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2552 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2554 BSTR str;
2555 HRESULT hres;
2557 str = (void*)0xdeadbeef;
2558 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2559 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2560 if(exval)
2561 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2562 else
2563 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2565 SysFreeString(str);
2568 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2569 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2571 BSTR str = a2bstr(val);
2572 HRESULT hres;
2574 hres = IHTMLStyle_put_filter(style, str);
2575 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2576 SysFreeString(str);
2578 _test_style_filter(line, style, val);
2581 static void test_style_filters(IHTMLElement *elem)
2583 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2584 IHTMLCurrentStyle2 *current_style2;
2585 IHTMLCurrentStyle *current_style;
2586 IHTMLStyle *style;
2587 HRESULT hres;
2589 hres = IHTMLElement_get_style(elem, &style);
2590 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2592 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2593 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2595 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2597 test_style_filter(style, NULL);
2598 test_current_style_filter(current_style2, NULL);
2599 set_style_filter(style, "alpha(opacity=50.0040)");
2600 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2601 set_style_filter(style, "alpha(opacity=100)");
2603 IHTMLStyle_Release(style);
2605 hres = IHTMLElement_get_style(elem, &style);
2606 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2608 test_style_filter(style, "alpha(opacity=100)");
2609 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2610 set_style_filter(style, NULL);
2611 set_style_filter(style, "alpha(opacity=100)");
2612 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2613 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2614 test_style_filter(style, NULL);
2617 IHTMLCurrentStyle2_Release(current_style2);
2618 IHTMLStyle_Release(style);
2619 IHTMLElement2_Release(elem2);
2622 static void test_current_style(IHTMLCurrentStyle *current_style)
2624 IHTMLCurrentStyle2 *current_style2;
2625 VARIANT_BOOL b;
2626 BSTR str;
2627 HRESULT hres;
2628 VARIANT v;
2630 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2631 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2632 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2633 SysFreeString(str);
2635 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2636 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2637 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2638 SysFreeString(str);
2640 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2641 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2642 SysFreeString(str);
2644 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2645 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2646 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2647 SysFreeString(str);
2649 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2650 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2651 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2652 SysFreeString(str);
2654 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2655 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2656 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2657 SysFreeString(str);
2659 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2660 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2661 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2662 SysFreeString(str);
2664 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2665 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2666 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2667 SysFreeString(str);
2669 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2670 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2671 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2672 SysFreeString(str);
2674 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2675 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2676 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2677 SysFreeString(str);
2679 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2680 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2681 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2682 SysFreeString(str);
2684 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2685 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2686 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2687 SysFreeString(str);
2689 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2690 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2691 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2692 SysFreeString(str);
2694 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2695 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2696 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2697 SysFreeString(str);
2699 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2700 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2701 SysFreeString(str);
2703 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2704 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2705 SysFreeString(str);
2707 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2708 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2709 SysFreeString(str);
2711 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2712 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2713 SysFreeString(str);
2715 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2716 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2717 SysFreeString(str);
2719 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2720 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2721 SysFreeString(str);
2723 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2724 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2725 SysFreeString(str);
2727 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2728 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2729 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2730 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2731 VariantClear(&v);
2733 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2734 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2735 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2736 VariantClear(&v);
2738 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2739 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2740 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2741 VariantClear(&v);
2743 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2744 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2745 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2746 VariantClear(&v);
2748 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2749 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2750 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2751 VariantClear(&v);
2753 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2754 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2755 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2756 VariantClear(&v);
2758 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2759 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2760 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2761 VariantClear(&v);
2763 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2764 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2765 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2766 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2767 VariantClear(&v);
2769 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2770 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2771 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2772 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2773 VariantClear(&v);
2775 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2776 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2777 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2778 VariantClear(&v);
2780 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2781 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2782 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2783 VariantClear(&v);
2785 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2786 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2787 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2788 VariantClear(&v);
2790 V_BSTR(&v) = NULL;
2791 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2792 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2793 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2794 VariantClear(&v);
2796 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2797 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2798 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2799 VariantClear(&v);
2801 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2802 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2803 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2804 VariantClear(&v);
2806 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2807 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2808 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2809 VariantClear(&v);
2811 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2812 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2813 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2814 VariantClear(&v);
2816 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2817 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2818 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2819 VariantClear(&v);
2821 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2822 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2823 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2824 VariantClear(&v);
2826 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2827 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2828 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2829 VariantClear(&v);
2831 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2832 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2833 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2834 VariantClear(&v);
2836 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2837 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2838 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2839 VariantClear(&v);
2841 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2842 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2843 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2844 VariantClear(&v);
2846 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2847 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2848 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2849 VariantClear(&v);
2851 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2852 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2853 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2854 VariantClear(&v);
2856 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2857 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2858 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2859 VariantClear(&v);
2861 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2862 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2863 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2864 VariantClear(&v);
2866 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2867 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2868 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2869 VariantClear(&v);
2871 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2872 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2873 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2874 VariantClear(&v);
2876 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2877 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2878 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2879 VariantClear(&v);
2881 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2882 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2883 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2884 VariantClear(&v);
2886 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
2887 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2888 SysFreeString(str);
2890 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2892 b = 100;
2893 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2894 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2895 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2897 IHTMLCurrentStyle2_Release(current_style2);
2900 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2902 static void basic_style_test(IHTMLDocument2 *doc)
2904 IHTMLCurrentStyle *cstyle;
2905 IHTMLElement *elem;
2906 IHTMLStyle *style;
2907 HRESULT hres;
2909 hres = IHTMLDocument2_get_body(doc, &elem);
2910 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2912 hres = IHTMLElement_get_style(elem, &style);
2913 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2915 test_body_style(style);
2917 cstyle = get_current_style(elem);
2918 test_current_style(cstyle);
2919 IHTMLCurrentStyle_Release(cstyle);
2920 IHTMLElement_Release(elem);
2922 elem = get_element_by_id(doc, "divid");
2923 test_style_filters(elem);
2925 test_set_csstext(style);
2926 IHTMLStyle_Release(style);
2927 IHTMLElement_Release(elem);
2930 static const char runtimestyle_test_str[] =
2931 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2933 static void runtimestyle_test(IHTMLDocument2 *doc)
2935 IHTMLStyle *style, *runtime_style;
2936 IHTMLElement2 *elem2;
2937 IHTMLElement *elem;
2938 BSTR str;
2939 HRESULT hres;
2941 hres = IHTMLDocument2_get_body(doc, &elem);
2942 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2944 elem2 = get_elem2_iface((IUnknown*)elem);
2946 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2947 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2949 hres = IHTMLElement_get_style(elem, &style);
2950 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2952 test_text_decoration(style, NULL);
2953 test_text_decoration(runtime_style, NULL);
2954 set_text_decoration(style, "underline");
2955 test_text_decoration(style, "underline");
2957 hres = IHTMLStyle_get_textDecoration(style, &str);
2958 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2959 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2960 SysFreeString(str);
2962 set_text_decoration(runtime_style, "blink");
2963 test_text_decoration(runtime_style, "blink");
2965 hres = IHTMLStyle_get_textDecoration(style, &str);
2966 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2967 todo_wine
2968 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2969 SysFreeString(str);
2971 IHTMLStyle_Release(runtime_style);
2972 IHTMLStyle_Release(style);
2973 IHTMLElement2_Release(elem2);
2974 IHTMLElement_Release(elem);
2977 static IHTMLDocument2 *notif_doc;
2978 static BOOL doc_complete;
2980 static IHTMLDocument2 *create_document(void)
2982 IHTMLDocument2 *doc;
2983 IHTMLDocument5 *doc5;
2984 HRESULT hres;
2986 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2987 &IID_IHTMLDocument2, (void**)&doc);
2988 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2989 if(FAILED(hres))
2990 return NULL;
2992 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2993 if(FAILED(hres)) {
2994 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2995 IHTMLDocument2_Release(doc);
2996 return NULL;
2999 IHTMLDocument5_Release(doc5);
3000 return doc;
3003 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
3004 REFIID riid, void**ppv)
3006 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3007 *ppv = iface;
3008 return S_OK;
3011 ok(0, "unexpected call\n");
3012 return E_NOINTERFACE;
3015 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
3017 return 2;
3020 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
3022 return 1;
3025 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
3027 if(dispID == DISPID_READYSTATE){
3028 BSTR state;
3029 HRESULT hres;
3031 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3032 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3034 if(!strcmp_wa(state, "complete"))
3035 doc_complete = TRUE;
3037 SysFreeString(state);
3040 return S_OK;
3043 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
3045 ok(0, "unexpected call\n");
3046 return E_NOTIMPL;
3049 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3050 PropertyNotifySink_QueryInterface,
3051 PropertyNotifySink_AddRef,
3052 PropertyNotifySink_Release,
3053 PropertyNotifySink_OnChanged,
3054 PropertyNotifySink_OnRequestEdit
3057 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
3059 static IHTMLDocument2 *create_doc_with_string(const char *str)
3061 IPersistStreamInit *init;
3062 IStream *stream;
3063 IHTMLDocument2 *doc;
3064 HGLOBAL mem;
3065 SIZE_T len;
3067 notif_doc = doc = create_document();
3068 if(!doc)
3069 return NULL;
3071 doc_complete = FALSE;
3072 len = strlen(str);
3073 mem = GlobalAlloc(0, len);
3074 memcpy(mem, str, len);
3075 CreateStreamOnHGlobal(mem, TRUE, &stream);
3077 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3079 IPersistStreamInit_Load(init, stream);
3080 IPersistStreamInit_Release(init);
3081 IStream_Release(stream);
3083 return doc;
3086 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3088 IConnectionPointContainer *container;
3089 IConnectionPoint *cp;
3090 DWORD cookie;
3091 HRESULT hres;
3093 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3094 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3096 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3097 IConnectionPointContainer_Release(container);
3098 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3100 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3101 IConnectionPoint_Release(cp);
3102 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3105 typedef void (*style_test_t)(IHTMLDocument2*);
3107 static void run_test(const char *str, style_test_t test)
3109 IHTMLDocument2 *doc;
3110 ULONG ref;
3111 MSG msg;
3113 doc = create_doc_with_string(str);
3114 if(!doc)
3115 return;
3117 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
3119 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3120 TranslateMessage(&msg);
3121 DispatchMessageW(&msg);
3124 test(doc);
3126 ref = IHTMLDocument2_Release(doc);
3127 ok(!ref || broken(ref == 1), /* Vista */
3128 "ref = %d\n", ref);
3132 START_TEST(style)
3134 CoInitialize(NULL);
3136 run_test(basic_test_str, basic_style_test);
3137 run_test(runtimestyle_test_str, runtimestyle_test);
3139 CoUninitialize();