mshtml: Added noscript tag handling tests.
[wine] / dlls / mshtml / tests / style.c
1 /*
2  * Copyright 2007-2011 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #define COBJMACROS
20 #define CONST_VTABLE
21
22 #include <wine/test.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ole2.h"
29 #include "mshtml.h"
30 #include "mshtmhst.h"
31 #include "docobj.h"
32
33 static int strcmp_wa(LPCWSTR strw, const char *stra)
34 {
35     CHAR buf[512];
36     WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
37     return lstrcmpA(stra, buf);
38 }
39
40 static BSTR a2bstr(const char *str)
41 {
42     BSTR ret;
43     int len;
44
45     if(!str)
46         return NULL;
47
48     len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
49     ret = SysAllocStringLen(NULL, len);
50     MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
51
52     return ret;
53 }
54
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)
57 {
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)));
63 }
64
65 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
66 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
67 {
68     IHTMLElement2 *elem;
69     HRESULT hres;
70
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;
74 }
75
76 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
77 {
78     HRESULT hres;
79     IHTMLDocument3 *doc3;
80     IHTMLElement *result;
81     BSTR idW = a2bstr(id);
82
83     hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
84     ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
85
86     hres = IHTMLDocument3_getElementById(doc3, idW, &result);
87     ok(hres == S_OK, "getElementById failed: %08x\n", hres);
88     ok(result != NULL, "result == NULL\n");
89     SysFreeString(idW);
90
91     IHTMLDocument3_Release(doc3);
92     return result;
93 }
94
95 #define get_current_style(e) _get_current_style(__LINE__,e)
96 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
97 {
98     IHTMLCurrentStyle *cstyle;
99     IHTMLElement2 *elem2;
100     HRESULT hres;
101
102     hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
103     ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
104
105     cstyle = NULL;
106     hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
107     ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
108     ok(cstyle != NULL, "cstyle = %p\n", cstyle);
109
110     IHTMLElement2_Release(elem2);
111     return cstyle;
112 }
113
114 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
115 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
116 {
117     HRESULT hres;
118     DISPID dispid;
119
120     hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
121                         LOCALE_USER_DEFAULT, &dispid);
122     ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
123     if(hres == S_OK)
124     {
125         DISPPARAMS params = {NULL,NULL,0,0};
126         DISPID dispidNamed = DISPID_PROPERTYPUT;
127         VARIANT ret;
128         VARIANT vDefault;
129         VARIANTARG arg;
130
131         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
132             DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
133         ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
134
135         params.cArgs = 1;
136         params.cNamedArgs = 1;
137         params.rgdispidNamedArgs = &dispidNamed;
138         V_VT(&arg) = VT_BSTR;
139         V_BSTR(&arg) = a2bstr("none");
140         params.rgvarg = &arg;
141         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
142             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
143         ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
144         VariantClear(&arg);
145
146         V_VT(&arg) = VT_BSTR;
147         V_BSTR(&arg) = a2bstr("dotted");
148         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
149             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
150         ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
151         VariantClear(&arg);
152
153         V_VT(&arg) = VT_BSTR;
154         V_BSTR(&arg) = a2bstr("dashed");
155         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
156         DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
157         ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
158         VariantClear(&arg);
159
160         V_VT(&arg) = VT_BSTR;
161         V_BSTR(&arg) = a2bstr("solid");
162         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
163             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
164         ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
165         VariantClear(&arg);
166
167         V_VT(&arg) = VT_BSTR;
168         V_BSTR(&arg) = a2bstr("double");
169         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
170             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
171         ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
172         VariantClear(&arg);
173
174         V_VT(&arg) = VT_BSTR;
175         V_BSTR(&arg) = a2bstr("groove");
176         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
177             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
178         ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
179         VariantClear(&arg);
180
181         V_VT(&arg) = VT_BSTR;
182         V_BSTR(&arg) = a2bstr("ridge");
183         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
184             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
185         ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
186         VariantClear(&arg);
187
188         V_VT(&arg) = VT_BSTR;
189         V_BSTR(&arg) = a2bstr("inset");
190         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
191             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
192         ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
193         VariantClear(&arg);
194
195         V_VT(&arg) = VT_BSTR;
196         V_BSTR(&arg) = a2bstr("outset");
197         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
198             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
199         ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
200         VariantClear(&arg);
201
202         V_VT(&arg) = VT_BSTR;
203         V_BSTR(&arg) = a2bstr("invalid");
204         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
205             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
206         ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
207         VariantClear(&arg);
208
209         params.rgvarg = &vDefault;
210         hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
211             DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
212         ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
213         VariantClear(&vDefault);
214     }
215 }
216
217 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
218 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
219 {
220     BSTR text = (void*)0xdeadbeef;
221     HRESULT hres;
222
223     hres = IHTMLStyle_get_cssText(style, &text);
224     ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
225     if(extext)
226         ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
227     else
228         ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
229
230     SysFreeString(text);
231 }
232
233 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
234 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
235 {
236     BSTR tmp;
237     HRESULT hres;
238
239     tmp = a2bstr(text);
240     hres = IHTMLStyle_put_cssText(style, tmp);
241     ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
242     SysFreeString(tmp);
243 }
244
245 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
246 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
247 {
248     BSTR str = a2bstr(attr);
249     VARIANT_BOOL b = 100;
250     HRESULT hres;
251
252     hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
253     SysFreeString(str);
254     ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
255     ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
256 }
257
258 #define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
259 static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
260 {
261     BSTR str;
262     HRESULT hres;
263
264     str = a2bstr(v);
265     hres = IHTMLStyle_put_textDecoration(style, str);
266     ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
267     SysFreeString(str);
268 }
269
270 #define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
271 static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
272 {
273     BSTR str;
274     HRESULT hres;
275
276     hres = IHTMLStyle_get_textDecoration(style, &str);
277     ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
278     if(exdec)
279         ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
280     else
281         ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
282     SysFreeString(str);
283 }
284
285 static void test_set_csstext(IHTMLStyle *style)
286 {
287     VARIANT v;
288     HRESULT hres;
289
290     test_style_set_csstext(style, "background-color: black;");
291
292     hres = IHTMLStyle_get_backgroundColor(style, &v);
293     ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
294     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
295     ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
296     VariantClear(&v);
297 }
298
299 static void test_style2(IHTMLStyle2 *style2)
300 {
301     VARIANT v;
302     BSTR str;
303     HRESULT hres;
304
305     str = (void*)0xdeadbeef;
306     hres = IHTMLStyle2_get_position(style2, &str);
307     ok(hres == S_OK, "get_position failed: %08x\n", hres);
308     ok(!str, "str != NULL\n");
309
310     str = a2bstr("absolute");
311     hres = IHTMLStyle2_put_position(style2, str);
312     ok(hres == S_OK, "put_position failed: %08x\n", hres);
313     SysFreeString(str);
314
315     str = NULL;
316     hres = IHTMLStyle2_get_position(style2, &str);
317     ok(hres == S_OK, "get_position failed: %08x\n", hres);
318     ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
319     SysFreeString(str);
320
321     /* Test right */
322     V_VT(&v) = VT_EMPTY;
323     hres = IHTMLStyle2_get_right(style2, &v);
324     ok(hres == S_OK, "get_top failed: %08x\n", hres);
325     ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
326     ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
327     VariantClear(&v);
328
329     V_VT(&v) = VT_BSTR;
330     V_BSTR(&v) = a2bstr("3px");
331     hres = IHTMLStyle2_put_right(style2, v);
332     ok(hres == S_OK, "put_right failed: %08x\n", hres);
333     VariantClear(&v);
334
335     V_VT(&v) = VT_EMPTY;
336     hres = IHTMLStyle2_get_right(style2, &v);
337     ok(hres == S_OK, "get_right failed: %08x\n", hres);
338     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
339     ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
340     VariantClear(&v);
341
342     /* direction */
343     str = (void*)0xdeadbeef;
344     hres = IHTMLStyle2_get_direction(style2, &str);
345     ok(hres == S_OK, "get_direction failed: %08x\n", hres);
346     ok(!str, "str = %s\n", wine_dbgstr_w(str));
347
348     str = a2bstr("ltr");
349     hres = IHTMLStyle2_put_direction(style2, str);
350     ok(hres == S_OK, "put_direction failed: %08x\n", hres);
351     SysFreeString(str);
352
353     str = NULL;
354     hres = IHTMLStyle2_get_direction(style2, &str);
355     ok(hres == S_OK, "get_direction failed: %08x\n", hres);
356     ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
357     SysFreeString(str);
358
359     /* bottom */
360     V_VT(&v) = VT_EMPTY;
361     hres = IHTMLStyle2_get_bottom(style2, &v);
362     ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
363     test_var_bstr(&v, NULL);
364
365     V_VT(&v) = VT_I4;
366     V_I4(&v) = 4;
367     hres = IHTMLStyle2_put_bottom(style2, v);
368     ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
369
370     V_VT(&v) = VT_EMPTY;
371     hres = IHTMLStyle2_get_bottom(style2, &v);
372     ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
373     test_var_bstr(&v, "4px");
374
375     /* overflowX */
376     str = (void*)0xdeadbeef;
377     hres = IHTMLStyle2_get_overflowX(style2, &str);
378     ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
379     ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
380
381     str = a2bstr("hidden");
382     hres = IHTMLStyle2_put_overflowX(style2, str);
383     ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
384     SysFreeString(str);
385
386     str = NULL;
387     hres = IHTMLStyle2_get_overflowX(style2, &str);
388     ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
389     ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
390
391     /* overflowY */
392     str = (void*)0xdeadbeef;
393     hres = IHTMLStyle2_get_overflowY(style2, &str);
394     ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
395     ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
396
397     str = a2bstr("hidden");
398     hres = IHTMLStyle2_put_overflowY(style2, str);
399     ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
400     SysFreeString(str);
401
402     str = NULL;
403     hres = IHTMLStyle2_get_overflowY(style2, &str);
404     ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
405     ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
406 }
407
408 static void test_style3(IHTMLStyle3 *style3)
409 {
410     BSTR str;
411     HRESULT hres;
412
413     str = (void*)0xdeadbeef;
414     hres = IHTMLStyle3_get_wordWrap(style3, &str);
415     ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
416     ok(!str, "str != NULL\n");
417
418     str = a2bstr("break-word");
419     hres = IHTMLStyle3_put_wordWrap(style3, str);
420     ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
421     SysFreeString(str);
422
423     str = NULL;
424     hres = IHTMLStyle3_get_wordWrap(style3, &str);
425     ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
426     ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
427     SysFreeString(str);
428 }
429
430 static void test_style4(IHTMLStyle4 *style4)
431 {
432     HRESULT hres;
433     VARIANT v;
434     VARIANT vdefault;
435
436     hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
437     ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
438
439     V_VT(&v) = VT_BSTR;
440     V_BSTR(&v) = a2bstr("10px");
441     hres = IHTMLStyle4_put_minHeight(style4, v);
442     ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
443     VariantClear(&v);
444
445     hres = IHTMLStyle4_get_minHeight(style4, &v);
446     ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
447     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
448     ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
449     VariantClear(&v);
450
451     hres = IHTMLStyle4_put_minHeight(style4, vdefault);
452     ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
453     VariantClear(&vdefault);
454 }
455
456 static void test_body_style(IHTMLStyle *style)
457 {
458     IHTMLStyle2 *style2;
459     IHTMLStyle3 *style3;
460     IHTMLStyle4 *style4;
461     VARIANT_BOOL b;
462     VARIANT v;
463     BSTR str;
464     HRESULT hres;
465     float f;
466     BSTR sOverflowDefault;
467     BSTR sDefault;
468     VARIANT vDefault;
469
470     test_style_csstext(style, NULL);
471
472     hres = IHTMLStyle_get_position(style, &str);
473     ok(hres == S_OK, "get_position failed: %08x\n", hres);
474     ok(!str, "str=%s\n", wine_dbgstr_w(str));
475
476     V_VT(&v) = VT_NULL;
477     hres = IHTMLStyle_get_marginRight(style, &v);
478     ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
479     ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
480     ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
481
482     V_VT(&v) = VT_I4;
483     V_I4(&v) = 6;
484     hres = IHTMLStyle_put_marginRight(style, v);
485     ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
486
487     V_VT(&v) = VT_NULL;
488     hres = IHTMLStyle_get_marginRight(style, &v);
489     ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
490     ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
491     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
492
493     V_VT(&v) = VT_NULL;
494     hres = IHTMLStyle_get_marginBottom(style, &v);
495     ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
496     ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
497     ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
498
499     V_VT(&v) = VT_I4;
500     V_I4(&v) = 6;
501     hres = IHTMLStyle_put_marginBottom(style, v);
502     ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
503
504     V_VT(&v) = VT_NULL;
505     hres = IHTMLStyle_get_marginBottom(style, &v);
506     ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
507     ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
508     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
509
510     V_VT(&v) = VT_NULL;
511     hres = IHTMLStyle_get_marginLeft(style, &v);
512     ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
513     ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
514     ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
515
516     V_VT(&v) = VT_I4;
517     V_I4(&v) = 6;
518     hres = IHTMLStyle_put_marginLeft(style, v);
519     ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
520
521     V_VT(&v) = VT_NULL;
522     hres = IHTMLStyle_get_marginLeft(style, &v);
523     ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
524     ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
525     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
526
527     str = (void*)0xdeadbeef;
528     hres = IHTMLStyle_get_fontFamily(style, &str);
529     ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
530     ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
531
532     str = (void*)0xdeadbeef;
533     hres = IHTMLStyle_get_fontWeight(style, &str);
534     ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
535     ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
536
537     hres = IHTMLStyle_get_fontWeight(style, &sDefault);
538     ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
539
540     str = a2bstr("test");
541     hres = IHTMLStyle_put_fontWeight(style, str);
542     ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
543     SysFreeString(str);
544
545     str = a2bstr("bold");
546     hres = IHTMLStyle_put_fontWeight(style, str);
547     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
548     SysFreeString(str);
549
550     str = a2bstr("bolder");
551     hres = IHTMLStyle_put_fontWeight(style, str);
552     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
553     SysFreeString(str);
554
555     str = a2bstr("lighter");
556     hres = IHTMLStyle_put_fontWeight(style, str);
557     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
558     SysFreeString(str);
559
560     str = a2bstr("100");
561     hres = IHTMLStyle_put_fontWeight(style, str);
562     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
563     SysFreeString(str);
564
565     str = a2bstr("200");
566     hres = IHTMLStyle_put_fontWeight(style, str);
567     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
568     SysFreeString(str);
569
570     str = a2bstr("300");
571     hres = IHTMLStyle_put_fontWeight(style, str);
572     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
573     SysFreeString(str);
574
575     str = a2bstr("400");
576     hres = IHTMLStyle_put_fontWeight(style, str);
577     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
578     SysFreeString(str);
579
580     str = a2bstr("500");
581     hres = IHTMLStyle_put_fontWeight(style, str);
582     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
583     SysFreeString(str);
584
585     str = a2bstr("600");
586     hres = IHTMLStyle_put_fontWeight(style, str);
587     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
588     SysFreeString(str);
589
590     str = a2bstr("700");
591     hres = IHTMLStyle_put_fontWeight(style, str);
592     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
593     SysFreeString(str);
594
595     str = a2bstr("800");
596     hres = IHTMLStyle_put_fontWeight(style, str);
597     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
598     SysFreeString(str);
599
600     str = a2bstr("900");
601     hres = IHTMLStyle_put_fontWeight(style, str);
602     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
603     SysFreeString(str);
604
605     hres = IHTMLStyle_get_fontWeight(style, &str);
606     ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
607     ok(!strcmp_wa(str, "900"), "str != style900\n");
608     SysFreeString(str);
609
610     hres = IHTMLStyle_put_fontWeight(style, sDefault);
611     ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
612     SysFreeString(sDefault);
613
614     /* font Variant */
615     hres = IHTMLStyle_get_fontVariant(style, NULL);
616     ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
617
618     hres = IHTMLStyle_get_fontVariant(style, &sDefault);
619     ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
620
621     str = a2bstr("test");
622     hres = IHTMLStyle_put_fontVariant(style, str);
623     ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
624     SysFreeString(str);
625
626     str = a2bstr("small-caps");
627     hres = IHTMLStyle_put_fontVariant(style, str);
628     ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
629     SysFreeString(str);
630
631     str = a2bstr("normal");
632     hres = IHTMLStyle_put_fontVariant(style, str);
633     ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
634     SysFreeString(str);
635
636     hres = IHTMLStyle_put_fontVariant(style, sDefault);
637     ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
638     SysFreeString(sDefault);
639
640     str = (void*)0xdeadbeef;
641     hres = IHTMLStyle_get_display(style, &str);
642     ok(hres == S_OK, "get_display failed: %08x\n", hres);
643     ok(!str, "display = %s\n", wine_dbgstr_w(str));
644
645     str = (void*)0xdeadbeef;
646     hres = IHTMLStyle_get_visibility(style, &str);
647     ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
648     ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
649
650     V_VT(&v) = VT_NULL;
651     hres = IHTMLStyle_get_fontSize(style, &v);
652     ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
653     ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
654     ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
655
656     V_VT(&v) = VT_I4;
657     V_I4(&v) = 12;
658     hres = IHTMLStyle_put_fontSize(style, v);
659     ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
660
661     V_VT(&v) = VT_NULL;
662     hres = IHTMLStyle_get_fontSize(style, &v);
663     ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
664     ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
665     ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
666
667     V_VT(&v) = VT_NULL;
668     hres = IHTMLStyle_get_color(style, &v);
669     ok(hres == S_OK, "get_color failed: %08x\n", hres);
670     ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
671     ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
672
673     V_VT(&v) = VT_I4;
674     V_I4(&v) = 0xfdfd;
675     hres = IHTMLStyle_put_color(style, v);
676     ok(hres == S_OK, "put_color failed: %08x\n", hres);
677
678     V_VT(&v) = VT_NULL;
679     hres = IHTMLStyle_get_color(style, &v);
680     ok(hres == S_OK, "get_color failed: %08x\n", hres);
681     ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
682     todo_wine
683     ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
684
685     b = 0xfefe;
686     hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
687     ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
688     ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
689
690     hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
691     ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
692
693     hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
694     ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
695     ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
696
697     hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
698     ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
699
700     b = 0xfefe;
701     hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
702     ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
703     ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
704
705     hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
706     ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
707
708     hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
709     ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
710     ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
711
712     hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
713     ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
714
715     b = 0xfefe;
716     hres = IHTMLStyle_get_textDecorationNone(style, &b);
717     ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
718     ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
719
720     hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
721     ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
722
723     hres = IHTMLStyle_get_textDecorationNone(style, &b);
724     ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
725     ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
726
727     hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
728     ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
729
730     b = 0xfefe;
731     hres = IHTMLStyle_get_textDecorationOverline(style, &b);
732     ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
733     ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
734
735     hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
736     ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
737
738     hres = IHTMLStyle_get_textDecorationOverline(style, &b);
739     ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
740     ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
741
742     hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
743     ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
744
745     b = 0xfefe;
746     hres = IHTMLStyle_get_textDecorationBlink(style, &b);
747     ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
748     ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
749
750     hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
751     ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
752
753     hres = IHTMLStyle_get_textDecorationBlink(style, &b);
754     ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
755     ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
756
757     hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
758     ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
759
760     hres = IHTMLStyle_get_textDecoration(style, &sDefault);
761     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
762
763     str = a2bstr("invalid");
764     hres = IHTMLStyle_put_textDecoration(style, str);
765     ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
766     SysFreeString(str);
767
768     set_text_decoration(style, "none");
769     test_text_decoration(style, "none");
770     set_text_decoration(style, "underline");
771     set_text_decoration(style, "overline");
772     set_text_decoration(style, "line-through");
773     set_text_decoration(style, "blink");
774     set_text_decoration(style, "overline");
775     set_text_decoration(style, "blink");
776     test_text_decoration(style, "blink");
777
778     hres = IHTMLStyle_put_textDecoration(style, sDefault);
779     ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
780     SysFreeString(sDefault);
781
782     hres = IHTMLStyle_get_posWidth(style, NULL);
783     ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
784
785     hres = IHTMLStyle_get_posWidth(style, &f);
786     ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
787     ok(f == 0.0f, "f = %f\n", f);
788
789     V_VT(&v) = VT_EMPTY;
790     hres = IHTMLStyle_get_width(style, &v);
791     ok(hres == S_OK, "get_width failed: %08x\n", hres);
792     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
793     ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
794
795     hres = IHTMLStyle_put_posWidth(style, 2.2);
796     ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
797
798     hres = IHTMLStyle_get_posWidth(style, &f);
799     ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
800     ok(f == 2.0f ||
801        f == 2.2f, /* IE8 */
802        "f = %f\n", f);
803
804     V_VT(&v) = VT_BSTR;
805     V_BSTR(&v) = a2bstr("auto");
806     hres = IHTMLStyle_put_width(style, v);
807     ok(hres == S_OK, "put_width failed: %08x\n", hres);
808     VariantClear(&v);
809
810     V_VT(&v) = VT_EMPTY;
811     hres = IHTMLStyle_get_width(style, &v);
812     ok(hres == S_OK, "get_width failed: %08x\n", hres);
813     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
814     ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
815     VariantClear(&v);
816
817     V_VT(&v) = VT_I4;
818     V_I4(&v) = 100;
819     hres = IHTMLStyle_put_width(style, v);
820     ok(hres == S_OK, "put_width failed: %08x\n", hres);
821
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), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
827     VariantClear(&v);
828
829     hres = IHTMLStyle_put_pixelWidth(style, 50);
830     ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
831
832     V_VT(&v) = VT_EMPTY;
833     hres = IHTMLStyle_get_width(style, &v);
834     ok(hres == S_OK, "get_width failed: %08x\n", hres);
835     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
836     ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
837     VariantClear(&v);
838
839     /* margin tests */
840     str = (void*)0xdeadbeef;
841     hres = IHTMLStyle_get_margin(style, &str);
842     ok(hres == S_OK, "get_margin failed: %08x\n", hres);
843     ok(!str, "margin = %s\n", wine_dbgstr_w(str));
844
845     str = a2bstr("1");
846     hres = IHTMLStyle_put_margin(style, str);
847     ok(hres == S_OK, "put_margin failed: %08x\n", hres);
848     SysFreeString(str);
849
850     hres = IHTMLStyle_get_margin(style, &str);
851     ok(hres == S_OK, "get_margin failed: %08x\n", hres);
852     ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
853     SysFreeString(str);
854
855     hres = IHTMLStyle_put_margin(style, NULL);
856     ok(hres == S_OK, "put_margin failed: %08x\n", hres);
857
858     str = (void*)0xdeadbeef;
859     hres = IHTMLStyle_get_marginTop(style, &v);
860     ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
861     ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
862     ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
863
864     V_VT(&v) = VT_BSTR;
865     V_BSTR(&v) = a2bstr("6px");
866     hres = IHTMLStyle_put_marginTop(style, v);
867     SysFreeString(V_BSTR(&v));
868     ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
869
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(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
875     VariantClear(&v);
876
877     V_VT(&v) = VT_I4;
878     V_I4(&v) = 5;
879     hres = IHTMLStyle_put_marginTop(style, v);
880     ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
881
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), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
887     VariantClear(&v);
888
889     str = NULL;
890     hres = IHTMLStyle_get_border(style, &str);
891     ok(hres == S_OK, "get_border failed: %08x\n", hres);
892     ok(!str || !*str, "str is not empty\n");
893     SysFreeString(str);
894
895     str = a2bstr("1px");
896     hres = IHTMLStyle_put_border(style, str);
897     ok(hres == S_OK, "put_border failed: %08x\n", hres);
898     SysFreeString(str);
899
900     V_VT(&v) = VT_EMPTY;
901     hres = IHTMLStyle_get_left(style, &v);
902     ok(hres == S_OK, "get_left failed: %08x\n", hres);
903     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
904     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
905     VariantClear(&v);
906
907     /* Test posLeft */
908     hres = IHTMLStyle_get_posLeft(style, NULL);
909     ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
910
911     f = 1.0f;
912     hres = IHTMLStyle_get_posLeft(style, &f);
913     ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
914     ok(f == 0.0, "expected 0.0 got %f\n", f);
915
916     hres = IHTMLStyle_put_posLeft(style, 4.9f);
917     ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
918
919     hres = IHTMLStyle_get_posLeft(style, &f);
920     ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
921     ok(f == 4.0 ||
922        f == 4.9f, /* IE8 */
923        "expected 4.0 or 4.9 (IE8) got %f\n", f);
924
925     /* Ensure left is updated correctly. */
926     V_VT(&v) = VT_EMPTY;
927     hres = IHTMLStyle_get_left(style, &v);
928     ok(hres == S_OK, "get_left failed: %08x\n", hres);
929     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
930     ok(!strcmp_wa(V_BSTR(&v), "4px") ||
931        !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
932        "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
933     VariantClear(&v);
934
935     /* Test left */
936     V_VT(&v) = VT_BSTR;
937     V_BSTR(&v) = a2bstr("3px");
938     hres = IHTMLStyle_put_left(style, v);
939     ok(hres == S_OK, "put_left failed: %08x\n", hres);
940     VariantClear(&v);
941
942     hres = IHTMLStyle_get_posLeft(style, &f);
943     ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
944     ok(f == 3.0, "expected 3.0 got %f\n", f);
945
946     V_VT(&v) = VT_EMPTY;
947     hres = IHTMLStyle_get_left(style, &v);
948     ok(hres == S_OK, "get_left failed: %08x\n", hres);
949     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
950     ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
951     VariantClear(&v);
952
953     V_VT(&v) = VT_NULL;
954     hres = IHTMLStyle_put_left(style, v);
955     ok(hres == S_OK, "put_left failed: %08x\n", hres);
956
957     V_VT(&v) = VT_EMPTY;
958     hres = IHTMLStyle_get_left(style, &v);
959     ok(hres == S_OK, "get_left failed: %08x\n", hres);
960     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
961     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
962     VariantClear(&v);
963
964     V_VT(&v) = VT_EMPTY;
965     hres = IHTMLStyle_get_top(style, &v);
966     ok(hres == S_OK, "get_top failed: %08x\n", hres);
967     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
968     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
969     VariantClear(&v);
970
971     /* Test posTop */
972     hres = IHTMLStyle_get_posTop(style, NULL);
973     ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
974
975     f = 1.0f;
976     hres = IHTMLStyle_get_posTop(style, &f);
977     ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
978     ok(f == 0.0, "expected 0.0 got %f\n", f);
979
980     hres = IHTMLStyle_put_posTop(style, 4.9f);
981     ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
982
983     hres = IHTMLStyle_get_posTop(style, &f);
984     ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
985     ok(f == 4.0 ||
986        f == 4.9f, /* IE8 */
987        "expected 4.0 or 4.9 (IE8) got %f\n", f);
988
989     V_VT(&v) = VT_BSTR;
990     V_BSTR(&v) = a2bstr("3px");
991     hres = IHTMLStyle_put_top(style, v);
992     ok(hres == S_OK, "put_top failed: %08x\n", hres);
993     VariantClear(&v);
994
995     V_VT(&v) = VT_EMPTY;
996     hres = IHTMLStyle_get_top(style, &v);
997     ok(hres == S_OK, "get_top failed: %08x\n", hres);
998     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
999     ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1000     VariantClear(&v);
1001
1002     hres = IHTMLStyle_get_posTop(style, &f);
1003     ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1004     ok(f == 3.0, "expected 3.0 got %f\n", f);
1005
1006     V_VT(&v) = VT_NULL;
1007     hres = IHTMLStyle_put_top(style, v);
1008     ok(hres == S_OK, "put_top failed: %08x\n", hres);
1009
1010     V_VT(&v) = VT_EMPTY;
1011     hres = IHTMLStyle_get_top(style, &v);
1012     ok(hres == S_OK, "get_top failed: %08x\n", hres);
1013     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1014     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1015     VariantClear(&v);
1016
1017     /* Test posHeight */
1018     hres = IHTMLStyle_get_posHeight(style, NULL);
1019     ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1020
1021     V_VT(&v) = VT_EMPTY;
1022     hres = IHTMLStyle_get_height(style, &v);
1023     ok(hres == S_OK, "get_height failed: %08x\n", hres);
1024     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1025     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1026     VariantClear(&v);
1027
1028     f = 1.0f;
1029     hres = IHTMLStyle_get_posHeight(style, &f);
1030     ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1031     ok(f == 0.0, "expected 0.0 got %f\n", f);
1032
1033     hres = IHTMLStyle_put_posHeight(style, 4.9f);
1034     ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1035
1036     hres = IHTMLStyle_get_posHeight(style, &f);
1037     ok(hres == S_OK, "get_posHeight 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);
1041
1042     V_VT(&v) = VT_BSTR;
1043     V_BSTR(&v) = a2bstr("70px");
1044     hres = IHTMLStyle_put_height(style, v);
1045     ok(hres == S_OK, "put_height failed: %08x\n", hres);
1046     VariantClear(&v);
1047
1048     V_VT(&v) = VT_EMPTY;
1049     hres = IHTMLStyle_get_height(style, &v);
1050     ok(hres == S_OK, "get_height 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), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1053     VariantClear(&v);
1054
1055     V_VT(&v) = VT_I4;
1056     V_I4(&v) = 64;
1057     hres = IHTMLStyle_put_height(style, v);
1058     ok(hres == S_OK, "put_height failed: %08x\n", hres);
1059
1060     V_VT(&v) = VT_EMPTY;
1061     hres = IHTMLStyle_get_height(style, &v);
1062     ok(hres == S_OK, "get_height failed: %08x\n", hres);
1063     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1064     ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1065     VariantClear(&v);
1066
1067     hres = IHTMLStyle_get_posHeight(style, &f);
1068     ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1069     ok(f == 64.0, "expected 64.0 got %f\n", f);
1070
1071     str = (void*)0xdeadbeef;
1072     hres = IHTMLStyle_get_cursor(style, &str);
1073     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1074     ok(!str, "get_cursor != NULL\n");
1075     SysFreeString(str);
1076
1077     str = a2bstr("default");
1078     hres = IHTMLStyle_put_cursor(style, str);
1079     ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1080     SysFreeString(str);
1081
1082     str = NULL;
1083     hres = IHTMLStyle_get_cursor(style, &str);
1084     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1085     ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1086     SysFreeString(str);
1087
1088     V_VT(&v) = VT_EMPTY;
1089     hres = IHTMLStyle_get_verticalAlign(style, &v);
1090     ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1091     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1092     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1093     VariantClear(&v);
1094
1095     V_VT(&v) = VT_BSTR;
1096     V_BSTR(&v) = a2bstr("middle");
1097     hres = IHTMLStyle_put_verticalAlign(style, v);
1098     ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1099     VariantClear(&v);
1100
1101     V_VT(&v) = VT_EMPTY;
1102     hres = IHTMLStyle_get_verticalAlign(style, &v);
1103     ok(hres == S_OK, "get_verticalAlign 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), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1106     VariantClear(&v);
1107
1108     V_VT(&v) = VT_I4;
1109     V_I4(&v) = 100;
1110     hres = IHTMLStyle_put_verticalAlign(style, v);
1111     ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1112     VariantClear(&v);
1113
1114     V_VT(&v) = VT_EMPTY;
1115     hres = IHTMLStyle_get_verticalAlign(style, &v);
1116     ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1117     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1118     ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1119     VariantClear(&v);
1120
1121     str = (void*)0xdeadbeef;
1122     hres = IHTMLStyle_get_textAlign(style, &str);
1123     ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1124     ok(!str, "textAlign != NULL\n");
1125
1126     str = a2bstr("center");
1127     hres = IHTMLStyle_put_textAlign(style, str);
1128     ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1129     SysFreeString(str);
1130
1131     str = NULL;
1132     hres = IHTMLStyle_get_textAlign(style, &str);
1133     ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1134     ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1135     SysFreeString(str);
1136
1137     str = (void*)0xdeadbeef;
1138     hres = IHTMLStyle_get_filter(style, &str);
1139     ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1140     ok(!str, "filter != NULL\n");
1141
1142     str = a2bstr("alpha(opacity=100)");
1143     hres = IHTMLStyle_put_filter(style, str);
1144     ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1145     SysFreeString(str);
1146
1147     V_VT(&v) = VT_EMPTY;
1148     hres = IHTMLStyle_get_zIndex(style, &v);
1149     ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1150     ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1151     ok(!V_I4(&v), "V_I4(v) != 0\n");
1152     VariantClear(&v);
1153
1154     V_VT(&v) = VT_BSTR;
1155     V_BSTR(&v) = a2bstr("1");
1156     hres = IHTMLStyle_put_zIndex(style, v);
1157     ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1158     VariantClear(&v);
1159
1160     V_VT(&v) = VT_EMPTY;
1161     hres = IHTMLStyle_get_zIndex(style, &v);
1162     ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1163     ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1164     ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1165     VariantClear(&v);
1166
1167     /* fontStyle */
1168     hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1169     ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1170
1171     str = a2bstr("test");
1172     hres = IHTMLStyle_put_fontStyle(style, str);
1173     ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1174     SysFreeString(str);
1175
1176     str = a2bstr("italic");
1177     hres = IHTMLStyle_put_fontStyle(style, str);
1178     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1179     SysFreeString(str);
1180
1181     str = a2bstr("oblique");
1182     hres = IHTMLStyle_put_fontStyle(style, str);
1183     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1184     SysFreeString(str);
1185
1186     str = a2bstr("normal");
1187     hres = IHTMLStyle_put_fontStyle(style, str);
1188     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1189     SysFreeString(str);
1190
1191     hres = IHTMLStyle_put_fontStyle(style, sDefault);
1192     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1193     SysFreeString(sDefault);
1194
1195     /* overflow */
1196     hres = IHTMLStyle_get_overflow(style, NULL);
1197     ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1198
1199     hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1200     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1201
1202     str = a2bstr("test");
1203     hres = IHTMLStyle_put_overflow(style, str);
1204     ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1205     SysFreeString(str);
1206
1207     str = a2bstr("visible");
1208     hres = IHTMLStyle_put_overflow(style, str);
1209     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1210     SysFreeString(str);
1211
1212     str = a2bstr("scroll");
1213     hres = IHTMLStyle_put_overflow(style, str);
1214     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1215     SysFreeString(str);
1216
1217     str = a2bstr("hidden");
1218     hres = IHTMLStyle_put_overflow(style, str);
1219     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1220     SysFreeString(str);
1221
1222     str = a2bstr("auto");
1223     hres = IHTMLStyle_put_overflow(style, str);
1224     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1225     SysFreeString(str);
1226
1227     hres = IHTMLStyle_get_overflow(style, &str);
1228     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1229     ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1230     SysFreeString(str);
1231
1232     str = a2bstr("");
1233     hres = IHTMLStyle_put_overflow(style, str);
1234     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1235     SysFreeString(str);
1236
1237     hres = IHTMLStyle_get_overflow(style, &str);
1238     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1239     ok(!str, "str=%s\n", wine_dbgstr_w(str));
1240     SysFreeString(str);
1241
1242     /* restore overflow default */
1243     hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1244     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1245     SysFreeString(sOverflowDefault);
1246
1247     /* Attribute Tests*/
1248     hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1249     ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1250
1251     str = a2bstr("position");
1252     hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1253     ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1254
1255     hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1256     ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1257     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1258     VariantClear(&v);
1259
1260     hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1261     ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1262
1263     V_VT(&v) = VT_BSTR;
1264     V_BSTR(&v) = a2bstr("absolute");
1265     hres = IHTMLStyle_setAttribute(style, str, v, 1);
1266     ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1267     VariantClear(&v);
1268
1269     hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1270     ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1271     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1272     ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1273     VariantClear(&v);
1274
1275     V_VT(&v) = VT_BSTR;
1276     V_BSTR(&v) = NULL;
1277     hres = IHTMLStyle_setAttribute(style, str, v, 1);
1278     ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1279     VariantClear(&v);
1280
1281     SysFreeString(str);
1282
1283     str = a2bstr("borderLeftStyle");
1284     test_border_styles(style, str);
1285     SysFreeString(str);
1286
1287     str = a2bstr("borderbottomstyle");
1288     test_border_styles(style, str);
1289     SysFreeString(str);
1290
1291     str = a2bstr("borderrightstyle");
1292     test_border_styles(style, str);
1293     SysFreeString(str);
1294
1295     str = a2bstr("bordertopstyle");
1296     test_border_styles(style, str);
1297     SysFreeString(str);
1298
1299     hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1300     ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1301
1302     str = a2bstr("none dotted dashed solid");
1303     hres = IHTMLStyle_put_borderStyle(style, str);
1304     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1305     SysFreeString(str);
1306
1307     str = a2bstr("none dotted dashed solid");
1308     hres = IHTMLStyle_get_borderStyle(style, &str);
1309     ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1310     ok(!strcmp_wa(str, "none dotted dashed solid"),
1311         "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1312     SysFreeString(str);
1313
1314     str = a2bstr("double groove ridge inset");
1315     hres = IHTMLStyle_put_borderStyle(style, str);
1316     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1317     SysFreeString(str);
1318
1319     str = a2bstr("window-inset outset ridge inset");
1320     hres = IHTMLStyle_put_borderStyle(style, str);
1321     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1322     SysFreeString(str);
1323
1324     str = a2bstr("window-inset");
1325     hres = IHTMLStyle_put_borderStyle(style, str);
1326     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1327     SysFreeString(str);
1328
1329     str = a2bstr("none none none none none");
1330     hres = IHTMLStyle_put_borderStyle(style, str);
1331     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1332     SysFreeString(str);
1333
1334     str = a2bstr("invalid none none none");
1335     hres = IHTMLStyle_put_borderStyle(style, str);
1336     ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1337     SysFreeString(str);
1338
1339     str = a2bstr("none invalid none none");
1340     hres = IHTMLStyle_put_borderStyle(style, str);
1341     ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1342     SysFreeString(str);
1343
1344     hres = IHTMLStyle_put_borderStyle(style, sDefault);
1345     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1346     SysFreeString(sDefault);
1347
1348     /* backgoundColor */
1349     hres = IHTMLStyle_get_backgroundColor(style, &v);
1350     ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1351     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1352     ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1353     VariantClear(&v);
1354
1355     V_VT(&v) = VT_BSTR;
1356     V_BSTR(&v) = a2bstr("red");
1357     hres = IHTMLStyle_put_backgroundColor(style, v);
1358     ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1359     VariantClear(&v);
1360
1361     hres = IHTMLStyle_get_backgroundColor(style, &v);
1362     ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1363     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1364     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1365     VariantClear(&v);
1366
1367     /* padding */
1368     hres = IHTMLStyle_get_padding(style, &str);
1369     ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1370     ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1371     SysFreeString(str);
1372
1373     hres = IHTMLStyle_get_paddingTop(style, &v);
1374     ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1375     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1376     ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1377
1378     V_VT(&v) = VT_I4;
1379     V_I4(&v) = 6;
1380     hres = IHTMLStyle_put_paddingTop(style, v);
1381     ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1382
1383     hres = IHTMLStyle_get_paddingTop(style, &v);
1384     ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1385     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1386     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1387     VariantClear(&v);
1388
1389     hres = IHTMLStyle_get_paddingRight(style, &v);
1390     ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1391     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1392     ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1393
1394     V_VT(&v) = VT_I4;
1395     V_I4(&v) = 6;
1396     hres = IHTMLStyle_put_paddingRight(style, v);
1397     ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1398
1399     hres = IHTMLStyle_get_paddingRight(style, &v);
1400     ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1401     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1402     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1403     VariantClear(&v);
1404
1405     hres = IHTMLStyle_get_paddingBottom(style, &v);
1406     ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1407     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1408     ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1409
1410     V_VT(&v) = VT_I4;
1411     V_I4(&v) = 6;
1412     hres = IHTMLStyle_put_paddingBottom(style, v);
1413     ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1414
1415     hres = IHTMLStyle_get_paddingBottom(style, &v);
1416     ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1417     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1418     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1419     VariantClear(&v);
1420
1421     str = a2bstr("1");
1422     hres = IHTMLStyle_put_padding(style, str);
1423     ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1424     SysFreeString(str);
1425
1426     hres = IHTMLStyle_get_padding(style, &str);
1427     ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1428     ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1429     SysFreeString(str);
1430
1431     /* PaddingLeft */
1432     hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1433     ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1434     ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1435     ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1436
1437     V_VT(&v) = VT_BSTR;
1438     V_BSTR(&v) = a2bstr("10");
1439     hres = IHTMLStyle_put_paddingLeft(style, v);
1440     ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1441     VariantClear(&v);
1442
1443     hres = IHTMLStyle_get_paddingLeft(style, &v);
1444     ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1445     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1446     VariantClear(&v);
1447
1448     hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1449     ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1450
1451     /* BackgroundRepeat */
1452     hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1453     ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1454
1455     str = a2bstr("invalid");
1456     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1457     ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1458     SysFreeString(str);
1459
1460     str = a2bstr("repeat");
1461     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1462     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1463     SysFreeString(str);
1464
1465     str = a2bstr("no-repeat");
1466     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1467     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1468     SysFreeString(str);
1469
1470     str = a2bstr("repeat-x");
1471     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1472     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1473     SysFreeString(str);
1474
1475     str = a2bstr("repeat-y");
1476     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1477     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1478     SysFreeString(str);
1479
1480     hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1481     ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1482     ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1483     SysFreeString(str);
1484
1485     hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1486     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1487     SysFreeString(sDefault);
1488
1489     /* BorderColor */
1490     hres = IHTMLStyle_get_borderColor(style, &sDefault);
1491     ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1492
1493     str = a2bstr("red green red blue");
1494     hres = IHTMLStyle_put_borderColor(style, str);
1495     ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1496     SysFreeString(str);
1497
1498     hres = IHTMLStyle_get_borderColor(style, &str);
1499     ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1500     ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1501     SysFreeString(str);
1502
1503     hres = IHTMLStyle_put_borderColor(style, sDefault);
1504     ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1505     SysFreeString(sDefault);
1506
1507     /* BorderRight */
1508     hres = IHTMLStyle_get_borderRight(style, &sDefault);
1509     ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1510
1511     str = a2bstr("thick dotted red");
1512     hres = IHTMLStyle_put_borderRight(style, str);
1513     ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1514     SysFreeString(str);
1515
1516     /* IHTMLStyle_get_borderRight appears to have a bug where
1517         it returns the first letter of the color.  So we check
1518         each style individually.
1519      */
1520     V_BSTR(&v) = NULL;
1521     hres = IHTMLStyle_get_borderRightColor(style, &v);
1522     ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1523     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1524     VariantClear(&v);
1525
1526     V_BSTR(&v) = NULL;
1527     hres = IHTMLStyle_get_borderRightWidth(style, &v);
1528     ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1529     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1530     VariantClear(&v);
1531
1532     hres = IHTMLStyle_get_borderRightStyle(style, &str);
1533     ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1534     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1535     SysFreeString(str);
1536
1537     hres = IHTMLStyle_put_borderRight(style, sDefault);
1538     ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1539     SysFreeString(sDefault);
1540
1541     /* BorderTop */
1542     hres = IHTMLStyle_get_borderTop(style, &sDefault);
1543     ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1544
1545     str = a2bstr("thick dotted red");
1546     hres = IHTMLStyle_put_borderTop(style, str);
1547     ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1548     SysFreeString(str);
1549
1550     /* IHTMLStyle_get_borderTop appears to have a bug where
1551         it returns the first letter of the color.  So we check
1552         each style individually.
1553      */
1554     V_BSTR(&v) = NULL;
1555     hres = IHTMLStyle_get_borderTopColor(style, &v);
1556     ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1557     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1558     VariantClear(&v);
1559
1560     V_BSTR(&v) = NULL;
1561     hres = IHTMLStyle_get_borderTopWidth(style, &v);
1562     ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1563     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1564     VariantClear(&v);
1565
1566     hres = IHTMLStyle_get_borderTopStyle(style, &str);
1567     ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1568     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1569     SysFreeString(str);
1570
1571     hres = IHTMLStyle_put_borderTop(style, sDefault);
1572     ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1573     SysFreeString(sDefault);
1574
1575     /* BorderBottom */
1576     hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1577     ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1578
1579     str = a2bstr("thick dotted red");
1580     hres = IHTMLStyle_put_borderBottom(style, str);
1581     ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1582     SysFreeString(str);
1583
1584     /* IHTMLStyle_get_borderBottom appears to have a bug where
1585         it returns the first letter of the color.  So we check
1586         each style individually.
1587      */
1588     V_BSTR(&v) = NULL;
1589     hres = IHTMLStyle_get_borderBottomColor(style, &v);
1590     ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1591     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1592     VariantClear(&v);
1593
1594     V_BSTR(&v) = NULL;
1595     hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1596     ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1597     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1598     VariantClear(&v);
1599
1600     hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1601     ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1602     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1603     SysFreeString(str);
1604
1605     hres = IHTMLStyle_put_borderBottom(style, sDefault);
1606     ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1607     SysFreeString(sDefault);
1608
1609     /* BorderLeft */
1610     hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1611     ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1612
1613     str = a2bstr("thick dotted red");
1614     hres = IHTMLStyle_put_borderLeft(style, str);
1615     ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1616     SysFreeString(str);
1617
1618     /* IHTMLStyle_get_borderLeft appears to have a bug where
1619         it returns the first letter of the color.  So we check
1620         each style individually.
1621      */
1622     V_BSTR(&v) = NULL;
1623     hres = IHTMLStyle_get_borderLeftColor(style, &v);
1624     ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1625     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1626     VariantClear(&v);
1627
1628     V_BSTR(&v) = NULL;
1629     hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1630     ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1631     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1632     VariantClear(&v);
1633
1634     hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1635     ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1636     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1637     SysFreeString(str);
1638
1639     hres = IHTMLStyle_put_borderLeft(style, sDefault);
1640     ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1641     SysFreeString(sDefault);
1642
1643     /* backgroundPositionX */
1644     hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1645     ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1646     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1647     ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1648     VariantClear(&v);
1649
1650     V_VT(&v) = VT_BSTR;
1651     V_BSTR(&v) = a2bstr("10px");
1652     hres = IHTMLStyle_put_backgroundPositionX(style, v);
1653     ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1654     VariantClear(&v);
1655
1656     hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1657     ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1658     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1659     ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1660     VariantClear(&v);
1661
1662     /* backgroundPositionY */
1663     hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1664     ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1665     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1666     VariantClear(&v);
1667
1668     V_VT(&v) = VT_BSTR;
1669     V_BSTR(&v) = a2bstr("15px");
1670     hres = IHTMLStyle_put_backgroundPositionY(style, v);
1671     ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1672     VariantClear(&v);
1673
1674     hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1675     ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1676     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1677     ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1678     VariantClear(&v);
1679
1680     /* backgroundPosition */
1681     str = NULL;
1682     hres = IHTMLStyle_get_backgroundPosition(style, &str);
1683     ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1684     ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1685     SysFreeString(str);
1686
1687     str = a2bstr("center 20%");
1688     hres = IHTMLStyle_put_backgroundPosition(style, str);
1689     ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1690     SysFreeString(str);
1691
1692     str = NULL;
1693     hres = IHTMLStyle_get_backgroundPosition(style, &str);
1694     ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1695     ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1696     SysFreeString(str);
1697
1698     hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1699     ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1700     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1701     ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1702     VariantClear(&v);
1703
1704     hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1705     ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1706     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1707     ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1708     VariantClear(&v);
1709
1710      /* borderTopWidth */
1711     hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1712     ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1713
1714     V_VT(&v) = VT_BSTR;
1715     V_BSTR(&v) = a2bstr("10px");
1716     hres = IHTMLStyle_put_borderTopWidth(style, v);
1717     ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1718     VariantClear(&v);
1719
1720     hres = IHTMLStyle_get_borderTopWidth(style, &v);
1721     ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1722     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1723     VariantClear(&v);
1724
1725     hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1726     ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1727     VariantClear(&vDefault);
1728
1729     /* borderRightWidth */
1730     hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1731     ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1732
1733     V_VT(&v) = VT_BSTR;
1734     V_BSTR(&v) = a2bstr("10");
1735     hres = IHTMLStyle_put_borderRightWidth(style, v);
1736     ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1737     VariantClear(&v);
1738
1739     hres = IHTMLStyle_get_borderRightWidth(style, &v);
1740     ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1741     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1742     VariantClear(&v);
1743
1744     hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1745     ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1746     VariantClear(&vDefault);
1747
1748     /* borderBottomWidth */
1749     hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1750     ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1751
1752     V_VT(&v) = VT_BSTR;
1753     V_BSTR(&v) = a2bstr("10");
1754     hres = IHTMLStyle_put_borderBottomWidth(style, v);
1755     ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1756     VariantClear(&v);
1757
1758     hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1759     ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1760     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1761     VariantClear(&v);
1762
1763     hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1764     ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1765     VariantClear(&vDefault);
1766
1767     /* borderLeftWidth */
1768     hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1769     ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1770
1771     V_VT(&v) = VT_BSTR;
1772     V_BSTR(&v) = a2bstr("10");
1773     hres = IHTMLStyle_put_borderLeftWidth(style, v);
1774     ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1775     VariantClear(&v);
1776
1777     hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1778     ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1779     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1780     VariantClear(&v);
1781
1782     hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1783     ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1784     VariantClear(&vDefault);
1785
1786     /* wordSpacing */
1787     hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1788     ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1789
1790     V_VT(&v) = VT_BSTR;
1791     V_BSTR(&v) = a2bstr("10");
1792     hres = IHTMLStyle_put_wordSpacing(style, v);
1793     ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1794     VariantClear(&v);
1795
1796     hres = IHTMLStyle_get_wordSpacing(style, &v);
1797     ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1798     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1799     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1800     VariantClear(&v);
1801
1802     hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1803     ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1804     VariantClear(&vDefault);
1805
1806     /* letterSpacing */
1807     hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1808     ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1809
1810     V_VT(&v) = VT_BSTR;
1811     V_BSTR(&v) = a2bstr("11");
1812     hres = IHTMLStyle_put_letterSpacing(style, v);
1813     ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1814     VariantClear(&v);
1815
1816     hres = IHTMLStyle_get_letterSpacing(style, &v);
1817     ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1818     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1819     ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1820     VariantClear(&v);
1821
1822     hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1823     ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1824     VariantClear(&vDefault);
1825
1826     /* borderTopColor */
1827     hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1828     ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1829
1830     V_VT(&v) = VT_BSTR;
1831     V_BSTR(&v) = a2bstr("red");
1832     hres = IHTMLStyle_put_borderTopColor(style, v);
1833     ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1834     VariantClear(&v);
1835
1836     hres = IHTMLStyle_get_borderTopColor(style, &v);
1837     ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1838     ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1839     VariantClear(&v);
1840
1841     hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1842     ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1843
1844         /* borderRightColor */
1845     hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1846     ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1847
1848     V_VT(&v) = VT_BSTR;
1849     V_BSTR(&v) = a2bstr("blue");
1850     hres = IHTMLStyle_put_borderRightColor(style, v);
1851     ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1852     VariantClear(&v);
1853
1854     hres = IHTMLStyle_get_borderRightColor(style, &v);
1855     ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1856     ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1857     VariantClear(&v);
1858
1859     hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1860     ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1861
1862     /* borderBottomColor */
1863     hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1864     ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1865
1866     V_VT(&v) = VT_BSTR;
1867     V_BSTR(&v) = a2bstr("cyan");
1868     hres = IHTMLStyle_put_borderBottomColor(style, v);
1869     ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1870     VariantClear(&v);
1871
1872     hres = IHTMLStyle_get_borderBottomColor(style, &v);
1873     ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1874     ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1875     VariantClear(&v);
1876
1877     hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1878     ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1879
1880     /* borderLeftColor */
1881     hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1882     ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1883
1884     V_VT(&v) = VT_BSTR;
1885     V_BSTR(&v) = a2bstr("cyan");
1886     hres = IHTMLStyle_put_borderLeftColor(style, v);
1887     ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1888     VariantClear(&v);
1889
1890     hres = IHTMLStyle_get_borderLeftColor(style, &v);
1891     ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1892     ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1893     VariantClear(&v);
1894
1895     hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1896     ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1897
1898     /* clip */
1899     hres = IHTMLStyle_get_clip(style, &str);
1900     ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1901     ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1902
1903     str = a2bstr("rect(0px 1px 500px 505px)");
1904     hres = IHTMLStyle_put_clip(style, str);
1905     ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1906     SysFreeString(str);
1907
1908     hres = IHTMLStyle_get_clip(style, &str);
1909     ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1910     ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1911     SysFreeString(str);
1912
1913     /* pageBreakAfter */
1914     hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1915     ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1916     ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1917
1918     str = a2bstr("always");
1919     hres = IHTMLStyle_put_pageBreakAfter(style, str);
1920     ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1921     SysFreeString(str);
1922
1923     hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1924     ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1925     ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1926     SysFreeString(str);
1927
1928     /* pageBreakBefore */
1929     hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1930     ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1931     ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1932
1933     str = a2bstr("always");
1934     hres = IHTMLStyle_put_pageBreakBefore(style, str);
1935     ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1936     SysFreeString(str);
1937
1938     hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1939     ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1940     ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1941     SysFreeString(str);
1942
1943     test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
1944     test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
1945
1946     hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1947     ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1948     ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1949
1950     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1951     ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1952     if(SUCCEEDED(hres)) {
1953         test_style2(style2);
1954         IHTMLStyle2_Release(style2);
1955     }
1956
1957     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1958     ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1959     if(SUCCEEDED(hres)) {
1960         test_style3(style3);
1961         IHTMLStyle3_Release(style3);
1962     }
1963
1964     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1965     ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1966     if(SUCCEEDED(hres)) {
1967         test_style4(style4);
1968         IHTMLStyle4_Release(style4);
1969     }
1970 }
1971
1972 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1973 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1974 {
1975     BSTR str;
1976     HRESULT hres;
1977
1978     str = (void*)0xdeadbeef;
1979     hres = IHTMLStyle_get_filter(style, &str);
1980     ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1981     if(exval)
1982         ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1983     else
1984         ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1985
1986     SysFreeString(str);
1987 }
1988
1989 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
1990 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
1991 {
1992     BSTR str;
1993     HRESULT hres;
1994
1995     str = (void*)0xdeadbeef;
1996     hres = IHTMLCurrentStyle2_get_filter(style, &str);
1997     ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1998     if(exval)
1999         ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2000     else
2001         ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2002
2003     SysFreeString(str);
2004 }
2005
2006 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2007 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2008 {
2009     BSTR str = a2bstr(val);
2010     HRESULT hres;
2011
2012     hres = IHTMLStyle_put_filter(style, str);
2013     ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2014     SysFreeString(str);
2015
2016     _test_style_filter(line, style, val);
2017 }
2018
2019 static void test_style_filters(IHTMLElement *elem)
2020 {
2021     IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2022     IHTMLCurrentStyle2 *current_style2;
2023     IHTMLCurrentStyle *current_style;
2024     IHTMLStyle *style;
2025     HRESULT hres;
2026
2027     hres = IHTMLElement_get_style(elem, &style);
2028     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2029
2030     hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2031     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2032
2033     hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
2034     IHTMLCurrentStyle_Release(current_style);
2035     ok(hres == S_OK, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres);
2036
2037     test_style_filter(style, NULL);
2038     test_current_style_filter(current_style2, NULL);
2039     set_style_filter(style, "alpha(opacity=50.0040)");
2040     test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2041     set_style_filter(style, "alpha(opacity=100)");
2042
2043     IHTMLStyle_Release(style);
2044
2045     hres = IHTMLElement_get_style(elem, &style);
2046     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2047
2048     test_style_filter(style, "alpha(opacity=100)");
2049     set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2050     set_style_filter(style, NULL);
2051     set_style_filter(style, "alpha(opacity=100)");
2052     test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2053     test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2054     test_style_filter(style, NULL);
2055
2056
2057     IHTMLCurrentStyle2_Release(current_style2);
2058     IHTMLStyle_Release(style);
2059     IHTMLElement2_Release(elem2);
2060 }
2061
2062 static void test_current_style(IHTMLCurrentStyle *current_style)
2063 {
2064     BSTR str;
2065     HRESULT hres;
2066     VARIANT v;
2067
2068     hres = IHTMLCurrentStyle_get_display(current_style, &str);
2069     ok(hres == S_OK, "get_display failed: %08x\n", hres);
2070     ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2071     SysFreeString(str);
2072
2073     hres = IHTMLCurrentStyle_get_position(current_style, &str);
2074     ok(hres == S_OK, "get_position failed: %08x\n", hres);
2075     ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2076     SysFreeString(str);
2077
2078     hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2079     ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2080     SysFreeString(str);
2081
2082     hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2083     ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2084     ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2085     SysFreeString(str);
2086
2087     hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2088     ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2089     ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2090     SysFreeString(str);
2091
2092     hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2093     ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2094     ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2095     SysFreeString(str);
2096
2097     hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2098     ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2099     ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2100     SysFreeString(str);
2101
2102     hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2103     ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2104     ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2105     SysFreeString(str);
2106
2107     hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2108     ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2109     ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2110     SysFreeString(str);
2111
2112     hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2113     ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2114     ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2115     SysFreeString(str);
2116
2117     hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2118     ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2119     ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2120     SysFreeString(str);
2121
2122     hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2123     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2124     ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2125     SysFreeString(str);
2126
2127     hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2128     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2129     ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2130     SysFreeString(str);
2131
2132     hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2133     ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2134     ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2135     SysFreeString(str);
2136
2137     hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2138     ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2139     SysFreeString(str);
2140
2141     hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2142     ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2143     SysFreeString(str);
2144
2145     hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2146     ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2147     SysFreeString(str);
2148
2149     hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2150     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2151     SysFreeString(str);
2152
2153     hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2154     ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2155     SysFreeString(str);
2156
2157     hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2158     ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2159     SysFreeString(str);
2160
2161     hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2162     ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2163     SysFreeString(str);
2164
2165     hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2166     ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2167     ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2168     ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2169     VariantClear(&v);
2170
2171     hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2172     ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2173     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2174     VariantClear(&v);
2175
2176     hres = IHTMLCurrentStyle_get_left(current_style, &v);
2177     ok(hres == S_OK, "get_left failed: %08x\n", hres);
2178     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2179     VariantClear(&v);
2180
2181     hres = IHTMLCurrentStyle_get_top(current_style, &v);
2182     ok(hres == S_OK, "get_top failed: %08x\n", hres);
2183     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2184     VariantClear(&v);
2185
2186     hres = IHTMLCurrentStyle_get_width(current_style, &v);
2187     ok(hres == S_OK, "get_width failed: %08x\n", hres);
2188     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2189     VariantClear(&v);
2190
2191     hres = IHTMLCurrentStyle_get_height(current_style, &v);
2192     ok(hres == S_OK, "get_height failed: %08x\n", hres);
2193     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2194     VariantClear(&v);
2195
2196     hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2197     ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2198     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2199     VariantClear(&v);
2200
2201     hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2202     ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2203     ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2204     ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2205     VariantClear(&v);
2206
2207     hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2208     ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2209     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2210     ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2211     VariantClear(&v);
2212
2213     hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2214     ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2215     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2216     VariantClear(&v);
2217
2218     hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2219     ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2220     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2221     VariantClear(&v);
2222
2223     hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2224     ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2225     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2226     VariantClear(&v);
2227
2228     V_BSTR(&v) = NULL;
2229     hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2230     ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2231     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2232     VariantClear(&v);
2233
2234     hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2235     ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2236     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2237     VariantClear(&v);
2238
2239     hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2240     ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2241     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2242     VariantClear(&v);
2243
2244     hres = IHTMLCurrentStyle_get_color(current_style, &v);
2245     ok(hres == S_OK, "get_color failed: %08x\n", hres);
2246     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2247     VariantClear(&v);
2248
2249     hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2250     ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2251     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2252     VariantClear(&v);
2253
2254     hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2255     ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2256     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2257     VariantClear(&v);
2258
2259     hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2260     ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2261     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2262     VariantClear(&v);
2263
2264     hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2265     ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2266     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2267     VariantClear(&v);
2268
2269     hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2270     ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2271     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2272     VariantClear(&v);
2273
2274     hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2275     ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2276     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2277     VariantClear(&v);
2278
2279     hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2280     ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2281     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2282     VariantClear(&v);
2283
2284     hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2285     ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2286     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2287     VariantClear(&v);
2288
2289     hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2290     ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2291     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2292     VariantClear(&v);
2293
2294     hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2295     ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2296     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2297     VariantClear(&v);
2298
2299     hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2300     ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2301     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2302     VariantClear(&v);
2303
2304     hres = IHTMLCurrentStyle_get_right(current_style, &v);
2305     ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2306     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2307     VariantClear(&v);
2308
2309     hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2310     ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2311     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2312     VariantClear(&v);
2313
2314     hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2315     ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2316     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2317     VariantClear(&v);
2318
2319     hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2320     ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2321     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2322     VariantClear(&v);
2323 }
2324
2325 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2326
2327 static void basic_style_test(IHTMLDocument2 *doc)
2328 {
2329     IHTMLCurrentStyle *cstyle;
2330     IHTMLElement *elem;
2331     IHTMLStyle *style;
2332     HRESULT hres;
2333
2334     hres = IHTMLDocument2_get_body(doc, &elem);
2335     ok(hres == S_OK, "get_body failed: %08x\n", hres);
2336
2337     hres = IHTMLElement_get_style(elem, &style);
2338     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2339
2340     test_body_style(style);
2341
2342     cstyle = get_current_style(elem);
2343     test_current_style(cstyle);
2344     IHTMLCurrentStyle_Release(cstyle);
2345     IHTMLElement_Release(elem);
2346
2347     elem = get_element_by_id(doc, "divid");
2348     test_style_filters(elem);
2349
2350     test_set_csstext(style);
2351     IHTMLStyle_Release(style);
2352     IHTMLElement_Release(elem);
2353 }
2354
2355 static const char runtimestyle_test_str[] =
2356     "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2357
2358 static void runtimestyle_test(IHTMLDocument2 *doc)
2359 {
2360     IHTMLStyle *style, *runtime_style;
2361     IHTMLElement2 *elem2;
2362     IHTMLElement *elem;
2363     BSTR str;
2364     HRESULT hres;
2365
2366     hres = IHTMLDocument2_get_body(doc, &elem);
2367     ok(hres == S_OK, "get_body failed: %08x\n", hres);
2368
2369     elem2 = get_elem2_iface((IUnknown*)elem);
2370
2371     hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2372     ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2373
2374     hres = IHTMLElement_get_style(elem, &style);
2375     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2376
2377     test_text_decoration(style, NULL);
2378     test_text_decoration(runtime_style, NULL);
2379     set_text_decoration(style, "underline");
2380     test_text_decoration(style, "underline");
2381
2382     hres = IHTMLStyle_get_textDecoration(style, &str);
2383     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2384     ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2385     SysFreeString(str);
2386
2387     set_text_decoration(runtime_style, "blink");
2388     test_text_decoration(runtime_style, "blink");
2389
2390     hres = IHTMLStyle_get_textDecoration(style, &str);
2391     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2392     todo_wine
2393     ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2394     SysFreeString(str);
2395
2396     IHTMLStyle_Release(runtime_style);
2397     IHTMLStyle_Release(style);
2398     IHTMLElement2_Release(elem2);
2399     IHTMLElement_Release(elem);
2400 }
2401
2402 static IHTMLDocument2 *notif_doc;
2403 static BOOL doc_complete;
2404
2405 static IHTMLDocument2 *create_document(void)
2406 {
2407     IHTMLDocument2 *doc;
2408     IHTMLDocument5 *doc5;
2409     HRESULT hres;
2410
2411     hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2412             &IID_IHTMLDocument2, (void**)&doc);
2413     ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2414     if(FAILED(hres))
2415         return NULL;
2416
2417     hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2418     if(FAILED(hres)) {
2419         win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2420         IHTMLDocument2_Release(doc);
2421         return NULL;
2422     }
2423
2424     IHTMLDocument5_Release(doc5);
2425     return doc;
2426 }
2427
2428 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2429         REFIID riid, void**ppv)
2430 {
2431     if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2432         *ppv = iface;
2433         return S_OK;
2434     }
2435
2436     ok(0, "unexpected call\n");
2437     return E_NOINTERFACE;
2438 }
2439
2440 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2441 {
2442     return 2;
2443 }
2444
2445 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2446 {
2447     return 1;
2448 }
2449
2450 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2451 {
2452     if(dispID == DISPID_READYSTATE){
2453         BSTR state;
2454         HRESULT hres;
2455
2456         hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2457         ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2458
2459         if(!strcmp_wa(state, "complete"))
2460             doc_complete = TRUE;
2461
2462         SysFreeString(state);
2463     }
2464
2465     return S_OK;
2466 }
2467
2468 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2469 {
2470     ok(0, "unexpected call\n");
2471     return E_NOTIMPL;
2472 }
2473
2474 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2475     PropertyNotifySink_QueryInterface,
2476     PropertyNotifySink_AddRef,
2477     PropertyNotifySink_Release,
2478     PropertyNotifySink_OnChanged,
2479     PropertyNotifySink_OnRequestEdit
2480 };
2481
2482 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2483
2484 static IHTMLDocument2 *create_doc_with_string(const char *str)
2485 {
2486     IPersistStreamInit *init;
2487     IStream *stream;
2488     IHTMLDocument2 *doc;
2489     HGLOBAL mem;
2490     SIZE_T len;
2491
2492     notif_doc = doc = create_document();
2493     if(!doc)
2494         return NULL;
2495
2496     doc_complete = FALSE;
2497     len = strlen(str);
2498     mem = GlobalAlloc(0, len);
2499     memcpy(mem, str, len);
2500     CreateStreamOnHGlobal(mem, TRUE, &stream);
2501
2502     IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2503
2504     IPersistStreamInit_Load(init, stream);
2505     IPersistStreamInit_Release(init);
2506     IStream_Release(stream);
2507
2508     return doc;
2509 }
2510
2511 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2512 {
2513     IConnectionPointContainer *container;
2514     IConnectionPoint *cp;
2515     DWORD cookie;
2516     HRESULT hres;
2517
2518     hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2519     ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2520
2521     hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2522     IConnectionPointContainer_Release(container);
2523     ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2524
2525     hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2526     IConnectionPoint_Release(cp);
2527     ok(hres == S_OK, "Advise failed: %08x\n", hres);
2528 }
2529
2530 typedef void (*style_test_t)(IHTMLDocument2*);
2531
2532 static void run_test(const char *str, style_test_t test)
2533 {
2534     IHTMLDocument2 *doc;
2535     ULONG ref;
2536     MSG msg;
2537
2538     doc = create_doc_with_string(str);
2539     if(!doc)
2540         return;
2541
2542     do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2543
2544     while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2545         TranslateMessage(&msg);
2546         DispatchMessage(&msg);
2547     }
2548
2549     test(doc);
2550
2551     ref = IHTMLDocument2_Release(doc);
2552     ok(!ref || broken(ref == 1), /* Vista */
2553        "ref = %d\n", ref);
2554 }
2555
2556
2557 START_TEST(style)
2558 {
2559     CoInitialize(NULL);
2560
2561     run_test(basic_test_str, basic_style_test);
2562     run_test(runtimestyle_test_str, runtimestyle_test);
2563
2564     CoUninitialize();
2565 }