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 static IHTMLElement
*get_element_by_id(IHTMLDocument2
*doc
, const char *id
)
60 BSTR idW
= a2bstr(id
);
62 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
63 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres
);
65 hres
= IHTMLDocument3_getElementById(doc3
, idW
, &result
);
66 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
67 ok(result
!= NULL
, "result == NULL\n");
70 IHTMLDocument3_Release(doc3
);
74 #define get_current_style(e) _get_current_style(__LINE__,e)
75 static IHTMLCurrentStyle
*_get_current_style(unsigned line
, IHTMLElement
*elem
)
77 IHTMLCurrentStyle
*cstyle
;
81 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
82 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
85 hres
= IHTMLElement2_get_currentStyle(elem2
, &cstyle
);
86 ok(hres
== S_OK
, "get_currentStyle failed: %08x\n", hres
);
87 ok(cstyle
!= NULL
, "cstyle = %p\n", cstyle
);
89 IHTMLElement2_Release(elem2
);
93 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
94 static void _test_border_styles(unsigned line
, IHTMLStyle
*pStyle
, BSTR Name
)
99 hres
= IHTMLStyle_GetIDsOfNames(pStyle
, &IID_NULL
, &Name
, 1,
100 LOCALE_USER_DEFAULT
, &dispid
);
101 ok_(__FILE__
,line
) (hres
== S_OK
, "GetIDsOfNames: %08x\n", hres
);
104 DISPPARAMS params
= {NULL
,NULL
,0,0};
105 DISPID dispidNamed
= DISPID_PROPERTYPUT
;
110 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
111 DISPATCH_PROPERTYGET
, ¶ms
, &vDefault
, NULL
, NULL
);
112 ok_(__FILE__
,line
) (hres
== S_OK
, "get_default. ret: %08x\n", hres
);
115 params
.cNamedArgs
= 1;
116 params
.rgdispidNamedArgs
= &dispidNamed
;
117 V_VT(&arg
) = VT_BSTR
;
118 V_BSTR(&arg
) = a2bstr("none");
119 params
.rgvarg
= &arg
;
120 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
121 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
122 ok_(__FILE__
,line
) (hres
== S_OK
, "none. ret: %08x\n", hres
);
125 V_VT(&arg
) = VT_BSTR
;
126 V_BSTR(&arg
) = a2bstr("dotted");
127 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
128 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
129 ok_(__FILE__
,line
) (hres
== S_OK
, "dotted. ret: %08x\n", hres
);
132 V_VT(&arg
) = VT_BSTR
;
133 V_BSTR(&arg
) = a2bstr("dashed");
134 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
135 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
136 ok_(__FILE__
,line
) (hres
== S_OK
, "dashed. ret: %08x\n", hres
);
139 V_VT(&arg
) = VT_BSTR
;
140 V_BSTR(&arg
) = a2bstr("solid");
141 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
142 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
143 ok_(__FILE__
,line
) (hres
== S_OK
, "solid. ret: %08x\n", hres
);
146 V_VT(&arg
) = VT_BSTR
;
147 V_BSTR(&arg
) = a2bstr("double");
148 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
149 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
150 ok_(__FILE__
,line
) (hres
== S_OK
, "double. ret: %08x\n", hres
);
153 V_VT(&arg
) = VT_BSTR
;
154 V_BSTR(&arg
) = a2bstr("groove");
155 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
156 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
157 ok_(__FILE__
,line
) (hres
== S_OK
, "groove. ret: %08x\n", hres
);
160 V_VT(&arg
) = VT_BSTR
;
161 V_BSTR(&arg
) = a2bstr("ridge");
162 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
163 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
164 ok_(__FILE__
,line
) (hres
== S_OK
, "ridge. ret: %08x\n", hres
);
167 V_VT(&arg
) = VT_BSTR
;
168 V_BSTR(&arg
) = a2bstr("inset");
169 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
170 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
171 ok_(__FILE__
,line
) (hres
== S_OK
, "inset. ret: %08x\n", hres
);
174 V_VT(&arg
) = VT_BSTR
;
175 V_BSTR(&arg
) = a2bstr("outset");
176 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
177 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
178 ok_(__FILE__
,line
) (hres
== S_OK
, "outset. ret: %08x\n", hres
);
181 V_VT(&arg
) = VT_BSTR
;
182 V_BSTR(&arg
) = a2bstr("invalid");
183 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
184 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
185 ok_(__FILE__
,line
) (FAILED(hres
), "invalid value passed.\n");
188 params
.rgvarg
= &vDefault
;
189 hres
= IHTMLStyle_Invoke(pStyle
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
190 DISPATCH_PROPERTYPUT
, ¶ms
, &ret
, NULL
, NULL
);
191 ok_(__FILE__
,line
) (hres
== S_OK
, "default. ret: %08x\n", hres
);
192 VariantClear(&vDefault
);
196 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
197 static void _test_style_csstext(unsigned line
, IHTMLStyle
*style
, const char *extext
)
199 BSTR text
= (void*)0xdeadbeef;
202 hres
= IHTMLStyle_get_cssText(style
, &text
);
203 ok_(__FILE__
,line
)(hres
== S_OK
, "get_cssText failed: %08x\n", hres
);
205 ok_(__FILE__
,line
)(!strcmp_wa(text
, extext
), "cssText = %s\n", wine_dbgstr_w(text
));
207 ok_(__FILE__
,line
)(!text
, "cssText = %s\n", wine_dbgstr_w(text
));
212 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
213 static void _test_style_set_csstext(unsigned line
, IHTMLStyle
*style
, const char *text
)
219 hres
= IHTMLStyle_put_cssText(style
, tmp
);
220 ok_(__FILE__
,line
)(hres
== S_OK
, "put_cssText failed: %08x\n", hres
);
224 static void test_set_csstext(IHTMLStyle
*style
)
229 test_style_set_csstext(style
, "background-color: black;");
231 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
232 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
233 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
234 ok(!strcmp_wa(V_BSTR(&v
), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
238 static void test_style2(IHTMLStyle2
*style2
)
244 str
= (void*)0xdeadbeef;
245 hres
= IHTMLStyle2_get_position(style2
, &str
);
246 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
247 ok(!str
, "str != NULL\n");
249 str
= a2bstr("absolute");
250 hres
= IHTMLStyle2_put_position(style2
, str
);
251 ok(hres
== S_OK
, "put_position failed: %08x\n", hres
);
255 hres
= IHTMLStyle2_get_position(style2
, &str
);
256 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
257 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
262 hres
= IHTMLStyle2_get_right(style2
, &v
);
263 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
264 ok(V_VT(&v
) == VT_BSTR
, "V_VT(right)=%d\n", V_VT(&v
));
265 ok(!V_BSTR(&v
), "V_BSTR(right) != NULL\n");
269 V_BSTR(&v
) = a2bstr("3px");
270 hres
= IHTMLStyle2_put_right(style2
, v
);
271 ok(hres
== S_OK
, "put_right failed: %08x\n", hres
);
275 hres
= IHTMLStyle2_get_right(style2
, &v
);
276 ok(hres
== S_OK
, "get_right failed: %08x\n", hres
);
277 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
278 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
282 str
= (void*)0xdeadbeef;
283 hres
= IHTMLStyle2_get_direction(style2
, &str
);
284 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
285 ok(!str
, "str = %s\n", wine_dbgstr_w(str
));
288 hres
= IHTMLStyle2_put_direction(style2
, str
);
289 ok(hres
== S_OK
, "put_direction failed: %08x\n", hres
);
293 hres
= IHTMLStyle2_get_direction(style2
, &str
);
294 ok(hres
== S_OK
, "get_direction failed: %08x\n", hres
);
295 ok(!strcmp_wa(str
, "ltr"), "str = %s\n", wine_dbgstr_w(str
));
299 static void test_style3(IHTMLStyle3
*style3
)
304 str
= (void*)0xdeadbeef;
305 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
306 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
307 ok(!str
, "str != NULL\n");
309 str
= a2bstr("break-word");
310 hres
= IHTMLStyle3_put_wordWrap(style3
, str
);
311 ok(hres
== S_OK
, "put_wordWrap failed: %08x\n", hres
);
315 hres
= IHTMLStyle3_get_wordWrap(style3
, &str
);
316 ok(hres
== S_OK
, "get_wordWrap failed: %08x\n", hres
);
317 ok(!strcmp_wa(str
, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str
));
321 static void test_style4(IHTMLStyle4
*style4
)
327 hres
= IHTMLStyle4_get_minHeight(style4
, &vdefault
);
328 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
331 V_BSTR(&v
) = a2bstr("10px");
332 hres
= IHTMLStyle4_put_minHeight(style4
, v
);
333 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
336 hres
= IHTMLStyle4_get_minHeight(style4
, &v
);
337 ok(hres
== S_OK
, "get_minHeight failed: %08x\n", hres
);
338 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
339 ok( !strcmp_wa(V_BSTR(&v
), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
342 hres
= IHTMLStyle4_put_minHeight(style4
, vdefault
);
343 ok(hres
== S_OK
, "put_minHeight failed: %08x\n", hres
);
344 VariantClear(&vdefault
);
347 static void test_body_style(IHTMLStyle
*style
)
357 BSTR sOverflowDefault
;
361 test_style_csstext(style
, NULL
);
363 hres
= IHTMLStyle_get_position(style
, &str
);
364 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
365 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
368 hres
= IHTMLStyle_get_marginRight(style
, &v
);
369 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
370 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginRight) = %d\n", V_VT(&v
));
371 ok(!V_BSTR(&v
), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
375 hres
= IHTMLStyle_put_marginRight(style
, v
);
376 ok(hres
== S_OK
, "put_marginRight failed: %08x\n", hres
);
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(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
385 hres
= IHTMLStyle_get_marginBottom(style
, &v
);
386 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
387 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginBottom) = %d\n", V_VT(&v
));
388 ok(!V_BSTR(&v
), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
392 hres
= IHTMLStyle_put_marginBottom(style
, v
);
393 ok(hres
== S_OK
, "put_marginBottom failed: %08x\n", hres
);
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(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
402 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
403 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
404 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
405 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
409 hres
= IHTMLStyle_put_marginLeft(style
, v
);
410 ok(hres
== S_OK
, "put_marginLeft failed: %08x\n", hres
);
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(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
418 str
= (void*)0xdeadbeef;
419 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
420 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
421 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
423 str
= (void*)0xdeadbeef;
424 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
425 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
426 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
428 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
429 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
431 str
= a2bstr("test");
432 hres
= IHTMLStyle_put_fontWeight(style
, str
);
433 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
436 str
= a2bstr("bold");
437 hres
= IHTMLStyle_put_fontWeight(style
, str
);
438 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
441 str
= a2bstr("bolder");
442 hres
= IHTMLStyle_put_fontWeight(style
, str
);
443 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
446 str
= a2bstr("lighter");
447 hres
= IHTMLStyle_put_fontWeight(style
, str
);
448 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
452 hres
= IHTMLStyle_put_fontWeight(style
, str
);
453 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
457 hres
= IHTMLStyle_put_fontWeight(style
, str
);
458 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
462 hres
= IHTMLStyle_put_fontWeight(style
, str
);
463 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
467 hres
= IHTMLStyle_put_fontWeight(style
, str
);
468 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
472 hres
= IHTMLStyle_put_fontWeight(style
, str
);
473 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
477 hres
= IHTMLStyle_put_fontWeight(style
, str
);
478 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
482 hres
= IHTMLStyle_put_fontWeight(style
, str
);
483 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
487 hres
= IHTMLStyle_put_fontWeight(style
, str
);
488 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
492 hres
= IHTMLStyle_put_fontWeight(style
, str
);
493 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
496 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
497 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
498 ok(!strcmp_wa(str
, "900"), "str != style900\n");
501 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
502 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
503 SysFreeString(sDefault
);
506 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
507 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
509 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
510 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
512 str
= a2bstr("test");
513 hres
= IHTMLStyle_put_fontVariant(style
, str
);
514 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
517 str
= a2bstr("small-caps");
518 hres
= IHTMLStyle_put_fontVariant(style
, str
);
519 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
522 str
= a2bstr("normal");
523 hres
= IHTMLStyle_put_fontVariant(style
, str
);
524 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
527 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
528 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
529 SysFreeString(sDefault
);
531 str
= (void*)0xdeadbeef;
532 hres
= IHTMLStyle_get_display(style
, &str
);
533 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
534 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
536 str
= (void*)0xdeadbeef;
537 hres
= IHTMLStyle_get_visibility(style
, &str
);
538 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
539 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
542 hres
= IHTMLStyle_get_fontSize(style
, &v
);
543 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
544 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
545 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
548 hres
= IHTMLStyle_get_color(style
, &v
);
549 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
550 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
551 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
554 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
555 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
556 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
558 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
559 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
560 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
562 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
563 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
564 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
566 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
567 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
570 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
571 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
572 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
574 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
575 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
576 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
578 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
579 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
580 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
582 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
583 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
586 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
587 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
588 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
590 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
591 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
592 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
594 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
595 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
596 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
598 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
599 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
602 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
603 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
604 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
606 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
607 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
608 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
610 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
611 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
612 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
614 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
615 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
618 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
619 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
620 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
622 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
623 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
624 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
626 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
627 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
628 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
630 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
631 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
633 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
634 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
636 str
= a2bstr("invalid");
637 hres
= IHTMLStyle_put_textDecoration(style
, str
);
638 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
641 str
= a2bstr("none");
642 hres
= IHTMLStyle_put_textDecoration(style
, str
);
643 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
646 str
= a2bstr("underline");
647 hres
= IHTMLStyle_put_textDecoration(style
, str
);
648 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
651 str
= a2bstr("overline");
652 hres
= IHTMLStyle_put_textDecoration(style
, str
);
653 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
656 str
= a2bstr("line-through");
657 hres
= IHTMLStyle_put_textDecoration(style
, str
);
658 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
661 str
= a2bstr("blink");
662 hres
= IHTMLStyle_put_textDecoration(style
, str
);
663 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
666 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
667 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
668 ok(!strcmp_wa(str
, "blink"), "str != blink\n");
671 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
672 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
673 SysFreeString(sDefault
);
675 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
676 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
678 hres
= IHTMLStyle_get_posWidth(style
, &f
);
679 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
680 ok(f
== 0.0f
, "f = %f\n", f
);
683 hres
= IHTMLStyle_get_width(style
, &v
);
684 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
685 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
686 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
688 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
689 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
691 hres
= IHTMLStyle_get_posWidth(style
, &f
);
692 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
698 V_BSTR(&v
) = a2bstr("auto");
699 hres
= IHTMLStyle_put_width(style
, v
);
700 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
704 hres
= IHTMLStyle_get_width(style
, &v
);
705 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
706 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
707 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
712 hres
= IHTMLStyle_put_width(style
, v
);
713 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
716 hres
= IHTMLStyle_get_width(style
, &v
);
717 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
718 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
719 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
723 str
= (void*)0xdeadbeef;
724 hres
= IHTMLStyle_get_margin(style
, &str
);
725 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
726 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
729 hres
= IHTMLStyle_put_margin(style
, str
);
730 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
733 hres
= IHTMLStyle_get_margin(style
, &str
);
734 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
735 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
738 hres
= IHTMLStyle_put_margin(style
, NULL
);
739 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
741 str
= (void*)0xdeadbeef;
742 hres
= IHTMLStyle_get_marginTop(style
, &v
);
743 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
744 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
745 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
748 V_BSTR(&v
) = a2bstr("6px");
749 hres
= IHTMLStyle_put_marginTop(style
, v
);
750 SysFreeString(V_BSTR(&v
));
751 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
753 str
= (void*)0xdeadbeef;
754 hres
= IHTMLStyle_get_marginTop(style
, &v
);
755 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
756 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
757 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
762 hres
= IHTMLStyle_put_marginTop(style
, v
);
763 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
765 str
= (void*)0xdeadbeef;
766 hres
= IHTMLStyle_get_marginTop(style
, &v
);
767 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
768 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
769 ok(!strcmp_wa(V_BSTR(&v
), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
773 hres
= IHTMLStyle_get_border(style
, &str
);
774 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
775 ok(!str
|| !*str
, "str is not empty\n");
779 hres
= IHTMLStyle_put_border(style
, str
);
780 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
784 hres
= IHTMLStyle_get_left(style
, &v
);
785 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
786 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
787 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
791 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
792 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
795 hres
= IHTMLStyle_get_posLeft(style
, &f
);
796 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
797 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
799 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
800 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
802 hres
= IHTMLStyle_get_posLeft(style
, &f
);
803 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
806 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
808 /* Ensure left is updated correctly. */
810 hres
= IHTMLStyle_get_left(style
, &v
);
811 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
812 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
813 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
814 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
815 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
820 V_BSTR(&v
) = a2bstr("3px");
821 hres
= IHTMLStyle_put_left(style
, v
);
822 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
825 hres
= IHTMLStyle_get_posLeft(style
, &f
);
826 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
827 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
830 hres
= IHTMLStyle_get_left(style
, &v
);
831 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
832 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
833 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
837 hres
= IHTMLStyle_put_left(style
, v
);
838 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
841 hres
= IHTMLStyle_get_left(style
, &v
);
842 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
843 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
844 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
848 hres
= IHTMLStyle_get_top(style
, &v
);
849 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
850 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
851 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
855 hres
= IHTMLStyle_get_posTop(style
, NULL
);
856 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
859 hres
= IHTMLStyle_get_posTop(style
, &f
);
860 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
861 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
863 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
864 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
866 hres
= IHTMLStyle_get_posTop(style
, &f
);
867 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
870 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
873 V_BSTR(&v
) = a2bstr("3px");
874 hres
= IHTMLStyle_put_top(style
, v
);
875 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
879 hres
= IHTMLStyle_get_top(style
, &v
);
880 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
881 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
882 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
885 hres
= IHTMLStyle_get_posTop(style
, &f
);
886 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
887 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
890 hres
= IHTMLStyle_put_top(style
, v
);
891 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
894 hres
= IHTMLStyle_get_top(style
, &v
);
895 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
896 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
897 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
901 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
902 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
905 hres
= IHTMLStyle_get_height(style
, &v
);
906 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
907 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
908 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
912 hres
= IHTMLStyle_get_posHeight(style
, &f
);
913 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
914 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
916 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
917 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
919 hres
= IHTMLStyle_get_posHeight(style
, &f
);
920 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
923 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
926 V_BSTR(&v
) = a2bstr("70px");
927 hres
= IHTMLStyle_put_height(style
, v
);
928 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
932 hres
= IHTMLStyle_get_height(style
, &v
);
933 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
934 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
935 ok(!strcmp_wa(V_BSTR(&v
), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
940 hres
= IHTMLStyle_put_height(style
, v
);
941 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
944 hres
= IHTMLStyle_get_height(style
, &v
);
945 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
946 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
947 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
950 hres
= IHTMLStyle_get_posHeight(style
, &f
);
951 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
952 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
954 str
= (void*)0xdeadbeef;
955 hres
= IHTMLStyle_get_cursor(style
, &str
);
956 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
957 ok(!str
, "get_cursor != NULL\n");
960 str
= a2bstr("default");
961 hres
= IHTMLStyle_put_cursor(style
, str
);
962 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
966 hres
= IHTMLStyle_get_cursor(style
, &str
);
967 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
968 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
972 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
973 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
974 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
975 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
979 V_BSTR(&v
) = a2bstr("middle");
980 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
981 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
985 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
986 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
987 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
988 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
991 str
= (void*)0xdeadbeef;
992 hres
= IHTMLStyle_get_textAlign(style
, &str
);
993 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
994 ok(!str
, "textAlign != NULL\n");
996 str
= a2bstr("center");
997 hres
= IHTMLStyle_put_textAlign(style
, str
);
998 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
1002 hres
= IHTMLStyle_get_textAlign(style
, &str
);
1003 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1004 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1007 str
= (void*)0xdeadbeef;
1008 hres
= IHTMLStyle_get_filter(style
, &str
);
1009 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1010 ok(!str
, "filter != NULL\n");
1012 str
= a2bstr("alpha(opacity=100)");
1013 hres
= IHTMLStyle_put_filter(style
, str
);
1014 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1017 V_VT(&v
) = VT_EMPTY
;
1018 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1019 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1020 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1021 ok(!V_I4(&v
), "V_I4(v) != 0\n");
1025 V_BSTR(&v
) = a2bstr("1");
1026 hres
= IHTMLStyle_put_zIndex(style
, v
);
1027 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
1030 V_VT(&v
) = VT_EMPTY
;
1031 hres
= IHTMLStyle_get_zIndex(style
, &v
);
1032 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1033 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
1034 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
1038 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
1039 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1041 str
= a2bstr("test");
1042 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1043 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
1046 str
= a2bstr("italic");
1047 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1048 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1051 str
= a2bstr("oblique");
1052 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1053 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1056 str
= a2bstr("normal");
1057 hres
= IHTMLStyle_put_fontStyle(style
, str
);
1058 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1061 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
1062 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1063 SysFreeString(sDefault
);
1066 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1067 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1069 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1070 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1072 str
= a2bstr("test");
1073 hres
= IHTMLStyle_put_overflow(style
, str
);
1074 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1077 str
= a2bstr("visible");
1078 hres
= IHTMLStyle_put_overflow(style
, str
);
1079 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1082 str
= a2bstr("scroll");
1083 hres
= IHTMLStyle_put_overflow(style
, str
);
1084 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1087 str
= a2bstr("hidden");
1088 hres
= IHTMLStyle_put_overflow(style
, str
);
1089 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1092 str
= a2bstr("auto");
1093 hres
= IHTMLStyle_put_overflow(style
, str
);
1094 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1097 hres
= IHTMLStyle_get_overflow(style
, &str
);
1098 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1099 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1103 hres
= IHTMLStyle_put_overflow(style
, str
);
1104 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1107 hres
= IHTMLStyle_get_overflow(style
, &str
);
1108 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1109 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1112 /* restore overflow default */
1113 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1114 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1115 SysFreeString(sOverflowDefault
);
1117 /* Attribute Tests*/
1118 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1119 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1121 str
= a2bstr("position");
1122 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1123 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1125 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1126 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1127 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1130 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1131 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1134 V_BSTR(&v
) = a2bstr("absolute");
1135 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1136 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1139 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1140 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1141 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1142 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1147 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1148 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1153 str
= a2bstr("borderLeftStyle");
1154 test_border_styles(style
, str
);
1157 str
= a2bstr("borderbottomstyle");
1158 test_border_styles(style
, str
);
1161 str
= a2bstr("borderrightstyle");
1162 test_border_styles(style
, str
);
1165 str
= a2bstr("bordertopstyle");
1166 test_border_styles(style
, str
);
1169 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1170 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1172 str
= a2bstr("none dotted dashed solid");
1173 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1174 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1177 str
= a2bstr("none dotted dashed solid");
1178 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1179 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1180 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1181 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1184 str
= a2bstr("double groove ridge inset");
1185 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1186 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1189 str
= a2bstr("window-inset outset ridge inset");
1190 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1191 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1194 str
= a2bstr("window-inset");
1195 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1196 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1199 str
= a2bstr("none none none none none");
1200 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1201 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1204 str
= a2bstr("invalid none none none");
1205 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1206 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1209 str
= a2bstr("none invalid none none");
1210 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1211 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1214 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1215 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1216 SysFreeString(sDefault
);
1218 /* backgoundColor */
1219 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1220 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1221 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1222 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1226 hres
= IHTMLStyle_get_padding(style
, &str
);
1227 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1228 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1232 hres
= IHTMLStyle_put_padding(style
, str
);
1233 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1236 hres
= IHTMLStyle_get_padding(style
, &str
);
1237 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1238 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1242 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1243 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1246 V_BSTR(&v
) = a2bstr("10");
1247 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1248 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1251 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1252 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1253 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1256 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1257 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1259 /* BackgroundRepeat */
1260 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1261 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1263 str
= a2bstr("invalid");
1264 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1265 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1268 str
= a2bstr("repeat");
1269 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1270 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1273 str
= a2bstr("no-repeat");
1274 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1275 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1278 str
= a2bstr("repeat-x");
1279 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1280 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1283 str
= a2bstr("repeat-y");
1284 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1285 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1288 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1289 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1290 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1293 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1294 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1295 SysFreeString(sDefault
);
1298 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1299 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1301 str
= a2bstr("red green red blue");
1302 hres
= IHTMLStyle_put_borderColor(style
, str
);
1303 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1306 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1307 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1308 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1311 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1312 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1313 SysFreeString(sDefault
);
1316 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1317 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1319 str
= a2bstr("thick dotted red");
1320 hres
= IHTMLStyle_put_borderRight(style
, str
);
1321 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1324 /* IHTMLStyle_get_borderRight appears to have a bug where
1325 it returns the first letter of the color. So we check
1326 each style individually.
1329 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1330 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1331 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1335 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1336 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1337 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1340 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1341 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1342 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1345 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1346 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1347 SysFreeString(sDefault
);
1350 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1351 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1353 str
= a2bstr("thick dotted red");
1354 hres
= IHTMLStyle_put_borderTop(style
, str
);
1355 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1358 /* IHTMLStyle_get_borderTop appears to have a bug where
1359 it returns the first letter of the color. So we check
1360 each style individually.
1363 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1364 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1365 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1369 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1370 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1371 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1374 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1375 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1376 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1379 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1380 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1381 SysFreeString(sDefault
);
1384 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1385 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1387 str
= a2bstr("thick dotted red");
1388 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1389 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1392 /* IHTMLStyle_get_borderBottom appears to have a bug where
1393 it returns the first letter of the color. So we check
1394 each style individually.
1397 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1398 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1399 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1403 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1404 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1405 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1408 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1409 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1410 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1413 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1414 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1415 SysFreeString(sDefault
);
1418 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1419 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1421 str
= a2bstr("thick dotted red");
1422 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1423 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1426 /* IHTMLStyle_get_borderLeft appears to have a bug where
1427 it returns the first letter of the color. So we check
1428 each style individually.
1431 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1432 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1433 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1437 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1438 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1439 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1442 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1443 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1444 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1447 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1448 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1449 SysFreeString(sDefault
);
1451 /* backgroundPositionX */
1452 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1453 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1454 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1455 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1459 V_BSTR(&v
) = a2bstr("10px");
1460 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1461 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1464 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1465 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1466 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1467 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1470 /* backgroundPositionY */
1471 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1472 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1473 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1477 V_BSTR(&v
) = a2bstr("15px");
1478 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
1479 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
1482 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1483 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1484 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1485 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1488 /* backgroundPosition */
1490 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1491 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1492 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1495 str
= a2bstr("center 20%");
1496 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
1497 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
1501 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1502 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1503 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1506 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1507 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1508 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1509 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1512 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1513 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1514 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1515 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1518 /* borderTopWidth */
1519 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
1520 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1523 V_BSTR(&v
) = a2bstr("10px");
1524 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
1525 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1528 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1529 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1530 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1533 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
1534 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1535 VariantClear(&vDefault
);
1537 /* borderRightWidth */
1538 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
1539 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1542 V_BSTR(&v
) = a2bstr("10");
1543 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
1544 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1547 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1548 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1549 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1552 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
1553 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1554 VariantClear(&vDefault
);
1556 /* borderBottomWidth */
1557 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
1558 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1561 V_BSTR(&v
) = a2bstr("10");
1562 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
1563 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1566 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1567 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1568 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1571 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
1572 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1573 VariantClear(&vDefault
);
1575 /* borderLeftWidth */
1576 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
1577 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1580 V_BSTR(&v
) = a2bstr("10");
1581 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
1582 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1585 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1586 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1587 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1590 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
1591 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1592 VariantClear(&vDefault
);
1595 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
1596 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1599 V_BSTR(&v
) = a2bstr("10");
1600 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
1601 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1604 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
1605 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1606 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1607 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1610 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
1611 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1612 VariantClear(&vDefault
);
1615 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
1616 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1619 V_BSTR(&v
) = a2bstr("11");
1620 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
1621 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1624 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
1625 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1626 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1627 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1630 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
1631 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1632 VariantClear(&vDefault
);
1634 /* borderTopColor */
1635 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
1636 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1639 V_BSTR(&v
) = a2bstr("red");
1640 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
1641 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1644 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1645 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1646 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1649 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
1650 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1652 /* borderRightColor */
1653 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
1654 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1657 V_BSTR(&v
) = a2bstr("blue");
1658 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
1659 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
1662 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1663 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1664 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1667 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
1668 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
1670 /* borderBottomColor */
1671 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
1672 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1675 V_BSTR(&v
) = a2bstr("cyan");
1676 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
1677 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1680 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1681 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1682 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1685 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
1686 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1688 /* borderLeftColor */
1689 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
1690 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1693 V_BSTR(&v
) = a2bstr("cyan");
1694 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
1695 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1698 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1699 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1700 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1703 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
1704 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1707 hres
= IHTMLStyle_get_clip(style
, &str
);
1708 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1709 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
1711 str
= a2bstr("rect(0px 1px 500px 505px)");
1712 hres
= IHTMLStyle_put_clip(style
, str
);
1713 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
1716 hres
= IHTMLStyle_get_clip(style
, &str
);
1717 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1718 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
1721 /* pageBreakAfter */
1722 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1723 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1724 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1726 str
= a2bstr("always");
1727 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
1728 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
1731 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1732 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1733 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1736 /* pageBreakBefore */
1737 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1738 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1739 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1741 str
= a2bstr("always");
1742 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
1743 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
1746 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1747 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1748 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1751 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
1752 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
1753 if(SUCCEEDED(hres
)) {
1754 test_style2(style2
);
1755 IHTMLStyle2_Release(style2
);
1758 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
1759 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
1760 if(SUCCEEDED(hres
)) {
1761 test_style3(style3
);
1762 IHTMLStyle3_Release(style3
);
1765 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
1766 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
1767 if(SUCCEEDED(hres
)) {
1768 test_style4(style4
);
1769 IHTMLStyle4_Release(style4
);
1773 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1774 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
1779 str
= (void*)0xdeadbeef;
1780 hres
= IHTMLStyle_get_filter(style
, &str
);
1781 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1783 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
1785 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
1790 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1791 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
1793 BSTR str
= a2bstr(val
);
1796 hres
= IHTMLStyle_put_filter(style
, str
);
1797 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1800 _test_style_filter(line
, style
, val
);
1803 static void test_style_filters(IHTMLElement
*elem
)
1808 hres
= IHTMLElement_get_style(elem
, &style
);
1809 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1811 test_style_filter(style
, NULL
);
1812 set_style_filter(style
, "alpha(opacity=50.0040)");
1813 set_style_filter(style
, "alpha(opacity=100)");
1815 IHTMLStyle_Release(style
);
1817 hres
= IHTMLElement_get_style(elem
, &style
);
1818 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1820 test_style_filter(style
, "alpha(opacity=100)");
1821 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
1822 set_style_filter(style
, NULL
);
1824 IHTMLStyle_Release(style
);
1827 static void test_current_style(IHTMLCurrentStyle
*current_style
)
1833 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
1834 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
1835 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
1838 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
1839 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
1840 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
1843 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
1844 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
1847 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
1848 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1849 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
1852 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
1853 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
1854 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
1857 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
1858 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
1859 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
1862 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
1863 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1864 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
1867 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
1868 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1869 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
1872 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
1873 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1874 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
1877 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
1878 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1879 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
1882 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
1883 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1884 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
1887 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
1888 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
1889 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
1892 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
1893 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1894 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1897 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
1898 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1899 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
1902 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
1903 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1906 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
1907 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1910 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
1911 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
1914 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
1915 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1918 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
1919 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
1922 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
1923 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1926 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
1927 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1930 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
1931 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
1932 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
1933 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
1936 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
1937 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
1938 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1941 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
1942 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1943 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1946 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
1947 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1948 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1951 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
1952 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1953 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1956 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
1957 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1958 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1961 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
1962 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
1963 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1966 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
1967 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1968 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
1969 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
1972 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
1973 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1974 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1975 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1978 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
1979 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
1980 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1983 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
1984 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
1985 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1988 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
1989 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1990 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1994 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
1995 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1996 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1999 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
2000 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
2001 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2004 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
2005 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
2006 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2009 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
2010 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
2011 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2014 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
2015 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
2016 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2019 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
2020 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
2021 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2024 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
2025 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
2026 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2029 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
2030 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
2031 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2034 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
2035 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
2036 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2039 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
2040 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
2041 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2044 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
2045 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2046 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2049 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
2050 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
2051 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2054 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
2055 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
2056 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2059 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
2060 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
2061 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2064 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2065 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2066 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2069 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2070 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2071 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2074 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2075 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2076 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2079 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2080 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2081 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2084 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2085 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2086 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2090 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2092 static void basic_style_test(IHTMLDocument2
*doc
)
2094 IHTMLCurrentStyle
*cstyle
;
2099 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2100 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2102 hres
= IHTMLElement_get_style(elem
, &style
);
2103 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2105 test_body_style(style
);
2107 cstyle
= get_current_style(elem
);
2108 test_current_style(cstyle
);
2109 IHTMLCurrentStyle_Release(cstyle
);
2110 IHTMLElement_Release(elem
);
2112 elem
= get_element_by_id(doc
, "divid");
2113 test_style_filters(elem
);
2115 test_set_csstext(style
);
2116 IHTMLStyle_Release(style
);
2117 IHTMLElement_Release(elem
);
2120 static IHTMLDocument2
*notif_doc
;
2121 static BOOL doc_complete
;
2123 static IHTMLDocument2
*create_document(void)
2125 IHTMLDocument2
*doc
;
2126 IHTMLDocument5
*doc5
;
2129 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2130 &IID_IHTMLDocument2
, (void**)&doc
);
2131 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2135 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2137 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2138 IHTMLDocument2_Release(doc
);
2142 IHTMLDocument5_Release(doc5
);
2146 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2147 REFIID riid
, void**ppv
)
2149 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2154 ok(0, "unexpected call\n");
2155 return E_NOINTERFACE
;
2158 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2163 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2168 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2170 if(dispID
== DISPID_READYSTATE
){
2174 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2175 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2177 if(!strcmp_wa(state
, "complete"))
2178 doc_complete
= TRUE
;
2180 SysFreeString(state
);
2186 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2188 ok(0, "unexpected call\n");
2192 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2193 PropertyNotifySink_QueryInterface
,
2194 PropertyNotifySink_AddRef
,
2195 PropertyNotifySink_Release
,
2196 PropertyNotifySink_OnChanged
,
2197 PropertyNotifySink_OnRequestEdit
2200 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2202 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2204 IPersistStreamInit
*init
;
2206 IHTMLDocument2
*doc
;
2210 notif_doc
= doc
= create_document();
2214 doc_complete
= FALSE
;
2216 mem
= GlobalAlloc(0, len
);
2217 memcpy(mem
, str
, len
);
2218 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2220 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2222 IPersistStreamInit_Load(init
, stream
);
2223 IPersistStreamInit_Release(init
);
2224 IStream_Release(stream
);
2229 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2231 IConnectionPointContainer
*container
;
2232 IConnectionPoint
*cp
;
2236 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2237 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2239 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2240 IConnectionPointContainer_Release(container
);
2241 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2243 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2244 IConnectionPoint_Release(cp
);
2245 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2248 typedef void (*style_test_t
)(IHTMLDocument2
*);
2250 static void run_test(const char *str
, style_test_t test
)
2252 IHTMLDocument2
*doc
;
2256 doc
= create_doc_with_string(str
);
2260 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2262 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
2263 TranslateMessage(&msg
);
2264 DispatchMessage(&msg
);
2269 ref
= IHTMLDocument2_Release(doc
);
2270 ok(!ref
|| broken(ref
== 1), /* Vista */
2279 run_test(basic_test_str
, basic_style_test
);