2 * Copyright 2007-2011 Jacek Caban for CodeWeavers
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.
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.
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
22 #include <wine/test.h>
33 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
36 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
37 return lstrcmpA(stra
, buf
);
40 static BSTR
a2bstr(const char *str
)
48 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
49 ret
= SysAllocStringLen(NULL
, len
);
50 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
55 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
56 static IHTMLElement2
*_get_elem2_iface(unsigned line
, IUnknown
*unk
)
61 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLElement2
, (void**)&elem
);
62 ok_(__FILE__
,line
) (hres
== S_OK
, "Could not get IHTMLElement2: %08x\n", hres
);
66 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
71 BSTR idW
= a2bstr(id
);
73 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
74 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
76 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
77 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
78 ok(result
!= NULL
, "result == NULL\n");
81 IHTMLDocument3_Release(doc3
);
85 #define get_current_style(e) _get_current_style(__LINE__,e)
86 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
88 IHTMLCurrentStyle
*cstyle
;
92 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
93 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
96 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
97 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
98 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
100 IHTMLElement2_Release(elem2
);
104 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
105 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
110 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
111 LOCALE_USER_DEFAULT
, &dispid
);
112 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
115 DISPPARAMS params
= {NULL
,NULL
,0,0};
116 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
121 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
122 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
123 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
126 params
.cNamedArgs
= 1;
127 params
.rgdispidNamedArgs
= &dispidNamed
;
128 V_VT(&arg
) = VT_BSTR
;
129 V_BSTR(&arg
) = a2bstr("none");
130 params
.rgvarg
= &arg
;
131 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
132 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
133 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
136 V_VT(&arg
) = VT_BSTR
;
137 V_BSTR(&arg
) = a2bstr("dotted");
138 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
139 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
140 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
143 V_VT(&arg
) = VT_BSTR
;
144 V_BSTR(&arg
) = a2bstr("dashed");
145 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
146 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
147 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
150 V_VT(&arg
) = VT_BSTR
;
151 V_BSTR(&arg
) = a2bstr("solid");
152 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
153 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
154 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
157 V_VT(&arg
) = VT_BSTR
;
158 V_BSTR(&arg
) = a2bstr("double");
159 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
160 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
161 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
164 V_VT(&arg
) = VT_BSTR
;
165 V_BSTR(&arg
) = a2bstr("groove");
166 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
167 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
168 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
171 V_VT(&arg
) = VT_BSTR
;
172 V_BSTR(&arg
) = a2bstr("ridge");
173 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
174 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
175 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
178 V_VT(&arg
) = VT_BSTR
;
179 V_BSTR(&arg
) = a2bstr("inset");
180 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
181 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
182 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
185 V_VT(&arg
) = VT_BSTR
;
186 V_BSTR(&arg
) = a2bstr("outset");
187 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
188 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
189 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
192 V_VT(&arg
) = VT_BSTR
;
193 V_BSTR(&arg
) = a2bstr("invalid");
194 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
195 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
196 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
199 params
.rgvarg
= &vDefault
;
200 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
201 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
202 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
203 VariantClear(&vDefault
);
207 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
208 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
210 BSTR text
= (void*)0xdeadbeef;
213 hres
= IHTMLStyle_get_cssText(style
, &text
);
214 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
216 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
218 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
223 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
224 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
230 hres
= IHTMLStyle_put_cssText(style
, tmp
);
231 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
235 static void test_set_csstext(IHTMLStyle
*style
)
240 test_style_set_csstext(style
, "background-color: black;");
242 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
243 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
244 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
245 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
249 static void test_style2(IHTMLStyle2
*style2
)
255 str
= (void*)0xdeadbeef;
256 hres
= IHTMLStyle2_get_position(style2
, &str
);
257 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
258 ok(!str
, "str != NULL\n");
260 str
= a2bstr("absolute");
261 hres
= IHTMLStyle2_put_position(style2
, str
);
262 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
266 hres
= IHTMLStyle2_get_position(style2
, &str
);
267 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
268 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
273 hres
= IHTMLStyle2_get_right(style2
, &v
);
274 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
275 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
276 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
280 V_BSTR(&v
) = a2bstr("3px");
281 hres
= IHTMLStyle2_put_right(style2
, v
);
282 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
286 hres
= IHTMLStyle2_get_right(style2
, &v
);
287 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
288 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
289 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
293 str
= (void*)0xdeadbeef;
294 hres
= IHTMLStyle2_get_direction(style2
, &str
);
295 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
296 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
299 hres
= IHTMLStyle2_put_direction(style2
, str
);
300 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
304 hres
= IHTMLStyle2_get_direction(style2
, &str
);
305 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
306 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
310 static void test_style3(IHTMLStyle3
*style3
)
315 str
= (void*)0xdeadbeef;
316 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
317 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
318 ok(!str
, "str != NULL\n");
320 str
= a2bstr("break-word");
321 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
322 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
326 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
327 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
328 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
332 static void test_style4(IHTMLStyle4
*style4
)
338 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
339 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
342 V_BSTR(&v
) = a2bstr("10px");
343 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
344 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
347 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
348 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
349 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
350 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
353 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
354 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
355 VariantClear(&vdefault
);
358 static void test_body_style(IHTMLStyle
*style
)
368 BSTR sOverflowDefault
;
372 test_style_csstext(style
, NULL
);
374 hres
= IHTMLStyle_get_position(style
, &str
);
375 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
376 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
379 hres
= IHTMLStyle_get_marginRight(style
, &v
);
380 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
381 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
382 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
386 hres
= IHTMLStyle_put_marginRight(style
, v
);
387 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
390 hres
= IHTMLStyle_get_marginRight(style
, &v
);
391 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
392 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
393 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
396 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
397 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
398 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
399 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
403 hres
= IHTMLStyle_put_marginBottom(style
, v
);
404 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
407 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
408 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
409 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
410 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
413 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
414 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
415 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
416 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
420 hres
= IHTMLStyle_put_marginLeft(style
, v
);
421 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
424 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
425 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
426 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
427 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
429 str
= (void*)0xdeadbeef;
430 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
431 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
432 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
434 str
= (void*)0xdeadbeef;
435 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
436 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
437 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
439 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
440 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
442 str
= a2bstr("test");
443 hres
= IHTMLStyle_put_fontWeight(style
, str
);
444 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
447 str
= a2bstr("bold");
448 hres
= IHTMLStyle_put_fontWeight(style
, str
);
449 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
452 str
= a2bstr("bolder");
453 hres
= IHTMLStyle_put_fontWeight(style
, str
);
454 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
457 str
= a2bstr("lighter");
458 hres
= IHTMLStyle_put_fontWeight(style
, str
);
459 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
463 hres
= IHTMLStyle_put_fontWeight(style
, str
);
464 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
468 hres
= IHTMLStyle_put_fontWeight(style
, str
);
469 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
473 hres
= IHTMLStyle_put_fontWeight(style
, str
);
474 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
478 hres
= IHTMLStyle_put_fontWeight(style
, str
);
479 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
483 hres
= IHTMLStyle_put_fontWeight(style
, str
);
484 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
488 hres
= IHTMLStyle_put_fontWeight(style
, str
);
489 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
493 hres
= IHTMLStyle_put_fontWeight(style
, str
);
494 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
498 hres
= IHTMLStyle_put_fontWeight(style
, str
);
499 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
503 hres
= IHTMLStyle_put_fontWeight(style
, str
);
504 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
507 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
508 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
509 ok(!strcmp_wa(str
, "900"), "str != style900\n");
512 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
513 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
514 SysFreeString(sDefault
);
517 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
518 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
520 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
521 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
523 str
= a2bstr("test");
524 hres
= IHTMLStyle_put_fontVariant(style
, str
);
525 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
528 str
= a2bstr("small-caps");
529 hres
= IHTMLStyle_put_fontVariant(style
, str
);
530 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
533 str
= a2bstr("normal");
534 hres
= IHTMLStyle_put_fontVariant(style
, str
);
535 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
538 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
539 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
540 SysFreeString(sDefault
);
542 str
= (void*)0xdeadbeef;
543 hres
= IHTMLStyle_get_display(style
, &str
);
544 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
545 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
547 str
= (void*)0xdeadbeef;
548 hres
= IHTMLStyle_get_visibility(style
, &str
);
549 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
550 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
553 hres
= IHTMLStyle_get_fontSize(style
, &v
);
554 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
555 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
556 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
560 hres
= IHTMLStyle_put_fontSize(style
, v
);
561 ok(hres
== S_OK
, "put_fontSize failed: %08x\n", hres
);
564 hres
= IHTMLStyle_get_fontSize(style
, &v
);
565 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
566 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
567 ok(!strcmp_wa(V_BSTR(&v
), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
570 hres
= IHTMLStyle_get_color(style
, &v
);
571 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
572 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
573 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
577 hres
= IHTMLStyle_put_color(style
, v
);
578 ok(hres
== S_OK
, "put_color failed: %08x\n", hres
);
581 hres
= IHTMLStyle_get_color(style
, &v
);
582 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
583 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
585 ok(!strcmp_wa(V_BSTR(&v
), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
588 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
589 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
590 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
592 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
593 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
594 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
596 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
597 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
598 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
600 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
601 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
604 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
605 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
606 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
608 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
609 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
610 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
612 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
613 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
614 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
616 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
617 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
620 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
621 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
622 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
624 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
625 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
626 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
628 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
629 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
630 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
632 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
633 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
636 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
637 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
638 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
640 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
641 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
642 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
644 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
645 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
646 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
648 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
649 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
652 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
653 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
654 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
656 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
657 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
658 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
660 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
661 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
662 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
664 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
665 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
667 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
668 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
670 str
= a2bstr("invalid");
671 hres
= IHTMLStyle_put_textDecoration(style
, str
);
672 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
675 str
= a2bstr("none");
676 hres
= IHTMLStyle_put_textDecoration(style
, str
);
677 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
680 str
= a2bstr("underline");
681 hres
= IHTMLStyle_put_textDecoration(style
, str
);
682 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
685 str
= a2bstr("overline");
686 hres
= IHTMLStyle_put_textDecoration(style
, str
);
687 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
690 str
= a2bstr("line-through");
691 hres
= IHTMLStyle_put_textDecoration(style
, str
);
692 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
695 str
= a2bstr("blink");
696 hres
= IHTMLStyle_put_textDecoration(style
, str
);
697 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
700 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
701 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
702 ok(!strcmp_wa(str
, "blink"), "str != blink\n");
705 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
706 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
707 SysFreeString(sDefault
);
709 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
710 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
712 hres
= IHTMLStyle_get_posWidth(style
, &f
);
713 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
714 ok(f
== 0.0f
, "f = %f\n", f
);
717 hres
= IHTMLStyle_get_width(style
, &v
);
718 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
719 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
720 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
722 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
723 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
725 hres
= IHTMLStyle_get_posWidth(style
, &f
);
726 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
732 V_BSTR(&v
) = a2bstr("auto");
733 hres
= IHTMLStyle_put_width(style
, v
);
734 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
738 hres
= IHTMLStyle_get_width(style
, &v
);
739 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
740 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
741 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
746 hres
= IHTMLStyle_put_width(style
, v
);
747 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
750 hres
= IHTMLStyle_get_width(style
, &v
);
751 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
752 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
753 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
757 str
= (void*)0xdeadbeef;
758 hres
= IHTMLStyle_get_margin(style
, &str
);
759 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
760 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
763 hres
= IHTMLStyle_put_margin(style
, str
);
764 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
767 hres
= IHTMLStyle_get_margin(style
, &str
);
768 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
769 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
772 hres
= IHTMLStyle_put_margin(style
, NULL
);
773 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
775 str
= (void*)0xdeadbeef;
776 hres
= IHTMLStyle_get_marginTop(style
, &v
);
777 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
778 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
779 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
782 V_BSTR(&v
) = a2bstr("6px");
783 hres
= IHTMLStyle_put_marginTop(style
, v
);
784 SysFreeString(V_BSTR(&v
));
785 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
787 str
= (void*)0xdeadbeef;
788 hres
= IHTMLStyle_get_marginTop(style
, &v
);
789 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
790 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
791 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
796 hres
= IHTMLStyle_put_marginTop(style
, v
);
797 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
799 str
= (void*)0xdeadbeef;
800 hres
= IHTMLStyle_get_marginTop(style
, &v
);
801 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
802 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
803 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
807 hres
= IHTMLStyle_get_border(style
, &str
);
808 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
809 ok(!str
|| !*str
, "str is not empty\n");
813 hres
= IHTMLStyle_put_border(style
, str
);
814 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
818 hres
= IHTMLStyle_get_left(style
, &v
);
819 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
820 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
821 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
825 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
826 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
829 hres
= IHTMLStyle_get_posLeft(style
, &f
);
830 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
831 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
833 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
834 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
836 hres
= IHTMLStyle_get_posLeft(style
, &f
);
837 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
840 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
842 /* Ensure left is updated correctly. */
844 hres
= IHTMLStyle_get_left(style
, &v
);
845 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
846 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
847 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
848 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
849 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
854 V_BSTR(&v
) = a2bstr("3px");
855 hres
= IHTMLStyle_put_left(style
, v
);
856 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
859 hres
= IHTMLStyle_get_posLeft(style
, &f
);
860 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
861 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
864 hres
= IHTMLStyle_get_left(style
, &v
);
865 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
866 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
867 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
871 hres
= IHTMLStyle_put_left(style
, v
);
872 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
875 hres
= IHTMLStyle_get_left(style
, &v
);
876 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
877 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
878 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
882 hres
= IHTMLStyle_get_top(style
, &v
);
883 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
884 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
885 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
889 hres
= IHTMLStyle_get_posTop(style
, NULL
);
890 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
893 hres
= IHTMLStyle_get_posTop(style
, &f
);
894 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
895 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
897 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
898 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
900 hres
= IHTMLStyle_get_posTop(style
, &f
);
901 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
904 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
907 V_BSTR(&v
) = a2bstr("3px");
908 hres
= IHTMLStyle_put_top(style
, v
);
909 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
913 hres
= IHTMLStyle_get_top(style
, &v
);
914 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
915 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
916 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
919 hres
= IHTMLStyle_get_posTop(style
, &f
);
920 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
921 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
924 hres
= IHTMLStyle_put_top(style
, v
);
925 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
928 hres
= IHTMLStyle_get_top(style
, &v
);
929 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
930 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
931 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
935 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
936 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
939 hres
= IHTMLStyle_get_height(style
, &v
);
940 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
941 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
942 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
946 hres
= IHTMLStyle_get_posHeight(style
, &f
);
947 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
948 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
950 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
951 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
953 hres
= IHTMLStyle_get_posHeight(style
, &f
);
954 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
957 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
960 V_BSTR(&v
) = a2bstr("70px");
961 hres
= IHTMLStyle_put_height(style
, v
);
962 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
966 hres
= IHTMLStyle_get_height(style
, &v
);
967 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
968 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
969 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
974 hres
= IHTMLStyle_put_height(style
, v
);
975 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
978 hres
= IHTMLStyle_get_height(style
, &v
);
979 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
980 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
981 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
984 hres
= IHTMLStyle_get_posHeight(style
, &f
);
985 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
986 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
988 str
= (void*)0xdeadbeef;
989 hres
= IHTMLStyle_get_cursor(style
, &str
);
990 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
991 ok(!str
, "get_cursor != NULL\n");
994 str
= a2bstr("default");
995 hres
= IHTMLStyle_put_cursor(style
, str
);
996 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
1000 hres
= IHTMLStyle_get_cursor(style
, &str
);
1001 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1002 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1005 V_VT(&v
) = VT_EMPTY
;
1006 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1007 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
1008 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1009 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
1013 V_BSTR(&v
) = a2bstr("middle");
1014 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
1015 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
1018 V_VT(&v
) = VT_EMPTY
;
1019 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
1020 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1021 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1022 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1025 str
= (void*)0xdeadbeef;
1026 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1027 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1028 ok(!str
, "textAlign != NULL\n");
1030 str
= a2bstr("center");
1031 hres
= IHTMLStyle_put_textAlign(style
, str
);
1032 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1036 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1037 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1038 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1041 str
= (void*)0xdeadbeef;
1042 hres
= IHTMLStyle_get_filter(style
, &str
);
1043 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1044 ok(!str
, "filter != NULL\n");
1046 str
= a2bstr("alpha(opacity=100)");
1047 hres
= IHTMLStyle_put_filter(style
, str
);
1048 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1051 V_VT(&v
) = VT_EMPTY
;
1052 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1053 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1054 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1055 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1059 V_BSTR(&v
) = a2bstr("1");
1060 hres
= IHTMLStyle_put_zIndex(style
, v
);
1061 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1064 V_VT(&v
) = VT_EMPTY
;
1065 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1066 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1067 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1068 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1072 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1073 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1075 str
= a2bstr("test");
1076 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1077 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1080 str
= a2bstr("italic");
1081 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1082 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1085 str
= a2bstr("oblique");
1086 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1087 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1090 str
= a2bstr("normal");
1091 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1092 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1095 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1096 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1097 SysFreeString(sDefault
);
1100 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1101 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1103 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1104 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1106 str
= a2bstr("test");
1107 hres
= IHTMLStyle_put_overflow(style
, str
);
1108 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1111 str
= a2bstr("visible");
1112 hres
= IHTMLStyle_put_overflow(style
, str
);
1113 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1116 str
= a2bstr("scroll");
1117 hres
= IHTMLStyle_put_overflow(style
, str
);
1118 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1121 str
= a2bstr("hidden");
1122 hres
= IHTMLStyle_put_overflow(style
, str
);
1123 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1126 str
= a2bstr("auto");
1127 hres
= IHTMLStyle_put_overflow(style
, str
);
1128 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1131 hres
= IHTMLStyle_get_overflow(style
, &str
);
1132 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1133 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1137 hres
= IHTMLStyle_put_overflow(style
, str
);
1138 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1141 hres
= IHTMLStyle_get_overflow(style
, &str
);
1142 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1143 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1146 /* restore overflow default */
1147 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1148 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1149 SysFreeString(sOverflowDefault
);
1151 /* Attribute Tests*/
1152 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1153 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1155 str
= a2bstr("position");
1156 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1157 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1159 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1160 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1161 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1164 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1165 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1168 V_BSTR(&v
) = a2bstr("absolute");
1169 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1170 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1173 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1174 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1175 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1176 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1181 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1182 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1187 str
= a2bstr("borderLeftStyle");
1188 test_border_styles(style
, str
);
1191 str
= a2bstr("borderbottomstyle");
1192 test_border_styles(style
, str
);
1195 str
= a2bstr("borderrightstyle");
1196 test_border_styles(style
, str
);
1199 str
= a2bstr("bordertopstyle");
1200 test_border_styles(style
, str
);
1203 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1204 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1206 str
= a2bstr("none dotted dashed solid");
1207 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1208 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1211 str
= a2bstr("none dotted dashed solid");
1212 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1213 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1214 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1215 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1218 str
= a2bstr("double groove ridge inset");
1219 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1220 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1223 str
= a2bstr("window-inset outset ridge inset");
1224 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1225 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1228 str
= a2bstr("window-inset");
1229 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1230 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1233 str
= a2bstr("none none none none none");
1234 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1235 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1238 str
= a2bstr("invalid none none none");
1239 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1240 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1243 str
= a2bstr("none invalid none none");
1244 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1245 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1248 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1249 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1250 SysFreeString(sDefault
);
1252 /* backgoundColor */
1253 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1254 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1255 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1256 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1260 hres
= IHTMLStyle_get_padding(style
, &str
);
1261 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1262 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1265 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1266 ok(hres
== S_OK
, "get_paddingTop: %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) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1272 hres
= IHTMLStyle_put_paddingTop(style
, v
);
1273 ok(hres
== S_OK
, "put_paddingTop failed: %08x\n", hres
);
1275 hres
= IHTMLStyle_get_paddingTop(style
, &v
);
1276 ok(hres
== S_OK
, "get_paddingTop: %08x\n", hres
);
1277 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1278 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1281 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1282 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1283 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1284 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1288 hres
= IHTMLStyle_put_paddingRight(style
, v
);
1289 ok(hres
== S_OK
, "put_paddingRight failed: %08x\n", hres
);
1291 hres
= IHTMLStyle_get_paddingRight(style
, &v
);
1292 ok(hres
== S_OK
, "get_paddingRight: %08x\n", hres
);
1293 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1294 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1297 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1298 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1299 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1300 ok(!V_BSTR(&v
), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1304 hres
= IHTMLStyle_put_paddingBottom(style
, v
);
1305 ok(hres
== S_OK
, "put_paddingBottom failed: %08x\n", hres
);
1307 hres
= IHTMLStyle_get_paddingBottom(style
, &v
);
1308 ok(hres
== S_OK
, "get_paddingBottom: %08x\n", hres
);
1309 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1310 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1314 hres
= IHTMLStyle_put_padding(style
, str
);
1315 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1318 hres
= IHTMLStyle_get_padding(style
, &str
);
1319 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1320 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1324 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1325 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1326 ok(V_VT(&vDefault
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&vDefault
));
1327 ok(!strcmp_wa(V_BSTR(&vDefault
), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault
)));
1330 V_BSTR(&v
) = a2bstr("10");
1331 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1332 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1335 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1336 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1337 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1340 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1341 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1343 /* BackgroundRepeat */
1344 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1345 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1347 str
= a2bstr("invalid");
1348 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1349 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1352 str
= a2bstr("repeat");
1353 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1354 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1357 str
= a2bstr("no-repeat");
1358 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1359 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1362 str
= a2bstr("repeat-x");
1363 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1364 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1367 str
= a2bstr("repeat-y");
1368 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1369 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1372 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1373 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1374 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1377 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1378 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1379 SysFreeString(sDefault
);
1382 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1383 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1385 str
= a2bstr("red green red blue");
1386 hres
= IHTMLStyle_put_borderColor(style
, str
);
1387 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1390 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1391 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1392 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1395 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1396 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1397 SysFreeString(sDefault
);
1400 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1401 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1403 str
= a2bstr("thick dotted red");
1404 hres
= IHTMLStyle_put_borderRight(style
, str
);
1405 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1408 /* IHTMLStyle_get_borderRight appears to have a bug where
1409 it returns the first letter of the color. So we check
1410 each style individually.
1413 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1414 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1415 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1419 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1420 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1421 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1424 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1425 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1426 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1429 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1430 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1431 SysFreeString(sDefault
);
1434 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1435 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1437 str
= a2bstr("thick dotted red");
1438 hres
= IHTMLStyle_put_borderTop(style
, str
);
1439 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1442 /* IHTMLStyle_get_borderTop appears to have a bug where
1443 it returns the first letter of the color. So we check
1444 each style individually.
1447 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1448 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1449 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1453 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1454 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1455 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1458 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1459 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1460 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1463 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1464 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1465 SysFreeString(sDefault
);
1468 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1469 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1471 str
= a2bstr("thick dotted red");
1472 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1473 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1476 /* IHTMLStyle_get_borderBottom appears to have a bug where
1477 it returns the first letter of the color. So we check
1478 each style individually.
1481 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1482 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1483 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1487 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1488 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1489 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1492 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1493 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1494 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1497 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1498 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1499 SysFreeString(sDefault
);
1502 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1503 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1505 str
= a2bstr("thick dotted red");
1506 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1507 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1510 /* IHTMLStyle_get_borderLeft appears to have a bug where
1511 it returns the first letter of the color. So we check
1512 each style individually.
1515 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1516 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1517 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1521 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1522 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1523 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1526 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1527 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1528 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1531 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1532 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1533 SysFreeString(sDefault
);
1535 /* backgroundPositionX */
1536 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1537 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1538 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1539 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1543 V_BSTR(&v
) = a2bstr("10px");
1544 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1545 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1548 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1549 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1550 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1551 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1554 /* backgroundPositionY */
1555 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1556 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1557 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1561 V_BSTR(&v
) = a2bstr("15px");
1562 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
1563 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
1566 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1567 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1568 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1569 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1572 /* backgroundPosition */
1574 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1575 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1576 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1579 str
= a2bstr("center 20%");
1580 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
1581 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
1585 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1586 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1587 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1590 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1591 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1592 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1593 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1596 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1597 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1598 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1599 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1602 /* borderTopWidth */
1603 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
1604 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1607 V_BSTR(&v
) = a2bstr("10px");
1608 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
1609 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1612 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1613 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1614 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1617 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
1618 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1619 VariantClear(&vDefault
);
1621 /* borderRightWidth */
1622 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
1623 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1626 V_BSTR(&v
) = a2bstr("10");
1627 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
1628 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1631 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1632 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1633 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1636 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
1637 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1638 VariantClear(&vDefault
);
1640 /* borderBottomWidth */
1641 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
1642 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1645 V_BSTR(&v
) = a2bstr("10");
1646 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
1647 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1650 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1651 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1652 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1655 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
1656 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1657 VariantClear(&vDefault
);
1659 /* borderLeftWidth */
1660 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
1661 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1664 V_BSTR(&v
) = a2bstr("10");
1665 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
1666 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1669 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1670 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1671 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1674 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
1675 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1676 VariantClear(&vDefault
);
1679 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
1680 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1683 V_BSTR(&v
) = a2bstr("10");
1684 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
1685 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1688 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
1689 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1690 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1691 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1694 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
1695 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1696 VariantClear(&vDefault
);
1699 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
1700 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1703 V_BSTR(&v
) = a2bstr("11");
1704 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
1705 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1708 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
1709 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1710 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1711 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1714 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
1715 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1716 VariantClear(&vDefault
);
1718 /* borderTopColor */
1719 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
1720 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1723 V_BSTR(&v
) = a2bstr("red");
1724 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
1725 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1728 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1729 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1730 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1733 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
1734 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1736 /* borderRightColor */
1737 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
1738 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1741 V_BSTR(&v
) = a2bstr("blue");
1742 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
1743 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
1746 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1747 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1748 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1751 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
1752 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
1754 /* borderBottomColor */
1755 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
1756 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1759 V_BSTR(&v
) = a2bstr("cyan");
1760 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
1761 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1764 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1765 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1766 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1769 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
1770 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1772 /* borderLeftColor */
1773 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
1774 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1777 V_BSTR(&v
) = a2bstr("cyan");
1778 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
1779 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1782 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1783 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1784 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1787 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
1788 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1791 hres
= IHTMLStyle_get_clip(style
, &str
);
1792 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1793 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
1795 str
= a2bstr("rect(0px 1px 500px 505px)");
1796 hres
= IHTMLStyle_put_clip(style
, str
);
1797 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
1800 hres
= IHTMLStyle_get_clip(style
, &str
);
1801 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1802 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
1805 /* pageBreakAfter */
1806 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1807 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1808 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1810 str
= a2bstr("always");
1811 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
1812 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
1815 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1816 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1817 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1820 /* pageBreakBefore */
1821 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1822 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1823 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1825 str
= a2bstr("always");
1826 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
1827 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
1830 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1831 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1832 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1835 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
1836 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
1837 if(SUCCEEDED(hres
)) {
1838 test_style2(style2
);
1839 IHTMLStyle2_Release(style2
);
1842 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
1843 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
1844 if(SUCCEEDED(hres
)) {
1845 test_style3(style3
);
1846 IHTMLStyle3_Release(style3
);
1849 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
1850 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
1851 if(SUCCEEDED(hres
)) {
1852 test_style4(style4
);
1853 IHTMLStyle4_Release(style4
);
1857 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1858 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
1863 str
= (void*)0xdeadbeef;
1864 hres
= IHTMLStyle_get_filter(style
, &str
);
1865 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1867 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
1869 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
1874 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
1875 static void _test_current_style_filter(unsigned line
, IHTMLCurrentStyle2
*style
, const char *exval
)
1880 str
= (void*)0xdeadbeef;
1881 hres
= IHTMLCurrentStyle2_get_filter(style
, &str
);
1882 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1884 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
1886 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
1891 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1892 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
1894 BSTR str
= a2bstr(val
);
1897 hres
= IHTMLStyle_put_filter(style
, str
);
1898 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1901 _test_style_filter(line
, style
, val
);
1904 static void test_style_filters(IHTMLElement
*elem
)
1906 IHTMLElement2
*elem2
= get_elem2_iface((IUnknown
*)elem
);
1907 IHTMLCurrentStyle2
*current_style2
;
1908 IHTMLCurrentStyle
*current_style
;
1912 hres
= IHTMLElement_get_style(elem
, &style
);
1913 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1915 hres
= IHTMLElement2_get_currentStyle(elem2
, ¤t_style
);
1916 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1918 hres
= IHTMLCurrentStyle_QueryInterface(current_style
, &IID_IHTMLCurrentStyle2
, (void**)¤t_style2
);
1919 IHTMLCurrentStyle_Release(current_style
);
1920 ok(hres
== S_OK
, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres
);
1922 test_style_filter(style
, NULL
);
1923 test_current_style_filter(current_style2
, NULL
);
1924 set_style_filter(style
, "alpha(opacity=50.0040)");
1925 test_current_style_filter(current_style2
, "alpha(opacity=50.0040)");
1926 set_style_filter(style
, "alpha(opacity=100)");
1928 IHTMLStyle_Release(style
);
1930 hres
= IHTMLElement_get_style(elem
, &style
);
1931 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1933 test_style_filter(style
, "alpha(opacity=100)");
1934 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
1935 set_style_filter(style
, NULL
);
1937 IHTMLCurrentStyle2_Release(current_style2
);
1938 IHTMLStyle_Release(style
);
1939 IHTMLElement2_Release(elem2
);
1942 static void test_current_style(IHTMLCurrentStyle
*current_style
)
1948 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
1949 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
1950 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
1953 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
1954 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
1955 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
1958 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
1959 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
1962 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
1963 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1964 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
1967 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
1968 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
1969 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
1972 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
1973 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
1974 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
1977 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
1978 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1979 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
1982 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
1983 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1984 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
1987 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
1988 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1989 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
1992 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
1993 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1994 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
1997 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
1998 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1999 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
2002 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
2003 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
2004 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
2007 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
2008 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
2009 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
2012 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
2013 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
2014 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
2017 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
2018 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
2021 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
2022 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
2025 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
2026 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
2029 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
2030 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
2033 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
2034 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
2037 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
2038 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
2041 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
2042 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
2045 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
2046 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
2047 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2048 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
2051 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
2052 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
2053 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2056 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
2057 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
2058 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2061 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
2062 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
2063 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2066 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
2067 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
2068 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2071 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
2072 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
2073 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2076 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
2077 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
2078 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2081 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
2082 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
2083 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
2084 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
2087 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
2088 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
2089 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2090 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
2093 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
2094 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
2095 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2098 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
2099 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
2100 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2103 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
2104 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
2105 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2109 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
2110 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
2111 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2114 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2115 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2116 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2119 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2120 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2121 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2124 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2125 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2126 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2129 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2130 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2131 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2134 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2135 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2136 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2139 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2140 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2141 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2144 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2145 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2146 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2149 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2150 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2151 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2154 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2155 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2156 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2159 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2160 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2161 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2164 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2165 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2166 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2169 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2170 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2171 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2174 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2175 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2176 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2179 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2180 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2181 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2184 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2185 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2186 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2189 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2190 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2191 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2194 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2195 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2196 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2199 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2200 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2201 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2205 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2207 static void basic_style_test(IHTMLDocument2
*doc
)
2209 IHTMLCurrentStyle
*cstyle
;
2214 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2215 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2217 hres
= IHTMLElement_get_style(elem
, &style
);
2218 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2220 test_body_style(style
);
2222 cstyle
= get_current_style(elem
);
2223 test_current_style(cstyle
);
2224 IHTMLCurrentStyle_Release(cstyle
);
2225 IHTMLElement_Release(elem
);
2227 elem
= get_element_by_id(doc
, "divid");
2228 test_style_filters(elem
);
2230 test_set_csstext(style
);
2231 IHTMLStyle_Release(style
);
2232 IHTMLElement_Release(elem
);
2235 static IHTMLDocument2
*notif_doc
;
2236 static BOOL doc_complete
;
2238 static IHTMLDocument2
*create_document(void)
2240 IHTMLDocument2
*doc
;
2241 IHTMLDocument5
*doc5
;
2244 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2245 &IID_IHTMLDocument2
, (void**)&doc
);
2246 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2250 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2252 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2253 IHTMLDocument2_Release(doc
);
2257 IHTMLDocument5_Release(doc5
);
2261 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2262 REFIID riid
, void**ppv
)
2264 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2269 ok(0, "unexpected call\n");
2270 return E_NOINTERFACE
;
2273 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2278 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2283 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2285 if(dispID
== DISPID_READYSTATE
){
2289 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2290 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2292 if(!strcmp_wa(state
, "complete"))
2293 doc_complete
= TRUE
;
2295 SysFreeString(state
);
2301 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2303 ok(0, "unexpected call\n");
2307 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2308 PropertyNotifySink_QueryInterface
,
2309 PropertyNotifySink_AddRef
,
2310 PropertyNotifySink_Release
,
2311 PropertyNotifySink_OnChanged
,
2312 PropertyNotifySink_OnRequestEdit
2315 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2317 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2319 IPersistStreamInit
*init
;
2321 IHTMLDocument2
*doc
;
2325 notif_doc
= doc
= create_document();
2329 doc_complete
= FALSE
;
2331 mem
= GlobalAlloc(0, len
);
2332 memcpy(mem
, str
, len
);
2333 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2335 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2337 IPersistStreamInit_Load(init
, stream
);
2338 IPersistStreamInit_Release(init
);
2339 IStream_Release(stream
);
2344 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2346 IConnectionPointContainer
*container
;
2347 IConnectionPoint
*cp
;
2351 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2352 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2354 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2355 IConnectionPointContainer_Release(container
);
2356 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2358 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2359 IConnectionPoint_Release(cp
);
2360 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2363 typedef void (*style_test_t
)(IHTMLDocument2
*);
2365 static void run_test(const char *str
, style_test_t test
)
2367 IHTMLDocument2
*doc
;
2371 doc
= create_doc_with_string(str
);
2375 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2377 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
2378 TranslateMessage(&msg
);
2379 DispatchMessage(&msg
);
2384 ref
= IHTMLDocument2_Release(doc
);
2385 ok(!ref
|| broken(ref
== 1), /* Vista */
2394 run_test(basic_test_str
, basic_style_test
);