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