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