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
)));
374 hres
= IHTMLStyle_get_marginLeft(style
, &v
);
375 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
376 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginLeft) = %d\n", V_VT(&v
));
377 ok(!V_BSTR(&v
), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
379 str
= (void*)0xdeadbeef;
380 hres
= IHTMLStyle_get_fontFamily(style
, &str
);
381 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
382 ok(!str
, "fontFamily = %s\n", wine_dbgstr_w(str
));
384 str
= (void*)0xdeadbeef;
385 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
386 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
387 ok(!str
, "fontWeight = %s\n", wine_dbgstr_w(str
));
389 hres
= IHTMLStyle_get_fontWeight(style
, &sDefault
);
390 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
392 str
= a2bstr("test");
393 hres
= IHTMLStyle_put_fontWeight(style
, str
);
394 ok(hres
== E_INVALIDARG
, "put_fontWeight failed: %08x\n", hres
);
397 str
= a2bstr("bold");
398 hres
= IHTMLStyle_put_fontWeight(style
, str
);
399 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
402 str
= a2bstr("bolder");
403 hres
= IHTMLStyle_put_fontWeight(style
, str
);
404 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
407 str
= a2bstr("lighter");
408 hres
= IHTMLStyle_put_fontWeight(style
, str
);
409 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
413 hres
= IHTMLStyle_put_fontWeight(style
, str
);
414 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
418 hres
= IHTMLStyle_put_fontWeight(style
, str
);
419 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
423 hres
= IHTMLStyle_put_fontWeight(style
, str
);
424 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
428 hres
= IHTMLStyle_put_fontWeight(style
, str
);
429 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
433 hres
= IHTMLStyle_put_fontWeight(style
, str
);
434 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
438 hres
= IHTMLStyle_put_fontWeight(style
, str
);
439 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
443 hres
= IHTMLStyle_put_fontWeight(style
, str
);
444 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
448 hres
= IHTMLStyle_put_fontWeight(style
, str
);
449 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
453 hres
= IHTMLStyle_put_fontWeight(style
, str
);
454 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
457 hres
= IHTMLStyle_get_fontWeight(style
, &str
);
458 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
459 ok(!strcmp_wa(str
, "900"), "str != style900\n");
462 hres
= IHTMLStyle_put_fontWeight(style
, sDefault
);
463 ok(hres
== S_OK
, "put_fontWeight failed: %08x\n", hres
);
464 SysFreeString(sDefault
);
467 hres
= IHTMLStyle_get_fontVariant(style
, NULL
);
468 ok(hres
== E_INVALIDARG
, "get_fontVariant failed: %08x\n", hres
);
470 hres
= IHTMLStyle_get_fontVariant(style
, &sDefault
);
471 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
473 str
= a2bstr("test");
474 hres
= IHTMLStyle_put_fontVariant(style
, str
);
475 ok(hres
== E_INVALIDARG
, "fontVariant failed: %08x\n", hres
);
478 str
= a2bstr("small-caps");
479 hres
= IHTMLStyle_put_fontVariant(style
, str
);
480 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
483 str
= a2bstr("normal");
484 hres
= IHTMLStyle_put_fontVariant(style
, str
);
485 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
488 hres
= IHTMLStyle_put_fontVariant(style
, sDefault
);
489 ok(hres
== S_OK
, "fontVariant failed: %08x\n", hres
);
490 SysFreeString(sDefault
);
492 str
= (void*)0xdeadbeef;
493 hres
= IHTMLStyle_get_display(style
, &str
);
494 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
495 ok(!str
, "display = %s\n", wine_dbgstr_w(str
));
497 str
= (void*)0xdeadbeef;
498 hres
= IHTMLStyle_get_visibility(style
, &str
);
499 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
500 ok(!str
, "visibility = %s\n", wine_dbgstr_w(str
));
503 hres
= IHTMLStyle_get_fontSize(style
, &v
);
504 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
505 ok(V_VT(&v
) == VT_BSTR
, "V_VT(fontSize) = %d\n", V_VT(&v
));
506 ok(!V_BSTR(&v
), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
509 hres
= IHTMLStyle_get_color(style
, &v
);
510 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
511 ok(V_VT(&v
) == VT_BSTR
, "V_VT(color) = %d\n", V_VT(&v
));
512 ok(!V_BSTR(&v
), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
515 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
516 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
517 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
519 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_TRUE
);
520 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
521 ok(b
== VARIANT_FALSE
, "textDecorationUnderline = %x\n", b
);
523 hres
= IHTMLStyle_get_textDecorationUnderline(style
, &b
);
524 ok(hres
== S_OK
, "get_textDecorationUnderline failed: %08x\n", hres
);
525 ok(b
== VARIANT_TRUE
, "textDecorationUnderline = %x\n", b
);
527 hres
= IHTMLStyle_put_textDecorationUnderline(style
, VARIANT_FALSE
);
528 ok(hres
== S_OK
, "put_textDecorationUnderline failed: %08x\n", hres
);
531 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
532 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
533 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
535 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_TRUE
);
536 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
537 ok(b
== VARIANT_FALSE
, "textDecorationLineThrough = %x\n", b
);
539 hres
= IHTMLStyle_get_textDecorationLineThrough(style
, &b
);
540 ok(hres
== S_OK
, "get_textDecorationLineThrough failed: %08x\n", hres
);
541 ok(b
== VARIANT_TRUE
, "textDecorationLineThrough = %x\n", b
);
543 hres
= IHTMLStyle_put_textDecorationLineThrough(style
, VARIANT_FALSE
);
544 ok(hres
== S_OK
, "put_textDecorationLineThrough failed: %08x\n", hres
);
547 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
548 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
549 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
551 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_TRUE
);
552 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
553 ok(b
== VARIANT_FALSE
, "textDecorationNone = %x\n", b
);
555 hres
= IHTMLStyle_get_textDecorationNone(style
, &b
);
556 ok(hres
== S_OK
, "get_textDecorationNone failed: %08x\n", hres
);
557 ok(b
== VARIANT_TRUE
, "textDecorationNone = %x\n", b
);
559 hres
= IHTMLStyle_put_textDecorationNone(style
, VARIANT_FALSE
);
560 ok(hres
== S_OK
, "put_textDecorationNone failed: %08x\n", hres
);
563 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
564 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
565 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
567 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_TRUE
);
568 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
569 ok(b
== VARIANT_FALSE
, "textDecorationOverline = %x\n", b
);
571 hres
= IHTMLStyle_get_textDecorationOverline(style
, &b
);
572 ok(hres
== S_OK
, "get_textDecorationOverline failed: %08x\n", hres
);
573 ok(b
== VARIANT_TRUE
, "textDecorationOverline = %x\n", b
);
575 hres
= IHTMLStyle_put_textDecorationOverline(style
, VARIANT_FALSE
);
576 ok(hres
== S_OK
, "put_textDecorationOverline failed: %08x\n", hres
);
579 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
580 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
581 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
583 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_TRUE
);
584 ok(hres
== S_OK
, "put_textDecorationBlink failed: %08x\n", hres
);
585 ok(b
== VARIANT_FALSE
, "textDecorationBlink = %x\n", b
);
587 hres
= IHTMLStyle_get_textDecorationBlink(style
, &b
);
588 ok(hres
== S_OK
, "get_textDecorationBlink failed: %08x\n", hres
);
589 ok(b
== VARIANT_TRUE
, "textDecorationBlink = %x\n", b
);
591 hres
= IHTMLStyle_put_textDecorationBlink(style
, VARIANT_FALSE
);
592 ok(hres
== S_OK
, "textDecorationBlink failed: %08x\n", hres
);
594 hres
= IHTMLStyle_get_textDecoration(style
, &sDefault
);
595 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
597 str
= a2bstr("invalid");
598 hres
= IHTMLStyle_put_textDecoration(style
, str
);
599 ok(hres
== E_INVALIDARG
, "put_textDecoration failed: %08x\n", hres
);
602 str
= a2bstr("none");
603 hres
= IHTMLStyle_put_textDecoration(style
, str
);
604 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
607 str
= a2bstr("underline");
608 hres
= IHTMLStyle_put_textDecoration(style
, str
);
609 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
612 str
= a2bstr("overline");
613 hres
= IHTMLStyle_put_textDecoration(style
, str
);
614 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
617 str
= a2bstr("line-through");
618 hres
= IHTMLStyle_put_textDecoration(style
, str
);
619 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
622 str
= a2bstr("blink");
623 hres
= IHTMLStyle_put_textDecoration(style
, str
);
624 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
627 hres
= IHTMLStyle_get_textDecoration(style
, &str
);
628 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
629 ok(!strcmp_wa(str
, "blink"), "str != blink\n");
632 hres
= IHTMLStyle_put_textDecoration(style
, sDefault
);
633 ok(hres
== S_OK
, "put_textDecoration failed: %08x\n", hres
);
634 SysFreeString(sDefault
);
636 hres
= IHTMLStyle_get_posWidth(style
, NULL
);
637 ok(hres
== E_POINTER
, "get_posWidth failed: %08x\n", hres
);
639 hres
= IHTMLStyle_get_posWidth(style
, &f
);
640 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
641 ok(f
== 0.0f
, "f = %f\n", f
);
644 hres
= IHTMLStyle_get_width(style
, &v
);
645 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
646 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
647 ok(!V_BSTR(&v
), "V_BSTR(v)=%p\n", V_BSTR(&v
));
649 hres
= IHTMLStyle_put_posWidth(style
, 2.2);
650 ok(hres
== S_OK
, "put_posWidth failed: %08x\n", hres
);
652 hres
= IHTMLStyle_get_posWidth(style
, &f
);
653 ok(hres
== S_OK
, "get_posWidth failed: %08x\n", hres
);
659 V_BSTR(&v
) = a2bstr("auto");
660 hres
= IHTMLStyle_put_width(style
, v
);
661 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
665 hres
= IHTMLStyle_get_width(style
, &v
);
666 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
667 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
668 ok(!strcmp_wa(V_BSTR(&v
), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
673 hres
= IHTMLStyle_put_width(style
, v
);
674 ok(hres
== S_OK
, "put_width failed: %08x\n", hres
);
677 hres
= IHTMLStyle_get_width(style
, &v
);
678 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
679 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
680 ok(!strcmp_wa(V_BSTR(&v
), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
684 str
= (void*)0xdeadbeef;
685 hres
= IHTMLStyle_get_margin(style
, &str
);
686 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
687 ok(!str
, "margin = %s\n", wine_dbgstr_w(str
));
690 hres
= IHTMLStyle_put_margin(style
, str
);
691 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
694 hres
= IHTMLStyle_get_margin(style
, &str
);
695 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
696 ok(!strcmp_wa(str
, "1px"), "margin = %s\n", wine_dbgstr_w(str
));
699 hres
= IHTMLStyle_put_margin(style
, NULL
);
700 ok(hres
== S_OK
, "put_margin failed: %08x\n", hres
);
702 str
= (void*)0xdeadbeef;
703 hres
= IHTMLStyle_get_marginTop(style
, &v
);
704 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
705 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
706 ok(!V_BSTR(&v
), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
709 V_BSTR(&v
) = a2bstr("6px");
710 hres
= IHTMLStyle_put_marginTop(style
, v
);
711 SysFreeString(V_BSTR(&v
));
712 ok(hres
== S_OK
, "put_marginTop failed: %08x\n", hres
);
714 str
= (void*)0xdeadbeef;
715 hres
= IHTMLStyle_get_marginTop(style
, &v
);
716 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
717 ok(V_VT(&v
) == VT_BSTR
, "V_VT(marginTop) = %d\n", V_VT(&v
));
718 ok(!strcmp_wa(V_BSTR(&v
), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
722 hres
= IHTMLStyle_get_border(style
, &str
);
723 ok(hres
== S_OK
, "get_border failed: %08x\n", hres
);
724 ok(!str
|| !*str
, "str is not empty\n");
728 hres
= IHTMLStyle_put_border(style
, str
);
729 ok(hres
== S_OK
, "put_border failed: %08x\n", hres
);
733 hres
= IHTMLStyle_get_left(style
, &v
);
734 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
735 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
736 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
740 hres
= IHTMLStyle_get_posLeft(style
, NULL
);
741 ok(hres
== E_POINTER
, "get_posLeft failed: %08x\n", hres
);
744 hres
= IHTMLStyle_get_posLeft(style
, &f
);
745 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
746 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
748 hres
= IHTMLStyle_put_posLeft(style
, 4.9f
);
749 ok(hres
== S_OK
, "put_posLeft failed: %08x\n", hres
);
751 hres
= IHTMLStyle_get_posLeft(style
, &f
);
752 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
755 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
757 /* Ensure left is updated correctly. */
759 hres
= IHTMLStyle_get_left(style
, &v
);
760 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
761 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
762 ok(!strcmp_wa(V_BSTR(&v
), "4px") ||
763 !strcmp_wa(V_BSTR(&v
), "4.9px"), /* IE8 */
764 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
769 V_BSTR(&v
) = a2bstr("3px");
770 hres
= IHTMLStyle_put_left(style
, v
);
771 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
774 hres
= IHTMLStyle_get_posLeft(style
, &f
);
775 ok(hres
== S_OK
, "get_posLeft failed: %08x\n", hres
);
776 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
779 hres
= IHTMLStyle_get_left(style
, &v
);
780 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
781 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
782 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
786 hres
= IHTMLStyle_put_left(style
, v
);
787 ok(hres
== S_OK
, "put_left failed: %08x\n", hres
);
790 hres
= IHTMLStyle_get_left(style
, &v
);
791 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
792 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
793 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
797 hres
= IHTMLStyle_get_top(style
, &v
);
798 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
799 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
800 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
804 hres
= IHTMLStyle_get_posTop(style
, NULL
);
805 ok(hres
== E_POINTER
, "get_posTop failed: %08x\n", hres
);
808 hres
= IHTMLStyle_get_posTop(style
, &f
);
809 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
810 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
812 hres
= IHTMLStyle_put_posTop(style
, 4.9f
);
813 ok(hres
== S_OK
, "put_posTop failed: %08x\n", hres
);
815 hres
= IHTMLStyle_get_posTop(style
, &f
);
816 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
819 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
822 V_BSTR(&v
) = a2bstr("3px");
823 hres
= IHTMLStyle_put_top(style
, v
);
824 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
828 hres
= IHTMLStyle_get_top(style
, &v
);
829 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
830 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
831 ok(!strcmp_wa(V_BSTR(&v
), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
834 hres
= IHTMLStyle_get_posTop(style
, &f
);
835 ok(hres
== S_OK
, "get_posTop failed: %08x\n", hres
);
836 ok(f
== 3.0, "expected 3.0 got %f\n", f
);
839 hres
= IHTMLStyle_put_top(style
, v
);
840 ok(hres
== S_OK
, "put_top failed: %08x\n", hres
);
843 hres
= IHTMLStyle_get_top(style
, &v
);
844 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
845 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
846 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
850 hres
= IHTMLStyle_get_posHeight(style
, NULL
);
851 ok(hres
== E_POINTER
, "get_posHeight failed: %08x\n", hres
);
854 hres
= IHTMLStyle_get_height(style
, &v
);
855 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
856 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
857 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
861 hres
= IHTMLStyle_get_posHeight(style
, &f
);
862 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
863 ok(f
== 0.0, "expected 0.0 got %f\n", f
);
865 hres
= IHTMLStyle_put_posHeight(style
, 4.9f
);
866 ok(hres
== S_OK
, "put_posHeight failed: %08x\n", hres
);
868 hres
= IHTMLStyle_get_posHeight(style
, &f
);
869 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
872 "expected 4.0 or 4.9 (IE8) got %f\n", f
);
875 V_BSTR(&v
) = a2bstr("64px");
876 hres
= IHTMLStyle_put_height(style
, v
);
877 ok(hres
== S_OK
, "put_height failed: %08x\n", hres
);
881 hres
= IHTMLStyle_get_height(style
, &v
);
882 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
883 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
884 ok(!strcmp_wa(V_BSTR(&v
), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
887 hres
= IHTMLStyle_get_posHeight(style
, &f
);
888 ok(hres
== S_OK
, "get_posHeight failed: %08x\n", hres
);
889 ok(f
== 64.0, "expected 64.0 got %f\n", f
);
891 str
= (void*)0xdeadbeef;
892 hres
= IHTMLStyle_get_cursor(style
, &str
);
893 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
894 ok(!str
, "get_cursor != NULL\n");
897 str
= a2bstr("default");
898 hres
= IHTMLStyle_put_cursor(style
, str
);
899 ok(hres
== S_OK
, "put_cursor failed: %08x\n", hres
);
903 hres
= IHTMLStyle_get_cursor(style
, &str
);
904 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
905 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
909 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
910 ok(hres
== S_OK
, "get_vertivalAlign failed: %08x\n", hres
);
911 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
912 ok(!V_BSTR(&v
), "V_BSTR(v) != NULL\n");
916 V_BSTR(&v
) = a2bstr("middle");
917 hres
= IHTMLStyle_put_verticalAlign(style
, v
);
918 ok(hres
== S_OK
, "put_vertivalAlign failed: %08x\n", hres
);
922 hres
= IHTMLStyle_get_verticalAlign(style
, &v
);
923 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
924 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
925 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
928 str
= (void*)0xdeadbeef;
929 hres
= IHTMLStyle_get_textAlign(style
, &str
);
930 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
931 ok(!str
, "textAlign != NULL\n");
933 str
= a2bstr("center");
934 hres
= IHTMLStyle_put_textAlign(style
, str
);
935 ok(hres
== S_OK
, "put_textAlign failed: %08x\n", hres
);
939 hres
= IHTMLStyle_get_textAlign(style
, &str
);
940 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
941 ok(!strcmp_wa(str
, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
944 str
= (void*)0xdeadbeef;
945 hres
= IHTMLStyle_get_filter(style
, &str
);
946 ok(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
947 ok(!str
, "filter != NULL\n");
949 str
= a2bstr("alpha(opacity=100)");
950 hres
= IHTMLStyle_put_filter(style
, str
);
951 ok(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
955 hres
= IHTMLStyle_get_zIndex(style
, &v
);
956 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
957 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
958 ok(!V_I4(&v
), "V_I4(v) != 0\n");
962 V_BSTR(&v
) = a2bstr("1");
963 hres
= IHTMLStyle_put_zIndex(style
, v
);
964 ok(hres
== S_OK
, "put_zIndex failed: %08x\n", hres
);
968 hres
= IHTMLStyle_get_zIndex(style
, &v
);
969 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
970 ok(V_VT(&v
) == VT_I4
, "V_VT(v)=%d\n", V_VT(&v
));
971 ok(V_I4(&v
) == 1, "V_I4(v) = %d\n", V_I4(&v
));
975 hres
= IHTMLStyle_get_fontStyle(style
, &sDefault
);
976 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
978 str
= a2bstr("test");
979 hres
= IHTMLStyle_put_fontStyle(style
, str
);
980 ok(hres
== E_INVALIDARG
, "put_fontStyle failed: %08x\n", hres
);
983 str
= a2bstr("italic");
984 hres
= IHTMLStyle_put_fontStyle(style
, str
);
985 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
988 str
= a2bstr("oblique");
989 hres
= IHTMLStyle_put_fontStyle(style
, str
);
990 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
993 str
= a2bstr("normal");
994 hres
= IHTMLStyle_put_fontStyle(style
, str
);
995 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
998 hres
= IHTMLStyle_put_fontStyle(style
, sDefault
);
999 ok(hres
== S_OK
, "put_fontStyle failed: %08x\n", hres
);
1000 SysFreeString(sDefault
);
1003 hres
= IHTMLStyle_get_overflow(style
, NULL
);
1004 ok(hres
== E_INVALIDARG
, "get_overflow failed: %08x\n", hres
);
1006 hres
= IHTMLStyle_get_overflow(style
, &sOverflowDefault
);
1007 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1009 str
= a2bstr("test");
1010 hres
= IHTMLStyle_put_overflow(style
, str
);
1011 ok(hres
== E_INVALIDARG
, "put_overflow failed: %08x\n", hres
);
1014 str
= a2bstr("visible");
1015 hres
= IHTMLStyle_put_overflow(style
, str
);
1016 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1019 str
= a2bstr("scroll");
1020 hres
= IHTMLStyle_put_overflow(style
, str
);
1021 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1024 str
= a2bstr("hidden");
1025 hres
= IHTMLStyle_put_overflow(style
, str
);
1026 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1029 str
= a2bstr("auto");
1030 hres
= IHTMLStyle_put_overflow(style
, str
);
1031 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1034 hres
= IHTMLStyle_get_overflow(style
, &str
);
1035 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1036 ok(!strcmp_wa(str
, "auto"), "str=%s\n", wine_dbgstr_w(str
));
1040 hres
= IHTMLStyle_put_overflow(style
, str
);
1041 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1044 hres
= IHTMLStyle_get_overflow(style
, &str
);
1045 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1046 ok(!str
, "str=%s\n", wine_dbgstr_w(str
));
1049 /* restore overflow default */
1050 hres
= IHTMLStyle_put_overflow(style
, sOverflowDefault
);
1051 ok(hres
== S_OK
, "put_overflow failed: %08x\n", hres
);
1052 SysFreeString(sOverflowDefault
);
1054 /* Attribute Tests*/
1055 hres
= IHTMLStyle_getAttribute(style
, NULL
, 1, &v
);
1056 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1058 str
= a2bstr("position");
1059 hres
= IHTMLStyle_getAttribute(style
, str
, 1, NULL
);
1060 ok(hres
== E_INVALIDARG
, "getAttribute failed: %08x\n", hres
);
1062 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1063 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1064 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1067 hres
= IHTMLStyle_setAttribute(style
, NULL
, v
, 1);
1068 ok(hres
== E_INVALIDARG
, "setAttribute failed: %08x\n", hres
);
1071 V_BSTR(&v
) = a2bstr("absolute");
1072 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1073 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1076 hres
= IHTMLStyle_getAttribute(style
, str
, 1, &v
);
1077 ok(hres
== S_OK
, "getAttribute failed: %08x\n", hres
);
1078 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1079 ok(!strcmp_wa(V_BSTR(&v
), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1084 hres
= IHTMLStyle_setAttribute(style
, str
, v
, 1);
1085 ok(hres
== S_OK
, "setAttribute failed: %08x\n", hres
);
1090 str
= a2bstr("borderLeftStyle");
1091 test_border_styles(style
, str
);
1094 str
= a2bstr("borderbottomstyle");
1095 test_border_styles(style
, str
);
1098 str
= a2bstr("borderrightstyle");
1099 test_border_styles(style
, str
);
1102 str
= a2bstr("bordertopstyle");
1103 test_border_styles(style
, str
);
1106 hres
= IHTMLStyle_get_borderStyle(style
, &sDefault
);
1107 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1109 str
= a2bstr("none dotted dashed solid");
1110 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1111 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1114 str
= a2bstr("none dotted dashed solid");
1115 hres
= IHTMLStyle_get_borderStyle(style
, &str
);
1116 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1117 ok(!strcmp_wa(str
, "none dotted dashed solid"),
1118 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v
)));
1121 str
= a2bstr("double groove ridge inset");
1122 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1123 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1126 str
= a2bstr("window-inset outset ridge inset");
1127 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1128 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1131 str
= a2bstr("window-inset");
1132 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1133 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1136 str
= a2bstr("none none none none none");
1137 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1138 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1141 str
= a2bstr("invalid none none none");
1142 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1143 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1146 str
= a2bstr("none invalid none none");
1147 hres
= IHTMLStyle_put_borderStyle(style
, str
);
1148 ok(hres
== E_INVALIDARG
, "put_borderStyle failed: %08x\n", hres
);
1151 hres
= IHTMLStyle_put_borderStyle(style
, sDefault
);
1152 ok(hres
== S_OK
, "put_borderStyle failed: %08x\n", hres
);
1153 SysFreeString(sDefault
);
1155 /* backgoundColor */
1156 hres
= IHTMLStyle_get_backgroundColor(style
, &v
);
1157 ok(hres
== S_OK
, "get_backgroundColor: %08x\n", hres
);
1158 ok(V_VT(&v
) == VT_BSTR
, "type failed: %d\n", V_VT(&v
));
1159 ok(!V_BSTR(&v
), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1163 hres
= IHTMLStyle_get_padding(style
, &str
);
1164 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1165 ok(!str
, "padding = %s\n", wine_dbgstr_w(str
));
1169 hres
= IHTMLStyle_put_padding(style
, str
);
1170 ok(hres
== S_OK
, "put_padding failed: %08x\n", hres
);
1173 hres
= IHTMLStyle_get_padding(style
, &str
);
1174 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1175 ok(!strcmp_wa(str
, "1px"), "padding = %s\n", wine_dbgstr_w(str
));
1179 hres
= IHTMLStyle_get_paddingLeft(style
, &vDefault
);
1180 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1183 V_BSTR(&v
) = a2bstr("10");
1184 hres
= IHTMLStyle_put_paddingLeft(style
, v
);
1185 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1188 hres
= IHTMLStyle_get_paddingLeft(style
, &v
);
1189 ok(hres
== S_OK
, "get_paddingLeft: %08x\n", hres
);
1190 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1193 hres
= IHTMLStyle_put_paddingLeft(style
, vDefault
);
1194 ok(hres
== S_OK
, "put_paddingLeft: %08x\n", hres
);
1196 /* BackgroundRepeat */
1197 hres
= IHTMLStyle_get_backgroundRepeat(style
, &sDefault
);
1198 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1200 str
= a2bstr("invalid");
1201 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1202 ok(hres
== E_INVALIDARG
, "put_backgroundRepeat failed: %08x\n", hres
);
1205 str
= a2bstr("repeat");
1206 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1207 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1210 str
= a2bstr("no-repeat");
1211 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1212 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1215 str
= a2bstr("repeat-x");
1216 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1217 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1220 str
= a2bstr("repeat-y");
1221 hres
= IHTMLStyle_put_backgroundRepeat(style
, str
);
1222 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1225 hres
= IHTMLStyle_get_backgroundRepeat(style
, &str
);
1226 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1227 ok(!strcmp_wa(str
, "repeat-y"), "str=%s\n", wine_dbgstr_w(str
));
1230 hres
= IHTMLStyle_put_backgroundRepeat(style
, sDefault
);
1231 ok(hres
== S_OK
, "put_backgroundRepeat failed: %08x\n", hres
);
1232 SysFreeString(sDefault
);
1235 hres
= IHTMLStyle_get_borderColor(style
, &sDefault
);
1236 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1238 str
= a2bstr("red green red blue");
1239 hres
= IHTMLStyle_put_borderColor(style
, str
);
1240 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1243 hres
= IHTMLStyle_get_borderColor(style
, &str
);
1244 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1245 ok(!strcmp_wa(str
, "red green red blue"), "str=%s\n", wine_dbgstr_w(str
));
1248 hres
= IHTMLStyle_put_borderColor(style
, sDefault
);
1249 ok(hres
== S_OK
, "put_borderColor failed: %08x\n", hres
);
1250 SysFreeString(sDefault
);
1253 hres
= IHTMLStyle_get_borderRight(style
, &sDefault
);
1254 ok(hres
== S_OK
, "get_borderRight failed: %08x\n", hres
);
1256 str
= a2bstr("thick dotted red");
1257 hres
= IHTMLStyle_put_borderRight(style
, str
);
1258 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1261 /* IHTMLStyle_get_borderRight appears to have a bug where
1262 it returns the first letter of the color. So we check
1263 each style individually.
1266 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1267 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1268 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1272 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1273 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1274 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1277 hres
= IHTMLStyle_get_borderRightStyle(style
, &str
);
1278 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1279 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1282 hres
= IHTMLStyle_put_borderRight(style
, sDefault
);
1283 ok(hres
== S_OK
, "put_borderRight failed: %08x\n", hres
);
1284 SysFreeString(sDefault
);
1287 hres
= IHTMLStyle_get_borderTop(style
, &sDefault
);
1288 ok(hres
== S_OK
, "get_borderTop failed: %08x\n", hres
);
1290 str
= a2bstr("thick dotted red");
1291 hres
= IHTMLStyle_put_borderTop(style
, str
);
1292 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1295 /* IHTMLStyle_get_borderTop appears to have a bug where
1296 it returns the first letter of the color. So we check
1297 each style individually.
1300 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1301 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1302 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1306 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1307 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1308 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1311 hres
= IHTMLStyle_get_borderTopStyle(style
, &str
);
1312 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1313 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1316 hres
= IHTMLStyle_put_borderTop(style
, sDefault
);
1317 ok(hres
== S_OK
, "put_borderTop failed: %08x\n", hres
);
1318 SysFreeString(sDefault
);
1321 hres
= IHTMLStyle_get_borderBottom(style
, &sDefault
);
1322 ok(hres
== S_OK
, "get_borderBottom failed: %08x\n", hres
);
1324 str
= a2bstr("thick dotted red");
1325 hres
= IHTMLStyle_put_borderBottom(style
, str
);
1326 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1329 /* IHTMLStyle_get_borderBottom appears to have a bug where
1330 it returns the first letter of the color. So we check
1331 each style individually.
1334 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1335 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1336 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1340 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1341 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1342 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1345 hres
= IHTMLStyle_get_borderBottomStyle(style
, &str
);
1346 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1347 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1350 hres
= IHTMLStyle_put_borderBottom(style
, sDefault
);
1351 ok(hres
== S_OK
, "put_borderBottom failed: %08x\n", hres
);
1352 SysFreeString(sDefault
);
1355 hres
= IHTMLStyle_get_borderLeft(style
, &sDefault
);
1356 ok(hres
== S_OK
, "get_borderLeft failed: %08x\n", hres
);
1358 str
= a2bstr("thick dotted red");
1359 hres
= IHTMLStyle_put_borderLeft(style
, str
);
1360 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1363 /* IHTMLStyle_get_borderLeft appears to have a bug where
1364 it returns the first letter of the color. So we check
1365 each style individually.
1368 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1369 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1370 ok(!strcmp_wa(V_BSTR(&v
), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1374 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1375 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1376 ok(!strcmp_wa(V_BSTR(&v
), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v
)));
1379 hres
= IHTMLStyle_get_borderLeftStyle(style
, &str
);
1380 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1381 ok(!strcmp_wa(str
, "dotted"), "str=%s\n", wine_dbgstr_w(str
));
1384 hres
= IHTMLStyle_put_borderLeft(style
, sDefault
);
1385 ok(hres
== S_OK
, "put_borderLeft failed: %08x\n", hres
);
1386 SysFreeString(sDefault
);
1388 /* backgroundPositionX */
1389 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1390 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1391 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1392 ok(!V_BSTR(&v
), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1396 V_BSTR(&v
) = a2bstr("10px");
1397 hres
= IHTMLStyle_put_backgroundPositionX(style
, v
);
1398 ok(hres
== S_OK
, "put_backgroundPositionX failed: %08x\n", hres
);
1401 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1402 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1403 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1404 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1407 /* backgroundPositionY */
1408 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1409 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1410 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1414 V_BSTR(&v
) = a2bstr("15px");
1415 hres
= IHTMLStyle_put_backgroundPositionY(style
, v
);
1416 ok(hres
== S_OK
, "put_backgroundPositionY failed: %08x\n", hres
);
1419 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1420 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1421 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1422 ok(!strcmp_wa(V_BSTR(&v
), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1425 /* backgroundPosition */
1427 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1428 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1429 ok(!strcmp_wa(str
, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1432 str
= a2bstr("center 20%");
1433 hres
= IHTMLStyle_put_backgroundPosition(style
, str
);
1434 ok(hres
== S_OK
, "put_backgroundPosition failed: %08x\n", hres
);
1438 hres
= IHTMLStyle_get_backgroundPosition(style
, &str
);
1439 ok(hres
== S_OK
, "get_backgroundPosition failed: %08x\n", hres
);
1440 ok(!strcmp_wa(str
, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str
));
1443 hres
= IHTMLStyle_get_backgroundPositionX(style
, &v
);
1444 ok(hres
== S_OK
, "get_backgroundPositionX failed: %08x\n", hres
);
1445 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1446 ok(!strcmp_wa(V_BSTR(&v
), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1449 hres
= IHTMLStyle_get_backgroundPositionY(style
, &v
);
1450 ok(hres
== S_OK
, "get_backgroundPositionY failed: %08x\n", hres
);
1451 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1452 ok(!strcmp_wa(V_BSTR(&v
), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1455 /* borderTopWidth */
1456 hres
= IHTMLStyle_get_borderTopWidth(style
, &vDefault
);
1457 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1460 V_BSTR(&v
) = a2bstr("10px");
1461 hres
= IHTMLStyle_put_borderTopWidth(style
, v
);
1462 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1465 hres
= IHTMLStyle_get_borderTopWidth(style
, &v
);
1466 ok(hres
== S_OK
, "get_borderTopWidth: %08x\n", hres
);
1467 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1470 hres
= IHTMLStyle_put_borderTopWidth(style
, vDefault
);
1471 ok(hres
== S_OK
, "put_borderTopWidth: %08x\n", hres
);
1472 VariantClear(&vDefault
);
1474 /* borderRightWidth */
1475 hres
= IHTMLStyle_get_borderRightWidth(style
, &vDefault
);
1476 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1479 V_BSTR(&v
) = a2bstr("10");
1480 hres
= IHTMLStyle_put_borderRightWidth(style
, v
);
1481 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1484 hres
= IHTMLStyle_get_borderRightWidth(style
, &v
);
1485 ok(hres
== S_OK
, "get_borderRightWidth: %08x\n", hres
);
1486 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1489 hres
= IHTMLStyle_put_borderRightWidth(style
, vDefault
);
1490 ok(hres
== S_OK
, "put_borderRightWidth: %08x\n", hres
);
1491 VariantClear(&vDefault
);
1493 /* borderBottomWidth */
1494 hres
= IHTMLStyle_get_borderBottomWidth(style
, &vDefault
);
1495 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1498 V_BSTR(&v
) = a2bstr("10");
1499 hres
= IHTMLStyle_put_borderBottomWidth(style
, v
);
1500 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1503 hres
= IHTMLStyle_get_borderBottomWidth(style
, &v
);
1504 ok(hres
== S_OK
, "get_borderBottomWidth: %08x\n", hres
);
1505 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1508 hres
= IHTMLStyle_put_borderBottomWidth(style
, vDefault
);
1509 ok(hres
== S_OK
, "put_borderBottomWidth: %08x\n", hres
);
1510 VariantClear(&vDefault
);
1512 /* borderLeftWidth */
1513 hres
= IHTMLStyle_get_borderLeftWidth(style
, &vDefault
);
1514 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1517 V_BSTR(&v
) = a2bstr("10");
1518 hres
= IHTMLStyle_put_borderLeftWidth(style
, v
);
1519 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1522 hres
= IHTMLStyle_get_borderLeftWidth(style
, &v
);
1523 ok(hres
== S_OK
, "get_borderLeftWidth: %08x\n", hres
);
1524 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1527 hres
= IHTMLStyle_put_borderLeftWidth(style
, vDefault
);
1528 ok(hres
== S_OK
, "put_borderLeftWidth: %08x\n", hres
);
1529 VariantClear(&vDefault
);
1532 hres
= IHTMLStyle_get_wordSpacing(style
, &vDefault
);
1533 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1536 V_BSTR(&v
) = a2bstr("10");
1537 hres
= IHTMLStyle_put_wordSpacing(style
, v
);
1538 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1541 hres
= IHTMLStyle_get_wordSpacing(style
, &v
);
1542 ok(hres
== S_OK
, "get_wordSpacing: %08x\n", hres
);
1543 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1544 ok(!strcmp_wa(V_BSTR(&v
), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1547 hres
= IHTMLStyle_put_wordSpacing(style
, vDefault
);
1548 ok(hres
== S_OK
, "put_wordSpacing: %08x\n", hres
);
1549 VariantClear(&vDefault
);
1552 hres
= IHTMLStyle_get_letterSpacing(style
, &vDefault
);
1553 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1556 V_BSTR(&v
) = a2bstr("11");
1557 hres
= IHTMLStyle_put_letterSpacing(style
, v
);
1558 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1561 hres
= IHTMLStyle_get_letterSpacing(style
, &v
);
1562 ok(hres
== S_OK
, "get_letterSpacing: %08x\n", hres
);
1563 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v)=%d\n", V_VT(&v
));
1564 ok(!strcmp_wa(V_BSTR(&v
), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1567 hres
= IHTMLStyle_put_letterSpacing(style
, vDefault
);
1568 ok(hres
== S_OK
, "put_letterSpacing: %08x\n", hres
);
1569 VariantClear(&vDefault
);
1571 /* borderTopColor */
1572 hres
= IHTMLStyle_get_borderTopColor(style
, &vDefault
);
1573 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1576 V_BSTR(&v
) = a2bstr("red");
1577 hres
= IHTMLStyle_put_borderTopColor(style
, v
);
1578 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1581 hres
= IHTMLStyle_get_borderTopColor(style
, &v
);
1582 ok(hres
== S_OK
, "get_borderTopColor: %08x\n", hres
);
1583 ok(!strcmp_wa(V_BSTR(&v
), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1586 hres
= IHTMLStyle_put_borderTopColor(style
, vDefault
);
1587 ok(hres
== S_OK
, "put_borderTopColor: %08x\n", hres
);
1589 /* borderRightColor */
1590 hres
= IHTMLStyle_get_borderRightColor(style
, &vDefault
);
1591 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1594 V_BSTR(&v
) = a2bstr("blue");
1595 hres
= IHTMLStyle_put_borderRightColor(style
, v
);
1596 ok(hres
== S_OK
, "put_borderRightColor: %08x\n", hres
);
1599 hres
= IHTMLStyle_get_borderRightColor(style
, &v
);
1600 ok(hres
== S_OK
, "get_borderRightColor: %08x\n", hres
);
1601 ok(!strcmp_wa(V_BSTR(&v
), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1604 hres
= IHTMLStyle_put_borderRightColor(style
, vDefault
);
1605 ok(hres
== S_OK
, "putborderRightColorr: %08x\n", hres
);
1607 /* borderBottomColor */
1608 hres
= IHTMLStyle_get_borderBottomColor(style
, &vDefault
);
1609 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1612 V_BSTR(&v
) = a2bstr("cyan");
1613 hres
= IHTMLStyle_put_borderBottomColor(style
, v
);
1614 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1617 hres
= IHTMLStyle_get_borderBottomColor(style
, &v
);
1618 ok(hres
== S_OK
, "get_borderBottomColor: %08x\n", hres
);
1619 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1622 hres
= IHTMLStyle_put_borderBottomColor(style
, vDefault
);
1623 ok(hres
== S_OK
, "put_borderBottomColor: %08x\n", hres
);
1625 /* borderLeftColor */
1626 hres
= IHTMLStyle_get_borderLeftColor(style
, &vDefault
);
1627 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1630 V_BSTR(&v
) = a2bstr("cyan");
1631 hres
= IHTMLStyle_put_borderLeftColor(style
, v
);
1632 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1635 hres
= IHTMLStyle_get_borderLeftColor(style
, &v
);
1636 ok(hres
== S_OK
, "get_borderLeftColor: %08x\n", hres
);
1637 ok(!strcmp_wa(V_BSTR(&v
), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1640 hres
= IHTMLStyle_put_borderLeftColor(style
, vDefault
);
1641 ok(hres
== S_OK
, "put_borderLeftColor: %08x\n", hres
);
1644 hres
= IHTMLStyle_get_clip(style
, &str
);
1645 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1646 ok(!str
, "clip = %s\n", wine_dbgstr_w(str
));
1648 str
= a2bstr("rect(0px 1px 500px 505px)");
1649 hres
= IHTMLStyle_put_clip(style
, str
);
1650 ok(hres
== S_OK
, "put_clip failed: %08x\n", hres
);
1653 hres
= IHTMLStyle_get_clip(style
, &str
);
1654 ok(hres
== S_OK
, "get_clip failed: %08x\n", hres
);
1655 ok(!strcmp_wa(str
, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str
));
1658 /* pageBreakAfter */
1659 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1660 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1661 ok(!str
, "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1663 str
= a2bstr("always");
1664 hres
= IHTMLStyle_put_pageBreakAfter(style
, str
);
1665 ok(hres
== S_OK
, "put_pageBreakAfter failed: %08x\n", hres
);
1668 hres
= IHTMLStyle_get_pageBreakAfter(style
, &str
);
1669 ok(hres
== S_OK
, "get_pageBreakAfter failed: %08x\n", hres
);
1670 ok(!strcmp_wa(str
, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str
));
1673 /* pageBreakBefore */
1674 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1675 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1676 ok(!str
, "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1678 str
= a2bstr("always");
1679 hres
= IHTMLStyle_put_pageBreakBefore(style
, str
);
1680 ok(hres
== S_OK
, "put_pageBreakBefore failed: %08x\n", hres
);
1683 hres
= IHTMLStyle_get_pageBreakBefore(style
, &str
);
1684 ok(hres
== S_OK
, "get_pageBreakBefore failed: %08x\n", hres
);
1685 ok(!strcmp_wa(str
, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str
));
1688 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle2
, (void**)&style2
);
1689 ok(hres
== S_OK
, "Could not get IHTMLStyle2 iface: %08x\n", hres
);
1690 if(SUCCEEDED(hres
)) {
1691 test_style2(style2
);
1692 IHTMLStyle2_Release(style2
);
1695 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle3
, (void**)&style3
);
1696 ok(hres
== S_OK
, "Could not get IHTMLStyle3 iface: %08x\n", hres
);
1697 if(SUCCEEDED(hres
)) {
1698 test_style3(style3
);
1699 IHTMLStyle3_Release(style3
);
1702 hres
= IHTMLStyle_QueryInterface(style
, &IID_IHTMLStyle4
, (void**)&style4
);
1703 ok(hres
== S_OK
, "Could not get IHTMLStyle4 iface: %08x\n", hres
);
1704 if(SUCCEEDED(hres
)) {
1705 test_style4(style4
);
1706 IHTMLStyle4_Release(style4
);
1710 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1711 static void _test_style_filter(unsigned line
, IHTMLStyle
*style
, const char *exval
)
1716 str
= (void*)0xdeadbeef;
1717 hres
= IHTMLStyle_get_filter(style
, &str
);
1718 ok_(__FILE__
,line
)(hres
== S_OK
, "get_filter failed: %08x\n", hres
);
1720 ok_(__FILE__
,line
)(str
&& !strcmp_wa(str
, exval
), "filter = %s, expected %s\n", wine_dbgstr_w(str
), exval
);
1722 ok_(__FILE__
,line
)(!str
, "str = %s, expected NULL\n", wine_dbgstr_w(str
));
1727 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1728 static void _set_style_filter(unsigned line
, IHTMLStyle
*style
, const char *val
)
1730 BSTR str
= a2bstr(val
);
1733 hres
= IHTMLStyle_put_filter(style
, str
);
1734 ok_(__FILE__
,line
)(hres
== S_OK
, "put_filter failed: %08x\n", hres
);
1737 _test_style_filter(line
, style
, val
);
1740 static void test_style_filters(IHTMLElement
*elem
)
1745 hres
= IHTMLElement_get_style(elem
, &style
);
1746 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1748 test_style_filter(style
, NULL
);
1749 set_style_filter(style
, "alpha(opacity=50.0040)");
1750 set_style_filter(style
, "alpha(opacity=100)");
1752 IHTMLStyle_Release(style
);
1754 hres
= IHTMLElement_get_style(elem
, &style
);
1755 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
1757 test_style_filter(style
, "alpha(opacity=100)");
1758 set_style_filter(style
, "xxx(a,b,c) alpha(opacity=100)");
1759 set_style_filter(style
, NULL
);
1761 IHTMLStyle_Release(style
);
1764 static void test_current_style(IHTMLCurrentStyle
*current_style
)
1770 hres
= IHTMLCurrentStyle_get_display(current_style
, &str
);
1771 ok(hres
== S_OK
, "get_display failed: %08x\n", hres
);
1772 ok(!strcmp_wa(str
, "block"), "get_display returned %s\n", wine_dbgstr_w(str
));
1775 hres
= IHTMLCurrentStyle_get_position(current_style
, &str
);
1776 ok(hres
== S_OK
, "get_position failed: %08x\n", hres
);
1777 ok(!strcmp_wa(str
, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str
));
1780 hres
= IHTMLCurrentStyle_get_fontFamily(current_style
, &str
);
1781 ok(hres
== S_OK
, "get_fontFamily failed: %08x\n", hres
);
1784 hres
= IHTMLCurrentStyle_get_fontStyle(current_style
, &str
);
1785 ok(hres
== S_OK
, "get_fontStyle failed: %08x\n", hres
);
1786 ok(!strcmp_wa(str
, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str
));
1789 hres
= IHTMLCurrentStyle_get_backgroundImage(current_style
, &str
);
1790 ok(hres
== S_OK
, "get_backgroundImage failed: %08x\n", hres
);
1791 ok(!strcmp_wa(str
, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str
));
1794 hres
= IHTMLCurrentStyle_get_fontVariant(current_style
, &str
);
1795 ok(hres
== S_OK
, "get_fontVariant failed: %08x\n", hres
);
1796 ok(!strcmp_wa(str
, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str
));
1799 hres
= IHTMLCurrentStyle_get_borderTopStyle(current_style
, &str
);
1800 ok(hres
== S_OK
, "get_borderTopStyle failed: %08x\n", hres
);
1801 ok(!strcmp_wa(str
, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str
));
1804 hres
= IHTMLCurrentStyle_get_borderRightStyle(current_style
, &str
);
1805 ok(hres
== S_OK
, "get_borderRightStyle failed: %08x\n", hres
);
1806 ok(!strcmp_wa(str
, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str
));
1809 hres
= IHTMLCurrentStyle_get_borderBottomStyle(current_style
, &str
);
1810 ok(hres
== S_OK
, "get_borderBottomStyle failed: %08x\n", hres
);
1811 ok(!strcmp_wa(str
, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str
));
1814 hres
= IHTMLCurrentStyle_get_borderLeftStyle(current_style
, &str
);
1815 ok(hres
== S_OK
, "get_borderLeftStyle failed: %08x\n", hres
);
1816 ok(!strcmp_wa(str
, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str
));
1819 hres
= IHTMLCurrentStyle_get_textAlign(current_style
, &str
);
1820 ok(hres
== S_OK
, "get_textAlign failed: %08x\n", hres
);
1821 ok(!strcmp_wa(str
, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str
));
1824 hres
= IHTMLCurrentStyle_get_textDecoration(current_style
, &str
);
1825 ok(hres
== S_OK
, "get_textDecoration failed: %08x\n", hres
);
1826 ok(!strcmp_wa(str
, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str
));
1829 hres
= IHTMLCurrentStyle_get_cursor(current_style
, &str
);
1830 ok(hres
== S_OK
, "get_cursor failed: %08x\n", hres
);
1831 ok(!strcmp_wa(str
, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str
));
1834 hres
= IHTMLCurrentStyle_get_backgroundRepeat(current_style
, &str
);
1835 ok(hres
== S_OK
, "get_backgroundRepeat failed: %08x\n", hres
);
1836 ok(!strcmp_wa(str
, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str
));
1839 hres
= IHTMLCurrentStyle_get_borderColor(current_style
, &str
);
1840 ok(hres
== S_OK
, "get_borderColor failed: %08x\n", hres
);
1843 hres
= IHTMLCurrentStyle_get_borderStyle(current_style
, &str
);
1844 ok(hres
== S_OK
, "get_borderStyle failed: %08x\n", hres
);
1847 hres
= IHTMLCurrentStyle_get_visibility(current_style
, &str
);
1848 ok(hres
== S_OK
, "get_visibility failed: %08x\n", hres
);
1851 hres
= IHTMLCurrentStyle_get_overflow(current_style
, &str
);
1852 ok(hres
== S_OK
, "get_overflow failed: %08x\n", hres
);
1855 hres
= IHTMLCurrentStyle_get_borderWidth(current_style
, &str
);
1856 ok(hres
== S_OK
, "get_borderWidth failed: %08x\n", hres
);
1859 hres
= IHTMLCurrentStyle_get_margin(current_style
, &str
);
1860 ok(hres
== S_OK
, "get_margin failed: %08x\n", hres
);
1863 hres
= IHTMLCurrentStyle_get_padding(current_style
, &str
);
1864 ok(hres
== S_OK
, "get_padding failed: %08x\n", hres
);
1867 hres
= IHTMLCurrentStyle_get_fontWeight(current_style
, &v
);
1868 ok(hres
== S_OK
, "get_fontWeight failed: %08x\n", hres
);
1869 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
1870 ok( V_I4(&v
) == 400, "expect 400 got (%d)\n", V_I4(&v
));
1873 hres
= IHTMLCurrentStyle_get_fontSize(current_style
, &v
);
1874 ok(hres
== S_OK
, "get_fontSize failed: %08x\n", hres
);
1875 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1878 hres
= IHTMLCurrentStyle_get_left(current_style
, &v
);
1879 ok(hres
== S_OK
, "get_left failed: %08x\n", hres
);
1880 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1883 hres
= IHTMLCurrentStyle_get_top(current_style
, &v
);
1884 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
1885 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1888 hres
= IHTMLCurrentStyle_get_width(current_style
, &v
);
1889 ok(hres
== S_OK
, "get_width failed: %08x\n", hres
);
1890 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1893 hres
= IHTMLCurrentStyle_get_height(current_style
, &v
);
1894 ok(hres
== S_OK
, "get_height failed: %08x\n", hres
);
1895 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1898 hres
= IHTMLCurrentStyle_get_paddingLeft(current_style
, &v
);
1899 ok(hres
== S_OK
, "get_paddingLeft failed: %08x\n", hres
);
1900 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1903 hres
= IHTMLCurrentStyle_get_zIndex(current_style
, &v
);
1904 ok(hres
== S_OK
, "get_zIndex failed: %08x\n", hres
);
1905 ok(V_VT(&v
) == VT_I4
, "V_VT(v) = %d\n", V_VT(&v
));
1906 ok( V_I4(&v
) == 1, "expect 1 got (%d)\n", V_I4(&v
));
1909 hres
= IHTMLCurrentStyle_get_verticalAlign(current_style
, &v
);
1910 ok(hres
== S_OK
, "get_verticalAlign failed: %08x\n", hres
);
1911 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1912 ok(!strcmp_wa(V_BSTR(&v
), "middle"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v
)));
1915 hres
= IHTMLCurrentStyle_get_marginRight(current_style
, &v
);
1916 ok(hres
== S_OK
, "get_marginRight failed: %08x\n", hres
);
1917 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1920 hres
= IHTMLCurrentStyle_get_marginLeft(current_style
, &v
);
1921 ok(hres
== S_OK
, "get_marginLeft failed: %08x\n", hres
);
1922 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1925 hres
= IHTMLCurrentStyle_get_borderLeftWidth(current_style
, &v
);
1926 ok(hres
== S_OK
, "get_borderLeftWidth failed: %08x\n", hres
);
1927 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1931 hres
= IHTMLCurrentStyle_get_borderRightWidth(current_style
, &v
);
1932 ok(hres
== S_OK
, "get_borderRightWidth failed: %08x\n", hres
);
1933 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1936 hres
= IHTMLCurrentStyle_get_borderBottomWidth(current_style
, &v
);
1937 ok(hres
== S_OK
, "get_borderBottomWidth failed: %08x\n", hres
);
1938 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1941 hres
= IHTMLCurrentStyle_get_borderTopWidth(current_style
, &v
);
1942 ok(hres
== S_OK
, "get_borderTopWidth failed: %08x\n", hres
);
1943 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1946 hres
= IHTMLCurrentStyle_get_color(current_style
, &v
);
1947 ok(hres
== S_OK
, "get_color failed: %08x\n", hres
);
1948 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1951 hres
= IHTMLCurrentStyle_get_backgroundColor(current_style
, &v
);
1952 ok(hres
== S_OK
, "get_backgroundColor failed: %08x\n", hres
);
1953 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1956 hres
= IHTMLCurrentStyle_get_borderLeftColor(current_style
, &v
);
1957 ok(hres
== S_OK
, "get_borderLeftColor failed: %08x\n", hres
);
1958 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1961 hres
= IHTMLCurrentStyle_get_borderTopColor(current_style
, &v
);
1962 ok(hres
== S_OK
, "get_borderTopColor failed: %08x\n", hres
);
1963 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1966 hres
= IHTMLCurrentStyle_get_borderRightColor(current_style
, &v
);
1967 ok(hres
== S_OK
, "get_borderRightColor failed: %08x\n", hres
);
1968 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1971 hres
= IHTMLCurrentStyle_get_borderBottomColor(current_style
, &v
);
1972 ok(hres
== S_OK
, "get_borderBottomColor failed: %08x\n", hres
);
1973 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1976 hres
= IHTMLCurrentStyle_get_paddingTop(current_style
, &v
);
1977 ok(hres
== S_OK
, "get_paddingTop failed: %08x\n", hres
);
1978 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1981 hres
= IHTMLCurrentStyle_get_paddingRight(current_style
, &v
);
1982 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
1983 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1986 hres
= IHTMLCurrentStyle_get_paddingBottom(current_style
, &v
);
1987 ok(hres
== S_OK
, "get_paddingRight failed: %08x\n", hres
);
1988 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1991 hres
= IHTMLCurrentStyle_get_letterSpacing(current_style
, &v
);
1992 ok(hres
== S_OK
, "get_letterSpacing failed: %08x\n", hres
);
1993 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
1996 hres
= IHTMLCurrentStyle_get_marginTop(current_style
, &v
);
1997 ok(hres
== S_OK
, "get_marginTop failed: %08x\n", hres
);
1998 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2001 hres
= IHTMLCurrentStyle_get_marginBottom(current_style
, &v
);
2002 ok(hres
== S_OK
, "get_marginBottom failed: %08x\n", hres
);
2003 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2006 hres
= IHTMLCurrentStyle_get_right(current_style
, &v
);
2007 ok(hres
== S_OK
, "get_Right failed: %08x\n", hres
);
2008 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2011 hres
= IHTMLCurrentStyle_get_bottom(current_style
, &v
);
2012 ok(hres
== S_OK
, "get_bottom failed: %08x\n", hres
);
2013 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2016 hres
= IHTMLCurrentStyle_get_lineHeight(current_style
, &v
);
2017 ok(hres
== S_OK
, "get_lineHeight failed: %08x\n", hres
);
2018 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2021 hres
= IHTMLCurrentStyle_get_textIndent(current_style
, &v
);
2022 ok(hres
== S_OK
, "get_textIndent failed: %08x\n", hres
);
2023 ok(V_VT(&v
) == VT_BSTR
, "V_VT(v) = %d\n", V_VT(&v
));
2027 static const char basic_test_str
[] = "<html><body><div id=\"divid\"></div/</body></html>";
2029 static void basic_style_test(IHTMLDocument2
*doc
)
2031 IHTMLCurrentStyle
*cstyle
;
2036 hres
= IHTMLDocument2_get_body(doc
, &elem
);
2037 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
2039 hres
= IHTMLElement_get_style(elem
, &style
);
2040 ok(hres
== S_OK
, "get_style failed: %08x\n", hres
);
2042 test_body_style(style
);
2044 cstyle
= get_current_style(elem
);
2045 test_current_style(cstyle
);
2046 IHTMLCurrentStyle_Release(cstyle
);
2047 IHTMLElement_Release(elem
);
2049 elem
= get_element_by_id(doc
, "divid");
2050 test_style_filters(elem
);
2052 test_set_csstext(style
);
2053 IHTMLStyle_Release(style
);
2054 IHTMLElement_Release(elem
);
2057 static IHTMLDocument2
*notif_doc
;
2058 static BOOL doc_complete
;
2060 static IHTMLDocument2
*create_document(void)
2062 IHTMLDocument2
*doc
;
2063 IHTMLDocument5
*doc5
;
2066 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2067 &IID_IHTMLDocument2
, (void**)&doc
);
2068 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
2072 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
2074 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2075 IHTMLDocument2_Release(doc
);
2079 IHTMLDocument5_Release(doc5
);
2083 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
2084 REFIID riid
, void**ppv
)
2086 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2091 ok(0, "unexpected call\n");
2092 return E_NOINTERFACE
;
2095 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
2100 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
2105 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
2107 if(dispID
== DISPID_READYSTATE
){
2111 hres
= IHTMLDocument2_get_readyState(notif_doc
, &state
);
2112 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2114 if(!strcmp_wa(state
, "complete"))
2115 doc_complete
= TRUE
;
2117 SysFreeString(state
);
2123 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
2125 ok(0, "unexpected call\n");
2129 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
2130 PropertyNotifySink_QueryInterface
,
2131 PropertyNotifySink_AddRef
,
2132 PropertyNotifySink_Release
,
2133 PropertyNotifySink_OnChanged
,
2134 PropertyNotifySink_OnRequestEdit
2137 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
2139 static IHTMLDocument2
*create_doc_with_string(const char *str
)
2141 IPersistStreamInit
*init
;
2143 IHTMLDocument2
*doc
;
2147 notif_doc
= doc
= create_document();
2151 doc_complete
= FALSE
;
2153 mem
= GlobalAlloc(0, len
);
2154 memcpy(mem
, str
, len
);
2155 CreateStreamOnHGlobal(mem
, TRUE
, &stream
);
2157 IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
2159 IPersistStreamInit_Load(init
, stream
);
2160 IPersistStreamInit_Release(init
);
2161 IStream_Release(stream
);
2166 static void do_advise(IUnknown
*unk
, REFIID riid
, IUnknown
*unk_advise
)
2168 IConnectionPointContainer
*container
;
2169 IConnectionPoint
*cp
;
2173 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2174 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2176 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2177 IConnectionPointContainer_Release(container
);
2178 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2180 hres
= IConnectionPoint_Advise(cp
, unk_advise
, &cookie
);
2181 IConnectionPoint_Release(cp
);
2182 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2185 typedef void (*style_test_t
)(IHTMLDocument2
*);
2187 static void run_test(const char *str
, style_test_t test
)
2189 IHTMLDocument2
*doc
;
2193 doc
= create_doc_with_string(str
);
2197 do_advise((IUnknown
*)doc
, &IID_IPropertyNotifySink
, (IUnknown
*)&PropertyNotifySink
);
2199 while(!doc_complete
&& GetMessage(&msg
, NULL
, 0, 0)) {
2200 TranslateMessage(&msg
);
2201 DispatchMessage(&msg
);
2206 ref
= IHTMLDocument2_Release(doc
);
2207 ok(!ref
|| broken(ref
== 1), /* Vista */
2216 run_test(basic_test_str
, basic_style_test
);