dmusic: Set instrument stream position where the instrument begins, not at the beginn...
[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_BSTR;
1056     V_BSTR(&v) = NULL;
1057     hres = IHTMLStyle_put_height(style, v);
1058     ok(hres == S_OK, "put_height failed: %08x\n", hres);
1059     VariantClear(&v);
1060
1061     V_VT(&v) = VT_EMPTY;
1062     hres = IHTMLStyle_get_height(style, &v);
1063     ok(hres == S_OK, "get_height failed: %08x\n", hres);
1064     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1065     ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1066     VariantClear(&v);
1067
1068     V_VT(&v) = VT_I4;
1069     V_I4(&v) = 64;
1070     hres = IHTMLStyle_put_height(style, v);
1071     ok(hres == S_OK, "put_height failed: %08x\n", hres);
1072
1073     V_VT(&v) = VT_EMPTY;
1074     hres = IHTMLStyle_get_height(style, &v);
1075     ok(hres == S_OK, "get_height failed: %08x\n", hres);
1076     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1077     ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1078     VariantClear(&v);
1079
1080     hres = IHTMLStyle_get_posHeight(style, &f);
1081     ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1082     ok(f == 64.0, "expected 64.0 got %f\n", f);
1083
1084     str = (void*)0xdeadbeef;
1085     hres = IHTMLStyle_get_cursor(style, &str);
1086     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1087     ok(!str, "get_cursor != NULL\n");
1088     SysFreeString(str);
1089
1090     str = a2bstr("default");
1091     hres = IHTMLStyle_put_cursor(style, str);
1092     ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1093     SysFreeString(str);
1094
1095     str = NULL;
1096     hres = IHTMLStyle_get_cursor(style, &str);
1097     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1098     ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1099     SysFreeString(str);
1100
1101     V_VT(&v) = VT_EMPTY;
1102     hres = IHTMLStyle_get_verticalAlign(style, &v);
1103     ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1104     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1105     ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1106     VariantClear(&v);
1107
1108     V_VT(&v) = VT_BSTR;
1109     V_BSTR(&v) = a2bstr("middle");
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), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1119     VariantClear(&v);
1120
1121     V_VT(&v) = VT_I4;
1122     V_I4(&v) = 100;
1123     hres = IHTMLStyle_put_verticalAlign(style, v);
1124     ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1125     VariantClear(&v);
1126
1127     V_VT(&v) = VT_EMPTY;
1128     hres = IHTMLStyle_get_verticalAlign(style, &v);
1129     ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1130     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1131     ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1132     VariantClear(&v);
1133
1134     str = (void*)0xdeadbeef;
1135     hres = IHTMLStyle_get_textAlign(style, &str);
1136     ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1137     ok(!str, "textAlign != NULL\n");
1138
1139     str = a2bstr("center");
1140     hres = IHTMLStyle_put_textAlign(style, str);
1141     ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1142     SysFreeString(str);
1143
1144     str = NULL;
1145     hres = IHTMLStyle_get_textAlign(style, &str);
1146     ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1147     ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1148     SysFreeString(str);
1149
1150     str = (void*)0xdeadbeef;
1151     hres = IHTMLStyle_get_filter(style, &str);
1152     ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1153     ok(!str, "filter != NULL\n");
1154
1155     str = a2bstr("alpha(opacity=100)");
1156     hres = IHTMLStyle_put_filter(style, str);
1157     ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1158     SysFreeString(str);
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), "V_I4(v) != 0\n");
1165     VariantClear(&v);
1166
1167     V_VT(&v) = VT_BSTR;
1168     V_BSTR(&v) = a2bstr("1");
1169     hres = IHTMLStyle_put_zIndex(style, v);
1170     ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1171     VariantClear(&v);
1172
1173     V_VT(&v) = VT_EMPTY;
1174     hres = IHTMLStyle_get_zIndex(style, &v);
1175     ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1176     ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1177     ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1178     VariantClear(&v);
1179
1180     /* fontStyle */
1181     hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1182     ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1183
1184     str = a2bstr("test");
1185     hres = IHTMLStyle_put_fontStyle(style, str);
1186     ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1187     SysFreeString(str);
1188
1189     str = a2bstr("italic");
1190     hres = IHTMLStyle_put_fontStyle(style, str);
1191     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1192     SysFreeString(str);
1193
1194     str = a2bstr("oblique");
1195     hres = IHTMLStyle_put_fontStyle(style, str);
1196     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1197     SysFreeString(str);
1198
1199     str = a2bstr("normal");
1200     hres = IHTMLStyle_put_fontStyle(style, str);
1201     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1202     SysFreeString(str);
1203
1204     hres = IHTMLStyle_put_fontStyle(style, sDefault);
1205     ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1206     SysFreeString(sDefault);
1207
1208     /* overflow */
1209     hres = IHTMLStyle_get_overflow(style, NULL);
1210     ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1211
1212     hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1213     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1214
1215     str = a2bstr("test");
1216     hres = IHTMLStyle_put_overflow(style, str);
1217     ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1218     SysFreeString(str);
1219
1220     str = a2bstr("visible");
1221     hres = IHTMLStyle_put_overflow(style, str);
1222     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1223     SysFreeString(str);
1224
1225     str = a2bstr("scroll");
1226     hres = IHTMLStyle_put_overflow(style, str);
1227     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1228     SysFreeString(str);
1229
1230     str = a2bstr("hidden");
1231     hres = IHTMLStyle_put_overflow(style, str);
1232     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1233     SysFreeString(str);
1234
1235     str = a2bstr("auto");
1236     hres = IHTMLStyle_put_overflow(style, str);
1237     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1238     SysFreeString(str);
1239
1240     hres = IHTMLStyle_get_overflow(style, &str);
1241     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1242     ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1243     SysFreeString(str);
1244
1245     str = a2bstr("");
1246     hres = IHTMLStyle_put_overflow(style, str);
1247     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1248     SysFreeString(str);
1249
1250     hres = IHTMLStyle_get_overflow(style, &str);
1251     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1252     ok(!str, "str=%s\n", wine_dbgstr_w(str));
1253     SysFreeString(str);
1254
1255     /* restore overflow default */
1256     hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1257     ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1258     SysFreeString(sOverflowDefault);
1259
1260     /* Attribute Tests*/
1261     hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1262     ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1263
1264     str = a2bstr("position");
1265     hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1266     ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1267
1268     hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1269     ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1270     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1271     VariantClear(&v);
1272
1273     hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1274     ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1275
1276     V_VT(&v) = VT_BSTR;
1277     V_BSTR(&v) = a2bstr("absolute");
1278     hres = IHTMLStyle_setAttribute(style, str, v, 1);
1279     ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1280     VariantClear(&v);
1281
1282     hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1283     ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1284     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1285     ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1286     VariantClear(&v);
1287
1288     V_VT(&v) = VT_BSTR;
1289     V_BSTR(&v) = NULL;
1290     hres = IHTMLStyle_setAttribute(style, str, v, 1);
1291     ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1292     VariantClear(&v);
1293
1294     SysFreeString(str);
1295
1296     str = a2bstr("borderLeftStyle");
1297     test_border_styles(style, str);
1298     SysFreeString(str);
1299
1300     str = a2bstr("borderbottomstyle");
1301     test_border_styles(style, str);
1302     SysFreeString(str);
1303
1304     str = a2bstr("borderrightstyle");
1305     test_border_styles(style, str);
1306     SysFreeString(str);
1307
1308     str = a2bstr("bordertopstyle");
1309     test_border_styles(style, str);
1310     SysFreeString(str);
1311
1312     hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1313     ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1314
1315     str = a2bstr("none dotted dashed solid");
1316     hres = IHTMLStyle_put_borderStyle(style, str);
1317     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1318     SysFreeString(str);
1319
1320     str = a2bstr("none dotted dashed solid");
1321     hres = IHTMLStyle_get_borderStyle(style, &str);
1322     ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1323     ok(!strcmp_wa(str, "none dotted dashed solid"),
1324         "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1325     SysFreeString(str);
1326
1327     str = a2bstr("double groove ridge inset");
1328     hres = IHTMLStyle_put_borderStyle(style, str);
1329     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1330     SysFreeString(str);
1331
1332     str = a2bstr("window-inset outset ridge inset");
1333     hres = IHTMLStyle_put_borderStyle(style, str);
1334     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1335     SysFreeString(str);
1336
1337     str = a2bstr("window-inset");
1338     hres = IHTMLStyle_put_borderStyle(style, str);
1339     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1340     SysFreeString(str);
1341
1342     str = a2bstr("none none none none none");
1343     hres = IHTMLStyle_put_borderStyle(style, str);
1344     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1345     SysFreeString(str);
1346
1347     str = a2bstr("invalid none none none");
1348     hres = IHTMLStyle_put_borderStyle(style, str);
1349     ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1350     SysFreeString(str);
1351
1352     str = a2bstr("none invalid none none");
1353     hres = IHTMLStyle_put_borderStyle(style, str);
1354     ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1355     SysFreeString(str);
1356
1357     hres = IHTMLStyle_put_borderStyle(style, sDefault);
1358     ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1359     SysFreeString(sDefault);
1360
1361     /* backgoundColor */
1362     hres = IHTMLStyle_get_backgroundColor(style, &v);
1363     ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1364     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1365     ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1366     VariantClear(&v);
1367
1368     V_VT(&v) = VT_BSTR;
1369     V_BSTR(&v) = a2bstr("red");
1370     hres = IHTMLStyle_put_backgroundColor(style, v);
1371     ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1372     VariantClear(&v);
1373
1374     hres = IHTMLStyle_get_backgroundColor(style, &v);
1375     ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1376     ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1377     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1378     VariantClear(&v);
1379
1380     /* padding */
1381     hres = IHTMLStyle_get_padding(style, &str);
1382     ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1383     ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1384     SysFreeString(str);
1385
1386     hres = IHTMLStyle_get_paddingTop(style, &v);
1387     ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1388     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1389     ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1390
1391     V_VT(&v) = VT_I4;
1392     V_I4(&v) = 6;
1393     hres = IHTMLStyle_put_paddingTop(style, v);
1394     ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1395
1396     hres = IHTMLStyle_get_paddingTop(style, &v);
1397     ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1398     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1399     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1400     VariantClear(&v);
1401
1402     hres = IHTMLStyle_get_paddingRight(style, &v);
1403     ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1404     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1405     ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1406
1407     V_VT(&v) = VT_I4;
1408     V_I4(&v) = 6;
1409     hres = IHTMLStyle_put_paddingRight(style, v);
1410     ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1411
1412     hres = IHTMLStyle_get_paddingRight(style, &v);
1413     ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1414     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1415     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1416     VariantClear(&v);
1417
1418     hres = IHTMLStyle_get_paddingBottom(style, &v);
1419     ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1420     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1421     ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1422
1423     V_VT(&v) = VT_I4;
1424     V_I4(&v) = 6;
1425     hres = IHTMLStyle_put_paddingBottom(style, v);
1426     ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1427
1428     hres = IHTMLStyle_get_paddingBottom(style, &v);
1429     ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1430     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1431     ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1432     VariantClear(&v);
1433
1434     str = a2bstr("1");
1435     hres = IHTMLStyle_put_padding(style, str);
1436     ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1437     SysFreeString(str);
1438
1439     hres = IHTMLStyle_get_padding(style, &str);
1440     ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1441     ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1442     SysFreeString(str);
1443
1444     /* PaddingLeft */
1445     hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1446     ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1447     ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1448     ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1449
1450     V_VT(&v) = VT_BSTR;
1451     V_BSTR(&v) = a2bstr("10");
1452     hres = IHTMLStyle_put_paddingLeft(style, v);
1453     ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1454     VariantClear(&v);
1455
1456     hres = IHTMLStyle_get_paddingLeft(style, &v);
1457     ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1458     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1459     VariantClear(&v);
1460
1461     hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1462     ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1463
1464     /* BackgroundRepeat */
1465     hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1466     ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1467
1468     str = a2bstr("invalid");
1469     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1470     ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1471     SysFreeString(str);
1472
1473     str = a2bstr("repeat");
1474     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1475     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1476     SysFreeString(str);
1477
1478     str = a2bstr("no-repeat");
1479     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1480     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1481     SysFreeString(str);
1482
1483     str = a2bstr("repeat-x");
1484     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1485     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1486     SysFreeString(str);
1487
1488     str = a2bstr("repeat-y");
1489     hres = IHTMLStyle_put_backgroundRepeat(style, str);
1490     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1491     SysFreeString(str);
1492
1493     hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1494     ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1495     ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1496     SysFreeString(str);
1497
1498     hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1499     ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1500     SysFreeString(sDefault);
1501
1502     /* BorderColor */
1503     hres = IHTMLStyle_get_borderColor(style, &sDefault);
1504     ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1505
1506     str = a2bstr("red green red blue");
1507     hres = IHTMLStyle_put_borderColor(style, str);
1508     ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1509     SysFreeString(str);
1510
1511     hres = IHTMLStyle_get_borderColor(style, &str);
1512     ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1513     ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1514     SysFreeString(str);
1515
1516     hres = IHTMLStyle_put_borderColor(style, sDefault);
1517     ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1518     SysFreeString(sDefault);
1519
1520     /* BorderRight */
1521     hres = IHTMLStyle_get_borderRight(style, &sDefault);
1522     ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1523
1524     str = a2bstr("thick dotted red");
1525     hres = IHTMLStyle_put_borderRight(style, str);
1526     ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1527     SysFreeString(str);
1528
1529     /* IHTMLStyle_get_borderRight appears to have a bug where
1530         it returns the first letter of the color.  So we check
1531         each style individually.
1532      */
1533     V_BSTR(&v) = NULL;
1534     hres = IHTMLStyle_get_borderRightColor(style, &v);
1535     ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1536     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1537     VariantClear(&v);
1538
1539     V_BSTR(&v) = NULL;
1540     hres = IHTMLStyle_get_borderRightWidth(style, &v);
1541     ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1542     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1543     VariantClear(&v);
1544
1545     hres = IHTMLStyle_get_borderRightStyle(style, &str);
1546     ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1547     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1548     SysFreeString(str);
1549
1550     hres = IHTMLStyle_put_borderRight(style, sDefault);
1551     ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1552     SysFreeString(sDefault);
1553
1554     /* BorderTop */
1555     hres = IHTMLStyle_get_borderTop(style, &sDefault);
1556     ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1557
1558     str = a2bstr("thick dotted red");
1559     hres = IHTMLStyle_put_borderTop(style, str);
1560     ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1561     SysFreeString(str);
1562
1563     /* IHTMLStyle_get_borderTop appears to have a bug where
1564         it returns the first letter of the color.  So we check
1565         each style individually.
1566      */
1567     V_BSTR(&v) = NULL;
1568     hres = IHTMLStyle_get_borderTopColor(style, &v);
1569     ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1570     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1571     VariantClear(&v);
1572
1573     V_BSTR(&v) = NULL;
1574     hres = IHTMLStyle_get_borderTopWidth(style, &v);
1575     ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1576     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1577     VariantClear(&v);
1578
1579     hres = IHTMLStyle_get_borderTopStyle(style, &str);
1580     ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1581     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1582     SysFreeString(str);
1583
1584     hres = IHTMLStyle_put_borderTop(style, sDefault);
1585     ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1586     SysFreeString(sDefault);
1587
1588     /* BorderBottom */
1589     hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1590     ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1591
1592     str = a2bstr("thick dotted red");
1593     hres = IHTMLStyle_put_borderBottom(style, str);
1594     ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1595     SysFreeString(str);
1596
1597     /* IHTMLStyle_get_borderBottom appears to have a bug where
1598         it returns the first letter of the color.  So we check
1599         each style individually.
1600      */
1601     V_BSTR(&v) = NULL;
1602     hres = IHTMLStyle_get_borderBottomColor(style, &v);
1603     ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1604     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1605     VariantClear(&v);
1606
1607     V_BSTR(&v) = NULL;
1608     hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1609     ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1610     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1611     VariantClear(&v);
1612
1613     hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1614     ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1615     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1616     SysFreeString(str);
1617
1618     hres = IHTMLStyle_put_borderBottom(style, sDefault);
1619     ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1620     SysFreeString(sDefault);
1621
1622     /* BorderLeft */
1623     hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1624     ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1625
1626     str = a2bstr("thick dotted red");
1627     hres = IHTMLStyle_put_borderLeft(style, str);
1628     ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1629     SysFreeString(str);
1630
1631     /* IHTMLStyle_get_borderLeft appears to have a bug where
1632         it returns the first letter of the color.  So we check
1633         each style individually.
1634      */
1635     V_BSTR(&v) = NULL;
1636     hres = IHTMLStyle_get_borderLeftColor(style, &v);
1637     ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1638     ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1639     VariantClear(&v);
1640
1641     V_BSTR(&v) = NULL;
1642     hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1643     ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1644     ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1645     VariantClear(&v);
1646
1647     hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1648     ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1649     ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1650     SysFreeString(str);
1651
1652     hres = IHTMLStyle_put_borderLeft(style, sDefault);
1653     ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1654     SysFreeString(sDefault);
1655
1656     /* backgroundPositionX */
1657     hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1658     ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1659     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1660     ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1661     VariantClear(&v);
1662
1663     V_VT(&v) = VT_BSTR;
1664     V_BSTR(&v) = a2bstr("10px");
1665     hres = IHTMLStyle_put_backgroundPositionX(style, v);
1666     ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1667     VariantClear(&v);
1668
1669     hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1670     ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1671     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1672     ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1673     VariantClear(&v);
1674
1675     /* backgroundPositionY */
1676     hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1677     ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1678     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1679     VariantClear(&v);
1680
1681     V_VT(&v) = VT_BSTR;
1682     V_BSTR(&v) = a2bstr("15px");
1683     hres = IHTMLStyle_put_backgroundPositionY(style, v);
1684     ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1685     VariantClear(&v);
1686
1687     hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1688     ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1689     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1690     ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1691     VariantClear(&v);
1692
1693     /* backgroundPosition */
1694     str = NULL;
1695     hres = IHTMLStyle_get_backgroundPosition(style, &str);
1696     ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1697     ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1698     SysFreeString(str);
1699
1700     str = a2bstr("center 20%");
1701     hres = IHTMLStyle_put_backgroundPosition(style, str);
1702     ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1703     SysFreeString(str);
1704
1705     str = NULL;
1706     hres = IHTMLStyle_get_backgroundPosition(style, &str);
1707     ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1708     ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1709     SysFreeString(str);
1710
1711     hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1712     ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1713     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1714     ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1715     VariantClear(&v);
1716
1717     hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1718     ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1719     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1720     ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1721     VariantClear(&v);
1722
1723      /* borderTopWidth */
1724     hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1725     ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1726
1727     V_VT(&v) = VT_BSTR;
1728     V_BSTR(&v) = a2bstr("10px");
1729     hres = IHTMLStyle_put_borderTopWidth(style, v);
1730     ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1731     VariantClear(&v);
1732
1733     hres = IHTMLStyle_get_borderTopWidth(style, &v);
1734     ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1735     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1736     VariantClear(&v);
1737
1738     hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1739     ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1740     VariantClear(&vDefault);
1741
1742     /* borderRightWidth */
1743     hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1744     ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1745
1746     V_VT(&v) = VT_BSTR;
1747     V_BSTR(&v) = a2bstr("10");
1748     hres = IHTMLStyle_put_borderRightWidth(style, v);
1749     ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1750     VariantClear(&v);
1751
1752     hres = IHTMLStyle_get_borderRightWidth(style, &v);
1753     ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1754     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1755     VariantClear(&v);
1756
1757     hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1758     ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1759     VariantClear(&vDefault);
1760
1761     /* borderBottomWidth */
1762     hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1763     ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1764
1765     V_VT(&v) = VT_BSTR;
1766     V_BSTR(&v) = a2bstr("10");
1767     hres = IHTMLStyle_put_borderBottomWidth(style, v);
1768     ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1769     VariantClear(&v);
1770
1771     hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1772     ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1773     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1774     VariantClear(&v);
1775
1776     hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1777     ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1778     VariantClear(&vDefault);
1779
1780     /* borderLeftWidth */
1781     hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1782     ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1783
1784     V_VT(&v) = VT_BSTR;
1785     V_BSTR(&v) = a2bstr("10");
1786     hres = IHTMLStyle_put_borderLeftWidth(style, v);
1787     ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1788     VariantClear(&v);
1789
1790     hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1791     ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1792     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1793     VariantClear(&v);
1794
1795     hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1796     ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1797     VariantClear(&vDefault);
1798
1799     /* wordSpacing */
1800     hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1801     ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1802
1803     V_VT(&v) = VT_BSTR;
1804     V_BSTR(&v) = a2bstr("10");
1805     hres = IHTMLStyle_put_wordSpacing(style, v);
1806     ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1807     VariantClear(&v);
1808
1809     hres = IHTMLStyle_get_wordSpacing(style, &v);
1810     ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1811     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1812     ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1813     VariantClear(&v);
1814
1815     hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1816     ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1817     VariantClear(&vDefault);
1818
1819     /* letterSpacing */
1820     hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1821     ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1822
1823     V_VT(&v) = VT_BSTR;
1824     V_BSTR(&v) = a2bstr("11");
1825     hres = IHTMLStyle_put_letterSpacing(style, v);
1826     ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1827     VariantClear(&v);
1828
1829     hres = IHTMLStyle_get_letterSpacing(style, &v);
1830     ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1831     ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1832     ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1833     VariantClear(&v);
1834
1835     hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1836     ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1837     VariantClear(&vDefault);
1838
1839     /* borderTopColor */
1840     hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1841     ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1842
1843     V_VT(&v) = VT_BSTR;
1844     V_BSTR(&v) = a2bstr("red");
1845     hres = IHTMLStyle_put_borderTopColor(style, v);
1846     ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1847     VariantClear(&v);
1848
1849     hres = IHTMLStyle_get_borderTopColor(style, &v);
1850     ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1851     ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1852     VariantClear(&v);
1853
1854     hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1855     ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1856
1857         /* borderRightColor */
1858     hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1859     ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1860
1861     V_VT(&v) = VT_BSTR;
1862     V_BSTR(&v) = a2bstr("blue");
1863     hres = IHTMLStyle_put_borderRightColor(style, v);
1864     ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1865     VariantClear(&v);
1866
1867     hres = IHTMLStyle_get_borderRightColor(style, &v);
1868     ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1869     ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1870     VariantClear(&v);
1871
1872     hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1873     ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1874
1875     /* borderBottomColor */
1876     hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1877     ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1878
1879     V_VT(&v) = VT_BSTR;
1880     V_BSTR(&v) = a2bstr("cyan");
1881     hres = IHTMLStyle_put_borderBottomColor(style, v);
1882     ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1883     VariantClear(&v);
1884
1885     hres = IHTMLStyle_get_borderBottomColor(style, &v);
1886     ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1887     ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1888     VariantClear(&v);
1889
1890     hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1891     ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1892
1893     /* borderLeftColor */
1894     hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1895     ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1896
1897     V_VT(&v) = VT_BSTR;
1898     V_BSTR(&v) = a2bstr("cyan");
1899     hres = IHTMLStyle_put_borderLeftColor(style, v);
1900     ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1901     VariantClear(&v);
1902
1903     hres = IHTMLStyle_get_borderLeftColor(style, &v);
1904     ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1905     ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1906     VariantClear(&v);
1907
1908     hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1909     ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1910
1911     /* clip */
1912     hres = IHTMLStyle_get_clip(style, &str);
1913     ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1914     ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1915
1916     str = a2bstr("rect(0px 1px 500px 505px)");
1917     hres = IHTMLStyle_put_clip(style, str);
1918     ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1919     SysFreeString(str);
1920
1921     hres = IHTMLStyle_get_clip(style, &str);
1922     ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1923     ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1924     SysFreeString(str);
1925
1926     /* clear */
1927     hres = IHTMLStyle_get_clear(style, &str);
1928     ok(hres == S_OK, "get_clear failed: %08x\n", hres);
1929     ok(!str, "clear = %s\n", wine_dbgstr_w(str));
1930
1931     str = a2bstr("both");
1932     hres = IHTMLStyle_put_clear(style, str);
1933     ok(hres == S_OK, "put_clear failed: %08x\n", hres);
1934     SysFreeString(str);
1935
1936     hres = IHTMLStyle_get_clear(style, &str);
1937     ok(hres == S_OK, "get_clear failed: %08x\n", hres);
1938     ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
1939     SysFreeString(str);
1940
1941     /* pageBreakAfter */
1942     hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1943     ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1944     ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1945
1946     str = a2bstr("always");
1947     hres = IHTMLStyle_put_pageBreakAfter(style, str);
1948     ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1949     SysFreeString(str);
1950
1951     hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1952     ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1953     ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1954     SysFreeString(str);
1955
1956     /* pageBreakBefore */
1957     hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1958     ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1959     ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1960
1961     str = a2bstr("always");
1962     hres = IHTMLStyle_put_pageBreakBefore(style, str);
1963     ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1964     SysFreeString(str);
1965
1966     hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1967     ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1968     ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1969     SysFreeString(str);
1970
1971     test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
1972     test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
1973
1974     hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1975     ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1976     ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1977
1978     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1979     ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1980     if(SUCCEEDED(hres)) {
1981         test_style2(style2);
1982         IHTMLStyle2_Release(style2);
1983     }
1984
1985     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1986     ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1987     if(SUCCEEDED(hres)) {
1988         test_style3(style3);
1989         IHTMLStyle3_Release(style3);
1990     }
1991
1992     hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1993     ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1994     if(SUCCEEDED(hres)) {
1995         test_style4(style4);
1996         IHTMLStyle4_Release(style4);
1997     }
1998 }
1999
2000 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2001 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2002 {
2003     BSTR str;
2004     HRESULT hres;
2005
2006     str = (void*)0xdeadbeef;
2007     hres = IHTMLStyle_get_filter(style, &str);
2008     ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2009     if(exval)
2010         ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2011     else
2012         ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2013
2014     SysFreeString(str);
2015 }
2016
2017 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2018 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2019 {
2020     BSTR str;
2021     HRESULT hres;
2022
2023     str = (void*)0xdeadbeef;
2024     hres = IHTMLCurrentStyle2_get_filter(style, &str);
2025     ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2026     if(exval)
2027         ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2028     else
2029         ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2030
2031     SysFreeString(str);
2032 }
2033
2034 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2035 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2036 {
2037     BSTR str = a2bstr(val);
2038     HRESULT hres;
2039
2040     hres = IHTMLStyle_put_filter(style, str);
2041     ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2042     SysFreeString(str);
2043
2044     _test_style_filter(line, style, val);
2045 }
2046
2047 static void test_style_filters(IHTMLElement *elem)
2048 {
2049     IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2050     IHTMLCurrentStyle2 *current_style2;
2051     IHTMLCurrentStyle *current_style;
2052     IHTMLStyle *style;
2053     HRESULT hres;
2054
2055     hres = IHTMLElement_get_style(elem, &style);
2056     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2057
2058     hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2059     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2060
2061     hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
2062     IHTMLCurrentStyle_Release(current_style);
2063     ok(hres == S_OK, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres);
2064
2065     test_style_filter(style, NULL);
2066     test_current_style_filter(current_style2, NULL);
2067     set_style_filter(style, "alpha(opacity=50.0040)");
2068     test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2069     set_style_filter(style, "alpha(opacity=100)");
2070
2071     IHTMLStyle_Release(style);
2072
2073     hres = IHTMLElement_get_style(elem, &style);
2074     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2075
2076     test_style_filter(style, "alpha(opacity=100)");
2077     set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2078     set_style_filter(style, NULL);
2079     set_style_filter(style, "alpha(opacity=100)");
2080     test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2081     test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2082     test_style_filter(style, NULL);
2083
2084
2085     IHTMLCurrentStyle2_Release(current_style2);
2086     IHTMLStyle_Release(style);
2087     IHTMLElement2_Release(elem2);
2088 }
2089
2090 static void test_current_style(IHTMLCurrentStyle *current_style)
2091 {
2092     BSTR str;
2093     HRESULT hres;
2094     VARIANT v;
2095
2096     hres = IHTMLCurrentStyle_get_display(current_style, &str);
2097     ok(hres == S_OK, "get_display failed: %08x\n", hres);
2098     ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2099     SysFreeString(str);
2100
2101     hres = IHTMLCurrentStyle_get_position(current_style, &str);
2102     ok(hres == S_OK, "get_position failed: %08x\n", hres);
2103     ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2104     SysFreeString(str);
2105
2106     hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2107     ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2108     SysFreeString(str);
2109
2110     hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2111     ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2112     ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2113     SysFreeString(str);
2114
2115     hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2116     ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2117     ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2118     SysFreeString(str);
2119
2120     hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2121     ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2122     ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2123     SysFreeString(str);
2124
2125     hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2126     ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2127     ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2128     SysFreeString(str);
2129
2130     hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2131     ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2132     ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2133     SysFreeString(str);
2134
2135     hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2136     ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2137     ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2138     SysFreeString(str);
2139
2140     hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2141     ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2142     ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2143     SysFreeString(str);
2144
2145     hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2146     ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2147     ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2148     SysFreeString(str);
2149
2150     hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2151     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2152     ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2153     SysFreeString(str);
2154
2155     hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2156     ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2157     ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2158     SysFreeString(str);
2159
2160     hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2161     ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2162     ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2163     SysFreeString(str);
2164
2165     hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2166     ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2167     SysFreeString(str);
2168
2169     hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2170     ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2171     SysFreeString(str);
2172
2173     hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2174     ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2175     SysFreeString(str);
2176
2177     hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2178     ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2179     SysFreeString(str);
2180
2181     hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2182     ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2183     SysFreeString(str);
2184
2185     hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2186     ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2187     SysFreeString(str);
2188
2189     hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2190     ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2191     SysFreeString(str);
2192
2193     hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2194     ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2195     ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2196     ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2197     VariantClear(&v);
2198
2199     hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2200     ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2201     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2202     VariantClear(&v);
2203
2204     hres = IHTMLCurrentStyle_get_left(current_style, &v);
2205     ok(hres == S_OK, "get_left failed: %08x\n", hres);
2206     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2207     VariantClear(&v);
2208
2209     hres = IHTMLCurrentStyle_get_top(current_style, &v);
2210     ok(hres == S_OK, "get_top failed: %08x\n", hres);
2211     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2212     VariantClear(&v);
2213
2214     hres = IHTMLCurrentStyle_get_width(current_style, &v);
2215     ok(hres == S_OK, "get_width failed: %08x\n", hres);
2216     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2217     VariantClear(&v);
2218
2219     hres = IHTMLCurrentStyle_get_height(current_style, &v);
2220     ok(hres == S_OK, "get_height failed: %08x\n", hres);
2221     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2222     VariantClear(&v);
2223
2224     hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2225     ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2226     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2227     VariantClear(&v);
2228
2229     hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2230     ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2231     ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2232     ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2233     VariantClear(&v);
2234
2235     hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2236     ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2237     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2238     ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2239     VariantClear(&v);
2240
2241     hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2242     ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2243     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2244     VariantClear(&v);
2245
2246     hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2247     ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2248     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2249     VariantClear(&v);
2250
2251     hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2252     ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2253     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2254     VariantClear(&v);
2255
2256     V_BSTR(&v) = NULL;
2257     hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2258     ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2259     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2260     VariantClear(&v);
2261
2262     hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2263     ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2264     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2265     VariantClear(&v);
2266
2267     hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2268     ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2269     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2270     VariantClear(&v);
2271
2272     hres = IHTMLCurrentStyle_get_color(current_style, &v);
2273     ok(hres == S_OK, "get_color failed: %08x\n", hres);
2274     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2275     VariantClear(&v);
2276
2277     hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2278     ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2279     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2280     VariantClear(&v);
2281
2282     hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2283     ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2284     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2285     VariantClear(&v);
2286
2287     hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2288     ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2289     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2290     VariantClear(&v);
2291
2292     hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2293     ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2294     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2295     VariantClear(&v);
2296
2297     hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2298     ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2299     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2300     VariantClear(&v);
2301
2302     hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2303     ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2304     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2305     VariantClear(&v);
2306
2307     hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2308     ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2309     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2310     VariantClear(&v);
2311
2312     hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2313     ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2314     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2315     VariantClear(&v);
2316
2317     hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2318     ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2319     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2320     VariantClear(&v);
2321
2322     hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2323     ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2324     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2325     VariantClear(&v);
2326
2327     hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2328     ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2329     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2330     VariantClear(&v);
2331
2332     hres = IHTMLCurrentStyle_get_right(current_style, &v);
2333     ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2334     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2335     VariantClear(&v);
2336
2337     hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2338     ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2339     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2340     VariantClear(&v);
2341
2342     hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2343     ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2344     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2345     VariantClear(&v);
2346
2347     hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2348     ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2349     ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2350     VariantClear(&v);
2351 }
2352
2353 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2354
2355 static void basic_style_test(IHTMLDocument2 *doc)
2356 {
2357     IHTMLCurrentStyle *cstyle;
2358     IHTMLElement *elem;
2359     IHTMLStyle *style;
2360     HRESULT hres;
2361
2362     hres = IHTMLDocument2_get_body(doc, &elem);
2363     ok(hres == S_OK, "get_body failed: %08x\n", hres);
2364
2365     hres = IHTMLElement_get_style(elem, &style);
2366     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2367
2368     test_body_style(style);
2369
2370     cstyle = get_current_style(elem);
2371     test_current_style(cstyle);
2372     IHTMLCurrentStyle_Release(cstyle);
2373     IHTMLElement_Release(elem);
2374
2375     elem = get_element_by_id(doc, "divid");
2376     test_style_filters(elem);
2377
2378     test_set_csstext(style);
2379     IHTMLStyle_Release(style);
2380     IHTMLElement_Release(elem);
2381 }
2382
2383 static const char runtimestyle_test_str[] =
2384     "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2385
2386 static void runtimestyle_test(IHTMLDocument2 *doc)
2387 {
2388     IHTMLStyle *style, *runtime_style;
2389     IHTMLElement2 *elem2;
2390     IHTMLElement *elem;
2391     BSTR str;
2392     HRESULT hres;
2393
2394     hres = IHTMLDocument2_get_body(doc, &elem);
2395     ok(hres == S_OK, "get_body failed: %08x\n", hres);
2396
2397     elem2 = get_elem2_iface((IUnknown*)elem);
2398
2399     hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2400     ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2401
2402     hres = IHTMLElement_get_style(elem, &style);
2403     ok(hres == S_OK, "get_style failed: %08x\n", hres);
2404
2405     test_text_decoration(style, NULL);
2406     test_text_decoration(runtime_style, NULL);
2407     set_text_decoration(style, "underline");
2408     test_text_decoration(style, "underline");
2409
2410     hres = IHTMLStyle_get_textDecoration(style, &str);
2411     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2412     ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2413     SysFreeString(str);
2414
2415     set_text_decoration(runtime_style, "blink");
2416     test_text_decoration(runtime_style, "blink");
2417
2418     hres = IHTMLStyle_get_textDecoration(style, &str);
2419     ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2420     todo_wine
2421     ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2422     SysFreeString(str);
2423
2424     IHTMLStyle_Release(runtime_style);
2425     IHTMLStyle_Release(style);
2426     IHTMLElement2_Release(elem2);
2427     IHTMLElement_Release(elem);
2428 }
2429
2430 static IHTMLDocument2 *notif_doc;
2431 static BOOL doc_complete;
2432
2433 static IHTMLDocument2 *create_document(void)
2434 {
2435     IHTMLDocument2 *doc;
2436     IHTMLDocument5 *doc5;
2437     HRESULT hres;
2438
2439     hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2440             &IID_IHTMLDocument2, (void**)&doc);
2441     ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2442     if(FAILED(hres))
2443         return NULL;
2444
2445     hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2446     if(FAILED(hres)) {
2447         win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2448         IHTMLDocument2_Release(doc);
2449         return NULL;
2450     }
2451
2452     IHTMLDocument5_Release(doc5);
2453     return doc;
2454 }
2455
2456 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2457         REFIID riid, void**ppv)
2458 {
2459     if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2460         *ppv = iface;
2461         return S_OK;
2462     }
2463
2464     ok(0, "unexpected call\n");
2465     return E_NOINTERFACE;
2466 }
2467
2468 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2469 {
2470     return 2;
2471 }
2472
2473 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2474 {
2475     return 1;
2476 }
2477
2478 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2479 {
2480     if(dispID == DISPID_READYSTATE){
2481         BSTR state;
2482         HRESULT hres;
2483
2484         hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2485         ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2486
2487         if(!strcmp_wa(state, "complete"))
2488             doc_complete = TRUE;
2489
2490         SysFreeString(state);
2491     }
2492
2493     return S_OK;
2494 }
2495
2496 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2497 {
2498     ok(0, "unexpected call\n");
2499     return E_NOTIMPL;
2500 }
2501
2502 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2503     PropertyNotifySink_QueryInterface,
2504     PropertyNotifySink_AddRef,
2505     PropertyNotifySink_Release,
2506     PropertyNotifySink_OnChanged,
2507     PropertyNotifySink_OnRequestEdit
2508 };
2509
2510 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2511
2512 static IHTMLDocument2 *create_doc_with_string(const char *str)
2513 {
2514     IPersistStreamInit *init;
2515     IStream *stream;
2516     IHTMLDocument2 *doc;
2517     HGLOBAL mem;
2518     SIZE_T len;
2519
2520     notif_doc = doc = create_document();
2521     if(!doc)
2522         return NULL;
2523
2524     doc_complete = FALSE;
2525     len = strlen(str);
2526     mem = GlobalAlloc(0, len);
2527     memcpy(mem, str, len);
2528     CreateStreamOnHGlobal(mem, TRUE, &stream);
2529
2530     IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2531
2532     IPersistStreamInit_Load(init, stream);
2533     IPersistStreamInit_Release(init);
2534     IStream_Release(stream);
2535
2536     return doc;
2537 }
2538
2539 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2540 {
2541     IConnectionPointContainer *container;
2542     IConnectionPoint *cp;
2543     DWORD cookie;
2544     HRESULT hres;
2545
2546     hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2547     ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2548
2549     hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2550     IConnectionPointContainer_Release(container);
2551     ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2552
2553     hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2554     IConnectionPoint_Release(cp);
2555     ok(hres == S_OK, "Advise failed: %08x\n", hres);
2556 }
2557
2558 typedef void (*style_test_t)(IHTMLDocument2*);
2559
2560 static void run_test(const char *str, style_test_t test)
2561 {
2562     IHTMLDocument2 *doc;
2563     ULONG ref;
2564     MSG msg;
2565
2566     doc = create_doc_with_string(str);
2567     if(!doc)
2568         return;
2569
2570     do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2571
2572     while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2573         TranslateMessage(&msg);
2574         DispatchMessage(&msg);
2575     }
2576
2577     test(doc);
2578
2579     ref = IHTMLDocument2_Release(doc);
2580     ok(!ref || broken(ref == 1), /* Vista */
2581        "ref = %d\n", ref);
2582 }
2583
2584
2585 START_TEST(style)
2586 {
2587     CoInitialize(NULL);
2588
2589     run_test(basic_test_str, basic_style_test);
2590     run_test(runtimestyle_test_str, runtimestyle_test);
2591
2592     CoUninitialize();
2593 }