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