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