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