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