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