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