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