ReactOS 0.4.15-dev-7918-g2a2556c
style.c
Go to the documentation of this file.
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#include "precomp.h"
20
21static int strcmp_wa(LPCWSTR strw, const char *stra)
22{
23 CHAR buf[512];
24 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
25 return lstrcmpA(stra, buf);
26}
27
28static BOOL wstr_contains(const WCHAR *strw, const char *stra)
29{
30 CHAR buf[512];
31 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
32 return strstr(buf, stra) != NULL;
33}
34
35static BSTR a2bstr(const char *str)
36{
37 BSTR ret;
38 int len;
39
40 if(!str)
41 return NULL;
42
43 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
46
47 return ret;
48}
49
50static const WCHAR *strstr_wa(const WCHAR *str, const char *suba)
51{
52 BSTR sub;
53 const WCHAR *ret = NULL;
54 sub = a2bstr(suba);
55 while (*str)
56 {
57 const WCHAR *p1 = str, *p2 = sub;
58 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
59 if (!*p2) {ret = str; break;}
60 str++;
61 }
62 SysFreeString(sub);
63 return ret;
64}
65
66#define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
67static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
68{
69 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
70 if(expect)
71 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
72 else
73 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
74}
75
76#define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
77static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
78{
79 IHTMLElement2 *elem;
81
82 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
83 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
84 return elem;
85}
86
87#define get_current_style2_iface(u) _get_current_style2_iface(__LINE__,u)
88static IHTMLCurrentStyle2 *_get_current_style2_iface(unsigned line, IUnknown *unk)
89{
90 IHTMLCurrentStyle2 *current_style2;
92
93 hres = IUnknown_QueryInterface(unk, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
94 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
95 return current_style2;
96}
97
98static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
99{
101 IHTMLDocument3 *doc3;
102 IHTMLElement *result;
103 BSTR idW = a2bstr(id);
104
105 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
106 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
107
108 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
109 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
110 ok(result != NULL, "result == NULL\n");
111 SysFreeString(idW);
112
113 IHTMLDocument3_Release(doc3);
114 return result;
115}
116
117#define get_current_style(e) _get_current_style(__LINE__,e)
118static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
119{
120 IHTMLCurrentStyle *cstyle;
121 IHTMLElement2 *elem2;
123
124 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
125 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
126
127 cstyle = NULL;
128 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
129 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
130 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
131
132 IHTMLElement2_Release(elem2);
133 return cstyle;
134}
135
136#define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
137static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
138{
140 DISPID dispid;
141
142 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
143 LOCALE_USER_DEFAULT, &dispid);
144 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
145 if(hres == S_OK)
146 {
147 DISPPARAMS params = {NULL,NULL,0,0};
148 DISPID dispidNamed = DISPID_PROPERTYPUT;
149 VARIANT ret;
150 VARIANT vDefault;
152
153 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
154 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
155 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
156
157 params.cArgs = 1;
158 params.cNamedArgs = 1;
159 params.rgdispidNamedArgs = &dispidNamed;
160 V_VT(&arg) = VT_BSTR;
161 V_BSTR(&arg) = a2bstr("none");
162 params.rgvarg = &arg;
163 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
165 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
167
168 V_VT(&arg) = VT_BSTR;
169 V_BSTR(&arg) = a2bstr("dotted");
170 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
172 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
174
175 V_VT(&arg) = VT_BSTR;
176 V_BSTR(&arg) = a2bstr("dashed");
177 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
179 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
181
182 V_VT(&arg) = VT_BSTR;
183 V_BSTR(&arg) = a2bstr("solid");
184 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
186 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
188
189 V_VT(&arg) = VT_BSTR;
190 V_BSTR(&arg) = a2bstr("double");
191 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
193 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
195
196 V_VT(&arg) = VT_BSTR;
197 V_BSTR(&arg) = a2bstr("groove");
198 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
200 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
202
203 V_VT(&arg) = VT_BSTR;
204 V_BSTR(&arg) = a2bstr("ridge");
205 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
207 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
209
210 V_VT(&arg) = VT_BSTR;
211 V_BSTR(&arg) = a2bstr("inset");
212 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
214 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
216
217 V_VT(&arg) = VT_BSTR;
218 V_BSTR(&arg) = a2bstr("outset");
219 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
221 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
223
224 V_VT(&arg) = VT_BSTR;
225 V_BSTR(&arg) = a2bstr("invalid");
226 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
228 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
230
231 params.rgvarg = &vDefault;
232 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
234 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
235 VariantClear(&vDefault);
236 }
237}
238
239#define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
240static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
241{
242 BSTR text = (void*)0xdeadbeef;
244
245 hres = IHTMLStyle_get_cssText(style, &text);
246 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
247 if(extext)
248 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
249 else
250 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
251
253}
254
255#define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
256static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
257{
258 BSTR tmp;
260
261 tmp = a2bstr(text);
262 hres = IHTMLStyle_put_cssText(style, tmp);
263 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
264 SysFreeString(tmp);
265}
266
267#define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
268static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
269{
270 BSTR str = a2bstr(attr);
271 VARIANT_BOOL b = 100;
273
274 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
276 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
277 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
278}
279
280#define set_text_decoration(a,b) _set_text_decoration(__LINE__,a,b)
281static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
282{
283 BSTR str;
285
286 str = a2bstr(v);
287 hres = IHTMLStyle_put_textDecoration(style, str);
288 ok_(__FILE__,line)(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
290}
291
292#define test_text_decoration(a,b) _test_text_decoration(__LINE__,a,b)
293static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
294{
295 BSTR str;
297
298 hres = IHTMLStyle_get_textDecoration(style, &str);
299 ok_(__FILE__,line)(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
300 if(exdec)
301 ok_(__FILE__,line)(!strcmp_wa(str, exdec), "textDecoration = %s, expected %s\n", wine_dbgstr_w(str), exdec);
302 else
303 ok_(__FILE__,line)(!str, "textDecoration = %s, expected NULL\n", wine_dbgstr_w(str));
305}
306
307static void test_set_csstext(IHTMLStyle *style)
308{
309 VARIANT v;
311
312 test_style_set_csstext(style, "background-color: black;");
313
314 hres = IHTMLStyle_get_backgroundColor(style, &v);
315 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
316 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
317 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
318 VariantClear(&v);
319}
320
321static void test_style2(IHTMLStyle2 *style2)
322{
323 VARIANT v;
324 BSTR str;
326
327 str = (void*)0xdeadbeef;
328 hres = IHTMLStyle2_get_position(style2, &str);
329 ok(hres == S_OK, "get_position failed: %08x\n", hres);
330 ok(!str, "str != NULL\n");
331
332 str = a2bstr("absolute");
333 hres = IHTMLStyle2_put_position(style2, str);
334 ok(hres == S_OK, "put_position failed: %08x\n", hres);
336
337 str = NULL;
338 hres = IHTMLStyle2_get_position(style2, &str);
339 ok(hres == S_OK, "get_position failed: %08x\n", hres);
340 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
342
343 /* Test right */
344 V_VT(&v) = VT_EMPTY;
345 hres = IHTMLStyle2_get_right(style2, &v);
346 ok(hres == S_OK, "get_top failed: %08x\n", hres);
347 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
348 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
349 VariantClear(&v);
350
351 V_VT(&v) = VT_BSTR;
352 V_BSTR(&v) = a2bstr("3px");
353 hres = IHTMLStyle2_put_right(style2, v);
354 ok(hres == S_OK, "put_right failed: %08x\n", hres);
355 VariantClear(&v);
356
357 V_VT(&v) = VT_EMPTY;
358 hres = IHTMLStyle2_get_right(style2, &v);
359 ok(hres == S_OK, "get_right failed: %08x\n", hres);
360 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
361 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
362 VariantClear(&v);
363
364 /* direction */
365 str = (void*)0xdeadbeef;
366 hres = IHTMLStyle2_get_direction(style2, &str);
367 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
368 ok(!str, "str = %s\n", wine_dbgstr_w(str));
369
370 str = a2bstr("ltr");
371 hres = IHTMLStyle2_put_direction(style2, str);
372 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
374
375 str = NULL;
376 hres = IHTMLStyle2_get_direction(style2, &str);
377 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
378 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
380
381 /* bottom */
382 V_VT(&v) = VT_EMPTY;
383 hres = IHTMLStyle2_get_bottom(style2, &v);
384 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
386
387 V_VT(&v) = VT_I4;
388 V_I4(&v) = 4;
389 hres = IHTMLStyle2_put_bottom(style2, v);
390 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
391
392 V_VT(&v) = VT_EMPTY;
393 hres = IHTMLStyle2_get_bottom(style2, &v);
394 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
395 test_var_bstr(&v, "4px");
396
397 /* overflowX */
398 str = (void*)0xdeadbeef;
399 hres = IHTMLStyle2_get_overflowX(style2, &str);
400 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
401 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
402
403 str = a2bstr("hidden");
404 hres = IHTMLStyle2_put_overflowX(style2, str);
405 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
407
408 str = NULL;
409 hres = IHTMLStyle2_get_overflowX(style2, &str);
410 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
411 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
412
413 /* overflowY */
414 str = (void*)0xdeadbeef;
415 hres = IHTMLStyle2_get_overflowY(style2, &str);
416 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
417 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
418
419 str = a2bstr("hidden");
420 hres = IHTMLStyle2_put_overflowY(style2, str);
421 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
423
424 str = NULL;
425 hres = IHTMLStyle2_get_overflowY(style2, &str);
426 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
427 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
428
429 /* tableLayout */
430 str = a2bstr("fixed");
431 hres = IHTMLStyle2_put_tableLayout(style2, str);
432 ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres);
434
435 str = (void*)0xdeadbeef;
436 hres = IHTMLStyle2_get_tableLayout(style2, &str);
437 ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres);
438 ok(!strcmp_wa(str, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str));
440}
441
442static void test_style3(IHTMLStyle3 *style3)
443{
444 VARIANT v;
445 BSTR str;
447
448 str = (void*)0xdeadbeef;
449 hres = IHTMLStyle3_get_wordWrap(style3, &str);
450 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
451 ok(!str, "str != NULL\n");
452
453 str = a2bstr("break-word");
454 hres = IHTMLStyle3_put_wordWrap(style3, str);
455 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
457
458 str = NULL;
459 hres = IHTMLStyle3_get_wordWrap(style3, &str);
460 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
461 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
463
464 V_VT(&v) = VT_ERROR;
465 hres = IHTMLStyle3_get_zoom(style3, &v);
466 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
467 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
468 ok(!V_BSTR(&v), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
469 VariantClear(&v);
470
471 V_VT(&v) = VT_BSTR;
472 V_BSTR(&v) = a2bstr("100%");
473 hres = IHTMLStyle3_put_zoom(style3, v);
474 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
475
476 V_VT(&v) = VT_ERROR;
477 hres = IHTMLStyle3_get_zoom(style3, &v);
478 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
479 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
480 ok(!strcmp_wa(V_BSTR(&v), "100%"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
481 VariantClear(&v);
482
483 V_VT(&v) = VT_I4;
484 V_I4(&v) = 1;
485 hres = IHTMLStyle3_put_zoom(style3, v);
486 ok(hres == S_OK, "put_zoom failed: %08x\n", hres);
487
488 V_VT(&v) = VT_ERROR;
489 hres = IHTMLStyle3_get_zoom(style3, &v);
490 ok(hres == S_OK, "get_zoom failed: %08x\n", hres);
491 ok(V_VT(&v) == VT_BSTR, "V_VT(zoom) = %d\n", V_VT(&v));
492 ok(!strcmp_wa(V_BSTR(&v), "1"), "V_BSTR(zoom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
493 VariantClear(&v);
494}
495
496static void test_style4(IHTMLStyle4 *style4)
497{
499 VARIANT v;
500 VARIANT vdefault;
501
502 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
503 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
504
505 V_VT(&v) = VT_BSTR;
506 V_BSTR(&v) = a2bstr("10px");
507 hres = IHTMLStyle4_put_minHeight(style4, v);
508 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
509 VariantClear(&v);
510
511 hres = IHTMLStyle4_get_minHeight(style4, &v);
512 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
513 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
514 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
515 VariantClear(&v);
516
517 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
518 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
519 VariantClear(&vdefault);
520}
521
522static void test_style5(IHTMLStyle5 *style5)
523{
525 VARIANT v;
526 VARIANT vdefault;
527
528 /* minWidth */
529 hres = IHTMLStyle5_get_minWidth(style5, &vdefault);
530 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
531
532 V_VT(&v) = VT_BSTR;
533 V_BSTR(&v) = a2bstr("12px");
534 hres = IHTMLStyle5_put_minWidth(style5, v);
535 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
536 VariantClear(&v);
537
538 hres = IHTMLStyle5_get_minWidth(style5, &v);
539 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
540 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
541 ok(!strcmp_wa(V_BSTR(&v), "12px"), "expect 12px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
542 VariantClear(&v);
543
544 V_VT(&v) = VT_BSTR;
545 V_BSTR(&v) = a2bstr("10%");
546 hres = IHTMLStyle5_put_minWidth(style5, v);
547 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
548 VariantClear(&v);
549
550 hres = IHTMLStyle5_get_minWidth(style5, &v);
551 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
552 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
553 ok(!strcmp_wa(V_BSTR(&v), "10%"), "expect 10%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
554 VariantClear(&v);
555
556 V_VT(&v) = VT_BSTR;
557 V_BSTR(&v) = a2bstr("10");
558 hres = IHTMLStyle5_put_minWidth(style5, v);
559 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
560 VariantClear(&v);
561
562 hres = IHTMLStyle5_get_minWidth(style5, &v);
563 ok(hres == S_OK, "get_minWidth failed: %08x\n", hres);
564 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
565 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
566 VariantClear(&v);
567
568 hres = IHTMLStyle5_put_minWidth(style5, vdefault);
569 ok(hres == S_OK, "put_minWidth failed: %08x\n", hres);
570 VariantClear(&vdefault);
571
572 /* maxWidth */
573 hres = IHTMLStyle5_get_maxWidth(style5, &vdefault);
574 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
575
576 V_VT(&v) = VT_BSTR;
577 V_BSTR(&v) = a2bstr("200px");
578 hres = IHTMLStyle5_put_maxWidth(style5, v);
579 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
580 VariantClear(&v);
581
582 hres = IHTMLStyle5_get_maxWidth(style5, &v);
583 ok(hres == S_OK, "get_maxWidth failed: %08x\n", hres);
584 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n",V_VT(&v));
585 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
586 VariantClear(&v);
587
588 V_VT(&v) = VT_BSTR;
589 V_BSTR(&v) = a2bstr("70%");
590 hres = IHTMLStyle5_put_maxWidth(style5, v);
591 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
592 VariantClear(&v);
593
594 hres = IHTMLStyle5_get_maxWidth(style5, &v);
595 ok(hres == S_OK, "get maxWidth failed: %08x\n", hres);
596 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
597 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
598 VariantClear(&v);
599
600 hres = IHTMLStyle5_put_maxWidth(style5,vdefault);
601 ok(hres == S_OK, "put_maxWidth failed: %08x\n", hres);
602 VariantClear(&vdefault);
603
604 /* maxHeight */
605 hres = IHTMLStyle5_get_maxHeight(style5, &vdefault);
606 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
607
608 V_VT(&v) = VT_BSTR;
609 V_BSTR(&v) = a2bstr("200px");
610 hres = IHTMLStyle5_put_maxHeight(style5, v);
611 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
612 VariantClear(&v);
613
614 hres = IHTMLStyle5_get_maxHeight(style5, &v);
615 ok(hres == S_OK, "get maxHeight failed: %08x\n", hres);
616 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
617 ok(!strcmp_wa(V_BSTR(&v), "200px"), "expect 200px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
618 VariantClear(&v);
619
620 V_VT(&v) = VT_BSTR;
621 V_BSTR(&v) = a2bstr("70%");
622 hres = IHTMLStyle5_put_maxHeight(style5, v);
623 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
624 VariantClear(&v);
625
626 hres = IHTMLStyle5_get_maxHeight(style5, &v);
627 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
628 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
629 ok(!strcmp_wa(V_BSTR(&v), "70%"), "expect 70%% got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
630 VariantClear(&v);
631
632 V_VT(&v) = VT_BSTR;
633 V_BSTR(&v) = a2bstr("100");
634 hres = IHTMLStyle5_put_maxHeight(style5, v);
635 ok(hres == S_OK, "put maxHeight failed: %08x\n", hres);
636 VariantClear(&v);
637
638 hres = IHTMLStyle5_get_maxHeight(style5, &v);
639 ok(hres == S_OK, "get_maxHeight failed: %08x\n", hres);
640 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
641 ok(!strcmp_wa(V_BSTR(&v), "100px"), "expect 100 got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
642 VariantClear(&v);
643
644 hres = IHTMLStyle5_put_maxHeight(style5, vdefault);
645 ok(hres == S_OK, "put maxHeight failed:%08x\n", hres);
646 VariantClear(&vdefault);
647}
648
649static void test_style6(IHTMLStyle6 *style)
650{
651 BSTR str;
653
654 str = (void*)0xdeadbeef;
655 hres = IHTMLStyle6_get_outline(style, &str);
656 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
657 ok(str && !*str, "outline = %s\n", wine_dbgstr_w(str));
659
660 str = a2bstr("1px");
661 hres = IHTMLStyle6_put_outline(style, str);
662 ok(hres == S_OK, "put_outline failed: %08x\n", hres);
664
665 str = (void*)0xdeadbeef;
666 hres = IHTMLStyle6_get_outline(style, &str);
667 ok(hres == S_OK, "get_outline failed: %08x\n", hres);
668 ok(wstr_contains(str, "1px"), "outline = %s\n", wine_dbgstr_w(str));
670
671 str = (void*)0xdeadbeef;
672 hres = IHTMLStyle6_get_boxSizing(style, &str);
673 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
674 ok(!str, "boxSizing = %s\n", wine_dbgstr_w(str));
676
677 str = a2bstr("border-box");
678 hres = IHTMLStyle6_put_boxSizing(style, str);
679 ok(hres == S_OK, "put_boxSizing failed: %08x\n", hres);
681
682 str = NULL;
683 hres = IHTMLStyle6_get_boxSizing(style, &str);
684 ok(hres == S_OK, "get_boxSizing failed: %08x\n", hres);
685 ok(!strcmp_wa(str, "border-box"), "boxSizing = %s\n", wine_dbgstr_w(str));
687}
688
689static void test_body_style(IHTMLStyle *style)
690{
691 IHTMLStyle2 *style2;
692 IHTMLStyle3 *style3;
693 IHTMLStyle4 *style4;
694 IHTMLStyle5 *style5;
695 IHTMLStyle6 *style6;
697 VARIANT v;
698 BSTR str;
700 float f;
701 BSTR sOverflowDefault;
702 BSTR sDefault;
703 LONG l;
704 VARIANT vDefault;
705
707
708 hres = IHTMLStyle_get_position(style, &str);
709 ok(hres == S_OK, "get_position failed: %08x\n", hres);
710 ok(!str, "str=%s\n", wine_dbgstr_w(str));
711
712 V_VT(&v) = VT_NULL;
713 hres = IHTMLStyle_get_marginRight(style, &v);
714 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
715 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
716 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
717
718 V_VT(&v) = VT_I4;
719 V_I4(&v) = 6;
720 hres = IHTMLStyle_put_marginRight(style, v);
721 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
722
723 V_VT(&v) = VT_NULL;
724 hres = IHTMLStyle_get_marginRight(style, &v);
725 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
726 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
727 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
728
729 V_VT(&v) = VT_NULL;
730 hres = IHTMLStyle_get_marginBottom(style, &v);
731 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
732 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
733 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
734
735 V_VT(&v) = VT_I4;
736 V_I4(&v) = 6;
737 hres = IHTMLStyle_put_marginBottom(style, v);
738 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
739
740 V_VT(&v) = VT_NULL;
741 hres = IHTMLStyle_get_marginBottom(style, &v);
742 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
743 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
744 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
745
746 V_VT(&v) = VT_NULL;
747 hres = IHTMLStyle_get_marginLeft(style, &v);
748 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
749 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
750 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
751
752 V_VT(&v) = VT_I4;
753 V_I4(&v) = 6;
754 hres = IHTMLStyle_put_marginLeft(style, v);
755 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
756
757 V_VT(&v) = VT_NULL;
758 hres = IHTMLStyle_get_marginLeft(style, &v);
759 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
760 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
761 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
762
763 str = (void*)0xdeadbeef;
764 hres = IHTMLStyle_get_fontFamily(style, &str);
765 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
766 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
767
768 str = (void*)0xdeadbeef;
769 hres = IHTMLStyle_get_fontWeight(style, &str);
770 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
771 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
772
773 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
774 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
775
776 str = a2bstr("test");
777 hres = IHTMLStyle_put_fontWeight(style, str);
778 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
780
781 str = a2bstr("bold");
782 hres = IHTMLStyle_put_fontWeight(style, str);
783 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
785
786 str = a2bstr("bolder");
787 hres = IHTMLStyle_put_fontWeight(style, str);
788 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
790
791 str = a2bstr("lighter");
792 hres = IHTMLStyle_put_fontWeight(style, str);
793 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
795
796 str = a2bstr("100");
797 hres = IHTMLStyle_put_fontWeight(style, str);
798 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
800
801 str = a2bstr("200");
802 hres = IHTMLStyle_put_fontWeight(style, str);
803 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
805
806 str = a2bstr("300");
807 hres = IHTMLStyle_put_fontWeight(style, str);
808 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
810
811 str = a2bstr("400");
812 hres = IHTMLStyle_put_fontWeight(style, str);
813 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
815
816 str = a2bstr("500");
817 hres = IHTMLStyle_put_fontWeight(style, str);
818 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
820
821 str = a2bstr("600");
822 hres = IHTMLStyle_put_fontWeight(style, str);
823 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
825
826 str = a2bstr("700");
827 hres = IHTMLStyle_put_fontWeight(style, str);
828 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
830
831 str = a2bstr("800");
832 hres = IHTMLStyle_put_fontWeight(style, str);
833 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
835
836 str = a2bstr("900");
837 hres = IHTMLStyle_put_fontWeight(style, str);
838 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
840
841 hres = IHTMLStyle_get_fontWeight(style, &str);
842 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
843 ok(!strcmp_wa(str, "900"), "str != style900\n");
845
846 str = a2bstr("");
847 hres = IHTMLStyle_put_fontWeight(style, str);
848 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
850
851 hres = IHTMLStyle_get_fontWeight(style, &str);
852 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
853 ok(!str, "str != NULL\n");
855
856 hres = IHTMLStyle_put_fontWeight(style, sDefault);
857 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
858 SysFreeString(sDefault);
859
860 /* font Variant */
861 hres = IHTMLStyle_get_fontVariant(style, NULL);
862 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
863
864 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
865 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
866
867 str = a2bstr("test");
868 hres = IHTMLStyle_put_fontVariant(style, str);
869 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
871
872 str = a2bstr("small-caps");
873 hres = IHTMLStyle_put_fontVariant(style, str);
874 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
876
877 str = a2bstr("normal");
878 hres = IHTMLStyle_put_fontVariant(style, str);
879 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
881
882 hres = IHTMLStyle_put_fontVariant(style, sDefault);
883 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
884 SysFreeString(sDefault);
885
886 str = (void*)0xdeadbeef;
887 hres = IHTMLStyle_get_display(style, &str);
888 ok(hres == S_OK, "get_display failed: %08x\n", hres);
889 ok(!str, "display = %s\n", wine_dbgstr_w(str));
890
891 str = (void*)0xdeadbeef;
892 hres = IHTMLStyle_get_visibility(style, &str);
893 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
894 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
895
896 V_VT(&v) = VT_NULL;
897 hres = IHTMLStyle_get_fontSize(style, &v);
898 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
899 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
900 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
901
902 V_VT(&v) = VT_I4;
903 V_I4(&v) = 12;
904 hres = IHTMLStyle_put_fontSize(style, v);
905 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
906
907 V_VT(&v) = VT_NULL;
908 hres = IHTMLStyle_get_fontSize(style, &v);
909 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
910 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
911 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
912
913 V_VT(&v) = VT_NULL;
914 hres = IHTMLStyle_get_color(style, &v);
915 ok(hres == S_OK, "get_color failed: %08x\n", hres);
916 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
917 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
918
919 V_VT(&v) = VT_I4;
920 V_I4(&v) = 0xfdfd;
921 hres = IHTMLStyle_put_color(style, v);
922 ok(hres == S_OK, "put_color failed: %08x\n", hres);
923
924 V_VT(&v) = VT_NULL;
925 hres = IHTMLStyle_get_color(style, &v);
926 ok(hres == S_OK, "get_color failed: %08x\n", hres);
927 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
929 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
930
931 V_VT(&v) = VT_I4;
932 V_I4(&v) = 3;
933 hres = IHTMLStyle_put_lineHeight(style, v);
934 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
935
936 hres = IHTMLStyle_get_lineHeight(style, &v);
937 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
938 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
939 ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
940
941 V_VT(&v) = VT_BSTR;
942 V_BSTR(&v) = a2bstr("300%");
943 hres = IHTMLStyle_put_lineHeight(style, v);
944 ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres);
945 VariantClear(&v);
946
947 hres = IHTMLStyle_get_lineHeight(style, &v);
948 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
949 ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v));
950 ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
951 VariantClear(&v);
952
953 b = 0xfefe;
954 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
955 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
956 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
957
958 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
959 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
960
961 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
962 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
963 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
964
965 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
966 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
967
968 b = 0xfefe;
969 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
970 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
971 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
972
973 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
974 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
975
976 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
977 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
978 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
979
980 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
981 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
982
983 b = 0xfefe;
984 hres = IHTMLStyle_get_textDecorationNone(style, &b);
985 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
986 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
987
988 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
989 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
990
991 hres = IHTMLStyle_get_textDecorationNone(style, &b);
992 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
993 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
994
995 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
996 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
997
998 b = 0xfefe;
999 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1000 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1001 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
1002
1003 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
1004 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1005
1006 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
1007 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
1008 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
1009
1010 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
1011 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
1012
1013 b = 0xfefe;
1014 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1015 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1016 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
1017
1018 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
1019 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
1020
1021 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
1022 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
1023 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
1024
1025 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
1026 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
1027
1028 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
1029 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
1030
1031 str = a2bstr("invalid");
1032 hres = IHTMLStyle_put_textDecoration(style, str);
1033 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
1035
1036 set_text_decoration(style, "none");
1037 test_text_decoration(style, "none");
1038 set_text_decoration(style, "underline");
1039 set_text_decoration(style, "overline");
1040 set_text_decoration(style, "line-through");
1041 set_text_decoration(style, "blink");
1042 set_text_decoration(style, "overline");
1043 set_text_decoration(style, "blink");
1044 test_text_decoration(style, "blink");
1045
1046 hres = IHTMLStyle_put_textDecoration(style, sDefault);
1047 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
1048 SysFreeString(sDefault);
1049
1050 hres = IHTMLStyle_get_posWidth(style, NULL);
1051 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
1052
1053 hres = IHTMLStyle_get_posWidth(style, &f);
1054 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1055 ok(f == 0.0f, "f = %f\n", f);
1056
1057 V_VT(&v) = VT_EMPTY;
1058 hres = IHTMLStyle_get_width(style, &v);
1059 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1060 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1061 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
1062
1063 hres = IHTMLStyle_put_posWidth(style, 2.2);
1064 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
1065
1066 hres = IHTMLStyle_get_posWidth(style, &f);
1067 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
1068 ok(f == 2.0f ||
1069 f == 2.2f, /* IE8 */
1070 "f = %f\n", f);
1071
1072 l = 0xdeadbeef;
1073 hres = IHTMLStyle_get_pixelWidth(style, &l);
1074 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1075 ok(l == 2, "pixelWidth = %d\n", l);
1076
1077 V_VT(&v) = VT_BSTR;
1078 V_BSTR(&v) = a2bstr("auto");
1079 hres = IHTMLStyle_put_width(style, v);
1080 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1081 VariantClear(&v);
1082
1083 V_VT(&v) = VT_EMPTY;
1084 hres = IHTMLStyle_get_width(style, &v);
1085 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1086 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1087 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1088 VariantClear(&v);
1089
1090 V_VT(&v) = VT_I4;
1091 V_I4(&v) = 100;
1092 hres = IHTMLStyle_put_width(style, v);
1093 ok(hres == S_OK, "put_width failed: %08x\n", hres);
1094
1095 l = 0xdeadbeef;
1096 hres = IHTMLStyle_get_pixelWidth(style, &l);
1097 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1098 ok(l == 100, "pixelWidth = %d\n", l);
1099
1100 V_VT(&v) = VT_EMPTY;
1101 hres = IHTMLStyle_get_width(style, &v);
1102 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1103 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1104 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1105 VariantClear(&v);
1106
1107 hres = IHTMLStyle_put_pixelWidth(style, 50);
1108 ok(hres == S_OK, "put_pixelWidth failed: %08x\n", hres);
1109
1110 l = 0xdeadbeef;
1111 hres = IHTMLStyle_get_pixelWidth(style, &l);
1112 ok(hres == S_OK, "get_pixelWidth failed: %08x\n", hres);
1113 ok(l == 50, "pixelWidth = %d\n", l);
1114
1115 hres = IHTMLStyle_get_pixelWidth(style, NULL);
1116 ok(hres == E_POINTER, "get_pixelWidth failed: %08x\n", hres);
1117
1118 V_VT(&v) = VT_EMPTY;
1119 hres = IHTMLStyle_get_width(style, &v);
1120 ok(hres == S_OK, "get_width failed: %08x\n", hres);
1121 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1122 ok(!strcmp_wa(V_BSTR(&v), "50px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1123 VariantClear(&v);
1124
1125 /* margin tests */
1126 str = (void*)0xdeadbeef;
1127 hres = IHTMLStyle_get_margin(style, &str);
1128 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1129 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
1130
1131 str = a2bstr("1");
1132 hres = IHTMLStyle_put_margin(style, str);
1133 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1135
1136 hres = IHTMLStyle_get_margin(style, &str);
1137 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
1138 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
1140
1141 hres = IHTMLStyle_put_margin(style, NULL);
1142 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
1143
1144 str = (void*)0xdeadbeef;
1145 hres = IHTMLStyle_get_marginTop(style, &v);
1146 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1147 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1148 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1149
1150 V_VT(&v) = VT_BSTR;
1151 V_BSTR(&v) = a2bstr("6px");
1152 hres = IHTMLStyle_put_marginTop(style, v);
1154 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1155
1156 str = (void*)0xdeadbeef;
1157 hres = IHTMLStyle_get_marginTop(style, &v);
1158 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1159 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1160 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1161 VariantClear(&v);
1162
1163 V_VT(&v) = VT_I4;
1164 V_I4(&v) = 5;
1165 hres = IHTMLStyle_put_marginTop(style, v);
1166 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
1167
1168 str = (void*)0xdeadbeef;
1169 hres = IHTMLStyle_get_marginTop(style, &v);
1170 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
1171 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
1172 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1173 VariantClear(&v);
1174
1175 str = NULL;
1176 hres = IHTMLStyle_get_border(style, &str);
1177 ok(hres == S_OK, "get_border failed: %08x\n", hres);
1178 ok(!str || !*str, "str is not empty\n");
1180
1181 str = a2bstr("1px");
1182 hres = IHTMLStyle_put_border(style, str);
1183 ok(hres == S_OK, "put_border failed: %08x\n", hres);
1185
1186 V_VT(&v) = VT_EMPTY;
1187 hres = IHTMLStyle_get_left(style, &v);
1188 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1189 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1190 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1191 VariantClear(&v);
1192
1193 l = 0xdeadbeef;
1194 hres = IHTMLStyle_get_pixelLeft(style, &l);
1195 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1196 ok(!l, "pixelLeft = %d\n", l);
1197
1198 /* Test posLeft */
1199 hres = IHTMLStyle_get_posLeft(style, NULL);
1200 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
1201
1202 f = 1.0f;
1203 hres = IHTMLStyle_get_posLeft(style, &f);
1204 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1205 ok(f == 0.0, "expected 0.0 got %f\n", f);
1206
1207 hres = IHTMLStyle_put_posLeft(style, 4.9f);
1208 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
1209
1210 hres = IHTMLStyle_get_posLeft(style, &f);
1211 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1212 ok(f == 4.0 ||
1213 f == 4.9f, /* IE8 */
1214 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1215
1216 /* Ensure left is updated correctly. */
1217 V_VT(&v) = VT_EMPTY;
1218 hres = IHTMLStyle_get_left(style, &v);
1219 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1220 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1221 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
1222 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
1223 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1224 VariantClear(&v);
1225
1226 /* Test left */
1227 V_VT(&v) = VT_BSTR;
1228 V_BSTR(&v) = a2bstr("3px");
1229 hres = IHTMLStyle_put_left(style, v);
1230 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1231 VariantClear(&v);
1232
1233 hres = IHTMLStyle_get_posLeft(style, &f);
1234 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
1235 ok(f == 3.0, "expected 3.0 got %f\n", f);
1236
1237 l = 0xdeadbeef;
1238 hres = IHTMLStyle_get_pixelLeft(style, &l);
1239 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1240 ok(l == 3, "pixelLeft = %d\n", l);
1241
1242 V_VT(&v) = VT_EMPTY;
1243 hres = IHTMLStyle_get_left(style, &v);
1244 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1245 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1246 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1247 VariantClear(&v);
1248
1249 V_VT(&v) = VT_BSTR;
1250 V_BSTR(&v) = a2bstr("4.99");
1251 hres = IHTMLStyle_put_left(style, v);
1252 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1253 VariantClear(&v);
1254
1255 l = 0xdeadbeef;
1256 hres = IHTMLStyle_get_pixelLeft(style, &l);
1257 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1258 ok(l == 4, "pixelLeft = %d\n", l);
1259
1260 V_VT(&v) = VT_NULL;
1261 hres = IHTMLStyle_put_left(style, v);
1262 ok(hres == S_OK, "put_left failed: %08x\n", hres);
1263
1264 V_VT(&v) = VT_EMPTY;
1265 hres = IHTMLStyle_get_left(style, &v);
1266 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1267 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1268 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1269 VariantClear(&v);
1270
1271 V_VT(&v) = VT_EMPTY;
1272 hres = IHTMLStyle_get_top(style, &v);
1273 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1274 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1275 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1276 VariantClear(&v);
1277
1278 l = 0xdeadbeef;
1279 hres = IHTMLStyle_get_pixelLeft(style, &l);
1280 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1281 ok(!l, "pixelLeft = %d\n", l);
1282
1283 hres = IHTMLStyle_put_pixelLeft(style, 6);
1284 ok(hres == S_OK, "put_pixelLeft failed: %08x\n", hres);
1285
1286 l = 0xdeadbeef;
1287 hres = IHTMLStyle_get_pixelLeft(style, &l);
1288 ok(hres == S_OK, "get_pixelLeft failed: %08x\n", hres);
1289 ok(l == 6, "pixelLeft = %d\n", l);
1290
1291 hres = IHTMLStyle_get_pixelLeft(style, NULL);
1292 ok(hres == E_POINTER, "get_pixelLeft failed: %08x\n", hres);
1293
1294 V_VT(&v) = VT_EMPTY;
1295 hres = IHTMLStyle_get_left(style, &v);
1296 ok(hres == S_OK, "get_left failed: %08x\n", hres);
1297 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1298 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1299 VariantClear(&v);
1300
1301 /* Test posTop */
1302 hres = IHTMLStyle_get_posTop(style, NULL);
1303 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
1304
1305 f = 1.0f;
1306 hres = IHTMLStyle_get_posTop(style, &f);
1307 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1308 ok(f == 0.0, "expected 0.0 got %f\n", f);
1309
1310 hres = IHTMLStyle_put_posTop(style, 4.9f);
1311 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
1312
1313 hres = IHTMLStyle_get_posTop(style, &f);
1314 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1315 ok(f == 4.0 ||
1316 f == 4.9f, /* IE8 */
1317 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1318
1319 hres = IHTMLStyle_put_pixelTop(style, 6);
1320 ok(hres == S_OK, "put_pixelTop failed: %08x\n", hres);
1321
1322 l = 0xdeadbeef;
1323 hres = IHTMLStyle_get_pixelTop(style, &l);
1324 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1325 ok(l == 6, "pixelTop = %d\n", l);
1326
1327 hres = IHTMLStyle_get_pixelTop(style, NULL);
1328 ok(hres == E_POINTER, "get_pixelTop failed: %08x\n", hres);
1329
1330 V_VT(&v) = VT_BSTR;
1331 V_BSTR(&v) = a2bstr("3px");
1332 hres = IHTMLStyle_put_top(style, v);
1333 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1334 VariantClear(&v);
1335
1336 V_VT(&v) = VT_EMPTY;
1337 hres = IHTMLStyle_get_top(style, &v);
1338 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1339 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1340 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1341 VariantClear(&v);
1342
1343 hres = IHTMLStyle_get_posTop(style, &f);
1344 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
1345 ok(f == 3.0, "expected 3.0 got %f\n", f);
1346
1347 l = 0xdeadbeef;
1348 hres = IHTMLStyle_get_pixelTop(style, &l);
1349 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1350 ok(l == 3, "pixelTop = %d\n", l);
1351
1352 V_VT(&v) = VT_NULL;
1353 hres = IHTMLStyle_put_top(style, v);
1354 ok(hres == S_OK, "put_top failed: %08x\n", hres);
1355
1356 V_VT(&v) = VT_EMPTY;
1357 hres = IHTMLStyle_get_top(style, &v);
1358 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1359 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1360 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1361 VariantClear(&v);
1362
1363 l = 0xdeadbeef;
1364 hres = IHTMLStyle_get_pixelTop(style, &l);
1365 ok(hres == S_OK, "get_pixelTop failed: %08x\n", hres);
1366 ok(!l, "pixelTop = %d\n", l);
1367
1368 /* Test posHeight */
1369 hres = IHTMLStyle_get_posHeight(style, NULL);
1370 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1371
1372 V_VT(&v) = VT_EMPTY;
1373 hres = IHTMLStyle_get_height(style, &v);
1374 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1375 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1376 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1377 VariantClear(&v);
1378
1379 f = 1.0f;
1380 hres = IHTMLStyle_get_posHeight(style, &f);
1381 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1382 ok(f == 0.0, "expected 0.0 got %f\n", f);
1383
1384 l = 0xdeadbeef;
1385 hres = IHTMLStyle_get_pixelHeight(style, &l);
1386 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1387 ok(!l, "pixelHeight = %d\n", l);
1388
1389 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1390 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1391
1392 hres = IHTMLStyle_get_posHeight(style, &f);
1393 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1394 ok(f == 4.0 ||
1395 f == 4.9f, /* IE8 */
1396 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1397
1398 l = 0xdeadbeef;
1399 hres = IHTMLStyle_get_pixelHeight(style, &l);
1400 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1401 ok(l == 4 ||
1402 l == 5, /* IE8 */
1403 "pixelHeight = %d\n", l);
1404
1405 V_VT(&v) = VT_BSTR;
1406 V_BSTR(&v) = a2bstr("70px");
1407 hres = IHTMLStyle_put_height(style, v);
1408 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1409 VariantClear(&v);
1410
1411 V_VT(&v) = VT_EMPTY;
1412 hres = IHTMLStyle_get_height(style, &v);
1413 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1414 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1415 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1416 VariantClear(&v);
1417
1418 l = 0xdeadbeef;
1419 hres = IHTMLStyle_get_pixelHeight(style, &l);
1420 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1421 ok(l == 70, "pixelHeight = %d\n", l);
1422
1423 V_VT(&v) = VT_BSTR;
1424 V_BSTR(&v) = NULL;
1425 hres = IHTMLStyle_put_height(style, v);
1426 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1427 VariantClear(&v);
1428
1429 V_VT(&v) = VT_EMPTY;
1430 hres = IHTMLStyle_get_height(style, &v);
1431 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1432 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1433 ok(!V_BSTR(&v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
1434 VariantClear(&v);
1435
1436 l = 0xdeadbeef;
1437 hres = IHTMLStyle_get_pixelHeight(style, &l);
1438 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1439 ok(!l, "pixelHeight = %d\n", l);
1440
1441 hres = IHTMLStyle_put_pixelHeight(style, 50);
1442 ok(hres == S_OK, "put_pixelHeight failed: %08x\n", hres);
1443
1444 l = 0xdeadbeef;
1445 hres = IHTMLStyle_get_pixelHeight(style, &l);
1446 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1447 ok(l == 50, "pixelHeight = %d\n", l);
1448
1449 hres = IHTMLStyle_get_pixelHeight(style, NULL);
1450 ok(hres == E_POINTER, "get_pixelHeight failed: %08x\n", hres);
1451
1452 V_VT(&v) = VT_I4;
1453 V_I4(&v) = 64;
1454 hres = IHTMLStyle_put_height(style, v);
1455 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1456
1457 V_VT(&v) = VT_EMPTY;
1458 hres = IHTMLStyle_get_height(style, &v);
1459 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1460 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1461 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1462 VariantClear(&v);
1463
1464 hres = IHTMLStyle_get_posHeight(style, &f);
1465 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1466 ok(f == 64.0, "expected 64.0 got %f\n", f);
1467
1468 l = 0xdeadbeef;
1469 hres = IHTMLStyle_get_pixelHeight(style, &l);
1470 ok(hres == S_OK, "get_pixelHeight failed: %08x\n", hres);
1471 ok(l == 64, "pixelHeight = %d\n", l);
1472
1473 str = (void*)0xdeadbeef;
1474 hres = IHTMLStyle_get_cursor(style, &str);
1475 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1476 ok(!str, "get_cursor != NULL\n");
1478
1479 str = a2bstr("default");
1480 hres = IHTMLStyle_put_cursor(style, str);
1481 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1483
1484 str = NULL;
1485 hres = IHTMLStyle_get_cursor(style, &str);
1486 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1487 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1489
1490 V_VT(&v) = VT_EMPTY;
1491 hres = IHTMLStyle_get_verticalAlign(style, &v);
1492 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1493 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1494 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1495 VariantClear(&v);
1496
1497 V_VT(&v) = VT_BSTR;
1498 V_BSTR(&v) = a2bstr("middle");
1499 hres = IHTMLStyle_put_verticalAlign(style, v);
1500 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1501 VariantClear(&v);
1502
1503 V_VT(&v) = VT_EMPTY;
1504 hres = IHTMLStyle_get_verticalAlign(style, &v);
1505 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1506 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1507 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1508 VariantClear(&v);
1509
1510 V_VT(&v) = VT_I4;
1511 V_I4(&v) = 100;
1512 hres = IHTMLStyle_put_verticalAlign(style, v);
1513 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1514 VariantClear(&v);
1515
1516 V_VT(&v) = VT_EMPTY;
1517 hres = IHTMLStyle_get_verticalAlign(style, &v);
1518 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1519 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1520 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1521 VariantClear(&v);
1522
1523 str = (void*)0xdeadbeef;
1524 hres = IHTMLStyle_get_textAlign(style, &str);
1525 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1526 ok(!str, "textAlign != NULL\n");
1527
1528 str = a2bstr("center");
1529 hres = IHTMLStyle_put_textAlign(style, str);
1530 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1532
1533 str = NULL;
1534 hres = IHTMLStyle_get_textAlign(style, &str);
1535 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1536 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1538
1539 V_VT(&v) = VT_NULL;
1540 hres = IHTMLStyle_get_textIndent(style, &v);
1541 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1542 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1543 ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1544
1545 V_VT(&v) = VT_I4;
1546 V_I4(&v) = 6;
1547 hres = IHTMLStyle_put_textIndent(style, v);
1548 ok(hres == S_OK, "put_textIndent failed: %08x\n", hres);
1549
1550 V_VT(&v) = VT_NULL;
1551 hres = IHTMLStyle_get_textIndent(style, &v);
1552 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
1553 ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v));
1554 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1555
1556 str = (void*)0xdeadbeef;
1557 hres = IHTMLStyle_get_textTransform(style, &str);
1558 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1559 ok(!str, "textTransform != NULL\n");
1560
1561 str = a2bstr("lowercase");
1562 hres = IHTMLStyle_put_textTransform(style, str);
1563 ok(hres == S_OK, "put_textTransform failed: %08x\n", hres);
1565
1566 str = NULL;
1567 hres = IHTMLStyle_get_textTransform(style, &str);
1568 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
1569 ok(!strcmp_wa(str, "lowercase"), "textTransform = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1571
1572 str = (void*)0xdeadbeef;
1573 hres = IHTMLStyle_get_filter(style, &str);
1574 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1575 ok(!str, "filter != NULL\n");
1576
1577 str = a2bstr("alpha(opacity=100)");
1578 hres = IHTMLStyle_put_filter(style, str);
1579 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1581
1582 V_VT(&v) = VT_EMPTY;
1583 hres = IHTMLStyle_get_zIndex(style, &v);
1584 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1585 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1586 ok(!V_I4(&v), "V_I4(v) != 0\n");
1587 VariantClear(&v);
1588
1589 V_VT(&v) = VT_BSTR;
1590 V_BSTR(&v) = a2bstr("1");
1591 hres = IHTMLStyle_put_zIndex(style, v);
1592 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1593 VariantClear(&v);
1594
1595 V_VT(&v) = VT_EMPTY;
1596 hres = IHTMLStyle_get_zIndex(style, &v);
1597 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1598 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1599 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1600 VariantClear(&v);
1601
1602 /* fontStyle */
1603 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1604 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1605
1606 str = a2bstr("test");
1607 hres = IHTMLStyle_put_fontStyle(style, str);
1608 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1610
1611 str = a2bstr("italic");
1612 hres = IHTMLStyle_put_fontStyle(style, str);
1613 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1615
1616 str = a2bstr("oblique");
1617 hres = IHTMLStyle_put_fontStyle(style, str);
1618 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1620
1621 str = a2bstr("normal");
1622 hres = IHTMLStyle_put_fontStyle(style, str);
1623 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1625
1626 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1627 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1628 SysFreeString(sDefault);
1629
1630 /* overflow */
1631 hres = IHTMLStyle_get_overflow(style, NULL);
1632 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1633
1634 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1635 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1636
1637 str = a2bstr("test");
1638 hres = IHTMLStyle_put_overflow(style, str);
1639 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1641
1642 str = a2bstr("visible");
1643 hres = IHTMLStyle_put_overflow(style, str);
1644 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1646
1647 str = a2bstr("scroll");
1648 hres = IHTMLStyle_put_overflow(style, str);
1649 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1651
1652 str = a2bstr("hidden");
1653 hres = IHTMLStyle_put_overflow(style, str);
1654 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1656
1657 str = a2bstr("auto");
1658 hres = IHTMLStyle_put_overflow(style, str);
1659 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1661
1662 hres = IHTMLStyle_get_overflow(style, &str);
1663 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1664 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1666
1667 str = a2bstr("");
1668 hres = IHTMLStyle_put_overflow(style, str);
1669 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1671
1672 hres = IHTMLStyle_get_overflow(style, &str);
1673 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1674 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1676
1677 /* restore overflow default */
1678 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1679 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1680 SysFreeString(sOverflowDefault);
1681
1682 /* Attribute Tests*/
1683 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1684 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1685
1686 str = a2bstr("position");
1687 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1688 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1689
1690 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1691 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1692 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1693 VariantClear(&v);
1694
1695 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1696 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1697
1698 V_VT(&v) = VT_BSTR;
1699 V_BSTR(&v) = a2bstr("absolute");
1700 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1701 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1702 VariantClear(&v);
1703
1704 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1705 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1706 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1707 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1708 VariantClear(&v);
1709
1710 V_VT(&v) = VT_BSTR;
1711 V_BSTR(&v) = NULL;
1712 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1713 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1714 VariantClear(&v);
1715
1717
1718 str = a2bstr("borderLeftStyle");
1721
1722 str = a2bstr("borderbottomstyle");
1725
1726 str = a2bstr("borderrightstyle");
1729
1730 str = a2bstr("bordertopstyle");
1733
1734 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1735 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1736
1737 str = a2bstr("none dotted dashed solid");
1738 hres = IHTMLStyle_put_borderStyle(style, str);
1739 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1741
1742 str = a2bstr("none dotted dashed solid");
1743 hres = IHTMLStyle_get_borderStyle(style, &str);
1744 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1745 ok(!strcmp_wa(str, "none dotted dashed solid"),
1746 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1748
1749 str = a2bstr("double groove ridge inset");
1750 hres = IHTMLStyle_put_borderStyle(style, str);
1751 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1753
1754 str = a2bstr("window-inset outset ridge inset");
1755 hres = IHTMLStyle_put_borderStyle(style, str);
1756 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1758
1759 str = a2bstr("window-inset");
1760 hres = IHTMLStyle_put_borderStyle(style, str);
1761 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1763
1764 str = a2bstr("none none none none none");
1765 hres = IHTMLStyle_put_borderStyle(style, str);
1766 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1768
1769 str = a2bstr("invalid none none none");
1770 hres = IHTMLStyle_put_borderStyle(style, str);
1771 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1773
1774 str = a2bstr("none invalid none none");
1775 hres = IHTMLStyle_put_borderStyle(style, str);
1776 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1778
1779 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1780 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1781 SysFreeString(sDefault);
1782
1783 /* backgoundColor */
1784 hres = IHTMLStyle_get_backgroundColor(style, &v);
1785 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1786 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1787 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1788 VariantClear(&v);
1789
1790 V_VT(&v) = VT_BSTR;
1791 V_BSTR(&v) = a2bstr("red");
1792 hres = IHTMLStyle_put_backgroundColor(style, v);
1793 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1794 VariantClear(&v);
1795
1796 hres = IHTMLStyle_get_backgroundColor(style, &v);
1797 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1798 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1799 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1800 VariantClear(&v);
1801
1802 str = a2bstr("fixed");
1803 hres = IHTMLStyle_put_backgroundAttachment(style, str);
1804 ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres);
1806
1807 hres = IHTMLStyle_get_backgroundAttachment(style, &str);
1808 ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres);
1809 ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str));
1811
1812 /* padding */
1813 hres = IHTMLStyle_get_padding(style, &str);
1814 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1815 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1817
1818 hres = IHTMLStyle_get_paddingTop(style, &v);
1819 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1820 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1821 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1822
1823 V_VT(&v) = VT_I4;
1824 V_I4(&v) = 6;
1825 hres = IHTMLStyle_put_paddingTop(style, v);
1826 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1827
1828 hres = IHTMLStyle_get_paddingTop(style, &v);
1829 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1830 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1831 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1832 VariantClear(&v);
1833
1834 hres = IHTMLStyle_get_paddingRight(style, &v);
1835 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1836 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1837 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1838
1839 V_VT(&v) = VT_I4;
1840 V_I4(&v) = 6;
1841 hres = IHTMLStyle_put_paddingRight(style, v);
1842 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1843
1844 hres = IHTMLStyle_get_paddingRight(style, &v);
1845 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1846 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1847 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1848 VariantClear(&v);
1849
1850 hres = IHTMLStyle_get_paddingBottom(style, &v);
1851 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1852 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1853 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1854
1855 V_VT(&v) = VT_I4;
1856 V_I4(&v) = 6;
1857 hres = IHTMLStyle_put_paddingBottom(style, v);
1858 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1859
1860 hres = IHTMLStyle_get_paddingBottom(style, &v);
1861 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1862 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1863 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1864 VariantClear(&v);
1865
1866 str = a2bstr("1");
1867 hres = IHTMLStyle_put_padding(style, str);
1868 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1870
1871 hres = IHTMLStyle_get_padding(style, &str);
1872 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1873 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1875
1876 /* PaddingLeft */
1877 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1878 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1879 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1880 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1881
1882 V_VT(&v) = VT_BSTR;
1883 V_BSTR(&v) = a2bstr("10");
1884 hres = IHTMLStyle_put_paddingLeft(style, v);
1885 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1886 VariantClear(&v);
1887
1888 hres = IHTMLStyle_get_paddingLeft(style, &v);
1889 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1890 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1891 VariantClear(&v);
1892
1893 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1894 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1895
1896 /* BackgroundRepeat */
1897 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1898 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1899
1900 str = a2bstr("invalid");
1901 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1902 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1904
1905 str = a2bstr("repeat");
1906 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1907 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1909
1910 str = a2bstr("no-repeat");
1911 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1912 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1914
1915 str = a2bstr("repeat-x");
1916 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1917 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1919
1920 str = a2bstr("repeat-y");
1921 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1922 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1924
1925 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1926 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1927 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1929
1930 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1931 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1932 SysFreeString(sDefault);
1933
1934 /* BorderColor */
1935 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1936 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1937
1938 str = a2bstr("red green red blue");
1939 hres = IHTMLStyle_put_borderColor(style, str);
1940 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1942
1943 hres = IHTMLStyle_get_borderColor(style, &str);
1944 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1945 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1947
1948 hres = IHTMLStyle_put_borderColor(style, sDefault);
1949 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1950 SysFreeString(sDefault);
1951
1952 /* BorderRight */
1953 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1954 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1955
1956 str = a2bstr("thick dotted red");
1957 hres = IHTMLStyle_put_borderRight(style, str);
1958 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1960
1961 /* IHTMLStyle_get_borderRight appears to have a bug where
1962 it returns the first letter of the color. So we check
1963 each style individually.
1964 */
1965 V_BSTR(&v) = NULL;
1966 hres = IHTMLStyle_get_borderRightColor(style, &v);
1967 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1968 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1969 VariantClear(&v);
1970
1971 V_BSTR(&v) = NULL;
1972 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1973 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1974 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1975 VariantClear(&v);
1976
1977 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1978 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1979 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1981
1982 hres = IHTMLStyle_put_borderRight(style, sDefault);
1983 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1984 SysFreeString(sDefault);
1985
1986 /* BorderTop */
1987 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1988 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1989
1990 str = a2bstr("thick dotted red");
1991 hres = IHTMLStyle_put_borderTop(style, str);
1992 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1994
1995 /* IHTMLStyle_get_borderTop appears to have a bug where
1996 it returns the first letter of the color. So we check
1997 each style individually.
1998 */
1999 V_BSTR(&v) = NULL;
2000 hres = IHTMLStyle_get_borderTopColor(style, &v);
2001 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2002 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2003 VariantClear(&v);
2004
2005 V_BSTR(&v) = NULL;
2006 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2007 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2008 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2009 VariantClear(&v);
2010
2011 hres = IHTMLStyle_get_borderTopStyle(style, &str);
2012 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2013 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2015
2016 hres = IHTMLStyle_put_borderTop(style, sDefault);
2017 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
2018 SysFreeString(sDefault);
2019
2020 /* BorderBottom */
2021 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
2022 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
2023
2024 str = a2bstr("thick dotted red");
2025 hres = IHTMLStyle_put_borderBottom(style, str);
2026 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2028
2029 /* IHTMLStyle_get_borderBottom appears to have a bug where
2030 it returns the first letter of the color. So we check
2031 each style individually.
2032 */
2033 V_BSTR(&v) = NULL;
2034 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2035 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2036 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2037 VariantClear(&v);
2038
2039 V_BSTR(&v) = NULL;
2040 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2041 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2042 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2043 VariantClear(&v);
2044
2045 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
2046 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2047 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2049
2050 hres = IHTMLStyle_put_borderBottom(style, sDefault);
2051 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
2052 SysFreeString(sDefault);
2053
2054 /* BorderLeft */
2055 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
2056 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
2057
2058 str = a2bstr("thick dotted red");
2059 hres = IHTMLStyle_put_borderLeft(style, str);
2060 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2062
2063 /* IHTMLStyle_get_borderLeft appears to have a bug where
2064 it returns the first letter of the color. So we check
2065 each style individually.
2066 */
2067 V_BSTR(&v) = NULL;
2068 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2069 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2070 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2071 VariantClear(&v);
2072
2073 V_BSTR(&v) = NULL;
2074 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2075 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2076 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
2077 VariantClear(&v);
2078
2079 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
2080 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2081 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
2083
2084 hres = IHTMLStyle_put_borderLeft(style, sDefault);
2085 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
2086 SysFreeString(sDefault);
2087
2088 /* backgroundPositionX */
2089 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2090 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2091 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2092 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2093 VariantClear(&v);
2094
2095 V_VT(&v) = VT_BSTR;
2096 V_BSTR(&v) = a2bstr("10px");
2097 hres = IHTMLStyle_put_backgroundPositionX(style, v);
2098 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
2099 VariantClear(&v);
2100
2101 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2102 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2103 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2104 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2105 VariantClear(&v);
2106
2107 /* backgroundPositionY */
2108 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2109 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2110 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2111 VariantClear(&v);
2112
2113 V_VT(&v) = VT_BSTR;
2114 V_BSTR(&v) = a2bstr("15px");
2115 hres = IHTMLStyle_put_backgroundPositionY(style, v);
2116 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
2117 VariantClear(&v);
2118
2119 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2120 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2121 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2122 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2123 VariantClear(&v);
2124
2125 /* backgroundPosition */
2126 str = NULL;
2127 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2128 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2129 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2131
2132 str = a2bstr("center 20%");
2133 hres = IHTMLStyle_put_backgroundPosition(style, str);
2134 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
2136
2137 str = NULL;
2138 hres = IHTMLStyle_get_backgroundPosition(style, &str);
2139 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
2140 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
2142
2143 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
2144 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
2145 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2146 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2147 VariantClear(&v);
2148
2149 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
2150 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
2151 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2152 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2153 VariantClear(&v);
2154
2155 /* borderTopWidth */
2156 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
2157 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2158
2159 V_VT(&v) = VT_BSTR;
2160 V_BSTR(&v) = a2bstr("10px");
2161 hres = IHTMLStyle_put_borderTopWidth(style, v);
2162 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2163 VariantClear(&v);
2164
2165 hres = IHTMLStyle_get_borderTopWidth(style, &v);
2166 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
2167 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2168 VariantClear(&v);
2169
2170 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
2171 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
2172 VariantClear(&vDefault);
2173
2174 /* borderRightWidth */
2175 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
2176 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2177
2178 V_VT(&v) = VT_BSTR;
2179 V_BSTR(&v) = a2bstr("10");
2180 hres = IHTMLStyle_put_borderRightWidth(style, v);
2181 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2182 VariantClear(&v);
2183
2184 hres = IHTMLStyle_get_borderRightWidth(style, &v);
2185 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
2186 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2187 VariantClear(&v);
2188
2189 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
2190 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
2191 VariantClear(&vDefault);
2192
2193 /* borderBottomWidth */
2194 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
2195 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2196
2197 V_VT(&v) = VT_BSTR;
2198 V_BSTR(&v) = a2bstr("10");
2199 hres = IHTMLStyle_put_borderBottomWidth(style, v);
2200 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2201 VariantClear(&v);
2202
2203 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
2204 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
2205 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2206 VariantClear(&v);
2207
2208 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
2209 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
2210 VariantClear(&vDefault);
2211
2212 /* borderLeftWidth */
2213 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
2214 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2215
2216 V_VT(&v) = VT_BSTR;
2217 V_BSTR(&v) = a2bstr("10");
2218 hres = IHTMLStyle_put_borderLeftWidth(style, v);
2219 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2220 VariantClear(&v);
2221
2222 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
2223 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
2224 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2225 VariantClear(&v);
2226
2227 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
2228 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
2229 VariantClear(&vDefault);
2230
2231 /* wordSpacing */
2232 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
2233 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2234
2235 V_VT(&v) = VT_BSTR;
2236 V_BSTR(&v) = a2bstr("10");
2237 hres = IHTMLStyle_put_wordSpacing(style, v);
2238 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2239 VariantClear(&v);
2240
2241 hres = IHTMLStyle_get_wordSpacing(style, &v);
2242 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
2243 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2244 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2245 VariantClear(&v);
2246
2247 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
2248 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
2249 VariantClear(&vDefault);
2250
2251 /* letterSpacing */
2252 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
2253 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2254
2255 V_VT(&v) = VT_BSTR;
2256 V_BSTR(&v) = a2bstr("11");
2257 hres = IHTMLStyle_put_letterSpacing(style, v);
2258 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2259 VariantClear(&v);
2260
2261 hres = IHTMLStyle_get_letterSpacing(style, &v);
2262 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
2263 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
2264 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2265 VariantClear(&v);
2266
2267 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
2268 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
2269 VariantClear(&vDefault);
2270
2271 /* borderTopColor */
2272 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
2273 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2274
2275 V_VT(&v) = VT_BSTR;
2276 V_BSTR(&v) = a2bstr("red");
2277 hres = IHTMLStyle_put_borderTopColor(style, v);
2278 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2279 VariantClear(&v);
2280
2281 hres = IHTMLStyle_get_borderTopColor(style, &v);
2282 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
2283 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2284 VariantClear(&v);
2285
2286 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
2287 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
2288
2289 /* borderRightColor */
2290 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
2291 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2292
2293 V_VT(&v) = VT_BSTR;
2294 V_BSTR(&v) = a2bstr("blue");
2295 hres = IHTMLStyle_put_borderRightColor(style, v);
2296 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
2297 VariantClear(&v);
2298
2299 hres = IHTMLStyle_get_borderRightColor(style, &v);
2300 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
2301 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2302 VariantClear(&v);
2303
2304 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
2305 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
2306
2307 /* borderBottomColor */
2308 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
2309 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2310
2311 V_VT(&v) = VT_BSTR;
2312 V_BSTR(&v) = a2bstr("cyan");
2313 hres = IHTMLStyle_put_borderBottomColor(style, v);
2314 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2315 VariantClear(&v);
2316
2317 hres = IHTMLStyle_get_borderBottomColor(style, &v);
2318 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
2319 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2320 VariantClear(&v);
2321
2322 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
2323 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
2324
2325 /* borderLeftColor */
2326 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
2327 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2328
2329 V_VT(&v) = VT_BSTR;
2330 V_BSTR(&v) = a2bstr("cyan");
2331 hres = IHTMLStyle_put_borderLeftColor(style, v);
2332 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2333 VariantClear(&v);
2334
2335 hres = IHTMLStyle_get_borderLeftColor(style, &v);
2336 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
2337 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
2338 VariantClear(&v);
2339
2340 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
2341 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
2342
2343 /* clip */
2344 hres = IHTMLStyle_get_clip(style, &str);
2345 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2346 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
2347
2348 str = a2bstr("rect(0px 1px 500px 505px)");
2349 hres = IHTMLStyle_put_clip(style, str);
2350 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
2352
2353 hres = IHTMLStyle_get_clip(style, &str);
2354 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
2355 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
2357
2358 /* clear */
2359 hres = IHTMLStyle_get_clear(style, &str);
2360 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2361 ok(!str, "clear = %s\n", wine_dbgstr_w(str));
2362
2363 str = a2bstr("both");
2364 hres = IHTMLStyle_put_clear(style, str);
2365 ok(hres == S_OK, "put_clear failed: %08x\n", hres);
2367
2368 hres = IHTMLStyle_get_clear(style, &str);
2369 ok(hres == S_OK, "get_clear failed: %08x\n", hres);
2370 ok(!strcmp_wa(str, "both"), "clear = %s\n", wine_dbgstr_w(str));
2372
2373 /* pageBreakAfter */
2374 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2375 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2376 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2377
2378 str = a2bstr("always");
2379 hres = IHTMLStyle_put_pageBreakAfter(style, str);
2380 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
2382
2383 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
2384 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
2385 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
2387
2388 /* pageBreakBefore */
2389 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2390 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2391 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2392
2393 str = a2bstr("always");
2394 hres = IHTMLStyle_put_pageBreakBefore(style, str);
2395 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
2397
2398 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2399 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2400 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2402
2403 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
2404 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
2405
2406 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
2407 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
2408 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
2409
2410 str = (void*)0xdeadbeef;
2411 hres = IHTMLStyle_get_whiteSpace(style, &str);
2412 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2413 ok(!str, "whiteSpace = %s\n", wine_dbgstr_w(str));
2414
2415 str = a2bstr("nowrap");
2416 hres = IHTMLStyle_put_whiteSpace(style, str);
2418 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2419
2420 str = NULL;
2421 hres = IHTMLStyle_get_whiteSpace(style, &str);
2422 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2423 ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2425
2426 str = a2bstr("normal");
2427 hres = IHTMLStyle_put_whiteSpace(style, str);
2429 ok(hres == S_OK, "put_whiteSpace failed: %08x\n", hres);
2430
2431 str = NULL;
2432 hres = IHTMLStyle_get_whiteSpace(style, &str);
2433 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2434 ok(!strcmp_wa(str, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2436
2437 /* listStyleType */
2438 hres = IHTMLStyle_get_listStyleType(style, &str);
2439 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2440 ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str));
2441
2442 str = a2bstr("square");
2443 hres = IHTMLStyle_put_listStyleType(style, str);
2444 ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres);
2446
2447 str = NULL;
2448 hres = IHTMLStyle_get_listStyleType(style, &str);
2449 ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres);
2450 ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str));
2451
2452 str = a2bstr("inside");
2453 hres = IHTMLStyle_put_listStylePosition(style, str);
2454 ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres);
2456
2457 hres = IHTMLStyle_get_listStylePosition(style, &str);
2458 ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres);
2459 ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str));
2461
2462 str = a2bstr("decimal-leading-zero none inside");
2463 hres = IHTMLStyle_put_listStyle(style, str);
2464 ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */
2465 "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres);
2467
2468 if (hres != E_INVALIDARG) {
2469 hres = IHTMLStyle_get_listStyle(style, &str);
2470 ok(hres == S_OK, "get_listStyle failed: %08x\n", hres);
2471 ok(strstr_wa(str, "decimal-leading-zero") &&
2472 strstr_wa(str, "none") != NULL &&
2473 strstr_wa(str, "inside") != NULL,
2474 "listStyle = %s\n", wine_dbgstr_w(str));
2476 } else {
2477 win_skip("IHTMLStyle_put_listStyle already failed\n");
2478 }
2479
2480 str = (void*)0xdeadbeef;
2481 hres = IHTMLStyle_get_styleFloat(style, &str);
2482 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2483 ok(!str, "styleFloat = %s\n", wine_dbgstr_w(str));
2484
2485 str = a2bstr("left");
2486 hres = IHTMLStyle_put_styleFloat(style, str);
2487 ok(hres == S_OK, "put_styleFloat failed: %08x\n", hres);
2489
2490 str = NULL;
2491 hres = IHTMLStyle_get_styleFloat(style, &str);
2492 ok(hres == S_OK, "get_styleFloat failed: %08x\n", hres);
2493 ok(!strcmp_wa(str, "left"), "styleFloat = %s\n", wine_dbgstr_w(str));
2494
2495 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
2496 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
2497 if(SUCCEEDED(hres)) {
2498 test_style2(style2);
2499 IHTMLStyle2_Release(style2);
2500 }
2501
2502 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
2503 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
2504 if(SUCCEEDED(hres)) {
2505 test_style3(style3);
2506 IHTMLStyle3_Release(style3);
2507 }
2508
2509 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
2510 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
2511 if(SUCCEEDED(hres)) {
2512 test_style4(style4);
2513 IHTMLStyle4_Release(style4);
2514 }
2515
2516 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle5, (void**)&style5);
2517 if(SUCCEEDED(hres)) {
2518 test_style5(style5);
2519 IHTMLStyle5_Release(style5);
2520 }else {
2521 win_skip("IHTMLStyle5 not available\n");
2522 }
2523
2524 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle6, (void**)&style6);
2525 if(SUCCEEDED(hres)) {
2526 test_style6(style6);
2527 IHTMLStyle6_Release(style6);
2528 }else {
2529 win_skip("IHTMLStyle6 not available\n");
2530 }
2531}
2532
2533#define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
2534static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
2535{
2536 BSTR str;
2537 HRESULT hres;
2538
2539 str = (void*)0xdeadbeef;
2540 hres = IHTMLStyle_get_filter(style, &str);
2541 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2542 if(exval)
2543 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2544 else
2545 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2546
2548}
2549
2550#define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
2551static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
2552{
2553 BSTR str;
2554 HRESULT hres;
2555
2556 str = (void*)0xdeadbeef;
2557 hres = IHTMLCurrentStyle2_get_filter(style, &str);
2558 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
2559 if(exval)
2560 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
2561 else
2562 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
2563
2565}
2566
2567#define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
2568static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
2569{
2570 BSTR str = a2bstr(val);
2571 HRESULT hres;
2572
2573 hres = IHTMLStyle_put_filter(style, str);
2574 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2576
2578}
2579
2580static void test_style_filters(IHTMLElement *elem)
2581{
2582 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2583 IHTMLCurrentStyle2 *current_style2;
2584 IHTMLCurrentStyle *current_style;
2585 IHTMLStyle *style;
2586 HRESULT hres;
2587
2588 hres = IHTMLElement_get_style(elem, &style);
2589 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2590
2591 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2592 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2593
2594 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2595
2597 test_current_style_filter(current_style2, NULL);
2598 set_style_filter(style, "alpha(opacity=50.0040)");
2599 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2600 set_style_filter(style, "alpha(opacity=100)");
2601
2602 IHTMLStyle_Release(style);
2603
2604 hres = IHTMLElement_get_style(elem, &style);
2605 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2606
2607 test_style_filter(style, "alpha(opacity=100)");
2608 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2610 set_style_filter(style, "alpha(opacity=100)");
2611 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2612 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2614
2615
2616 IHTMLCurrentStyle2_Release(current_style2);
2617 IHTMLStyle_Release(style);
2618 IHTMLElement2_Release(elem2);
2619}
2620
2621static void test_current_style(IHTMLCurrentStyle *current_style)
2622{
2623 IHTMLCurrentStyle2 *current_style2;
2624 IHTMLCurrentStyle3 *current_style3;
2626 BSTR str;
2627 HRESULT hres;
2628 VARIANT v;
2629
2630 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2631 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2632 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2634
2635 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2636 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2637 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2639
2640 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2641 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2643
2644 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2645 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2646 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2648
2649 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2650 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2651 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2653
2654 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2655 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2656 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2658
2659 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2660 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2661 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2663
2664 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2665 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2666 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2668
2669 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2670 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2671 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2673
2674 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2675 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2676 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2678
2679 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2680 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2681 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2683
2684 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2685 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2686 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2688
2689 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2690 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2691 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2693
2694 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2695 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2696 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2698
2699 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2700 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2702
2703 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2704 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2706
2707 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2708 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2710
2711 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2712 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2714
2715 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2716 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2718
2719 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2720 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2722
2723 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2724 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2726
2727 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2728 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2729 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2730 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2731 VariantClear(&v);
2732
2733 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2734 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2735 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2736 VariantClear(&v);
2737
2738 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2739 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2740 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2741 VariantClear(&v);
2742
2743 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2744 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2745 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2746 VariantClear(&v);
2747
2748 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2749 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2750 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2751 VariantClear(&v);
2752
2753 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2754 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2755 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2756 VariantClear(&v);
2757
2758 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2759 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2760 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2761 VariantClear(&v);
2762
2763 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2764 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2765 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2766 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2767 VariantClear(&v);
2768
2769 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2770 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2771 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2772 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2773 VariantClear(&v);
2774
2775 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2776 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2777 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2778 VariantClear(&v);
2779
2780 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2781 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2782 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2783 VariantClear(&v);
2784
2785 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2786 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2787 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2788 VariantClear(&v);
2789
2790 V_BSTR(&v) = NULL;
2791 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2792 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2793 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2794 VariantClear(&v);
2795
2796 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2797 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2798 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2799 VariantClear(&v);
2800
2801 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2802 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2803 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2804 VariantClear(&v);
2805
2806 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2807 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2808 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2809 VariantClear(&v);
2810
2811 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2812 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2813 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2814 VariantClear(&v);
2815
2816 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2817 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2818 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2819 VariantClear(&v);
2820
2821 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2822 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2823 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2824 VariantClear(&v);
2825
2826 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2827 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2828 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2829 VariantClear(&v);
2830
2831 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2832 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2833 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2834 VariantClear(&v);
2835
2836 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2837 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2838 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2839 VariantClear(&v);
2840
2841 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2842 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2843 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2844 VariantClear(&v);
2845
2846 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2847 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2848 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2849 VariantClear(&v);
2850
2851 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2852 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2853 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2854 VariantClear(&v);
2855
2856 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2857 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2858 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2859 VariantClear(&v);
2860
2861 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2862 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2863 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2864 VariantClear(&v);
2865
2866 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2867 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2868 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2869 VariantClear(&v);
2870
2871 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2872 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2873 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2874 VariantClear(&v);
2875
2876 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2877 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2878 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2879 VariantClear(&v);
2880
2881 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2882 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2883 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2884 VariantClear(&v);
2885
2886 hres = IHTMLCurrentStyle_get_textTransform(current_style, &str);
2887 ok(hres == S_OK, "get_textTransform failed: %08x\n", hres);
2889
2890 current_style2 = get_current_style2_iface((IUnknown*)current_style);
2891
2892 b = 100;
2893 hres = IHTMLCurrentStyle2_get_hasLayout(current_style2, &b);
2894 ok(hres == S_OK, "get_hasLayout failed: %08x\n", hres);
2895 ok(b == VARIANT_TRUE, "hasLayout = %x\n", b);
2896
2897 IHTMLCurrentStyle2_Release(current_style2);
2898
2899 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle3, (void**)&current_style3);
2900 ok(hres == S_OK, "Could not get IHTMLCurrentStyle3 iface: %08x\n", hres);
2901
2902 hres = IHTMLCurrentStyle3_get_whiteSpace(current_style3, &str);
2903 ok(hres == S_OK, "get_whiteSpace failed: %08x\n", hres);
2904 ok(!strcmp_wa(str, "normal"), "whiteSpace = %s\n", wine_dbgstr_w(str));
2906
2907 IHTMLCurrentStyle3_Release(current_style3);
2908}
2909
2910static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2911
2912static void basic_style_test(IHTMLDocument2 *doc)
2913{
2914 IHTMLCurrentStyle *cstyle;
2915 IHTMLElement *elem;
2916 IHTMLStyle *style;
2917 HRESULT hres;
2918
2919 hres = IHTMLDocument2_get_body(doc, &elem);
2920 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2921
2922 hres = IHTMLElement_get_style(elem, &style);
2923 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2924
2926
2927 cstyle = get_current_style(elem);
2928 test_current_style(cstyle);
2929 IHTMLCurrentStyle_Release(cstyle);
2930 IHTMLElement_Release(elem);
2931
2932 elem = get_element_by_id(doc, "divid");
2934
2936 IHTMLStyle_Release(style);
2937 IHTMLElement_Release(elem);
2938}
2939
2940static const char runtimestyle_test_str[] =
2941 "<html><head><style>body {text-decoration: auto}</style></head><body></body></html>";
2942
2943static void runtimestyle_test(IHTMLDocument2 *doc)
2944{
2945 IHTMLStyle *style, *runtime_style;
2946 IHTMLElement2 *elem2;
2947 IHTMLElement *elem;
2948 BSTR str;
2949 HRESULT hres;
2950
2951 hres = IHTMLDocument2_get_body(doc, &elem);
2952 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2953
2954 elem2 = get_elem2_iface((IUnknown*)elem);
2955
2956 hres = IHTMLElement2_get_runtimeStyle(elem2, &runtime_style);
2957 ok(hres == S_OK, "get_runtimeStyle failed: %08x\n", hres);
2958
2959 hres = IHTMLElement_get_style(elem, &style);
2960 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2961
2963 test_text_decoration(runtime_style, NULL);
2964 set_text_decoration(style, "underline");
2965 test_text_decoration(style, "underline");
2966
2967 hres = IHTMLStyle_get_textDecoration(style, &str);
2968 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2969 ok(broken(!str) || !strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2971
2972 set_text_decoration(runtime_style, "blink");
2973 test_text_decoration(runtime_style, "blink");
2974
2975 hres = IHTMLStyle_get_textDecoration(style, &str);
2976 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2977 todo_wine
2978 ok(!strcmp_wa(str, "underline"), "textDecoration = %s\n", wine_dbgstr_w(str));
2980
2981 IHTMLStyle_Release(runtime_style);
2982 IHTMLStyle_Release(style);
2983 IHTMLElement2_Release(elem2);
2984 IHTMLElement_Release(elem);
2985}
2986
2987static IHTMLDocument2 *notif_doc;
2989
2990static IHTMLDocument2 *create_document(void)
2991{
2992 IHTMLDocument2 *doc;
2993 IHTMLDocument5 *doc5;
2994 HRESULT hres;
2995
2996 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2997 &IID_IHTMLDocument2, (void**)&doc);
2998 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2999 if(FAILED(hres))
3000 return NULL;
3001
3002 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
3003 if(FAILED(hres)) {
3004 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3005 IHTMLDocument2_Release(doc);
3006 return NULL;
3007 }
3008
3009 IHTMLDocument5_Release(doc5);
3010 return doc;
3011}
3012
3014 REFIID riid, void**ppv)
3015{
3017 *ppv = iface;
3018 return S_OK;
3019 }
3020
3021 ok(0, "unexpected call\n");
3022 return E_NOINTERFACE;
3023}
3024
3026{
3027 return 2;
3028}
3029
3031{
3032 return 1;
3033}
3034
3036{
3037 if(dispID == DISPID_READYSTATE){
3038 BSTR state;
3039 HRESULT hres;
3040
3041 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
3042 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3043
3044 if(!strcmp_wa(state, "complete"))
3046
3048 }
3049
3050 return S_OK;
3051}
3052
3054{
3055 ok(0, "unexpected call\n");
3056 return E_NOTIMPL;
3057}
3058
3059static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
3065};
3066
3068
3069static IHTMLDocument2 *create_doc_with_string(const char *str)
3070{
3072 IStream *stream;
3073 IHTMLDocument2 *doc;
3074 HGLOBAL mem;
3075 SIZE_T len;
3076
3077 notif_doc = doc = create_document();
3078 if(!doc)
3079 return NULL;
3080
3082 len = strlen(str);
3083 mem = GlobalAlloc(0, len);
3084 memcpy(mem, str, len);
3086
3087 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
3088
3089 IPersistStreamInit_Load(init, stream);
3090 IPersistStreamInit_Release(init);
3091 IStream_Release(stream);
3092
3093 return doc;
3094}
3095
3096static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
3097{
3100 DWORD cookie;
3101 HRESULT hres;
3102
3103 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
3104 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3105
3106 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3107 IConnectionPointContainer_Release(container);
3108 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3109
3110 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
3111 IConnectionPoint_Release(cp);
3112 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3113}
3114
3115typedef void (*style_test_t)(IHTMLDocument2*);
3116
3117static void run_test(const char *str, style_test_t test)
3118{
3119 IHTMLDocument2 *doc;
3120 ULONG ref;
3121 MSG msg;
3122
3124 if(!doc)
3125 return;
3126
3128
3129 while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
3132 }
3133
3134 test(doc);
3135
3136 ref = IHTMLDocument2_Release(doc);
3137 ok(!ref || broken(ref == 1), /* Vista */
3138 "ref = %d\n", ref);
3139}
3140
3141
3143{
3145
3148
3150}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define broken(x)
Definition: _sntprintf.h:21
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Arabic default style
Definition: afstyles.h:94
static int state
Definition: maze.c:121
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
r l[0]
Definition: byte_order.h:168
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_ERROR
Definition: compat.h:2305
@ VT_I4
Definition: compat.h:2298
@ VT_EMPTY
Definition: compat.h:2295
const WCHAR * text
Definition: package.c:1799
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLdouble * v
Definition: gl.h:2040
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define DISPID_READYSTATE
Definition: idispids.h:22
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define f
Definition: ke_i.h:83
#define b
Definition: ke_i.h:79
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
POINT cp
Definition: magnifier.c:59
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT hres
Definition: protocol.c:465
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
#define test_current_style_filter(a, b)
Definition: style.c:2550
#define get_current_style(e)
Definition: style.c:117
static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
Definition: style.c:137
static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
Definition: style.c:3059
#define set_text_decoration(a, b)
Definition: style.c:280
static void test_style3(IHTMLStyle3 *style3)
Definition: style.c:442
static void basic_style_test(IHTMLDocument2 *doc)
Definition: style.c:2912
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
Definition: style.c:3035
static void test_style4(IHTMLStyle4 *style4)
Definition: style.c:496
static void test_style5(IHTMLStyle5 *style5)
Definition: style.c:522
static IHTMLCurrentStyle * _get_current_style(unsigned line, IHTMLElement *elem)
Definition: style.c:118
static void _test_text_decoration(unsigned line, IHTMLStyle *style, const char *exdec)
Definition: style.c:293
static void test_style_filters(IHTMLElement *elem)
Definition: style.c:2580
#define test_style_remove_attribute(a, b, c)
Definition: style.c:267
#define test_style_set_csstext(s, t)
Definition: style.c:255
static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
Definition: style.c:256
static BOOL wstr_contains(const WCHAR *strw, const char *stra)
Definition: style.c:28
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
Definition: style.c:3025
static void test_style2(IHTMLStyle2 *style2)
Definition: style.c:321
static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
Definition: style.c:2568
static IHTMLCurrentStyle2 * _get_current_style2_iface(unsigned line, IUnknown *unk)
Definition: style.c:88
static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
Definition: style.c:67
#define test_border_styles(p, n)
Definition: style.c:136
static BSTR a2bstr(const char *str)
Definition: style.c:35
void(* style_test_t)(IHTMLDocument2 *)
Definition: style.c:3115
static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: style.c:21
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
Definition: style.c:3053
static IHTMLDocument2 * create_document(void)
Definition: style.c:2990
static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
Definition: style.c:2551
#define test_style_csstext(s, t)
Definition: style.c:239
static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
Definition: style.c:3096
#define get_current_style2_iface(u)
Definition: style.c:87
#define test_style_filter(a, b)
Definition: style.c:2533
#define test_var_bstr(a, b)
Definition: style.c:66
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
Definition: style.c:3030
static void test_current_style(IHTMLCurrentStyle *current_style)
Definition: style.c:2621
#define set_style_filter(a, b)
Definition: style.c:2567
static IHTMLElement * get_element_by_id(IHTMLDocument2 *doc, const char *id)
Definition: style.c:98
static void _set_text_decoration(unsigned line, IHTMLStyle *style, const char *v)
Definition: style.c:281
static BOOL doc_complete
Definition: style.c:2988
static const WCHAR * strstr_wa(const WCHAR *str, const char *suba)
Definition: style.c:50
static IHTMLDocument2 * create_doc_with_string(const char *str)
Definition: style.c:3069
#define get_elem2_iface(u)
Definition: style.c:76
static void test_set_csstext(IHTMLStyle *style)
Definition: style.c:307
static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface, REFIID riid, void **ppv)
Definition: style.c:3013
static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
Definition: style.c:268
static void test_body_style(IHTMLStyle *style)
Definition: style.c:689
static const char basic_test_str[]
Definition: style.c:2910
static void runtimestyle_test(IHTMLDocument2 *doc)
Definition: style.c:2943
static void test_style6(IHTMLStyle6 *style)
Definition: style.c:649
static const char runtimestyle_test_str[]
Definition: style.c:2940
static IHTMLDocument2 * notif_doc
Definition: style.c:2987
static IHTMLElement2 * _get_elem2_iface(unsigned line, IUnknown *unk)
Definition: style.c:77
static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
Definition: style.c:240
static IPropertyNotifySink PropertyNotifySink
Definition: style.c:3067
#define test_text_decoration(a, b)
Definition: style.c:292
static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
Definition: style.c:2534
#define todo_wine
Definition: custom.c:79
static size_t elem
Definition: string.c:68
static VARIANTARG static DISPID
Definition: ordinal.c:52
#define run_test(test)
Definition: ms_seh.c:71
#define LOCALE_USER_DEFAULT
#define LOCALE_SYSTEM_DEFAULT
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_I4(A)
Definition: oleauto.h:247
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007
const GUID IID_IConnectionPointContainer
const GUID IID_IPropertyNotifySink
const GUID IID_IPersistStreamInit
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
#define test
Definition: rosglue.h:37
const WCHAR * str
#define win_skip
Definition: test.h:160
Definition: cookie.c:202
Definition: cookie.c:34
Definition: parser.c:49
Definition: mem.c:156
Definition: send.c:48
Definition: parse.h:23
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
int ret
void * arg
Definition: msvc.h:10
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365
static int init
Definition: wintirpc.c:33
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175