mshtml: Added IHTMLStyle::whiteSpace property implementation.
[wine.git] / dlls / mshtml / tests / style.c
blobe42bcb78a51ac835d379dd4528cb18ba7c5fdfa5
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 BSTR a2bstr(const char *str)
42 BSTR ret;
43 int len;
45 if(!str)
46 return NULL;
48 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
49 ret = SysAllocStringLen(NULL, len);
50 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
52 return ret;
55 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
56 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
58 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
59 if(expect)
60 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
61 else
62 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
65 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
66 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
68 IHTMLElement2 *elem;
69 HRESULT hres;
71 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
72 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
73 return elem;
76 #define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
77 static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
79 IHTMLCurrentStyle2 *current_style2;
80 HRESULT hres;
82 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
83 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
84 return current_style2;
87 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
89 HRESULT hres;
90 IHTMLDocument3 *doc3;
91 IHTMLElement *result;
92 BSTR idW = a2bstr(id);
94 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
95 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
97 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
98 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
99 ok(result != NULL, "result == NULL\n");
100 SysFreeString(idW);
102 IHTMLDocument3_Release(doc3);
103 return result;
106 #define get_current_style(e) _get_current_style(__LINE__,e)
107 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
109 IHTMLCurrentStyle *cstyle;
110 IHTMLElement2 *elem2;
111 HRESULT hres;
113 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
114 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
116 cstyle = NULL;
117 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
118 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
119 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
121 IHTMLElement2_Release(elem2);
122 return cstyle;
125 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
126 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
128 HRESULT hres;
129 DISPID dispid;
131 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
132 LOCALE_USER_DEFAULT, &dispid);
133 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
134 if(hres == S_OK)
136 DISPPARAMS params = {NULL,NULL,0,0};
137 DISPID dispidNamed = DISPID_PROPERTYPUT;
138 VARIANT ret;
139 VARIANT vDefault;
140 VARIANTARG arg;
142 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
143 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
144 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
146 params.cArgs = 1;
147 params.cNamedArgs = 1;
148 params.rgdispidNamedArgs = &dispidNamed;
149 V_VT(&arg) = VT_BSTR;
150 V_BSTR(&arg) = a2bstr("none");
151 params.rgvarg = &arg;
152 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
153 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
154 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
155 VariantClear(&arg);
157 V_VT(&arg) = VT_BSTR;
158 V_BSTR(&arg) = a2bstr("dotted");
159 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
160 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
161 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
162 VariantClear(&arg);
164 V_VT(&arg) = VT_BSTR;
165 V_BSTR(&arg) = a2bstr("dashed");
166 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
167 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
168 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
169 VariantClear(&arg);
171 V_VT(&arg) = VT_BSTR;
172 V_BSTR(&arg) = a2bstr("solid");
173 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
174 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
175 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
176 VariantClear(&arg);
178 V_VT(&arg) = VT_BSTR;
179 V_BSTR(&arg) = a2bstr("double");
180 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
181 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
182 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
183 VariantClear(&arg);
185 V_VT(&arg) = VT_BSTR;
186 V_BSTR(&arg) = a2bstr("groove");
187 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
188 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
189 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
190 VariantClear(&arg);
192 V_VT(&arg) = VT_BSTR;
193 V_BSTR(&arg) = a2bstr("ridge");
194 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
195 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
196 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
197 VariantClear(&arg);
199 V_VT(&arg) = VT_BSTR;
200 V_BSTR(&arg) = a2bstr("inset");
201 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
202 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
203 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
204 VariantClear(&arg);
206 V_VT(&arg) = VT_BSTR;
207 V_BSTR(&arg) = a2bstr("outset");
208 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
209 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
210 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
211 VariantClear(&arg);
213 V_VT(&arg) = VT_BSTR;
214 V_BSTR(&arg) = a2bstr("invalid");
215 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
216 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
217 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
218 VariantClear(&arg);
220 params.rgvarg = &vDefault;
221 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
222 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
223 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
224 VariantClear(&vDefault);
228 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
229 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
231 BSTR text = (void*)0xdeadbeef;
232 HRESULT hres;
234 hres = IHTMLStyle_get_cssText(style, &text);
235 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
236 if(extext)
237 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
238 else
239 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
241 SysFreeString(text);
244 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
245 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
247 BSTR tmp;
248 HRESULT hres;
250 tmp = a2bstr(text);
251 hres = IHTMLStyle_put_cssText(style, tmp);
252 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
253 SysFreeString(tmp);
256 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
257 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
259 BSTR str = a2bstr(attr);
260 VARIANT_BOOL b = 100;
261 HRESULT hres;
263 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
264 SysFreeString(str);
265 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
266 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
269 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
270 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
272 BSTR str;
273 HRESULT hres;
275 str = a2bstr(v);
276 hres = IHTMLStyle_put_textDecoration(style, str);
277 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
278 SysFreeString(str);
281 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
282 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
284 BSTR str;
285 HRESULT hres;
287 hres = IHTMLStyle_get_textDecoration(style, &str);
288 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
289 if(exdec)
290 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
291 else
292 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
293 SysFreeString(str);
296 static void test_set_csstext(IHTMLStyle *style)
298 VARIANT v;
299 HRESULT hres;
301 test_style_set_csstext(style, "background-color: black;");
303 hres = IHTMLStyle_get_backgroundColor(style, &v);
304 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
305 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
306 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
307 VariantClear(&v);
310 static void test_style2(IHTMLStyle2 *style2)
312 VARIANT v;
313 BSTR str;
314 HRESULT hres;
316 str = (void*)0xdeadbeef;
317 hres = IHTMLStyle2_get_position(style2, &str);
318 ok(hres == S_OK, "get_position failed: %08x\n", hres);
319 ok(!str, "str != NULL\n");
321 str = a2bstr("absolute");
322 hres = IHTMLStyle2_put_position(style2, str);
323 ok(hres == S_OK, "put_position failed: %08x\n", hres);
324 SysFreeString(str);
326 str = NULL;
327 hres = IHTMLStyle2_get_position(style2, &str);
328 ok(hres == S_OK, "get_position failed: %08x\n", hres);
329 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
330 SysFreeString(str);
332 /* Test right */
333 V_VT(&v) = VT_EMPTY;
334 hres = IHTMLStyle2_get_right(style2, &v);
335 ok(hres == S_OK, "get_top failed: %08x\n", hres);
336 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
337 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
338 VariantClear(&v);
340 V_VT(&v) = VT_BSTR;
341 V_BSTR(&v) = a2bstr("3px");
342 hres = IHTMLStyle2_put_right(style2, v);
343 ok(hres == S_OK, "put_right failed: %08x\n", hres);
344 VariantClear(&v);
346 V_VT(&v) = VT_EMPTY;
347 hres = IHTMLStyle2_get_right(style2, &v);
348 ok(hres == S_OK, "get_right failed: %08x\n", hres);
349 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
350 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
351 VariantClear(&v);
353 /* direction */
354 str = (void*)0xdeadbeef;
355 hres = IHTMLStyle2_get_direction(style2, &str);
356 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
357 ok(!str, "str = %s\n", wine_dbgstr_w(str));
359 str = a2bstr("ltr");
360 hres = IHTMLStyle2_put_direction(style2, str);
361 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
362 SysFreeString(str);
364 str = NULL;
365 hres = IHTMLStyle2_get_direction(style2, &str);
366 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
367 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
368 SysFreeString(str);
370 /* bottom */
371 V_VT(&v) = VT_EMPTY;
372 hres = IHTMLStyle2_get_bottom(style2, &v);
373 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
374 test_var_bstr(&v, NULL);
376 V_VT(&v) = VT_I4;
377 V_I4(&v) = 4;
378 hres = IHTMLStyle2_put_bottom(style2, v);
379 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
381 V_VT(&v) = VT_EMPTY;
382 hres = IHTMLStyle2_get_bottom(style2, &v);
383 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
384 test_var_bstr(&v, "4px");
386 /* overflowX */
387 str = (void*)0xdeadbeef;
388 hres = IHTMLStyle2_get_overflowX(style2, &str);
389 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
390 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
392 str = a2bstr("hidden");
393 hres = IHTMLStyle2_put_overflowX(style2, str);
394 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
395 SysFreeString(str);
397 str = NULL;
398 hres = IHTMLStyle2_get_overflowX(style2, &str);
399 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
400 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
402 /* overflowY */
403 str = (void*)0xdeadbeef;
404 hres = IHTMLStyle2_get_overflowY(style2, &str);
405 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
406 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
408 str = a2bstr("hidden");
409 hres = IHTMLStyle2_put_overflowY(style2, str);
410 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
411 SysFreeString(str);
413 str = NULL;
414 hres = IHTMLStyle2_get_overflowY(style2, &str);
415 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
416 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
419 static void test_style3(IHTMLStyle3 *style3)
421 BSTR str;
422 HRESULT hres;
424 str = (void*)0xdeadbeef;
425 hres = IHTMLStyle3_get_wordWrap(style3, &str);
426 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
427 ok(!str, "str != NULL\n");
429 str = a2bstr("break-word");
430 hres = IHTMLStyle3_put_wordWrap(style3, str);
431 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
432 SysFreeString(str);
434 str = NULL;
435 hres = IHTMLStyle3_get_wordWrap(style3, &str);
436 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
437 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
438 SysFreeString(str);
441 static void test_style4(IHTMLStyle4 *style4)
443 HRESULT hres;
444 VARIANT v;
445 VARIANT vdefault;
447 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
448 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
450 V_VT(&v) = VT_BSTR;
451 V_BSTR(&v) = a2bstr("10px");
452 hres = IHTMLStyle4_put_minHeight(style4, v);
453 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
454 VariantClear(&v);
456 hres = IHTMLStyle4_get_minHeight(style4, &v);
457 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
458 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
459 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
460 VariantClear(&v);
462 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
463 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
464 VariantClear(&vdefault);
467 static void test_body_style(IHTMLStyle *style)
469 IHTMLStyle2 *style2;
470 IHTMLStyle3 *style3;
471 IHTMLStyle4 *style4;
472 VARIANT_BOOL b;
473 VARIANT v;
474 BSTR str;
475 HRESULT hres;
476 float f;
477 BSTR sOverflowDefault;
478 BSTR sDefault;
479 LONG l;
480 VARIANT vDefault;
482 test_style_csstext(style, NULL);
484 hres = IHTMLStyle_get_position(style, &str);
485 ok(hres == S_OK, "get_position failed: %08x\n", hres);
486 ok(!str, "str=%s\n", wine_dbgstr_w(str));
488 V_VT(&v) = VT_NULL;
489 hres = IHTMLStyle_get_marginRight(style, &v);
490 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
491 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
492 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
494 V_VT(&v) = VT_I4;
495 V_I4(&v) = 6;
496 hres = IHTMLStyle_put_marginRight(style, v);
497 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
499 V_VT(&v) = VT_NULL;
500 hres = IHTMLStyle_get_marginRight(style, &v);
501 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
502 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
503 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
505 V_VT(&v) = VT_NULL;
506 hres = IHTMLStyle_get_marginBottom(style, &v);
507 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
508 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
509 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
511 V_VT(&v) = VT_I4;
512 V_I4(&v) = 6;
513 hres = IHTMLStyle_put_marginBottom(style, v);
514 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
516 V_VT(&v) = VT_NULL;
517 hres = IHTMLStyle_get_marginBottom(style, &v);
518 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
519 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
520 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
522 V_VT(&v) = VT_NULL;
523 hres = IHTMLStyle_get_marginLeft(style, &v);
524 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
525 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
526 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
528 V_VT(&v) = VT_I4;
529 V_I4(&v) = 6;
530 hres = IHTMLStyle_put_marginLeft(style, v);
531 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
533 V_VT(&v) = VT_NULL;
534 hres = IHTMLStyle_get_marginLeft(style, &v);
535 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
536 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
537 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
539 str = (void*)0xdeadbeef;
540 hres = IHTMLStyle_get_fontFamily(style, &str);
541 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
542 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
544 str = (void*)0xdeadbeef;
545 hres = IHTMLStyle_get_fontWeight(style, &str);
546 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
547 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
549 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
550 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
552 str = a2bstr("test");
553 hres = IHTMLStyle_put_fontWeight(style, str);
554 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
555 SysFreeString(str);
557 str = a2bstr("bold");
558 hres = IHTMLStyle_put_fontWeight(style, str);
559 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
560 SysFreeString(str);
562 str = a2bstr("bolder");
563 hres = IHTMLStyle_put_fontWeight(style, str);
564 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
565 SysFreeString(str);
567 str = a2bstr("lighter");
568 hres = IHTMLStyle_put_fontWeight(style, str);
569 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
570 SysFreeString(str);
572 str = a2bstr("100");
573 hres = IHTMLStyle_put_fontWeight(style, str);
574 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
575 SysFreeString(str);
577 str = a2bstr("200");
578 hres = IHTMLStyle_put_fontWeight(style, str);
579 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
580 SysFreeString(str);
582 str = a2bstr("300");
583 hres = IHTMLStyle_put_fontWeight(style, str);
584 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
585 SysFreeString(str);
587 str = a2bstr("400");
588 hres = IHTMLStyle_put_fontWeight(style, str);
589 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
590 SysFreeString(str);
592 str = a2bstr("500");
593 hres = IHTMLStyle_put_fontWeight(style, str);
594 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
595 SysFreeString(str);
597 str = a2bstr("600");
598 hres = IHTMLStyle_put_fontWeight(style, str);
599 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
600 SysFreeString(str);
602 str = a2bstr("700");
603 hres = IHTMLStyle_put_fontWeight(style, str);
604 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
605 SysFreeString(str);
607 str = a2bstr("800");
608 hres = IHTMLStyle_put_fontWeight(style, str);
609 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
610 SysFreeString(str);
612 str = a2bstr("900");
613 hres = IHTMLStyle_put_fontWeight(style, str);
614 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
615 SysFreeString(str);
617 hres = IHTMLStyle_get_fontWeight(style, &str);
618 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
619 ok(!strcmp_wa(str, "900"), "str != style900\n");
620 SysFreeString(str);
622 hres = IHTMLStyle_put_fontWeight(style, sDefault);
623 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
624 SysFreeString(sDefault);
626 /* font Variant */
627 hres = IHTMLStyle_get_fontVariant(style, NULL);
628 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
630 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
631 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
633 str = a2bstr("test");
634 hres = IHTMLStyle_put_fontVariant(style, str);
635 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
636 SysFreeString(str);
638 str = a2bstr("small-caps");
639 hres = IHTMLStyle_put_fontVariant(style, str);
640 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
641 SysFreeString(str);
643 str = a2bstr("normal");
644 hres = IHTMLStyle_put_fontVariant(style, str);
645 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
646 SysFreeString(str);
648 hres = IHTMLStyle_put_fontVariant(style, sDefault);
649 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
650 SysFreeString(sDefault);
652 str = (void*)0xdeadbeef;
653 hres = IHTMLStyle_get_display(style, &str);
654 ok(hres == S_OK, "get_display failed: %08x\n", hres);
655 ok(!str, "display = %s\n", wine_dbgstr_w(str));
657 str = (void*)0xdeadbeef;
658 hres = IHTMLStyle_get_visibility(style, &str);
659 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
660 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
662 V_VT(&v) = VT_NULL;
663 hres = IHTMLStyle_get_fontSize(style, &v);
664 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
665 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
666 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
668 V_VT(&v) = VT_I4;
669 V_I4(&v) = 12;
670 hres = IHTMLStyle_put_fontSize(style, v);
671 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
673 V_VT(&v) = VT_NULL;
674 hres = IHTMLStyle_get_fontSize(style, &v);
675 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
676 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
677 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
679 V_VT(&v) = VT_NULL;
680 hres = IHTMLStyle_get_color(style, &v);
681 ok(hres == S_OK, "get_color failed: %08x\n", hres);
682 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
683 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
685 V_VT(&v) = VT_I4;
686 V_I4(&v) = 0xfdfd;
687 hres = IHTMLStyle_put_color(style, v);
688 ok(hres == S_OK, "put_color failed: %08x\n", hres);
690 V_VT(&v) = VT_NULL;
691 hres = IHTMLStyle_get_color(style, &v);
692 ok(hres == S_OK, "get_color failed: %08x\n", hres);
693 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
694 todo_wine
695 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
697 b = 0xfefe;
698 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
699 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
700 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
702 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
703 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
705 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
706 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
707 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
709 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
710 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
712 b = 0xfefe;
713 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
714 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
715 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
717 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
718 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
720 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
721 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
722 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
724 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
725 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
727 b = 0xfefe;
728 hres = IHTMLStyle_get_textDecorationNone(style, &b);
729 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
730 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
732 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
733 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
735 hres = IHTMLStyle_get_textDecorationNone(style, &b);
736 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
737 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
739 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
740 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
742 b = 0xfefe;
743 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
744 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
745 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
747 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
748 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
750 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
751 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
752 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
754 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
755 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
757 b = 0xfefe;
758 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
759 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
760 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
762 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
763 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
765 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
766 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
767 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
769 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
770 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
772 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
773 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
775 str = a2bstr("invalid");
776 hres = IHTMLStyle_put_textDecoration(style, str);
777 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
778 SysFreeString(str);
780 set_text_decoration(style, "none");
781 test_text_decoration(style, "none");
782 set_text_decoration(style, "underline");
783 set_text_decoration(style, "overline");
784 set_text_decoration(style, "line-through");
785 set_text_decoration(style, "blink");
786 set_text_decoration(style, "overline");
787 set_text_decoration(style, "blink");
788 test_text_decoration(style, "blink");
790 hres = IHTMLStyle_put_textDecoration(style, sDefault);
791 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
792 SysFreeString(sDefault);
794 hres = IHTMLStyle_get_posWidth(style, NULL);
795 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
797 hres = IHTMLStyle_get_posWidth(style, &f);
798 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
799 ok(f == 0.0f, "f = %f\n", f);
801 V_VT(&v) = VT_EMPTY;
802 hres = IHTMLStyle_get_width(style, &v);
803 ok(hres == S_OK, "get_width failed: %08x\n", hres);
804 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
805 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
807 hres = IHTMLStyle_put_posWidth(style, 2.2);
808 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
810 hres = IHTMLStyle_get_posWidth(style, &f);
811 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
812 ok(f == 2.0f ||
813 f == 2.2f, /* IE8 */
814 "f = %f\n", f);
816 V_VT(&v) = VT_BSTR;
817 V_BSTR(&v) = a2bstr("auto");
818 hres = IHTMLStyle_put_width(style, v);
819 ok(hres == S_OK, "put_width failed: %08x\n", hres);
820 VariantClear(&v);
822 V_VT(&v) = VT_EMPTY;
823 hres = IHTMLStyle_get_width(style, &v);
824 ok(hres == S_OK, "get_width failed: %08x\n", hres);
825 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
826 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
827 VariantClear(&v);
829 V_VT(&v) = VT_I4;
830 V_I4(&v) = 100;
831 hres = IHTMLStyle_put_width(style, v);
832 ok(hres == S_OK, "put_width failed: %08x\n", hres);
834 V_VT(&v) = VT_EMPTY;
835 hres = IHTMLStyle_get_width(style, &v);
836 ok(hres == S_OK, "get_width failed: %08x\n", hres);
837 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
838 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
839 VariantClear(&v);
841 hres = IHTMLStyle_put_pixelWidth(style, 50);
842 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
844 V_VT(&v) = VT_EMPTY;
845 hres = IHTMLStyle_get_width(style, &v);
846 ok(hres == S_OK, "get_width failed: %08x\n", hres);
847 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
848 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
849 VariantClear(&v);
851 /* margin tests */
852 str = (void*)0xdeadbeef;
853 hres = IHTMLStyle_get_margin(style, &str);
854 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
855 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
857 str = a2bstr("1");
858 hres = IHTMLStyle_put_margin(style, str);
859 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
860 SysFreeString(str);
862 hres = IHTMLStyle_get_margin(style, &str);
863 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
864 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
865 SysFreeString(str);
867 hres = IHTMLStyle_put_margin(style, NULL);
868 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
870 str = (void*)0xdeadbeef;
871 hres = IHTMLStyle_get_marginTop(style, &v);
872 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
873 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
874 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
876 V_VT(&v) = VT_BSTR;
877 V_BSTR(&v) = a2bstr("6px");
878 hres = IHTMLStyle_put_marginTop(style, v);
879 SysFreeString(V_BSTR(&v));
880 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
882 str = (void*)0xdeadbeef;
883 hres = IHTMLStyle_get_marginTop(style, &v);
884 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
885 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
886 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
887 VariantClear(&v);
889 V_VT(&v) = VT_I4;
890 V_I4(&v) = 5;
891 hres = IHTMLStyle_put_marginTop(style, v);
892 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
894 str = (void*)0xdeadbeef;
895 hres = IHTMLStyle_get_marginTop(style, &v);
896 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
897 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
898 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
899 VariantClear(&v);
901 str = NULL;
902 hres = IHTMLStyle_get_border(style, &str);
903 ok(hres == S_OK, "get_border failed: %08x\n", hres);
904 ok(!str || !*str, "str is not empty\n");
905 SysFreeString(str);
907 str = a2bstr("1px");
908 hres = IHTMLStyle_put_border(style, str);
909 ok(hres == S_OK, "put_border failed: %08x\n", hres);
910 SysFreeString(str);
912 V_VT(&v) = VT_EMPTY;
913 hres = IHTMLStyle_get_left(style, &v);
914 ok(hres == S_OK, "get_left failed: %08x\n", hres);
915 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
916 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
917 VariantClear(&v);
919 l = 0xdeadbeef;
920 hres = IHTMLStyle_get_pixelLeft(style, &l);
921 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
922 ok(!l, "pixelLeft = %d\n", l);
924 /* Test posLeft */
925 hres = IHTMLStyle_get_posLeft(style, NULL);
926 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
928 f = 1.0f;
929 hres = IHTMLStyle_get_posLeft(style, &f);
930 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
931 ok(f == 0.0, "expected 0.0 got %f\n", f);
933 hres = IHTMLStyle_put_posLeft(style, 4.9f);
934 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
936 hres = IHTMLStyle_get_posLeft(style, &f);
937 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
938 ok(f == 4.0 ||
939 f == 4.9f, /* IE8 */
940 "expected 4.0 or 4.9 (IE8) got %f\n", f);
942 /* Ensure left is updated correctly. */
943 V_VT(&v) = VT_EMPTY;
944 hres = IHTMLStyle_get_left(style, &v);
945 ok(hres == S_OK, "get_left failed: %08x\n", hres);
946 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
947 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
948 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
949 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
950 VariantClear(&v);
952 /* Test left */
953 V_VT(&v) = VT_BSTR;
954 V_BSTR(&v) = a2bstr("3px");
955 hres = IHTMLStyle_put_left(style, v);
956 ok(hres == S_OK, "put_left failed: %08x\n", hres);
957 VariantClear(&v);
959 hres = IHTMLStyle_get_posLeft(style, &f);
960 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
961 ok(f == 3.0, "expected 3.0 got %f\n", f);
963 l = 0xdeadbeef;
964 hres = IHTMLStyle_get_pixelLeft(style, &l);
965 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
966 ok(l == 3, "pixelLeft = %d\n", l);
968 V_VT(&v) = VT_EMPTY;
969 hres = IHTMLStyle_get_left(style, &v);
970 ok(hres == S_OK, "get_left failed: %08x\n", hres);
971 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
972 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
973 VariantClear(&v);
975 V_VT(&v) = VT_BSTR;
976 V_BSTR(&v) = a2bstr("4.99");
977 hres = IHTMLStyle_put_left(style, v);
978 ok(hres == S_OK, "put_left failed: %08x\n", hres);
979 VariantClear(&v);
981 l = 0xdeadbeef;
982 hres = IHTMLStyle_get_pixelLeft(style, &l);
983 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
984 ok(l == 4, "pixelLeft = %d\n", l);
986 V_VT(&v) = VT_NULL;
987 hres = IHTMLStyle_put_left(style, v);
988 ok(hres == S_OK, "put_left failed: %08x\n", hres);
990 V_VT(&v) = VT_EMPTY;
991 hres = IHTMLStyle_get_left(style, &v);
992 ok(hres == S_OK, "get_left failed: %08x\n", hres);
993 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
994 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
995 VariantClear(&v);
997 V_VT(&v) = VT_EMPTY;
998 hres = IHTMLStyle_get_top(style, &v);
999 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1000 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1001 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1002 VariantClear(&v);
1004 l = 0xdeadbeef;
1005 hres = IHTMLStyle_get_pixelLeft(style, &l);
1006 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1007 ok(!l, "pixelLeft = %d\n", l);
1009 hres = IHTMLStyle_put_pixelLeft(style, 6);
1010 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1012 l = 0xdeadbeef;
1013 hres = IHTMLStyle_get_pixelLeft(style, &l);
1014 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1015 ok(l == 6, "pixelLeft = %d\n", l);
1017 V_VT(&v) = VT_EMPTY;
1018 hres = IHTMLStyle_get_left(style, &v);
1019 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1020 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1021 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1022 VariantClear(&v);
1024 /* Test posTop */
1025 hres = IHTMLStyle_get_posTop(style, NULL);
1026 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1028 f = 1.0f;
1029 hres = IHTMLStyle_get_posTop(style, &f);
1030 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1031 ok(f == 0.0, "expected 0.0 got %f\n", f);
1033 hres = IHTMLStyle_put_posTop(style, 4.9f);
1034 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1036 hres = IHTMLStyle_get_posTop(style, &f);
1037 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1038 ok(f == 4.0 ||
1039 f == 4.9f, /* IE8 */
1040 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1042 V_VT(&v) = VT_BSTR;
1043 V_BSTR(&v) = a2bstr("3px");
1044 hres = IHTMLStyle_put_top(style, v);
1045 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1046 VariantClear(&v);
1048 V_VT(&v) = VT_EMPTY;
1049 hres = IHTMLStyle_get_top(style, &v);
1050 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1051 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1052 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1053 VariantClear(&v);
1055 hres = IHTMLStyle_get_posTop(style, &f);
1056 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1057 ok(f == 3.0, "expected 3.0 got %f\n", f);
1059 V_VT(&v) = VT_NULL;
1060 hres = IHTMLStyle_put_top(style, v);
1061 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1063 V_VT(&v) = VT_EMPTY;
1064 hres = IHTMLStyle_get_top(style, &v);
1065 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1066 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1067 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1068 VariantClear(&v);
1070 /* Test posHeight */
1071 hres = IHTMLStyle_get_posHeight(style, NULL);
1072 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1074 V_VT(&v) = VT_EMPTY;
1075 hres = IHTMLStyle_get_height(style, &v);
1076 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1077 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1078 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1079 VariantClear(&v);
1081 f = 1.0f;
1082 hres = IHTMLStyle_get_posHeight(style, &f);
1083 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1084 ok(f == 0.0, "expected 0.0 got %f\n", f);
1086 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1087 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1089 hres = IHTMLStyle_get_posHeight(style, &f);
1090 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1091 ok(f == 4.0 ||
1092 f == 4.9f, /* IE8 */
1093 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1095 V_VT(&v) = VT_BSTR;
1096 V_BSTR(&v) = a2bstr("70px");
1097 hres = IHTMLStyle_put_height(style, v);
1098 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1099 VariantClear(&v);
1101 V_VT(&v) = VT_EMPTY;
1102 hres = IHTMLStyle_get_height(style, &v);
1103 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1104 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1105 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1106 VariantClear(&v);
1108 V_VT(&v) = VT_BSTR;
1109 V_BSTR(&v) = NULL;
1110 hres = IHTMLStyle_put_height(style, v);
1111 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1112 VariantClear(&v);
1114 V_VT(&v) = VT_EMPTY;
1115 hres = IHTMLStyle_get_height(style, &v);
1116 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1117 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1118 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1119 VariantClear(&v);
1121 V_VT(&v) = VT_I4;
1122 V_I4(&v) = 64;
1123 hres = IHTMLStyle_put_height(style, v);
1124 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1126 V_VT(&v) = VT_EMPTY;
1127 hres = IHTMLStyle_get_height(style, &v);
1128 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1129 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1130 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1131 VariantClear(&v);
1133 hres = IHTMLStyle_get_posHeight(style, &f);
1134 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1135 ok(f == 64.0, "expected 64.0 got %f\n", f);
1137 str = (void*)0xdeadbeef;
1138 hres = IHTMLStyle_get_cursor(style, &str);
1139 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1140 ok(!str, "get_cursor != NULL\n");
1141 SysFreeString(str);
1143 str = a2bstr("default");
1144 hres = IHTMLStyle_put_cursor(style, str);
1145 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1146 SysFreeString(str);
1148 str = NULL;
1149 hres = IHTMLStyle_get_cursor(style, &str);
1150 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1151 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1152 SysFreeString(str);
1154 V_VT(&v) = VT_EMPTY;
1155 hres = IHTMLStyle_get_verticalAlign(style, &v);
1156 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1157 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1158 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1159 VariantClear(&v);
1161 V_VT(&v) = VT_BSTR;
1162 V_BSTR(&v) = a2bstr("middle");
1163 hres = IHTMLStyle_put_verticalAlign(style, v);
1164 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1165 VariantClear(&v);
1167 V_VT(&v) = VT_EMPTY;
1168 hres = IHTMLStyle_get_verticalAlign(style, &v);
1169 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1170 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1171 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1172 VariantClear(&v);
1174 V_VT(&v) = VT_I4;
1175 V_I4(&v) = 100;
1176 hres = IHTMLStyle_put_verticalAlign(style, v);
1177 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1178 VariantClear(&v);
1180 V_VT(&v) = VT_EMPTY;
1181 hres = IHTMLStyle_get_verticalAlign(style, &v);
1182 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1183 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1184 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1185 VariantClear(&v);
1187 str = (void*)0xdeadbeef;
1188 hres = IHTMLStyle_get_textAlign(style, &str);
1189 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1190 ok(!str, "textAlign != NULL\n");
1192 str = a2bstr("center");
1193 hres = IHTMLStyle_put_textAlign(style, str);
1194 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1195 SysFreeString(str);
1197 str = NULL;
1198 hres = IHTMLStyle_get_textAlign(style, &str);
1199 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1200 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1201 SysFreeString(str);
1203 str = (void*)0xdeadbeef;
1204 hres = IHTMLStyle_get_filter(style, &str);
1205 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1206 ok(!str, "filter != NULL\n");
1208 str = a2bstr("alpha(opacity=100)");
1209 hres = IHTMLStyle_put_filter(style, str);
1210 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1211 SysFreeString(str);
1213 V_VT(&v) = VT_EMPTY;
1214 hres = IHTMLStyle_get_zIndex(style, &v);
1215 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1216 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1217 ok(!V_I4(&v), "V_I4(v) != 0\n");
1218 VariantClear(&v);
1220 V_VT(&v) = VT_BSTR;
1221 V_BSTR(&v) = a2bstr("1");
1222 hres = IHTMLStyle_put_zIndex(style, v);
1223 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1224 VariantClear(&v);
1226 V_VT(&v) = VT_EMPTY;
1227 hres = IHTMLStyle_get_zIndex(style, &v);
1228 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1229 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1230 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1231 VariantClear(&v);
1233 /* fontStyle */
1234 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1235 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1237 str = a2bstr("test");
1238 hres = IHTMLStyle_put_fontStyle(style, str);
1239 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1240 SysFreeString(str);
1242 str = a2bstr("italic");
1243 hres = IHTMLStyle_put_fontStyle(style, str);
1244 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1245 SysFreeString(str);
1247 str = a2bstr("oblique");
1248 hres = IHTMLStyle_put_fontStyle(style, str);
1249 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1250 SysFreeString(str);
1252 str = a2bstr("normal");
1253 hres = IHTMLStyle_put_fontStyle(style, str);
1254 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1255 SysFreeString(str);
1257 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1258 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1259 SysFreeString(sDefault);
1261 /* overflow */
1262 hres = IHTMLStyle_get_overflow(style, NULL);
1263 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1265 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1266 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1268 str = a2bstr("test");
1269 hres = IHTMLStyle_put_overflow(style, str);
1270 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1271 SysFreeString(str);
1273 str = a2bstr("visible");
1274 hres = IHTMLStyle_put_overflow(style, str);
1275 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1276 SysFreeString(str);
1278 str = a2bstr("scroll");
1279 hres = IHTMLStyle_put_overflow(style, str);
1280 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1281 SysFreeString(str);
1283 str = a2bstr("hidden");
1284 hres = IHTMLStyle_put_overflow(style, str);
1285 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1286 SysFreeString(str);
1288 str = a2bstr("auto");
1289 hres = IHTMLStyle_put_overflow(style, str);
1290 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1291 SysFreeString(str);
1293 hres = IHTMLStyle_get_overflow(style, &str);
1294 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1295 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1296 SysFreeString(str);
1298 str = a2bstr("");
1299 hres = IHTMLStyle_put_overflow(style, str);
1300 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1301 SysFreeString(str);
1303 hres = IHTMLStyle_get_overflow(style, &str);
1304 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1305 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1306 SysFreeString(str);
1308 /* restore overflow default */
1309 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1310 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1311 SysFreeString(sOverflowDefault);
1313 /* Attribute Tests*/
1314 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1315 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1317 str = a2bstr("position");
1318 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1319 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1321 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1322 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1323 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1324 VariantClear(&v);
1326 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1327 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1329 V_VT(&v) = VT_BSTR;
1330 V_BSTR(&v) = a2bstr("absolute");
1331 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1332 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1333 VariantClear(&v);
1335 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1336 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1337 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1338 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1339 VariantClear(&v);
1341 V_VT(&v) = VT_BSTR;
1342 V_BSTR(&v) = NULL;
1343 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1344 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1345 VariantClear(&v);
1347 SysFreeString(str);
1349 str = a2bstr("borderLeftStyle");
1350 test_border_styles(style, str);
1351 SysFreeString(str);
1353 str = a2bstr("borderbottomstyle");
1354 test_border_styles(style, str);
1355 SysFreeString(str);
1357 str = a2bstr("borderrightstyle");
1358 test_border_styles(style, str);
1359 SysFreeString(str);
1361 str = a2bstr("bordertopstyle");
1362 test_border_styles(style, str);
1363 SysFreeString(str);
1365 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1366 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1368 str = a2bstr("none dotted dashed solid");
1369 hres = IHTMLStyle_put_borderStyle(style, str);
1370 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1371 SysFreeString(str);
1373 str = a2bstr("none dotted dashed solid");
1374 hres = IHTMLStyle_get_borderStyle(style, &str);
1375 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1376 ok(!strcmp_wa(str, "none dotted dashed solid"),
1377 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1378 SysFreeString(str);
1380 str = a2bstr("double groove ridge inset");
1381 hres = IHTMLStyle_put_borderStyle(style, str);
1382 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1383 SysFreeString(str);
1385 str = a2bstr("window-inset outset ridge inset");
1386 hres = IHTMLStyle_put_borderStyle(style, str);
1387 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1388 SysFreeString(str);
1390 str = a2bstr("window-inset");
1391 hres = IHTMLStyle_put_borderStyle(style, str);
1392 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1393 SysFreeString(str);
1395 str = a2bstr("none none none none none");
1396 hres = IHTMLStyle_put_borderStyle(style, str);
1397 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1398 SysFreeString(str);
1400 str = a2bstr("invalid none none none");
1401 hres = IHTMLStyle_put_borderStyle(style, str);
1402 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1403 SysFreeString(str);
1405 str = a2bstr("none invalid none none");
1406 hres = IHTMLStyle_put_borderStyle(style, str);
1407 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1408 SysFreeString(str);
1410 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1411 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1412 SysFreeString(sDefault);
1414 /* backgoundColor */
1415 hres = IHTMLStyle_get_backgroundColor(style, &v);
1416 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1417 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1418 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1419 VariantClear(&v);
1421 V_VT(&v) = VT_BSTR;
1422 V_BSTR(&v) = a2bstr("red");
1423 hres = IHTMLStyle_put_backgroundColor(style, v);
1424 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1425 VariantClear(&v);
1427 hres = IHTMLStyle_get_backgroundColor(style, &v);
1428 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1429 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1430 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1431 VariantClear(&v);
1433 /* padding */
1434 hres = IHTMLStyle_get_padding(style, &str);
1435 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1436 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1437 SysFreeString(str);
1439 hres = IHTMLStyle_get_paddingTop(style, &v);
1440 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1441 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1442 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1444 V_VT(&v) = VT_I4;
1445 V_I4(&v) = 6;
1446 hres = IHTMLStyle_put_paddingTop(style, v);
1447 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1449 hres = IHTMLStyle_get_paddingTop(style, &v);
1450 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1451 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1452 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1453 VariantClear(&v);
1455 hres = IHTMLStyle_get_paddingRight(style, &v);
1456 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1457 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1458 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1460 V_VT(&v) = VT_I4;
1461 V_I4(&v) = 6;
1462 hres = IHTMLStyle_put_paddingRight(style, v);
1463 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1465 hres = IHTMLStyle_get_paddingRight(style, &v);
1466 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1467 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1468 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1469 VariantClear(&v);
1471 hres = IHTMLStyle_get_paddingBottom(style, &v);
1472 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1473 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1474 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1476 V_VT(&v) = VT_I4;
1477 V_I4(&v) = 6;
1478 hres = IHTMLStyle_put_paddingBottom(style, v);
1479 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1481 hres = IHTMLStyle_get_paddingBottom(style, &v);
1482 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1483 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1484 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1485 VariantClear(&v);
1487 str = a2bstr("1");
1488 hres = IHTMLStyle_put_padding(style, str);
1489 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1490 SysFreeString(str);
1492 hres = IHTMLStyle_get_padding(style, &str);
1493 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1494 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1495 SysFreeString(str);
1497 /* PaddingLeft */
1498 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1499 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1500 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1501 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1503 V_VT(&v) = VT_BSTR;
1504 V_BSTR(&v) = a2bstr("10");
1505 hres = IHTMLStyle_put_paddingLeft(style, v);
1506 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1507 VariantClear(&v);
1509 hres = IHTMLStyle_get_paddingLeft(style, &v);
1510 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1511 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1512 VariantClear(&v);
1514 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1515 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1517 /* BackgroundRepeat */
1518 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1519 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1521 str = a2bstr("invalid");
1522 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1523 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1524 SysFreeString(str);
1526 str = a2bstr("repeat");
1527 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1528 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1529 SysFreeString(str);
1531 str = a2bstr("no-repeat");
1532 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1533 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1534 SysFreeString(str);
1536 str = a2bstr("repeat-x");
1537 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1538 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1539 SysFreeString(str);
1541 str = a2bstr("repeat-y");
1542 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1543 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1544 SysFreeString(str);
1546 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1547 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1548 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1549 SysFreeString(str);
1551 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1552 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1553 SysFreeString(sDefault);
1555 /* BorderColor */
1556 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1557 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1559 str = a2bstr("red green red blue");
1560 hres = IHTMLStyle_put_borderColor(style, str);
1561 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1562 SysFreeString(str);
1564 hres = IHTMLStyle_get_borderColor(style, &str);
1565 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1566 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1567 SysFreeString(str);
1569 hres = IHTMLStyle_put_borderColor(style, sDefault);
1570 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1571 SysFreeString(sDefault);
1573 /* BorderRight */
1574 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1575 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1577 str = a2bstr("thick dotted red");
1578 hres = IHTMLStyle_put_borderRight(style, str);
1579 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1580 SysFreeString(str);
1582 /* IHTMLStyle_get_borderRight appears to have a bug where
1583 it returns the first letter of the color. So we check
1584 each style individually.
1586 V_BSTR(&v) = NULL;
1587 hres = IHTMLStyle_get_borderRightColor(style, &v);
1588 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1589 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1590 VariantClear(&v);
1592 V_BSTR(&v) = NULL;
1593 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1594 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1595 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1596 VariantClear(&v);
1598 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1599 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1600 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1601 SysFreeString(str);
1603 hres = IHTMLStyle_put_borderRight(style, sDefault);
1604 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1605 SysFreeString(sDefault);
1607 /* BorderTop */
1608 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1609 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1611 str = a2bstr("thick dotted red");
1612 hres = IHTMLStyle_put_borderTop(style, str);
1613 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1614 SysFreeString(str);
1616 /* IHTMLStyle_get_borderTop appears to have a bug where
1617 it returns the first letter of the color. So we check
1618 each style individually.
1620 V_BSTR(&v) = NULL;
1621 hres = IHTMLStyle_get_borderTopColor(style, &v);
1622 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1623 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1624 VariantClear(&v);
1626 V_BSTR(&v) = NULL;
1627 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1628 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1629 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1630 VariantClear(&v);
1632 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1633 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1634 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1635 SysFreeString(str);
1637 hres = IHTMLStyle_put_borderTop(style, sDefault);
1638 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1639 SysFreeString(sDefault);
1641 /* BorderBottom */
1642 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1643 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1645 str = a2bstr("thick dotted red");
1646 hres = IHTMLStyle_put_borderBottom(style, str);
1647 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1648 SysFreeString(str);
1650 /* IHTMLStyle_get_borderBottom appears to have a bug where
1651 it returns the first letter of the color. So we check
1652 each style individually.
1654 V_BSTR(&v) = NULL;
1655 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1656 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1657 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1658 VariantClear(&v);
1660 V_BSTR(&v) = NULL;
1661 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1662 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1663 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1664 VariantClear(&v);
1666 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1667 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1668 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1669 SysFreeString(str);
1671 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1672 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1673 SysFreeString(sDefault);
1675 /* BorderLeft */
1676 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1677 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1679 str = a2bstr("thick dotted red");
1680 hres = IHTMLStyle_put_borderLeft(style, str);
1681 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1682 SysFreeString(str);
1684 /* IHTMLStyle_get_borderLeft appears to have a bug where
1685 it returns the first letter of the color. So we check
1686 each style individually.
1688 V_BSTR(&v) = NULL;
1689 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1690 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1691 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1692 VariantClear(&v);
1694 V_BSTR(&v) = NULL;
1695 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1696 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1697 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1698 VariantClear(&v);
1700 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1701 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1702 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1703 SysFreeString(str);
1705 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1706 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1707 SysFreeString(sDefault);
1709 /* backgroundPositionX */
1710 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1711 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1712 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1713 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1714 VariantClear(&v);
1716 V_VT(&v) = VT_BSTR;
1717 V_BSTR(&v) = a2bstr("10px");
1718 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1719 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1720 VariantClear(&v);
1722 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1723 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1724 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1725 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1726 VariantClear(&v);
1728 /* backgroundPositionY */
1729 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1730 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1731 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1732 VariantClear(&v);
1734 V_VT(&v) = VT_BSTR;
1735 V_BSTR(&v) = a2bstr("15px");
1736 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1737 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1738 VariantClear(&v);
1740 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1741 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1742 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1743 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1744 VariantClear(&v);
1746 /* backgroundPosition */
1747 str = NULL;
1748 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1749 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1750 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1751 SysFreeString(str);
1753 str = a2bstr("center 20%");
1754 hres = IHTMLStyle_put_backgroundPosition(style, str);
1755 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1756 SysFreeString(str);
1758 str = NULL;
1759 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1760 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1761 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1762 SysFreeString(str);
1764 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1765 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1766 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1767 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1768 VariantClear(&v);
1770 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1771 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1772 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1773 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1774 VariantClear(&v);
1776 /* borderTopWidth */
1777 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1778 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1780 V_VT(&v) = VT_BSTR;
1781 V_BSTR(&v) = a2bstr("10px");
1782 hres = IHTMLStyle_put_borderTopWidth(style, v);
1783 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1784 VariantClear(&v);
1786 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1787 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1788 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1789 VariantClear(&v);
1791 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1792 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1793 VariantClear(&vDefault);
1795 /* borderRightWidth */
1796 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1797 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1799 V_VT(&v) = VT_BSTR;
1800 V_BSTR(&v) = a2bstr("10");
1801 hres = IHTMLStyle_put_borderRightWidth(style, v);
1802 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1803 VariantClear(&v);
1805 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1806 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1807 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1808 VariantClear(&v);
1810 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1811 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1812 VariantClear(&vDefault);
1814 /* borderBottomWidth */
1815 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1816 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1818 V_VT(&v) = VT_BSTR;
1819 V_BSTR(&v) = a2bstr("10");
1820 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1821 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1822 VariantClear(&v);
1824 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1825 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1826 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1827 VariantClear(&v);
1829 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1830 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1831 VariantClear(&vDefault);
1833 /* borderLeftWidth */
1834 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1835 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1837 V_VT(&v) = VT_BSTR;
1838 V_BSTR(&v) = a2bstr("10");
1839 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1840 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1841 VariantClear(&v);
1843 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1844 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1845 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1846 VariantClear(&v);
1848 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1849 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1850 VariantClear(&vDefault);
1852 /* wordSpacing */
1853 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1854 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1856 V_VT(&v) = VT_BSTR;
1857 V_BSTR(&v) = a2bstr("10");
1858 hres = IHTMLStyle_put_wordSpacing(style, v);
1859 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1860 VariantClear(&v);
1862 hres = IHTMLStyle_get_wordSpacing(style, &v);
1863 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1864 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1865 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1866 VariantClear(&v);
1868 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1869 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1870 VariantClear(&vDefault);
1872 /* letterSpacing */
1873 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1874 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1876 V_VT(&v) = VT_BSTR;
1877 V_BSTR(&v) = a2bstr("11");
1878 hres = IHTMLStyle_put_letterSpacing(style, v);
1879 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1880 VariantClear(&v);
1882 hres = IHTMLStyle_get_letterSpacing(style, &v);
1883 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1884 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1885 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1886 VariantClear(&v);
1888 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1889 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1890 VariantClear(&vDefault);
1892 /* borderTopColor */
1893 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1894 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1896 V_VT(&v) = VT_BSTR;
1897 V_BSTR(&v) = a2bstr("red");
1898 hres = IHTMLStyle_put_borderTopColor(style, v);
1899 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1900 VariantClear(&v);
1902 hres = IHTMLStyle_get_borderTopColor(style, &v);
1903 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1904 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1905 VariantClear(&v);
1907 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1908 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1910 /* borderRightColor */
1911 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1912 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1914 V_VT(&v) = VT_BSTR;
1915 V_BSTR(&v) = a2bstr("blue");
1916 hres = IHTMLStyle_put_borderRightColor(style, v);
1917 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1918 VariantClear(&v);
1920 hres = IHTMLStyle_get_borderRightColor(style, &v);
1921 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1922 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1923 VariantClear(&v);
1925 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1926 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1928 /* borderBottomColor */
1929 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1930 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1932 V_VT(&v) = VT_BSTR;
1933 V_BSTR(&v) = a2bstr("cyan");
1934 hres = IHTMLStyle_put_borderBottomColor(style, v);
1935 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1936 VariantClear(&v);
1938 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1939 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1940 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1941 VariantClear(&v);
1943 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1944 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1946 /* borderLeftColor */
1947 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1948 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1950 V_VT(&v) = VT_BSTR;
1951 V_BSTR(&v) = a2bstr("cyan");
1952 hres = IHTMLStyle_put_borderLeftColor(style, v);
1953 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1954 VariantClear(&v);
1956 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1957 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1958 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1959 VariantClear(&v);
1961 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1962 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1964 /* clip */
1965 hres = IHTMLStyle_get_clip(style, &str);
1966 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1967 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1969 str = a2bstr("rect(0px 1px 500px 505px)");
1970 hres = IHTMLStyle_put_clip(style, str);
1971 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1972 SysFreeString(str);
1974 hres = IHTMLStyle_get_clip(style, &str);
1975 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1976 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1977 SysFreeString(str);
1979 /* clear */
1980 hres = IHTMLStyle_get_clear(style, &str);
1981 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
1982 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
1984 str = a2bstr("both");
1985 hres = IHTMLStyle_put_clear(style, str);
1986 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
1987 SysFreeString(str);
1989 hres = IHTMLStyle_get_clear(style, &str);
1990 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
1991 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
1992 SysFreeString(str);
1994 /* pageBreakAfter */
1995 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1996 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1997 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1999 str = a2bstr("always");
2000 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2001 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2002 SysFreeString(str);
2004 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2005 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2006 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2007 SysFreeString(str);
2009 /* pageBreakBefore */
2010 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2011 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2012 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2014 str = a2bstr("always");
2015 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2016 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2017 SysFreeString(str);
2019 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2020 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2021 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2022 SysFreeString(str);
2024 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2025 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2027 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2028 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2029 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2031 str = (void*)0xdeadbeef;
2032 hres = IHTMLStyle_get_whiteSpace(style, &str);
2033 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2034 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2036 str = a2bstr("nowrap");
2037 hres = IHTMLStyle_put_whiteSpace(style, str);
2038 SysFreeString(str);
2039 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2041 str = NULL;
2042 hres = IHTMLStyle_get_whiteSpace(style, &str);
2043 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2044 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2045 SysFreeString(str);
2047 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2048 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2049 if(SUCCEEDED(hres)) {
2050 test_style2(style2);
2051 IHTMLStyle2_Release(style2);
2054 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2055 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2056 if(SUCCEEDED(hres)) {
2057 test_style3(style3);
2058 IHTMLStyle3_Release(style3);
2061 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2062 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2063 if(SUCCEEDED(hres)) {
2064 test_style4(style4);
2065 IHTMLStyle4_Release(style4);
2069 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2070 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2072 BSTR str;
2073 HRESULT hres;
2075 str = (void*)0xdeadbeef;
2076 hres = IHTMLStyle_get_filter(style, &str);
2077 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2078 if(exval)
2079 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2080 else
2081 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2083 SysFreeString(str);
2086 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2087 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2089 BSTR str;
2090 HRESULT hres;
2092 str = (void*)0xdeadbeef;
2093 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2094 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2095 if(exval)
2096 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2097 else
2098 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2100 SysFreeString(str);
2103 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2104 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2106 BSTR str = a2bstr(val);
2107 HRESULT hres;
2109 hres = IHTMLStyle_put_filter(style, str);
2110 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2111 SysFreeString(str);
2113 _test_style_filter(line, style, val);
2116 static void test_style_filters(IHTMLElement *elem)
2118 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2119 IHTMLCurrentStyle2 *current_style2;
2120 IHTMLCurrentStyle *current_style;
2121 IHTMLStyle *style;
2122 HRESULT hres;
2124 hres = IHTMLElement_get_style(elem, &style);
2125 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2127 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2128 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2130 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2132 test_style_filter(style, NULL);
2133 test_current_style_filter(current_style2, NULL);
2134 set_style_filter(style, "alpha(opacity=50.0040)");
2135 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2136 set_style_filter(style, "alpha(opacity=100)");
2138 IHTMLStyle_Release(style);
2140 hres = IHTMLElement_get_style(elem, &style);
2141 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2143 test_style_filter(style, "alpha(opacity=100)");
2144 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2145 set_style_filter(style, NULL);
2146 set_style_filter(style, "alpha(opacity=100)");
2147 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2148 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2149 test_style_filter(style, NULL);
2152 IHTMLCurrentStyle2_Release(current_style2);
2153 IHTMLStyle_Release(style);
2154 IHTMLElement2_Release(elem2);
2157 static void test_current_style(IHTMLCurrentStyle *current_style)
2159 IHTMLCurrentStyle2 *current_style2;
2160 VARIANT_BOOL b;
2161 BSTR str;
2162 HRESULT hres;
2163 VARIANT v;
2165 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2166 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2167 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2168 SysFreeString(str);
2170 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2171 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2172 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2173 SysFreeString(str);
2175 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2176 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2177 SysFreeString(str);
2179 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2180 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2181 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2182 SysFreeString(str);
2184 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2185 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2186 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2187 SysFreeString(str);
2189 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2190 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2191 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2192 SysFreeString(str);
2194 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2195 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2196 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2197 SysFreeString(str);
2199 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2200 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2201 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2202 SysFreeString(str);
2204 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2205 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2206 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2207 SysFreeString(str);
2209 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2210 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2211 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2212 SysFreeString(str);
2214 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2215 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2216 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2217 SysFreeString(str);
2219 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2220 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2221 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2222 SysFreeString(str);
2224 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2225 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2226 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2227 SysFreeString(str);
2229 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2230 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2231 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2232 SysFreeString(str);
2234 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2235 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2236 SysFreeString(str);
2238 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2239 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2240 SysFreeString(str);
2242 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2243 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2244 SysFreeString(str);
2246 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2247 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2248 SysFreeString(str);
2250 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2251 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2252 SysFreeString(str);
2254 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2255 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2256 SysFreeString(str);
2258 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2259 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2260 SysFreeString(str);
2262 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2263 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2264 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2265 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2266 VariantClear(&v);
2268 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2269 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2270 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2271 VariantClear(&v);
2273 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2274 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2275 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2276 VariantClear(&v);
2278 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2279 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2280 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2281 VariantClear(&v);
2283 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2284 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2285 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2286 VariantClear(&v);
2288 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2289 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2290 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2291 VariantClear(&v);
2293 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2294 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2295 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2296 VariantClear(&v);
2298 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2299 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2300 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2301 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2302 VariantClear(&v);
2304 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2305 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2306 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2307 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2308 VariantClear(&v);
2310 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2311 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2312 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2313 VariantClear(&v);
2315 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2316 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2317 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2318 VariantClear(&v);
2320 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2321 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2322 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2323 VariantClear(&v);
2325 V_BSTR(&v) = NULL;
2326 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2327 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2328 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2329 VariantClear(&v);
2331 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2332 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2333 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2334 VariantClear(&v);
2336 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2337 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2338 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2339 VariantClear(&v);
2341 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2342 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2343 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2344 VariantClear(&v);
2346 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2347 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2348 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2349 VariantClear(&v);
2351 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2352 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2353 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2354 VariantClear(&v);
2356 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2357 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2358 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2359 VariantClear(&v);
2361 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2362 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2363 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2364 VariantClear(&v);
2366 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2367 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2368 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2369 VariantClear(&v);
2371 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2372 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2373 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2374 VariantClear(&v);
2376 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2377 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2378 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2379 VariantClear(&v);
2381 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2382 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2383 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2384 VariantClear(&v);
2386 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2387 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2388 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2389 VariantClear(&v);
2391 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2392 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2393 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2394 VariantClear(&v);
2396 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2397 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2398 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2399 VariantClear(&v);
2401 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2402 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2403 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2404 VariantClear(&v);
2406 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2407 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2408 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2409 VariantClear(&v);
2411 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2412 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2413 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2414 VariantClear(&v);
2416 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2417 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2418 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2419 VariantClear(&v);
2421 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2423 b = 100;
2424 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2425 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2426 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2428 IHTMLCurrentStyle2_Release(current_style2);
2431 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2433 static void basic_style_test(IHTMLDocument2 *doc)
2435 IHTMLCurrentStyle *cstyle;
2436 IHTMLElement *elem;
2437 IHTMLStyle *style;
2438 HRESULT hres;
2440 hres = IHTMLDocument2_get_body(doc, &elem);
2441 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2443 hres = IHTMLElement_get_style(elem, &style);
2444 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2446 test_body_style(style);
2448 cstyle = get_current_style(elem);
2449 test_current_style(cstyle);
2450 IHTMLCurrentStyle_Release(cstyle);
2451 IHTMLElement_Release(elem);
2453 elem = get_element_by_id(doc, "divid");
2454 test_style_filters(elem);
2456 test_set_csstext(style);
2457 IHTMLStyle_Release(style);
2458 IHTMLElement_Release(elem);
2461 static const char runtimestyle_test_str[] =
2462 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2464 static void runtimestyle_test(IHTMLDocument2 *doc)
2466 IHTMLStyle *style, *runtime_style;
2467 IHTMLElement2 *elem2;
2468 IHTMLElement *elem;
2469 BSTR str;
2470 HRESULT hres;
2472 hres = IHTMLDocument2_get_body(doc, &elem);
2473 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2475 elem2 = get_elem2_iface((IUnknown*)elem);
2477 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2478 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2480 hres = IHTMLElement_get_style(elem, &style);
2481 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2483 test_text_decoration(style, NULL);
2484 test_text_decoration(runtime_style, NULL);
2485 set_text_decoration(style, "underline");
2486 test_text_decoration(style, "underline");
2488 hres = IHTMLStyle_get_textDecoration(style, &str);
2489 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2490 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2491 SysFreeString(str);
2493 set_text_decoration(runtime_style, "blink");
2494 test_text_decoration(runtime_style, "blink");
2496 hres = IHTMLStyle_get_textDecoration(style, &str);
2497 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2498 todo_wine
2499 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2500 SysFreeString(str);
2502 IHTMLStyle_Release(runtime_style);
2503 IHTMLStyle_Release(style);
2504 IHTMLElement2_Release(elem2);
2505 IHTMLElement_Release(elem);
2508 static IHTMLDocument2 *notif_doc;
2509 static BOOL doc_complete;
2511 static IHTMLDocument2 *create_document(void)
2513 IHTMLDocument2 *doc;
2514 IHTMLDocument5 *doc5;
2515 HRESULT hres;
2517 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2518 &IID_IHTMLDocument2, (void**)&doc);
2519 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2520 if(FAILED(hres))
2521 return NULL;
2523 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2524 if(FAILED(hres)) {
2525 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2526 IHTMLDocument2_Release(doc);
2527 return NULL;
2530 IHTMLDocument5_Release(doc5);
2531 return doc;
2534 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2535 REFIID riid, void**ppv)
2537 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2538 *ppv = iface;
2539 return S_OK;
2542 ok(0, "unexpected call\n");
2543 return E_NOINTERFACE;
2546 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2548 return 2;
2551 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2553 return 1;
2556 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2558 if(dispID == DISPID_READYSTATE){
2559 BSTR state;
2560 HRESULT hres;
2562 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2563 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2565 if(!strcmp_wa(state, "complete"))
2566 doc_complete = TRUE;
2568 SysFreeString(state);
2571 return S_OK;
2574 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2576 ok(0, "unexpected call\n");
2577 return E_NOTIMPL;
2580 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2581 PropertyNotifySink_QueryInterface,
2582 PropertyNotifySink_AddRef,
2583 PropertyNotifySink_Release,
2584 PropertyNotifySink_OnChanged,
2585 PropertyNotifySink_OnRequestEdit
2588 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2590 static IHTMLDocument2 *create_doc_with_string(const char *str)
2592 IPersistStreamInit *init;
2593 IStream *stream;
2594 IHTMLDocument2 *doc;
2595 HGLOBAL mem;
2596 SIZE_T len;
2598 notif_doc = doc = create_document();
2599 if(!doc)
2600 return NULL;
2602 doc_complete = FALSE;
2603 len = strlen(str);
2604 mem = GlobalAlloc(0, len);
2605 memcpy(mem, str, len);
2606 CreateStreamOnHGlobal(mem, TRUE, &stream);
2608 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2610 IPersistStreamInit_Load(init, stream);
2611 IPersistStreamInit_Release(init);
2612 IStream_Release(stream);
2614 return doc;
2617 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2619 IConnectionPointContainer *container;
2620 IConnectionPoint *cp;
2621 DWORD cookie;
2622 HRESULT hres;
2624 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2625 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2627 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2628 IConnectionPointContainer_Release(container);
2629 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2631 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2632 IConnectionPoint_Release(cp);
2633 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2636 typedef void (*style_test_t)(IHTMLDocument2*);
2638 static void run_test(const char *str, style_test_t test)
2640 IHTMLDocument2 *doc;
2641 ULONG ref;
2642 MSG msg;
2644 doc = create_doc_with_string(str);
2645 if(!doc)
2646 return;
2648 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2650 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2651 TranslateMessage(&msg);
2652 DispatchMessage(&msg);
2655 test(doc);
2657 ref = IHTMLDocument2_Release(doc);
2658 ok(!ref || broken(ref == 1), /* Vista */
2659 "ref = %d\n", ref);
2663 START_TEST(style)
2665 CoInitialize(NULL);
2667 run_test(basic_test_str, basic_style_test);
2668 run_test(runtimestyle_test_str, runtimestyle_test);
2670 CoUninitialize();