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