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