mshtml: Added IHTMLStyle2::overflowY implementation.
[wine/multimedia.git] / dlls / mshtml / tests / style.c
blob7b6d69d8d249c2e395f2bbea80bb8cd09a99ad70
1 /*
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
19 #define COBJMACROS
20 #define CONST_VTABLE
22 #include <wine/test.h>
23 #include <stdarg.h>
24 #include <stdio.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ole2.h"
29 #include "mshtml.h"
30 #include "mshtmhst.h"
31 #include "docobj.h"
33 static int strcmp_wa(LPCWSTR strw, const char *stra)
35 CHAR buf[512];
36 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
37 return lstrcmpA(stra, buf);
40 static BSTR a2bstr(const char *str)
42 BSTR ret;
43 int len;
45 if(!str)
46 return NULL;
48 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
49 ret = SysAllocStringLen(NULL, len);
50 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
52 return ret;
55 #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b)
56 static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect)
58 ok_(__FILE__,line)(V_VT(v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(v));
59 if(expect)
60 ok_(__FILE__,line)(!strcmp_wa(V_BSTR(v), expect), "V_BSTR(v) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(v)), expect);
61 else
62 ok_(__FILE__,line)(!V_BSTR(v), "V_BSTR(v) = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(v)));
65 #define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
66 static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
68 IHTMLElement2 *elem;
69 HRESULT hres;
71 hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem);
72 ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2: %08x\n", hres);
73 return elem;
76 static IHTMLElement *get_element_by_id(IHTMLDocument2 *doc, const char *id)
78 HRESULT hres;
79 IHTMLDocument3 *doc3;
80 IHTMLElement *result;
81 BSTR idW = a2bstr(id);
83 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
84 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument3) failed: %08x\n", hres);
86 hres = IHTMLDocument3_getElementById(doc3, idW, &result);
87 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
88 ok(result != NULL, "result == NULL\n");
89 SysFreeString(idW);
91 IHTMLDocument3_Release(doc3);
92 return result;
95 #define get_current_style(e) _get_current_style(__LINE__,e)
96 static IHTMLCurrentStyle *_get_current_style(unsigned line, IHTMLElement *elem)
98 IHTMLCurrentStyle *cstyle;
99 IHTMLElement2 *elem2;
100 HRESULT hres;
102 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
103 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
105 cstyle = NULL;
106 hres = IHTMLElement2_get_currentStyle(elem2, &cstyle);
107 ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres);
108 ok(cstyle != NULL, "cstyle = %p\n", cstyle);
110 IHTMLElement2_Release(elem2);
111 return cstyle;
114 #define test_border_styles(p, n) _test_border_styles(__LINE__, p, n)
115 static void _test_border_styles(unsigned line, IHTMLStyle *pStyle, BSTR Name)
117 HRESULT hres;
118 DISPID dispid;
120 hres = IHTMLStyle_GetIDsOfNames(pStyle, &IID_NULL, &Name, 1,
121 LOCALE_USER_DEFAULT, &dispid);
122 ok_(__FILE__,line) (hres == S_OK, "GetIDsOfNames: %08x\n", hres);
123 if(hres == S_OK)
125 DISPPARAMS params = {NULL,NULL,0,0};
126 DISPID dispidNamed = DISPID_PROPERTYPUT;
127 VARIANT ret;
128 VARIANT vDefault;
129 VARIANTARG arg;
131 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
132 DISPATCH_PROPERTYGET, &params, &vDefault, NULL, NULL);
133 ok_(__FILE__,line) (hres == S_OK, "get_default. ret: %08x\n", hres);
135 params.cArgs = 1;
136 params.cNamedArgs = 1;
137 params.rgdispidNamedArgs = &dispidNamed;
138 V_VT(&arg) = VT_BSTR;
139 V_BSTR(&arg) = a2bstr("none");
140 params.rgvarg = &arg;
141 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
142 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
143 ok_(__FILE__,line) (hres == S_OK, "none. ret: %08x\n", hres);
144 VariantClear(&arg);
146 V_VT(&arg) = VT_BSTR;
147 V_BSTR(&arg) = a2bstr("dotted");
148 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
149 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
150 ok_(__FILE__,line) (hres == S_OK, "dotted. ret: %08x\n", hres);
151 VariantClear(&arg);
153 V_VT(&arg) = VT_BSTR;
154 V_BSTR(&arg) = a2bstr("dashed");
155 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
156 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
157 ok_(__FILE__,line) (hres == S_OK, "dashed. ret: %08x\n", hres);
158 VariantClear(&arg);
160 V_VT(&arg) = VT_BSTR;
161 V_BSTR(&arg) = a2bstr("solid");
162 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
163 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
164 ok_(__FILE__,line) (hres == S_OK, "solid. ret: %08x\n", hres);
165 VariantClear(&arg);
167 V_VT(&arg) = VT_BSTR;
168 V_BSTR(&arg) = a2bstr("double");
169 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
170 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
171 ok_(__FILE__,line) (hres == S_OK, "double. ret: %08x\n", hres);
172 VariantClear(&arg);
174 V_VT(&arg) = VT_BSTR;
175 V_BSTR(&arg) = a2bstr("groove");
176 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
177 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
178 ok_(__FILE__,line) (hres == S_OK, "groove. ret: %08x\n", hres);
179 VariantClear(&arg);
181 V_VT(&arg) = VT_BSTR;
182 V_BSTR(&arg) = a2bstr("ridge");
183 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
184 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
185 ok_(__FILE__,line) (hres == S_OK, "ridge. ret: %08x\n", hres);
186 VariantClear(&arg);
188 V_VT(&arg) = VT_BSTR;
189 V_BSTR(&arg) = a2bstr("inset");
190 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
191 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
192 ok_(__FILE__,line) (hres == S_OK, "inset. ret: %08x\n", hres);
193 VariantClear(&arg);
195 V_VT(&arg) = VT_BSTR;
196 V_BSTR(&arg) = a2bstr("outset");
197 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
198 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
199 ok_(__FILE__,line) (hres == S_OK, "outset. ret: %08x\n", hres);
200 VariantClear(&arg);
202 V_VT(&arg) = VT_BSTR;
203 V_BSTR(&arg) = a2bstr("invalid");
204 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
205 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
206 ok_(__FILE__,line) (FAILED(hres), "invalid value passed.\n");
207 VariantClear(&arg);
209 params.rgvarg = &vDefault;
210 hres = IHTMLStyle_Invoke(pStyle, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
211 DISPATCH_PROPERTYPUT, &params, &ret, NULL, NULL);
212 ok_(__FILE__,line) (hres == S_OK, "default. ret: %08x\n", hres);
213 VariantClear(&vDefault);
217 #define test_style_csstext(s,t) _test_style_csstext(__LINE__,s,t)
218 static void _test_style_csstext(unsigned line, IHTMLStyle *style, const char *extext)
220 BSTR text = (void*)0xdeadbeef;
221 HRESULT hres;
223 hres = IHTMLStyle_get_cssText(style, &text);
224 ok_(__FILE__,line)(hres == S_OK, "get_cssText failed: %08x\n", hres);
225 if(extext)
226 ok_(__FILE__,line)(!strcmp_wa(text, extext), "cssText = %s\n", wine_dbgstr_w(text));
227 else
228 ok_(__FILE__,line)(!text, "cssText = %s\n", wine_dbgstr_w(text));
230 SysFreeString(text);
233 #define test_style_set_csstext(s,t) _test_style_set_csstext(__LINE__,s,t)
234 static void _test_style_set_csstext(unsigned line, IHTMLStyle *style, const char *text)
236 BSTR tmp;
237 HRESULT hres;
239 tmp = a2bstr(text);
240 hres = IHTMLStyle_put_cssText(style, tmp);
241 ok_(__FILE__,line)(hres == S_OK, "put_cssText failed: %08x\n", hres);
242 SysFreeString(tmp);
245 #define test_style_remove_attribute(a,b,c) _test_style_remove_attribute(__LINE__,a,b,c)
246 static void _test_style_remove_attribute(unsigned line, IHTMLStyle *style, const char *attr, VARIANT_BOOL exb)
248 BSTR str = a2bstr(attr);
249 VARIANT_BOOL b = 100;
250 HRESULT hres;
252 hres = IHTMLStyle_removeAttribute(style, str, 1, &b);
253 SysFreeString(str);
254 ok_(__FILE__,line)(hres == S_OK, "removeAttribute failed: %08x\n", hres);
255 ok_(__FILE__,line)(b == exb, "removeAttribute returned %x, expected %x\n", b, exb);
258 static void test_set_csstext(IHTMLStyle *style)
260 VARIANT v;
261 HRESULT hres;
263 test_style_set_csstext(style, "background-color: black;");
265 hres = IHTMLStyle_get_backgroundColor(style, &v);
266 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
267 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
268 ok(!strcmp_wa(V_BSTR(&v), "black"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
269 VariantClear(&v);
272 static void test_style2(IHTMLStyle2 *style2)
274 VARIANT v;
275 BSTR str;
276 HRESULT hres;
278 str = (void*)0xdeadbeef;
279 hres = IHTMLStyle2_get_position(style2, &str);
280 ok(hres == S_OK, "get_position failed: %08x\n", hres);
281 ok(!str, "str != NULL\n");
283 str = a2bstr("absolute");
284 hres = IHTMLStyle2_put_position(style2, str);
285 ok(hres == S_OK, "put_position failed: %08x\n", hres);
286 SysFreeString(str);
288 str = NULL;
289 hres = IHTMLStyle2_get_position(style2, &str);
290 ok(hres == S_OK, "get_position failed: %08x\n", hres);
291 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
292 SysFreeString(str);
294 /* Test right */
295 V_VT(&v) = VT_EMPTY;
296 hres = IHTMLStyle2_get_right(style2, &v);
297 ok(hres == S_OK, "get_top failed: %08x\n", hres);
298 ok(V_VT(&v) == VT_BSTR, "V_VT(right)=%d\n", V_VT(&v));
299 ok(!V_BSTR(&v), "V_BSTR(right) != NULL\n");
300 VariantClear(&v);
302 V_VT(&v) = VT_BSTR;
303 V_BSTR(&v) = a2bstr("3px");
304 hres = IHTMLStyle2_put_right(style2, v);
305 ok(hres == S_OK, "put_right failed: %08x\n", hres);
306 VariantClear(&v);
308 V_VT(&v) = VT_EMPTY;
309 hres = IHTMLStyle2_get_right(style2, &v);
310 ok(hres == S_OK, "get_right failed: %08x\n", hres);
311 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
312 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
313 VariantClear(&v);
315 /* direction */
316 str = (void*)0xdeadbeef;
317 hres = IHTMLStyle2_get_direction(style2, &str);
318 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
319 ok(!str, "str = %s\n", wine_dbgstr_w(str));
321 str = a2bstr("ltr");
322 hres = IHTMLStyle2_put_direction(style2, str);
323 ok(hres == S_OK, "put_direction failed: %08x\n", hres);
324 SysFreeString(str);
326 str = NULL;
327 hres = IHTMLStyle2_get_direction(style2, &str);
328 ok(hres == S_OK, "get_direction failed: %08x\n", hres);
329 ok(!strcmp_wa(str, "ltr"), "str = %s\n", wine_dbgstr_w(str));
330 SysFreeString(str);
332 /* bottom */
333 V_VT(&v) = VT_EMPTY;
334 hres = IHTMLStyle2_get_bottom(style2, &v);
335 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
336 test_var_bstr(&v, NULL);
338 V_VT(&v) = VT_I4;
339 V_I4(&v) = 4;
340 hres = IHTMLStyle2_put_bottom(style2, v);
341 ok(hres == S_OK, "put_bottom failed: %08x\n", hres);
343 V_VT(&v) = VT_EMPTY;
344 hres = IHTMLStyle2_get_bottom(style2, &v);
345 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
346 test_var_bstr(&v, "4px");
348 /* overflowX */
349 str = (void*)0xdeadbeef;
350 hres = IHTMLStyle2_get_overflowX(style2, &str);
351 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
352 ok(!str, "overflowX = %s\n", wine_dbgstr_w(str));
354 str = a2bstr("hidden");
355 hres = IHTMLStyle2_put_overflowX(style2, str);
356 ok(hres == S_OK, "put_overflowX failed: %08x\n", hres);
357 SysFreeString(str);
359 str = NULL;
360 hres = IHTMLStyle2_get_overflowX(style2, &str);
361 ok(hres == S_OK, "get_overflowX failed: %08x\n", hres);
362 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
364 /* overflowY */
365 str = (void*)0xdeadbeef;
366 hres = IHTMLStyle2_get_overflowY(style2, &str);
367 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
368 ok(!str, "overflowY = %s\n", wine_dbgstr_w(str));
370 str = a2bstr("hidden");
371 hres = IHTMLStyle2_put_overflowY(style2, str);
372 ok(hres == S_OK, "put_overflowY failed: %08x\n", hres);
373 SysFreeString(str);
375 str = NULL;
376 hres = IHTMLStyle2_get_overflowY(style2, &str);
377 ok(hres == S_OK, "get_overflowY failed: %08x\n", hres);
378 ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str));
381 static void test_style3(IHTMLStyle3 *style3)
383 BSTR str;
384 HRESULT hres;
386 str = (void*)0xdeadbeef;
387 hres = IHTMLStyle3_get_wordWrap(style3, &str);
388 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
389 ok(!str, "str != NULL\n");
391 str = a2bstr("break-word");
392 hres = IHTMLStyle3_put_wordWrap(style3, str);
393 ok(hres == S_OK, "put_wordWrap failed: %08x\n", hres);
394 SysFreeString(str);
396 str = NULL;
397 hres = IHTMLStyle3_get_wordWrap(style3, &str);
398 ok(hres == S_OK, "get_wordWrap failed: %08x\n", hres);
399 ok(!strcmp_wa(str, "break-word"), "get_wordWrap returned %s\n", wine_dbgstr_w(str));
400 SysFreeString(str);
403 static void test_style4(IHTMLStyle4 *style4)
405 HRESULT hres;
406 VARIANT v;
407 VARIANT vdefault;
409 hres = IHTMLStyle4_get_minHeight(style4, &vdefault);
410 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
412 V_VT(&v) = VT_BSTR;
413 V_BSTR(&v) = a2bstr("10px");
414 hres = IHTMLStyle4_put_minHeight(style4, v);
415 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
416 VariantClear(&v);
418 hres = IHTMLStyle4_get_minHeight(style4, &v);
419 ok(hres == S_OK, "get_minHeight failed: %08x\n", hres);
420 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
421 ok( !strcmp_wa(V_BSTR(&v), "10px"), "expect 10px got (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
422 VariantClear(&v);
424 hres = IHTMLStyle4_put_minHeight(style4, vdefault);
425 ok(hres == S_OK, "put_minHeight failed: %08x\n", hres);
426 VariantClear(&vdefault);
429 static void test_body_style(IHTMLStyle *style)
431 IHTMLStyle2 *style2;
432 IHTMLStyle3 *style3;
433 IHTMLStyle4 *style4;
434 VARIANT_BOOL b;
435 VARIANT v;
436 BSTR str;
437 HRESULT hres;
438 float f;
439 BSTR sOverflowDefault;
440 BSTR sDefault;
441 VARIANT vDefault;
443 test_style_csstext(style, NULL);
445 hres = IHTMLStyle_get_position(style, &str);
446 ok(hres == S_OK, "get_position failed: %08x\n", hres);
447 ok(!str, "str=%s\n", wine_dbgstr_w(str));
449 V_VT(&v) = VT_NULL;
450 hres = IHTMLStyle_get_marginRight(style, &v);
451 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
452 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
453 ok(!V_BSTR(&v), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
455 V_VT(&v) = VT_I4;
456 V_I4(&v) = 6;
457 hres = IHTMLStyle_put_marginRight(style, v);
458 ok(hres == S_OK, "put_marginRight failed: %08x\n", hres);
460 V_VT(&v) = VT_NULL;
461 hres = IHTMLStyle_get_marginRight(style, &v);
462 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
463 ok(V_VT(&v) == VT_BSTR, "V_VT(marginRight) = %d\n", V_VT(&v));
464 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginRight) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
466 V_VT(&v) = VT_NULL;
467 hres = IHTMLStyle_get_marginBottom(style, &v);
468 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
469 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
470 ok(!V_BSTR(&v), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
472 V_VT(&v) = VT_I4;
473 V_I4(&v) = 6;
474 hres = IHTMLStyle_put_marginBottom(style, v);
475 ok(hres == S_OK, "put_marginBottom failed: %08x\n", hres);
477 V_VT(&v) = VT_NULL;
478 hres = IHTMLStyle_get_marginBottom(style, &v);
479 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
480 ok(V_VT(&v) == VT_BSTR, "V_VT(marginBottom) = %d\n", V_VT(&v));
481 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginBottom) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
483 V_VT(&v) = VT_NULL;
484 hres = IHTMLStyle_get_marginLeft(style, &v);
485 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
486 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
487 ok(!V_BSTR(&v), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
489 V_VT(&v) = VT_I4;
490 V_I4(&v) = 6;
491 hres = IHTMLStyle_put_marginLeft(style, v);
492 ok(hres == S_OK, "put_marginLeft failed: %08x\n", hres);
494 V_VT(&v) = VT_NULL;
495 hres = IHTMLStyle_get_marginLeft(style, &v);
496 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
497 ok(V_VT(&v) == VT_BSTR, "V_VT(marginLeft) = %d\n", V_VT(&v));
498 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginLeft) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
500 str = (void*)0xdeadbeef;
501 hres = IHTMLStyle_get_fontFamily(style, &str);
502 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
503 ok(!str, "fontFamily = %s\n", wine_dbgstr_w(str));
505 str = (void*)0xdeadbeef;
506 hres = IHTMLStyle_get_fontWeight(style, &str);
507 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
508 ok(!str, "fontWeight = %s\n", wine_dbgstr_w(str));
510 hres = IHTMLStyle_get_fontWeight(style, &sDefault);
511 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
513 str = a2bstr("test");
514 hres = IHTMLStyle_put_fontWeight(style, str);
515 ok(hres == E_INVALIDARG, "put_fontWeight failed: %08x\n", hres);
516 SysFreeString(str);
518 str = a2bstr("bold");
519 hres = IHTMLStyle_put_fontWeight(style, str);
520 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
521 SysFreeString(str);
523 str = a2bstr("bolder");
524 hres = IHTMLStyle_put_fontWeight(style, str);
525 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
526 SysFreeString(str);
528 str = a2bstr("lighter");
529 hres = IHTMLStyle_put_fontWeight(style, str);
530 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
531 SysFreeString(str);
533 str = a2bstr("100");
534 hres = IHTMLStyle_put_fontWeight(style, str);
535 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
536 SysFreeString(str);
538 str = a2bstr("200");
539 hres = IHTMLStyle_put_fontWeight(style, str);
540 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
541 SysFreeString(str);
543 str = a2bstr("300");
544 hres = IHTMLStyle_put_fontWeight(style, str);
545 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
546 SysFreeString(str);
548 str = a2bstr("400");
549 hres = IHTMLStyle_put_fontWeight(style, str);
550 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
551 SysFreeString(str);
553 str = a2bstr("500");
554 hres = IHTMLStyle_put_fontWeight(style, str);
555 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
556 SysFreeString(str);
558 str = a2bstr("600");
559 hres = IHTMLStyle_put_fontWeight(style, str);
560 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
561 SysFreeString(str);
563 str = a2bstr("700");
564 hres = IHTMLStyle_put_fontWeight(style, str);
565 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
566 SysFreeString(str);
568 str = a2bstr("800");
569 hres = IHTMLStyle_put_fontWeight(style, str);
570 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
571 SysFreeString(str);
573 str = a2bstr("900");
574 hres = IHTMLStyle_put_fontWeight(style, str);
575 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
576 SysFreeString(str);
578 hres = IHTMLStyle_get_fontWeight(style, &str);
579 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
580 ok(!strcmp_wa(str, "900"), "str != style900\n");
581 SysFreeString(str);
583 hres = IHTMLStyle_put_fontWeight(style, sDefault);
584 ok(hres == S_OK, "put_fontWeight failed: %08x\n", hres);
585 SysFreeString(sDefault);
587 /* font Variant */
588 hres = IHTMLStyle_get_fontVariant(style, NULL);
589 ok(hres == E_INVALIDARG, "get_fontVariant failed: %08x\n", hres);
591 hres = IHTMLStyle_get_fontVariant(style, &sDefault);
592 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
594 str = a2bstr("test");
595 hres = IHTMLStyle_put_fontVariant(style, str);
596 ok(hres == E_INVALIDARG, "fontVariant failed: %08x\n", hres);
597 SysFreeString(str);
599 str = a2bstr("small-caps");
600 hres = IHTMLStyle_put_fontVariant(style, str);
601 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
602 SysFreeString(str);
604 str = a2bstr("normal");
605 hres = IHTMLStyle_put_fontVariant(style, str);
606 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
607 SysFreeString(str);
609 hres = IHTMLStyle_put_fontVariant(style, sDefault);
610 ok(hres == S_OK, "fontVariant failed: %08x\n", hres);
611 SysFreeString(sDefault);
613 str = (void*)0xdeadbeef;
614 hres = IHTMLStyle_get_display(style, &str);
615 ok(hres == S_OK, "get_display failed: %08x\n", hres);
616 ok(!str, "display = %s\n", wine_dbgstr_w(str));
618 str = (void*)0xdeadbeef;
619 hres = IHTMLStyle_get_visibility(style, &str);
620 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
621 ok(!str, "visibility = %s\n", wine_dbgstr_w(str));
623 V_VT(&v) = VT_NULL;
624 hres = IHTMLStyle_get_fontSize(style, &v);
625 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
626 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
627 ok(!V_BSTR(&v), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
629 V_VT(&v) = VT_I4;
630 V_I4(&v) = 12;
631 hres = IHTMLStyle_put_fontSize(style, v);
632 ok(hres == S_OK, "put_fontSize failed: %08x\n", hres);
634 V_VT(&v) = VT_NULL;
635 hres = IHTMLStyle_get_fontSize(style, &v);
636 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
637 ok(V_VT(&v) == VT_BSTR, "V_VT(fontSize) = %d\n", V_VT(&v));
638 ok(!strcmp_wa(V_BSTR(&v), "12px"), "V_BSTR(fontSize) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
640 V_VT(&v) = VT_NULL;
641 hres = IHTMLStyle_get_color(style, &v);
642 ok(hres == S_OK, "get_color failed: %08x\n", hres);
643 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
644 ok(!V_BSTR(&v), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
646 V_VT(&v) = VT_I4;
647 V_I4(&v) = 0xfdfd;
648 hres = IHTMLStyle_put_color(style, v);
649 ok(hres == S_OK, "put_color failed: %08x\n", hres);
651 V_VT(&v) = VT_NULL;
652 hres = IHTMLStyle_get_color(style, &v);
653 ok(hres == S_OK, "get_color failed: %08x\n", hres);
654 ok(V_VT(&v) == VT_BSTR, "V_VT(color) = %d\n", V_VT(&v));
655 todo_wine
656 ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
658 b = 0xfefe;
659 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
660 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
661 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
663 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_TRUE);
664 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
665 ok(b == VARIANT_FALSE, "textDecorationUnderline = %x\n", b);
667 hres = IHTMLStyle_get_textDecorationUnderline(style, &b);
668 ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres);
669 ok(b == VARIANT_TRUE, "textDecorationUnderline = %x\n", b);
671 hres = IHTMLStyle_put_textDecorationUnderline(style, VARIANT_FALSE);
672 ok(hres == S_OK, "put_textDecorationUnderline failed: %08x\n", hres);
674 b = 0xfefe;
675 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
676 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
677 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
679 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_TRUE);
680 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
681 ok(b == VARIANT_FALSE, "textDecorationLineThrough = %x\n", b);
683 hres = IHTMLStyle_get_textDecorationLineThrough(style, &b);
684 ok(hres == S_OK, "get_textDecorationLineThrough failed: %08x\n", hres);
685 ok(b == VARIANT_TRUE, "textDecorationLineThrough = %x\n", b);
687 hres = IHTMLStyle_put_textDecorationLineThrough(style, VARIANT_FALSE);
688 ok(hres == S_OK, "put_textDecorationLineThrough failed: %08x\n", hres);
690 b = 0xfefe;
691 hres = IHTMLStyle_get_textDecorationNone(style, &b);
692 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
693 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
695 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_TRUE);
696 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
697 ok(b == VARIANT_FALSE, "textDecorationNone = %x\n", b);
699 hres = IHTMLStyle_get_textDecorationNone(style, &b);
700 ok(hres == S_OK, "get_textDecorationNone failed: %08x\n", hres);
701 ok(b == VARIANT_TRUE, "textDecorationNone = %x\n", b);
703 hres = IHTMLStyle_put_textDecorationNone(style, VARIANT_FALSE);
704 ok(hres == S_OK, "put_textDecorationNone failed: %08x\n", hres);
706 b = 0xfefe;
707 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
708 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
709 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
711 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_TRUE);
712 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
713 ok(b == VARIANT_FALSE, "textDecorationOverline = %x\n", b);
715 hres = IHTMLStyle_get_textDecorationOverline(style, &b);
716 ok(hres == S_OK, "get_textDecorationOverline failed: %08x\n", hres);
717 ok(b == VARIANT_TRUE, "textDecorationOverline = %x\n", b);
719 hres = IHTMLStyle_put_textDecorationOverline(style, VARIANT_FALSE);
720 ok(hres == S_OK, "put_textDecorationOverline failed: %08x\n", hres);
722 b = 0xfefe;
723 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
724 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
725 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
727 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_TRUE);
728 ok(hres == S_OK, "put_textDecorationBlink failed: %08x\n", hres);
729 ok(b == VARIANT_FALSE, "textDecorationBlink = %x\n", b);
731 hres = IHTMLStyle_get_textDecorationBlink(style, &b);
732 ok(hres == S_OK, "get_textDecorationBlink failed: %08x\n", hres);
733 ok(b == VARIANT_TRUE, "textDecorationBlink = %x\n", b);
735 hres = IHTMLStyle_put_textDecorationBlink(style, VARIANT_FALSE);
736 ok(hres == S_OK, "textDecorationBlink failed: %08x\n", hres);
738 hres = IHTMLStyle_get_textDecoration(style, &sDefault);
739 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
741 str = a2bstr("invalid");
742 hres = IHTMLStyle_put_textDecoration(style, str);
743 ok(hres == E_INVALIDARG, "put_textDecoration failed: %08x\n", hres);
744 SysFreeString(str);
746 str = a2bstr("none");
747 hres = IHTMLStyle_put_textDecoration(style, str);
748 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
749 SysFreeString(str);
751 str = a2bstr("underline");
752 hres = IHTMLStyle_put_textDecoration(style, str);
753 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
754 SysFreeString(str);
756 str = a2bstr("overline");
757 hres = IHTMLStyle_put_textDecoration(style, str);
758 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
759 SysFreeString(str);
761 str = a2bstr("line-through");
762 hres = IHTMLStyle_put_textDecoration(style, str);
763 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
764 SysFreeString(str);
766 str = a2bstr("blink");
767 hres = IHTMLStyle_put_textDecoration(style, str);
768 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
769 SysFreeString(str);
771 hres = IHTMLStyle_get_textDecoration(style, &str);
772 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
773 ok(!strcmp_wa(str, "blink"), "str != blink\n");
774 SysFreeString(str);
776 hres = IHTMLStyle_put_textDecoration(style, sDefault);
777 ok(hres == S_OK, "put_textDecoration failed: %08x\n", hres);
778 SysFreeString(sDefault);
780 hres = IHTMLStyle_get_posWidth(style, NULL);
781 ok(hres == E_POINTER, "get_posWidth failed: %08x\n", hres);
783 hres = IHTMLStyle_get_posWidth(style, &f);
784 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
785 ok(f == 0.0f, "f = %f\n", f);
787 V_VT(&v) = VT_EMPTY;
788 hres = IHTMLStyle_get_width(style, &v);
789 ok(hres == S_OK, "get_width failed: %08x\n", hres);
790 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
791 ok(!V_BSTR(&v), "V_BSTR(v)=%p\n", V_BSTR(&v));
793 hres = IHTMLStyle_put_posWidth(style, 2.2);
794 ok(hres == S_OK, "put_posWidth failed: %08x\n", hres);
796 hres = IHTMLStyle_get_posWidth(style, &f);
797 ok(hres == S_OK, "get_posWidth failed: %08x\n", hres);
798 ok(f == 2.0f ||
799 f == 2.2f, /* IE8 */
800 "f = %f\n", f);
802 V_VT(&v) = VT_BSTR;
803 V_BSTR(&v) = a2bstr("auto");
804 hres = IHTMLStyle_put_width(style, v);
805 ok(hres == S_OK, "put_width failed: %08x\n", hres);
806 VariantClear(&v);
808 V_VT(&v) = VT_EMPTY;
809 hres = IHTMLStyle_get_width(style, &v);
810 ok(hres == S_OK, "get_width failed: %08x\n", hres);
811 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
812 ok(!strcmp_wa(V_BSTR(&v), "auto"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
813 VariantClear(&v);
815 V_VT(&v) = VT_I4;
816 V_I4(&v) = 100;
817 hres = IHTMLStyle_put_width(style, v);
818 ok(hres == S_OK, "put_width failed: %08x\n", hres);
820 V_VT(&v) = VT_EMPTY;
821 hres = IHTMLStyle_get_width(style, &v);
822 ok(hres == S_OK, "get_width failed: %08x\n", hres);
823 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
824 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v)=%s\n", wine_dbgstr_w(V_BSTR(&v)));
825 VariantClear(&v);
827 /* margin tests */
828 str = (void*)0xdeadbeef;
829 hres = IHTMLStyle_get_margin(style, &str);
830 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
831 ok(!str, "margin = %s\n", wine_dbgstr_w(str));
833 str = a2bstr("1");
834 hres = IHTMLStyle_put_margin(style, str);
835 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
836 SysFreeString(str);
838 hres = IHTMLStyle_get_margin(style, &str);
839 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
840 ok(!strcmp_wa(str, "1px"), "margin = %s\n", wine_dbgstr_w(str));
841 SysFreeString(str);
843 hres = IHTMLStyle_put_margin(style, NULL);
844 ok(hres == S_OK, "put_margin failed: %08x\n", hres);
846 str = (void*)0xdeadbeef;
847 hres = IHTMLStyle_get_marginTop(style, &v);
848 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
849 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
850 ok(!V_BSTR(&v), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
852 V_VT(&v) = VT_BSTR;
853 V_BSTR(&v) = a2bstr("6px");
854 hres = IHTMLStyle_put_marginTop(style, v);
855 SysFreeString(V_BSTR(&v));
856 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
858 str = (void*)0xdeadbeef;
859 hres = IHTMLStyle_get_marginTop(style, &v);
860 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
861 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
862 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
863 VariantClear(&v);
865 V_VT(&v) = VT_I4;
866 V_I4(&v) = 5;
867 hres = IHTMLStyle_put_marginTop(style, v);
868 ok(hres == S_OK, "put_marginTop failed: %08x\n", hres);
870 str = (void*)0xdeadbeef;
871 hres = IHTMLStyle_get_marginTop(style, &v);
872 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
873 ok(V_VT(&v) == VT_BSTR, "V_VT(marginTop) = %d\n", V_VT(&v));
874 ok(!strcmp_wa(V_BSTR(&v), "5px"), "V_BSTR(marginTop) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
875 VariantClear(&v);
877 str = NULL;
878 hres = IHTMLStyle_get_border(style, &str);
879 ok(hres == S_OK, "get_border failed: %08x\n", hres);
880 ok(!str || !*str, "str is not empty\n");
881 SysFreeString(str);
883 str = a2bstr("1px");
884 hres = IHTMLStyle_put_border(style, str);
885 ok(hres == S_OK, "put_border failed: %08x\n", hres);
886 SysFreeString(str);
888 V_VT(&v) = VT_EMPTY;
889 hres = IHTMLStyle_get_left(style, &v);
890 ok(hres == S_OK, "get_left failed: %08x\n", hres);
891 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
892 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
893 VariantClear(&v);
895 /* Test posLeft */
896 hres = IHTMLStyle_get_posLeft(style, NULL);
897 ok(hres == E_POINTER, "get_posLeft failed: %08x\n", hres);
899 f = 1.0f;
900 hres = IHTMLStyle_get_posLeft(style, &f);
901 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
902 ok(f == 0.0, "expected 0.0 got %f\n", f);
904 hres = IHTMLStyle_put_posLeft(style, 4.9f);
905 ok(hres == S_OK, "put_posLeft failed: %08x\n", hres);
907 hres = IHTMLStyle_get_posLeft(style, &f);
908 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
909 ok(f == 4.0 ||
910 f == 4.9f, /* IE8 */
911 "expected 4.0 or 4.9 (IE8) got %f\n", f);
913 /* Ensure left is updated correctly. */
914 V_VT(&v) = VT_EMPTY;
915 hres = IHTMLStyle_get_left(style, &v);
916 ok(hres == S_OK, "get_left failed: %08x\n", hres);
917 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
918 ok(!strcmp_wa(V_BSTR(&v), "4px") ||
919 !strcmp_wa(V_BSTR(&v), "4.9px"), /* IE8 */
920 "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
921 VariantClear(&v);
923 /* Test left */
924 V_VT(&v) = VT_BSTR;
925 V_BSTR(&v) = a2bstr("3px");
926 hres = IHTMLStyle_put_left(style, v);
927 ok(hres == S_OK, "put_left failed: %08x\n", hres);
928 VariantClear(&v);
930 hres = IHTMLStyle_get_posLeft(style, &f);
931 ok(hres == S_OK, "get_posLeft failed: %08x\n", hres);
932 ok(f == 3.0, "expected 3.0 got %f\n", f);
934 V_VT(&v) = VT_EMPTY;
935 hres = IHTMLStyle_get_left(style, &v);
936 ok(hres == S_OK, "get_left failed: %08x\n", hres);
937 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
938 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
939 VariantClear(&v);
941 V_VT(&v) = VT_NULL;
942 hres = IHTMLStyle_put_left(style, v);
943 ok(hres == S_OK, "put_left failed: %08x\n", hres);
945 V_VT(&v) = VT_EMPTY;
946 hres = IHTMLStyle_get_left(style, &v);
947 ok(hres == S_OK, "get_left failed: %08x\n", hres);
948 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
949 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
950 VariantClear(&v);
952 V_VT(&v) = VT_EMPTY;
953 hres = IHTMLStyle_get_top(style, &v);
954 ok(hres == S_OK, "get_top failed: %08x\n", hres);
955 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
956 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
957 VariantClear(&v);
959 /* Test posTop */
960 hres = IHTMLStyle_get_posTop(style, NULL);
961 ok(hres == E_POINTER, "get_posTop failed: %08x\n", hres);
963 f = 1.0f;
964 hres = IHTMLStyle_get_posTop(style, &f);
965 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
966 ok(f == 0.0, "expected 0.0 got %f\n", f);
968 hres = IHTMLStyle_put_posTop(style, 4.9f);
969 ok(hres == S_OK, "put_posTop failed: %08x\n", hres);
971 hres = IHTMLStyle_get_posTop(style, &f);
972 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
973 ok(f == 4.0 ||
974 f == 4.9f, /* IE8 */
975 "expected 4.0 or 4.9 (IE8) got %f\n", f);
977 V_VT(&v) = VT_BSTR;
978 V_BSTR(&v) = a2bstr("3px");
979 hres = IHTMLStyle_put_top(style, v);
980 ok(hres == S_OK, "put_top failed: %08x\n", hres);
981 VariantClear(&v);
983 V_VT(&v) = VT_EMPTY;
984 hres = IHTMLStyle_get_top(style, &v);
985 ok(hres == S_OK, "get_top failed: %08x\n", hres);
986 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
987 ok(!strcmp_wa(V_BSTR(&v), "3px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
988 VariantClear(&v);
990 hres = IHTMLStyle_get_posTop(style, &f);
991 ok(hres == S_OK, "get_posTop failed: %08x\n", hres);
992 ok(f == 3.0, "expected 3.0 got %f\n", f);
994 V_VT(&v) = VT_NULL;
995 hres = IHTMLStyle_put_top(style, v);
996 ok(hres == S_OK, "put_top failed: %08x\n", hres);
998 V_VT(&v) = VT_EMPTY;
999 hres = IHTMLStyle_get_top(style, &v);
1000 ok(hres == S_OK, "get_top failed: %08x\n", hres);
1001 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1002 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1003 VariantClear(&v);
1005 /* Test posHeight */
1006 hres = IHTMLStyle_get_posHeight(style, NULL);
1007 ok(hres == E_POINTER, "get_posHeight failed: %08x\n", hres);
1009 V_VT(&v) = VT_EMPTY;
1010 hres = IHTMLStyle_get_height(style, &v);
1011 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1012 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1013 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1014 VariantClear(&v);
1016 f = 1.0f;
1017 hres = IHTMLStyle_get_posHeight(style, &f);
1018 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1019 ok(f == 0.0, "expected 0.0 got %f\n", f);
1021 hres = IHTMLStyle_put_posHeight(style, 4.9f);
1022 ok(hres == S_OK, "put_posHeight failed: %08x\n", hres);
1024 hres = IHTMLStyle_get_posHeight(style, &f);
1025 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1026 ok(f == 4.0 ||
1027 f == 4.9f, /* IE8 */
1028 "expected 4.0 or 4.9 (IE8) got %f\n", f);
1030 V_VT(&v) = VT_BSTR;
1031 V_BSTR(&v) = a2bstr("70px");
1032 hres = IHTMLStyle_put_height(style, v);
1033 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1034 VariantClear(&v);
1036 V_VT(&v) = VT_EMPTY;
1037 hres = IHTMLStyle_get_height(style, &v);
1038 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1039 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1040 ok(!strcmp_wa(V_BSTR(&v), "70px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1041 VariantClear(&v);
1043 V_VT(&v) = VT_I4;
1044 V_I4(&v) = 64;
1045 hres = IHTMLStyle_put_height(style, v);
1046 ok(hres == S_OK, "put_height failed: %08x\n", hres);
1048 V_VT(&v) = VT_EMPTY;
1049 hres = IHTMLStyle_get_height(style, &v);
1050 ok(hres == S_OK, "get_height failed: %08x\n", hres);
1051 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1052 ok(!strcmp_wa(V_BSTR(&v), "64px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1053 VariantClear(&v);
1055 hres = IHTMLStyle_get_posHeight(style, &f);
1056 ok(hres == S_OK, "get_posHeight failed: %08x\n", hres);
1057 ok(f == 64.0, "expected 64.0 got %f\n", f);
1059 str = (void*)0xdeadbeef;
1060 hres = IHTMLStyle_get_cursor(style, &str);
1061 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1062 ok(!str, "get_cursor != NULL\n");
1063 SysFreeString(str);
1065 str = a2bstr("default");
1066 hres = IHTMLStyle_put_cursor(style, str);
1067 ok(hres == S_OK, "put_cursor failed: %08x\n", hres);
1068 SysFreeString(str);
1070 str = NULL;
1071 hres = IHTMLStyle_get_cursor(style, &str);
1072 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
1073 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
1074 SysFreeString(str);
1076 V_VT(&v) = VT_EMPTY;
1077 hres = IHTMLStyle_get_verticalAlign(style, &v);
1078 ok(hres == S_OK, "get_vertivalAlign failed: %08x\n", hres);
1079 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1080 ok(!V_BSTR(&v), "V_BSTR(v) != NULL\n");
1081 VariantClear(&v);
1083 V_VT(&v) = VT_BSTR;
1084 V_BSTR(&v) = a2bstr("middle");
1085 hres = IHTMLStyle_put_verticalAlign(style, v);
1086 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1087 VariantClear(&v);
1089 V_VT(&v) = VT_EMPTY;
1090 hres = IHTMLStyle_get_verticalAlign(style, &v);
1091 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1092 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1093 ok(!strcmp_wa(V_BSTR(&v), "middle"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1094 VariantClear(&v);
1096 V_VT(&v) = VT_I4;
1097 V_I4(&v) = 100;
1098 hres = IHTMLStyle_put_verticalAlign(style, v);
1099 ok(hres == S_OK, "put_vertivalAlign failed: %08x\n", hres);
1100 VariantClear(&v);
1102 V_VT(&v) = VT_EMPTY;
1103 hres = IHTMLStyle_get_verticalAlign(style, &v);
1104 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
1105 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1106 ok(!strcmp_wa(V_BSTR(&v), "100px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1107 VariantClear(&v);
1109 str = (void*)0xdeadbeef;
1110 hres = IHTMLStyle_get_textAlign(style, &str);
1111 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1112 ok(!str, "textAlign != NULL\n");
1114 str = a2bstr("center");
1115 hres = IHTMLStyle_put_textAlign(style, str);
1116 ok(hres == S_OK, "put_textAlign failed: %08x\n", hres);
1117 SysFreeString(str);
1119 str = NULL;
1120 hres = IHTMLStyle_get_textAlign(style, &str);
1121 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
1122 ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1123 SysFreeString(str);
1125 str = (void*)0xdeadbeef;
1126 hres = IHTMLStyle_get_filter(style, &str);
1127 ok(hres == S_OK, "get_filter failed: %08x\n", hres);
1128 ok(!str, "filter != NULL\n");
1130 str = a2bstr("alpha(opacity=100)");
1131 hres = IHTMLStyle_put_filter(style, str);
1132 ok(hres == S_OK, "put_filter failed: %08x\n", hres);
1133 SysFreeString(str);
1135 V_VT(&v) = VT_EMPTY;
1136 hres = IHTMLStyle_get_zIndex(style, &v);
1137 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1138 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1139 ok(!V_I4(&v), "V_I4(v) != 0\n");
1140 VariantClear(&v);
1142 V_VT(&v) = VT_BSTR;
1143 V_BSTR(&v) = a2bstr("1");
1144 hres = IHTMLStyle_put_zIndex(style, v);
1145 ok(hres == S_OK, "put_zIndex failed: %08x\n", hres);
1146 VariantClear(&v);
1148 V_VT(&v) = VT_EMPTY;
1149 hres = IHTMLStyle_get_zIndex(style, &v);
1150 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
1151 ok(V_VT(&v) == VT_I4, "V_VT(v)=%d\n", V_VT(&v));
1152 ok(V_I4(&v) == 1, "V_I4(v) = %d\n", V_I4(&v));
1153 VariantClear(&v);
1155 /* fontStyle */
1156 hres = IHTMLStyle_get_fontStyle(style, &sDefault);
1157 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
1159 str = a2bstr("test");
1160 hres = IHTMLStyle_put_fontStyle(style, str);
1161 ok(hres == E_INVALIDARG, "put_fontStyle failed: %08x\n", hres);
1162 SysFreeString(str);
1164 str = a2bstr("italic");
1165 hres = IHTMLStyle_put_fontStyle(style, str);
1166 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1167 SysFreeString(str);
1169 str = a2bstr("oblique");
1170 hres = IHTMLStyle_put_fontStyle(style, str);
1171 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1172 SysFreeString(str);
1174 str = a2bstr("normal");
1175 hres = IHTMLStyle_put_fontStyle(style, str);
1176 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1177 SysFreeString(str);
1179 hres = IHTMLStyle_put_fontStyle(style, sDefault);
1180 ok(hres == S_OK, "put_fontStyle failed: %08x\n", hres);
1181 SysFreeString(sDefault);
1183 /* overflow */
1184 hres = IHTMLStyle_get_overflow(style, NULL);
1185 ok(hres == E_INVALIDARG, "get_overflow failed: %08x\n", hres);
1187 hres = IHTMLStyle_get_overflow(style, &sOverflowDefault);
1188 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1190 str = a2bstr("test");
1191 hres = IHTMLStyle_put_overflow(style, str);
1192 ok(hres == E_INVALIDARG, "put_overflow failed: %08x\n", hres);
1193 SysFreeString(str);
1195 str = a2bstr("visible");
1196 hres = IHTMLStyle_put_overflow(style, str);
1197 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1198 SysFreeString(str);
1200 str = a2bstr("scroll");
1201 hres = IHTMLStyle_put_overflow(style, str);
1202 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1203 SysFreeString(str);
1205 str = a2bstr("hidden");
1206 hres = IHTMLStyle_put_overflow(style, str);
1207 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1208 SysFreeString(str);
1210 str = a2bstr("auto");
1211 hres = IHTMLStyle_put_overflow(style, str);
1212 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1213 SysFreeString(str);
1215 hres = IHTMLStyle_get_overflow(style, &str);
1216 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1217 ok(!strcmp_wa(str, "auto"), "str=%s\n", wine_dbgstr_w(str));
1218 SysFreeString(str);
1220 str = a2bstr("");
1221 hres = IHTMLStyle_put_overflow(style, str);
1222 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1223 SysFreeString(str);
1225 hres = IHTMLStyle_get_overflow(style, &str);
1226 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
1227 ok(!str, "str=%s\n", wine_dbgstr_w(str));
1228 SysFreeString(str);
1230 /* restore overflow default */
1231 hres = IHTMLStyle_put_overflow(style, sOverflowDefault);
1232 ok(hres == S_OK, "put_overflow failed: %08x\n", hres);
1233 SysFreeString(sOverflowDefault);
1235 /* Attribute Tests*/
1236 hres = IHTMLStyle_getAttribute(style, NULL, 1, &v);
1237 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1239 str = a2bstr("position");
1240 hres = IHTMLStyle_getAttribute(style, str, 1, NULL);
1241 ok(hres == E_INVALIDARG, "getAttribute failed: %08x\n", hres);
1243 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1244 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1245 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1246 VariantClear(&v);
1248 hres = IHTMLStyle_setAttribute(style, NULL, v, 1);
1249 ok(hres == E_INVALIDARG, "setAttribute failed: %08x\n", hres);
1251 V_VT(&v) = VT_BSTR;
1252 V_BSTR(&v) = a2bstr("absolute");
1253 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1254 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1255 VariantClear(&v);
1257 hres = IHTMLStyle_getAttribute(style, str, 1, &v);
1258 ok(hres == S_OK, "getAttribute failed: %08x\n", hres);
1259 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1260 ok(!strcmp_wa(V_BSTR(&v), "absolute"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1261 VariantClear(&v);
1263 V_VT(&v) = VT_BSTR;
1264 V_BSTR(&v) = NULL;
1265 hres = IHTMLStyle_setAttribute(style, str, v, 1);
1266 ok(hres == S_OK, "setAttribute failed: %08x\n", hres);
1267 VariantClear(&v);
1269 SysFreeString(str);
1271 str = a2bstr("borderLeftStyle");
1272 test_border_styles(style, str);
1273 SysFreeString(str);
1275 str = a2bstr("borderbottomstyle");
1276 test_border_styles(style, str);
1277 SysFreeString(str);
1279 str = a2bstr("borderrightstyle");
1280 test_border_styles(style, str);
1281 SysFreeString(str);
1283 str = a2bstr("bordertopstyle");
1284 test_border_styles(style, str);
1285 SysFreeString(str);
1287 hres = IHTMLStyle_get_borderStyle(style, &sDefault);
1288 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1290 str = a2bstr("none dotted dashed solid");
1291 hres = IHTMLStyle_put_borderStyle(style, str);
1292 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1293 SysFreeString(str);
1295 str = a2bstr("none dotted dashed solid");
1296 hres = IHTMLStyle_get_borderStyle(style, &str);
1297 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
1298 ok(!strcmp_wa(str, "none dotted dashed solid"),
1299 "expected (none dotted dashed solid) = (%s)\n", wine_dbgstr_w(V_BSTR(&v)));
1300 SysFreeString(str);
1302 str = a2bstr("double groove ridge inset");
1303 hres = IHTMLStyle_put_borderStyle(style, str);
1304 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1305 SysFreeString(str);
1307 str = a2bstr("window-inset outset ridge inset");
1308 hres = IHTMLStyle_put_borderStyle(style, str);
1309 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1310 SysFreeString(str);
1312 str = a2bstr("window-inset");
1313 hres = IHTMLStyle_put_borderStyle(style, str);
1314 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1315 SysFreeString(str);
1317 str = a2bstr("none none none none none");
1318 hres = IHTMLStyle_put_borderStyle(style, str);
1319 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1320 SysFreeString(str);
1322 str = a2bstr("invalid none none none");
1323 hres = IHTMLStyle_put_borderStyle(style, str);
1324 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1325 SysFreeString(str);
1327 str = a2bstr("none invalid none none");
1328 hres = IHTMLStyle_put_borderStyle(style, str);
1329 ok(hres == E_INVALIDARG, "put_borderStyle failed: %08x\n", hres);
1330 SysFreeString(str);
1332 hres = IHTMLStyle_put_borderStyle(style, sDefault);
1333 ok(hres == S_OK, "put_borderStyle failed: %08x\n", hres);
1334 SysFreeString(sDefault);
1336 /* backgoundColor */
1337 hres = IHTMLStyle_get_backgroundColor(style, &v);
1338 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1339 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1340 ok(!V_BSTR(&v), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1341 VariantClear(&v);
1343 V_VT(&v) = VT_BSTR;
1344 V_BSTR(&v) = a2bstr("red");
1345 hres = IHTMLStyle_put_backgroundColor(style, v);
1346 ok(hres == S_OK, "put_backgroundColor failed: %08x\n", hres);
1347 VariantClear(&v);
1349 hres = IHTMLStyle_get_backgroundColor(style, &v);
1350 ok(hres == S_OK, "get_backgroundColor: %08x\n", hres);
1351 ok(V_VT(&v) == VT_BSTR, "type failed: %d\n", V_VT(&v));
1352 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1353 VariantClear(&v);
1355 /* padding */
1356 hres = IHTMLStyle_get_padding(style, &str);
1357 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1358 ok(!str, "padding = %s\n", wine_dbgstr_w(str));
1359 SysFreeString(str);
1361 hres = IHTMLStyle_get_paddingTop(style, &v);
1362 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1363 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1364 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1366 V_VT(&v) = VT_I4;
1367 V_I4(&v) = 6;
1368 hres = IHTMLStyle_put_paddingTop(style, v);
1369 ok(hres == S_OK, "put_paddingTop failed: %08x\n", hres);
1371 hres = IHTMLStyle_get_paddingTop(style, &v);
1372 ok(hres == S_OK, "get_paddingTop: %08x\n", hres);
1373 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1374 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1375 VariantClear(&v);
1377 hres = IHTMLStyle_get_paddingRight(style, &v);
1378 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1379 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1380 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1382 V_VT(&v) = VT_I4;
1383 V_I4(&v) = 6;
1384 hres = IHTMLStyle_put_paddingRight(style, v);
1385 ok(hres == S_OK, "put_paddingRight failed: %08x\n", hres);
1387 hres = IHTMLStyle_get_paddingRight(style, &v);
1388 ok(hres == S_OK, "get_paddingRight: %08x\n", hres);
1389 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1390 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1391 VariantClear(&v);
1393 hres = IHTMLStyle_get_paddingBottom(style, &v);
1394 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1395 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1396 ok(!V_BSTR(&v), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1398 V_VT(&v) = VT_I4;
1399 V_I4(&v) = 6;
1400 hres = IHTMLStyle_put_paddingBottom(style, v);
1401 ok(hres == S_OK, "put_paddingBottom failed: %08x\n", hres);
1403 hres = IHTMLStyle_get_paddingBottom(style, &v);
1404 ok(hres == S_OK, "get_paddingBottom: %08x\n", hres);
1405 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
1406 ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1407 VariantClear(&v);
1409 str = a2bstr("1");
1410 hres = IHTMLStyle_put_padding(style, str);
1411 ok(hres == S_OK, "put_padding failed: %08x\n", hres);
1412 SysFreeString(str);
1414 hres = IHTMLStyle_get_padding(style, &str);
1415 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
1416 ok(!strcmp_wa(str, "1px"), "padding = %s\n", wine_dbgstr_w(str));
1417 SysFreeString(str);
1419 /* PaddingLeft */
1420 hres = IHTMLStyle_get_paddingLeft(style, &vDefault);
1421 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1422 ok(V_VT(&vDefault) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&vDefault));
1423 ok(!strcmp_wa(V_BSTR(&vDefault), "1px"), "V_BSTR(v) = %s\n", wine_dbgstr_w(V_BSTR(&vDefault)));
1425 V_VT(&v) = VT_BSTR;
1426 V_BSTR(&v) = a2bstr("10");
1427 hres = IHTMLStyle_put_paddingLeft(style, v);
1428 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1429 VariantClear(&v);
1431 hres = IHTMLStyle_get_paddingLeft(style, &v);
1432 ok(hres == S_OK, "get_paddingLeft: %08x\n", hres);
1433 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expecte 10 = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1434 VariantClear(&v);
1436 hres = IHTMLStyle_put_paddingLeft(style, vDefault);
1437 ok(hres == S_OK, "put_paddingLeft: %08x\n", hres);
1439 /* BackgroundRepeat */
1440 hres = IHTMLStyle_get_backgroundRepeat(style, &sDefault);
1441 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1443 str = a2bstr("invalid");
1444 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1445 ok(hres == E_INVALIDARG, "put_backgroundRepeat failed: %08x\n", hres);
1446 SysFreeString(str);
1448 str = a2bstr("repeat");
1449 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1450 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1451 SysFreeString(str);
1453 str = a2bstr("no-repeat");
1454 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1455 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1456 SysFreeString(str);
1458 str = a2bstr("repeat-x");
1459 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1460 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1461 SysFreeString(str);
1463 str = a2bstr("repeat-y");
1464 hres = IHTMLStyle_put_backgroundRepeat(style, str);
1465 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1466 SysFreeString(str);
1468 hres = IHTMLStyle_get_backgroundRepeat(style, &str);
1469 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
1470 ok(!strcmp_wa(str, "repeat-y"), "str=%s\n", wine_dbgstr_w(str));
1471 SysFreeString(str);
1473 hres = IHTMLStyle_put_backgroundRepeat(style, sDefault);
1474 ok(hres == S_OK, "put_backgroundRepeat failed: %08x\n", hres);
1475 SysFreeString(sDefault);
1477 /* BorderColor */
1478 hres = IHTMLStyle_get_borderColor(style, &sDefault);
1479 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1481 str = a2bstr("red green red blue");
1482 hres = IHTMLStyle_put_borderColor(style, str);
1483 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1484 SysFreeString(str);
1486 hres = IHTMLStyle_get_borderColor(style, &str);
1487 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
1488 ok(!strcmp_wa(str, "red green red blue"), "str=%s\n", wine_dbgstr_w(str));
1489 SysFreeString(str);
1491 hres = IHTMLStyle_put_borderColor(style, sDefault);
1492 ok(hres == S_OK, "put_borderColor failed: %08x\n", hres);
1493 SysFreeString(sDefault);
1495 /* BorderRight */
1496 hres = IHTMLStyle_get_borderRight(style, &sDefault);
1497 ok(hres == S_OK, "get_borderRight failed: %08x\n", hres);
1499 str = a2bstr("thick dotted red");
1500 hres = IHTMLStyle_put_borderRight(style, str);
1501 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1502 SysFreeString(str);
1504 /* IHTMLStyle_get_borderRight appears to have a bug where
1505 it returns the first letter of the color. So we check
1506 each style individually.
1508 V_BSTR(&v) = NULL;
1509 hres = IHTMLStyle_get_borderRightColor(style, &v);
1510 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
1511 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1512 VariantClear(&v);
1514 V_BSTR(&v) = NULL;
1515 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1516 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
1517 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1518 VariantClear(&v);
1520 hres = IHTMLStyle_get_borderRightStyle(style, &str);
1521 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
1522 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1523 SysFreeString(str);
1525 hres = IHTMLStyle_put_borderRight(style, sDefault);
1526 ok(hres == S_OK, "put_borderRight failed: %08x\n", hres);
1527 SysFreeString(sDefault);
1529 /* BorderTop */
1530 hres = IHTMLStyle_get_borderTop(style, &sDefault);
1531 ok(hres == S_OK, "get_borderTop failed: %08x\n", hres);
1533 str = a2bstr("thick dotted red");
1534 hres = IHTMLStyle_put_borderTop(style, str);
1535 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1536 SysFreeString(str);
1538 /* IHTMLStyle_get_borderTop appears to have a bug where
1539 it returns the first letter of the color. So we check
1540 each style individually.
1542 V_BSTR(&v) = NULL;
1543 hres = IHTMLStyle_get_borderTopColor(style, &v);
1544 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
1545 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1546 VariantClear(&v);
1548 V_BSTR(&v) = NULL;
1549 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1550 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
1551 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1552 VariantClear(&v);
1554 hres = IHTMLStyle_get_borderTopStyle(style, &str);
1555 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
1556 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1557 SysFreeString(str);
1559 hres = IHTMLStyle_put_borderTop(style, sDefault);
1560 ok(hres == S_OK, "put_borderTop failed: %08x\n", hres);
1561 SysFreeString(sDefault);
1563 /* BorderBottom */
1564 hres = IHTMLStyle_get_borderBottom(style, &sDefault);
1565 ok(hres == S_OK, "get_borderBottom failed: %08x\n", hres);
1567 str = a2bstr("thick dotted red");
1568 hres = IHTMLStyle_put_borderBottom(style, str);
1569 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1570 SysFreeString(str);
1572 /* IHTMLStyle_get_borderBottom appears to have a bug where
1573 it returns the first letter of the color. So we check
1574 each style individually.
1576 V_BSTR(&v) = NULL;
1577 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1578 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
1579 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1580 VariantClear(&v);
1582 V_BSTR(&v) = NULL;
1583 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1584 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
1585 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1586 VariantClear(&v);
1588 hres = IHTMLStyle_get_borderBottomStyle(style, &str);
1589 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
1590 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1591 SysFreeString(str);
1593 hres = IHTMLStyle_put_borderBottom(style, sDefault);
1594 ok(hres == S_OK, "put_borderBottom failed: %08x\n", hres);
1595 SysFreeString(sDefault);
1597 /* BorderLeft */
1598 hres = IHTMLStyle_get_borderLeft(style, &sDefault);
1599 ok(hres == S_OK, "get_borderLeft failed: %08x\n", hres);
1601 str = a2bstr("thick dotted red");
1602 hres = IHTMLStyle_put_borderLeft(style, str);
1603 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1604 SysFreeString(str);
1606 /* IHTMLStyle_get_borderLeft appears to have a bug where
1607 it returns the first letter of the color. So we check
1608 each style individually.
1610 V_BSTR(&v) = NULL;
1611 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1612 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
1613 ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1614 VariantClear(&v);
1616 V_BSTR(&v) = NULL;
1617 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1618 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
1619 ok(!strcmp_wa(V_BSTR(&v), "thick"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v)));
1620 VariantClear(&v);
1622 hres = IHTMLStyle_get_borderLeftStyle(style, &str);
1623 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
1624 ok(!strcmp_wa(str, "dotted"), "str=%s\n", wine_dbgstr_w(str));
1625 SysFreeString(str);
1627 hres = IHTMLStyle_put_borderLeft(style, sDefault);
1628 ok(hres == S_OK, "put_borderLeft failed: %08x\n", hres);
1629 SysFreeString(sDefault);
1631 /* backgroundPositionX */
1632 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1633 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1634 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1635 ok(!V_BSTR(&v), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1636 VariantClear(&v);
1638 V_VT(&v) = VT_BSTR;
1639 V_BSTR(&v) = a2bstr("10px");
1640 hres = IHTMLStyle_put_backgroundPositionX(style, v);
1641 ok(hres == S_OK, "put_backgroundPositionX failed: %08x\n", hres);
1642 VariantClear(&v);
1644 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1645 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1646 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1647 ok(!strcmp_wa(V_BSTR(&v), "10px"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1648 VariantClear(&v);
1650 /* backgroundPositionY */
1651 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1652 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1653 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1654 VariantClear(&v);
1656 V_VT(&v) = VT_BSTR;
1657 V_BSTR(&v) = a2bstr("15px");
1658 hres = IHTMLStyle_put_backgroundPositionY(style, v);
1659 ok(hres == S_OK, "put_backgroundPositionY failed: %08x\n", hres);
1660 VariantClear(&v);
1662 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1663 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1664 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1665 ok(!strcmp_wa(V_BSTR(&v), "15px"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1666 VariantClear(&v);
1668 /* backgroundPosition */
1669 str = NULL;
1670 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1671 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1672 ok(!strcmp_wa(str, "10px 15px"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1673 SysFreeString(str);
1675 str = a2bstr("center 20%");
1676 hres = IHTMLStyle_put_backgroundPosition(style, str);
1677 ok(hres == S_OK, "put_backgroundPosition failed: %08x\n", hres);
1678 SysFreeString(str);
1680 str = NULL;
1681 hres = IHTMLStyle_get_backgroundPosition(style, &str);
1682 ok(hres == S_OK, "get_backgroundPosition failed: %08x\n", hres);
1683 ok(!strcmp_wa(str, "center 20%"), "backgroundPosition = %s\n", wine_dbgstr_w(str));
1684 SysFreeString(str);
1686 hres = IHTMLStyle_get_backgroundPositionX(style, &v);
1687 ok(hres == S_OK, "get_backgroundPositionX failed: %08x\n", hres);
1688 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1689 ok(!strcmp_wa(V_BSTR(&v), "center"), "backgroundPositionX = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1690 VariantClear(&v);
1692 hres = IHTMLStyle_get_backgroundPositionY(style, &v);
1693 ok(hres == S_OK, "get_backgroundPositionY failed: %08x\n", hres);
1694 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1695 ok(!strcmp_wa(V_BSTR(&v), "20%"), "backgroundPositionY = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1696 VariantClear(&v);
1698 /* borderTopWidth */
1699 hres = IHTMLStyle_get_borderTopWidth(style, &vDefault);
1700 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1702 V_VT(&v) = VT_BSTR;
1703 V_BSTR(&v) = a2bstr("10px");
1704 hres = IHTMLStyle_put_borderTopWidth(style, v);
1705 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1706 VariantClear(&v);
1708 hres = IHTMLStyle_get_borderTopWidth(style, &v);
1709 ok(hres == S_OK, "get_borderTopWidth: %08x\n", hres);
1710 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1711 VariantClear(&v);
1713 hres = IHTMLStyle_put_borderTopWidth(style, vDefault);
1714 ok(hres == S_OK, "put_borderTopWidth: %08x\n", hres);
1715 VariantClear(&vDefault);
1717 /* borderRightWidth */
1718 hres = IHTMLStyle_get_borderRightWidth(style, &vDefault);
1719 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1721 V_VT(&v) = VT_BSTR;
1722 V_BSTR(&v) = a2bstr("10");
1723 hres = IHTMLStyle_put_borderRightWidth(style, v);
1724 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1725 VariantClear(&v);
1727 hres = IHTMLStyle_get_borderRightWidth(style, &v);
1728 ok(hres == S_OK, "get_borderRightWidth: %08x\n", hres);
1729 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1730 VariantClear(&v);
1732 hres = IHTMLStyle_put_borderRightWidth(style, vDefault);
1733 ok(hres == S_OK, "put_borderRightWidth: %08x\n", hres);
1734 VariantClear(&vDefault);
1736 /* borderBottomWidth */
1737 hres = IHTMLStyle_get_borderBottomWidth(style, &vDefault);
1738 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1740 V_VT(&v) = VT_BSTR;
1741 V_BSTR(&v) = a2bstr("10");
1742 hres = IHTMLStyle_put_borderBottomWidth(style, v);
1743 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1744 VariantClear(&v);
1746 hres = IHTMLStyle_get_borderBottomWidth(style, &v);
1747 ok(hres == S_OK, "get_borderBottomWidth: %08x\n", hres);
1748 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1749 VariantClear(&v);
1751 hres = IHTMLStyle_put_borderBottomWidth(style, vDefault);
1752 ok(hres == S_OK, "put_borderBottomWidth: %08x\n", hres);
1753 VariantClear(&vDefault);
1755 /* borderLeftWidth */
1756 hres = IHTMLStyle_get_borderLeftWidth(style, &vDefault);
1757 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1759 V_VT(&v) = VT_BSTR;
1760 V_BSTR(&v) = a2bstr("10");
1761 hres = IHTMLStyle_put_borderLeftWidth(style, v);
1762 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1763 VariantClear(&v);
1765 hres = IHTMLStyle_get_borderLeftWidth(style, &v);
1766 ok(hres == S_OK, "get_borderLeftWidth: %08x\n", hres);
1767 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1768 VariantClear(&v);
1770 hres = IHTMLStyle_put_borderLeftWidth(style, vDefault);
1771 ok(hres == S_OK, "put_borderLeftWidth: %08x\n", hres);
1772 VariantClear(&vDefault);
1774 /* wordSpacing */
1775 hres = IHTMLStyle_get_wordSpacing(style, &vDefault);
1776 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1778 V_VT(&v) = VT_BSTR;
1779 V_BSTR(&v) = a2bstr("10");
1780 hres = IHTMLStyle_put_wordSpacing(style, v);
1781 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1782 VariantClear(&v);
1784 hres = IHTMLStyle_get_wordSpacing(style, &v);
1785 ok(hres == S_OK, "get_wordSpacing: %08x\n", hres);
1786 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1787 ok(!strcmp_wa(V_BSTR(&v), "10px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1788 VariantClear(&v);
1790 hres = IHTMLStyle_put_wordSpacing(style, vDefault);
1791 ok(hres == S_OK, "put_wordSpacing: %08x\n", hres);
1792 VariantClear(&vDefault);
1794 /* letterSpacing */
1795 hres = IHTMLStyle_get_letterSpacing(style, &vDefault);
1796 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1798 V_VT(&v) = VT_BSTR;
1799 V_BSTR(&v) = a2bstr("11");
1800 hres = IHTMLStyle_put_letterSpacing(style, v);
1801 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1802 VariantClear(&v);
1804 hres = IHTMLStyle_get_letterSpacing(style, &v);
1805 ok(hres == S_OK, "get_letterSpacing: %08x\n", hres);
1806 ok(V_VT(&v) == VT_BSTR, "V_VT(v)=%d\n", V_VT(&v));
1807 ok(!strcmp_wa(V_BSTR(&v), "11px"), "expected 10px = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1808 VariantClear(&v);
1810 hres = IHTMLStyle_put_letterSpacing(style, vDefault);
1811 ok(hres == S_OK, "put_letterSpacing: %08x\n", hres);
1812 VariantClear(&vDefault);
1814 /* borderTopColor */
1815 hres = IHTMLStyle_get_borderTopColor(style, &vDefault);
1816 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1818 V_VT(&v) = VT_BSTR;
1819 V_BSTR(&v) = a2bstr("red");
1820 hres = IHTMLStyle_put_borderTopColor(style, v);
1821 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1822 VariantClear(&v);
1824 hres = IHTMLStyle_get_borderTopColor(style, &v);
1825 ok(hres == S_OK, "get_borderTopColor: %08x\n", hres);
1826 ok(!strcmp_wa(V_BSTR(&v), "red"), "expecte red = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1827 VariantClear(&v);
1829 hres = IHTMLStyle_put_borderTopColor(style, vDefault);
1830 ok(hres == S_OK, "put_borderTopColor: %08x\n", hres);
1832 /* borderRightColor */
1833 hres = IHTMLStyle_get_borderRightColor(style, &vDefault);
1834 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1836 V_VT(&v) = VT_BSTR;
1837 V_BSTR(&v) = a2bstr("blue");
1838 hres = IHTMLStyle_put_borderRightColor(style, v);
1839 ok(hres == S_OK, "put_borderRightColor: %08x\n", hres);
1840 VariantClear(&v);
1842 hres = IHTMLStyle_get_borderRightColor(style, &v);
1843 ok(hres == S_OK, "get_borderRightColor: %08x\n", hres);
1844 ok(!strcmp_wa(V_BSTR(&v), "blue"), "expected blue = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1845 VariantClear(&v);
1847 hres = IHTMLStyle_put_borderRightColor(style, vDefault);
1848 ok(hres == S_OK, "putborderRightColorr: %08x\n", hres);
1850 /* borderBottomColor */
1851 hres = IHTMLStyle_get_borderBottomColor(style, &vDefault);
1852 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1854 V_VT(&v) = VT_BSTR;
1855 V_BSTR(&v) = a2bstr("cyan");
1856 hres = IHTMLStyle_put_borderBottomColor(style, v);
1857 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1858 VariantClear(&v);
1860 hres = IHTMLStyle_get_borderBottomColor(style, &v);
1861 ok(hres == S_OK, "get_borderBottomColor: %08x\n", hres);
1862 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1863 VariantClear(&v);
1865 hres = IHTMLStyle_put_borderBottomColor(style, vDefault);
1866 ok(hres == S_OK, "put_borderBottomColor: %08x\n", hres);
1868 /* borderLeftColor */
1869 hres = IHTMLStyle_get_borderLeftColor(style, &vDefault);
1870 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1872 V_VT(&v) = VT_BSTR;
1873 V_BSTR(&v) = a2bstr("cyan");
1874 hres = IHTMLStyle_put_borderLeftColor(style, v);
1875 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1876 VariantClear(&v);
1878 hres = IHTMLStyle_get_borderLeftColor(style, &v);
1879 ok(hres == S_OK, "get_borderLeftColor: %08x\n", hres);
1880 ok(!strcmp_wa(V_BSTR(&v), "cyan"), "expected cyan = %s\n", wine_dbgstr_w(V_BSTR(&v)));
1881 VariantClear(&v);
1883 hres = IHTMLStyle_put_borderLeftColor(style, vDefault);
1884 ok(hres == S_OK, "put_borderLeftColor: %08x\n", hres);
1886 /* clip */
1887 hres = IHTMLStyle_get_clip(style, &str);
1888 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1889 ok(!str, "clip = %s\n", wine_dbgstr_w(str));
1891 str = a2bstr("rect(0px 1px 500px 505px)");
1892 hres = IHTMLStyle_put_clip(style, str);
1893 ok(hres == S_OK, "put_clip failed: %08x\n", hres);
1894 SysFreeString(str);
1896 hres = IHTMLStyle_get_clip(style, &str);
1897 ok(hres == S_OK, "get_clip failed: %08x\n", hres);
1898 ok(!strcmp_wa(str, "rect(0px 1px 500px 505px)"), "clip = %s\n", wine_dbgstr_w(str));
1899 SysFreeString(str);
1901 /* pageBreakAfter */
1902 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1903 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1904 ok(!str, "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1906 str = a2bstr("always");
1907 hres = IHTMLStyle_put_pageBreakAfter(style, str);
1908 ok(hres == S_OK, "put_pageBreakAfter failed: %08x\n", hres);
1909 SysFreeString(str);
1911 hres = IHTMLStyle_get_pageBreakAfter(style, &str);
1912 ok(hres == S_OK, "get_pageBreakAfter failed: %08x\n", hres);
1913 ok(!strcmp_wa(str, "always"), "pageBreakAfter = %s\n", wine_dbgstr_w(str));
1914 SysFreeString(str);
1916 /* pageBreakBefore */
1917 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1918 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1919 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1921 str = a2bstr("always");
1922 hres = IHTMLStyle_put_pageBreakBefore(style, str);
1923 ok(hres == S_OK, "put_pageBreakBefore failed: %08x\n", hres);
1924 SysFreeString(str);
1926 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1927 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1928 ok(!strcmp_wa(str, "always"), "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1929 SysFreeString(str);
1931 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_TRUE);
1932 test_style_remove_attribute(style, "pageBreakBefore", VARIANT_FALSE);
1934 hres = IHTMLStyle_get_pageBreakBefore(style, &str);
1935 ok(hres == S_OK, "get_pageBreakBefore failed: %08x\n", hres);
1936 ok(!str, "pageBreakBefore = %s\n", wine_dbgstr_w(str));
1938 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2);
1939 ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres);
1940 if(SUCCEEDED(hres)) {
1941 test_style2(style2);
1942 IHTMLStyle2_Release(style2);
1945 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle3, (void**)&style3);
1946 ok(hres == S_OK, "Could not get IHTMLStyle3 iface: %08x\n", hres);
1947 if(SUCCEEDED(hres)) {
1948 test_style3(style3);
1949 IHTMLStyle3_Release(style3);
1952 hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle4, (void**)&style4);
1953 ok(hres == S_OK, "Could not get IHTMLStyle4 iface: %08x\n", hres);
1954 if(SUCCEEDED(hres)) {
1955 test_style4(style4);
1956 IHTMLStyle4_Release(style4);
1960 #define test_style_filter(a,b) _test_style_filter(__LINE__,a,b)
1961 static void _test_style_filter(unsigned line, IHTMLStyle *style, const char *exval)
1963 BSTR str;
1964 HRESULT hres;
1966 str = (void*)0xdeadbeef;
1967 hres = IHTMLStyle_get_filter(style, &str);
1968 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1969 if(exval)
1970 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1971 else
1972 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1974 SysFreeString(str);
1977 #define test_current_style_filter(a,b) _test_current_style_filter(__LINE__,a,b)
1978 static void _test_current_style_filter(unsigned line, IHTMLCurrentStyle2 *style, const char *exval)
1980 BSTR str;
1981 HRESULT hres;
1983 str = (void*)0xdeadbeef;
1984 hres = IHTMLCurrentStyle2_get_filter(style, &str);
1985 ok_(__FILE__,line)(hres == S_OK, "get_filter failed: %08x\n", hres);
1986 if(exval)
1987 ok_(__FILE__,line)(str && !strcmp_wa(str, exval), "filter = %s, expected %s\n", wine_dbgstr_w(str), exval);
1988 else
1989 ok_(__FILE__,line)(!str, "str = %s, expected NULL\n", wine_dbgstr_w(str));
1991 SysFreeString(str);
1994 #define set_style_filter(a,b) _set_style_filter(__LINE__,a,b)
1995 static void _set_style_filter(unsigned line, IHTMLStyle *style, const char *val)
1997 BSTR str = a2bstr(val);
1998 HRESULT hres;
2000 hres = IHTMLStyle_put_filter(style, str);
2001 ok_(__FILE__,line)(hres == S_OK, "put_filter failed: %08x\n", hres);
2002 SysFreeString(str);
2004 _test_style_filter(line, style, val);
2007 static void test_style_filters(IHTMLElement *elem)
2009 IHTMLElement2 *elem2 = get_elem2_iface((IUnknown*)elem);
2010 IHTMLCurrentStyle2 *current_style2;
2011 IHTMLCurrentStyle *current_style;
2012 IHTMLStyle *style;
2013 HRESULT hres;
2015 hres = IHTMLElement_get_style(elem, &style);
2016 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2018 hres = IHTMLElement2_get_currentStyle(elem2, &current_style);
2019 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2021 hres = IHTMLCurrentStyle_QueryInterface(current_style, &IID_IHTMLCurrentStyle2, (void**)&current_style2);
2022 IHTMLCurrentStyle_Release(current_style);
2023 ok(hres == S_OK, "Could not get IHTMLCurrentStyle2 iface: %08x\n", hres);
2025 test_style_filter(style, NULL);
2026 test_current_style_filter(current_style2, NULL);
2027 set_style_filter(style, "alpha(opacity=50.0040)");
2028 test_current_style_filter(current_style2, "alpha(opacity=50.0040)");
2029 set_style_filter(style, "alpha(opacity=100)");
2031 IHTMLStyle_Release(style);
2033 hres = IHTMLElement_get_style(elem, &style);
2034 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2036 test_style_filter(style, "alpha(opacity=100)");
2037 set_style_filter(style, "xxx(a,b,c) alpha(opacity=100)");
2038 set_style_filter(style, NULL);
2039 set_style_filter(style, "alpha(opacity=100)");
2040 test_style_remove_attribute(style, "filter", VARIANT_TRUE);
2041 test_style_remove_attribute(style, "filter", VARIANT_FALSE);
2042 test_style_filter(style, NULL);
2045 IHTMLCurrentStyle2_Release(current_style2);
2046 IHTMLStyle_Release(style);
2047 IHTMLElement2_Release(elem2);
2050 static void test_current_style(IHTMLCurrentStyle *current_style)
2052 BSTR str;
2053 HRESULT hres;
2054 VARIANT v;
2056 hres = IHTMLCurrentStyle_get_display(current_style, &str);
2057 ok(hres == S_OK, "get_display failed: %08x\n", hres);
2058 ok(!strcmp_wa(str, "block"), "get_display returned %s\n", wine_dbgstr_w(str));
2059 SysFreeString(str);
2061 hres = IHTMLCurrentStyle_get_position(current_style, &str);
2062 ok(hres == S_OK, "get_position failed: %08x\n", hres);
2063 ok(!strcmp_wa(str, "absolute"), "get_position returned %s\n", wine_dbgstr_w(str));
2064 SysFreeString(str);
2066 hres = IHTMLCurrentStyle_get_fontFamily(current_style, &str);
2067 ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres);
2068 SysFreeString(str);
2070 hres = IHTMLCurrentStyle_get_fontStyle(current_style, &str);
2071 ok(hres == S_OK, "get_fontStyle failed: %08x\n", hres);
2072 ok(!strcmp_wa(str, "normal"), "get_fontStyle returned %s\n", wine_dbgstr_w(str));
2073 SysFreeString(str);
2075 hres = IHTMLCurrentStyle_get_backgroundImage(current_style, &str);
2076 ok(hres == S_OK, "get_backgroundImage failed: %08x\n", hres);
2077 ok(!strcmp_wa(str, "none"), "get_backgroundImage returned %s\n", wine_dbgstr_w(str));
2078 SysFreeString(str);
2080 hres = IHTMLCurrentStyle_get_fontVariant(current_style, &str);
2081 ok(hres == S_OK, "get_fontVariant failed: %08x\n", hres);
2082 ok(!strcmp_wa(str, "normal"), "get_fontVariant returned %s\n", wine_dbgstr_w(str));
2083 SysFreeString(str);
2085 hres = IHTMLCurrentStyle_get_borderTopStyle(current_style, &str);
2086 ok(hres == S_OK, "get_borderTopStyle failed: %08x\n", hres);
2087 ok(!strcmp_wa(str, "none"), "get_borderTopStyle returned %s\n", wine_dbgstr_w(str));
2088 SysFreeString(str);
2090 hres = IHTMLCurrentStyle_get_borderRightStyle(current_style, &str);
2091 ok(hres == S_OK, "get_borderRightStyle failed: %08x\n", hres);
2092 ok(!strcmp_wa(str, "none"), "get_borderRightStyle returned %s\n", wine_dbgstr_w(str));
2093 SysFreeString(str);
2095 hres = IHTMLCurrentStyle_get_borderBottomStyle(current_style, &str);
2096 ok(hres == S_OK, "get_borderBottomStyle failed: %08x\n", hres);
2097 ok(!strcmp_wa(str, "none"), "get_borderBottomStyle returned %s\n", wine_dbgstr_w(str));
2098 SysFreeString(str);
2100 hres = IHTMLCurrentStyle_get_borderLeftStyle(current_style, &str);
2101 ok(hres == S_OK, "get_borderLeftStyle failed: %08x\n", hres);
2102 ok(!strcmp_wa(str, "none"), "get_borderLeftStyle returned %s\n", wine_dbgstr_w(str));
2103 SysFreeString(str);
2105 hres = IHTMLCurrentStyle_get_textAlign(current_style, &str);
2106 ok(hres == S_OK, "get_textAlign failed: %08x\n", hres);
2107 ok(!strcmp_wa(str, "center"), "get_textAlign returned %s\n", wine_dbgstr_w(str));
2108 SysFreeString(str);
2110 hres = IHTMLCurrentStyle_get_textDecoration(current_style, &str);
2111 ok(hres == S_OK, "get_textDecoration failed: %08x\n", hres);
2112 ok(!strcmp_wa(str, "none"), "get_textDecoration returned %s\n", wine_dbgstr_w(str));
2113 SysFreeString(str);
2115 hres = IHTMLCurrentStyle_get_cursor(current_style, &str);
2116 ok(hres == S_OK, "get_cursor failed: %08x\n", hres);
2117 ok(!strcmp_wa(str, "default"), "get_cursor returned %s\n", wine_dbgstr_w(str));
2118 SysFreeString(str);
2120 hres = IHTMLCurrentStyle_get_backgroundRepeat(current_style, &str);
2121 ok(hres == S_OK, "get_backgroundRepeat failed: %08x\n", hres);
2122 ok(!strcmp_wa(str, "repeat"), "get_backgroundRepeat returned %s\n", wine_dbgstr_w(str));
2123 SysFreeString(str);
2125 hres = IHTMLCurrentStyle_get_borderColor(current_style, &str);
2126 ok(hres == S_OK, "get_borderColor failed: %08x\n", hres);
2127 SysFreeString(str);
2129 hres = IHTMLCurrentStyle_get_borderStyle(current_style, &str);
2130 ok(hres == S_OK, "get_borderStyle failed: %08x\n", hres);
2131 SysFreeString(str);
2133 hres = IHTMLCurrentStyle_get_visibility(current_style, &str);
2134 ok(hres == S_OK, "get_visibility failed: %08x\n", hres);
2135 SysFreeString(str);
2137 hres = IHTMLCurrentStyle_get_overflow(current_style, &str);
2138 ok(hres == S_OK, "get_overflow failed: %08x\n", hres);
2139 SysFreeString(str);
2141 hres = IHTMLCurrentStyle_get_borderWidth(current_style, &str);
2142 ok(hres == S_OK, "get_borderWidth failed: %08x\n", hres);
2143 SysFreeString(str);
2145 hres = IHTMLCurrentStyle_get_margin(current_style, &str);
2146 ok(hres == S_OK, "get_margin failed: %08x\n", hres);
2147 SysFreeString(str);
2149 hres = IHTMLCurrentStyle_get_padding(current_style, &str);
2150 ok(hres == S_OK, "get_padding failed: %08x\n", hres);
2151 SysFreeString(str);
2153 hres = IHTMLCurrentStyle_get_fontWeight(current_style, &v);
2154 ok(hres == S_OK, "get_fontWeight failed: %08x\n", hres);
2155 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2156 ok( V_I4(&v) == 400, "expect 400 got (%d)\n", V_I4(&v));
2157 VariantClear(&v);
2159 hres = IHTMLCurrentStyle_get_fontSize(current_style, &v);
2160 ok(hres == S_OK, "get_fontSize failed: %08x\n", hres);
2161 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2162 VariantClear(&v);
2164 hres = IHTMLCurrentStyle_get_left(current_style, &v);
2165 ok(hres == S_OK, "get_left failed: %08x\n", hres);
2166 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2167 VariantClear(&v);
2169 hres = IHTMLCurrentStyle_get_top(current_style, &v);
2170 ok(hres == S_OK, "get_top failed: %08x\n", hres);
2171 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2172 VariantClear(&v);
2174 hres = IHTMLCurrentStyle_get_width(current_style, &v);
2175 ok(hres == S_OK, "get_width failed: %08x\n", hres);
2176 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2177 VariantClear(&v);
2179 hres = IHTMLCurrentStyle_get_height(current_style, &v);
2180 ok(hres == S_OK, "get_height failed: %08x\n", hres);
2181 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2182 VariantClear(&v);
2184 hres = IHTMLCurrentStyle_get_paddingLeft(current_style, &v);
2185 ok(hres == S_OK, "get_paddingLeft failed: %08x\n", hres);
2186 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2187 VariantClear(&v);
2189 hres = IHTMLCurrentStyle_get_zIndex(current_style, &v);
2190 ok(hres == S_OK, "get_zIndex failed: %08x\n", hres);
2191 ok(V_VT(&v) == VT_I4, "V_VT(v) = %d\n", V_VT(&v));
2192 ok( V_I4(&v) == 1, "expect 1 got (%d)\n", V_I4(&v));
2193 VariantClear(&v);
2195 hres = IHTMLCurrentStyle_get_verticalAlign(current_style, &v);
2196 ok(hres == S_OK, "get_verticalAlign failed: %08x\n", hres);
2197 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2198 ok(!strcmp_wa(V_BSTR(&v), "100px"), "get_verticalAlign returned %s\n", wine_dbgstr_w(V_BSTR(&v)));
2199 VariantClear(&v);
2201 hres = IHTMLCurrentStyle_get_marginRight(current_style, &v);
2202 ok(hres == S_OK, "get_marginRight failed: %08x\n", hres);
2203 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2204 VariantClear(&v);
2206 hres = IHTMLCurrentStyle_get_marginLeft(current_style, &v);
2207 ok(hres == S_OK, "get_marginLeft failed: %08x\n", hres);
2208 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2209 VariantClear(&v);
2211 hres = IHTMLCurrentStyle_get_borderLeftWidth(current_style, &v);
2212 ok(hres == S_OK, "get_borderLeftWidth failed: %08x\n", hres);
2213 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2214 VariantClear(&v);
2216 V_BSTR(&v) = NULL;
2217 hres = IHTMLCurrentStyle_get_borderRightWidth(current_style, &v);
2218 ok(hres == S_OK, "get_borderRightWidth failed: %08x\n", hres);
2219 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2220 VariantClear(&v);
2222 hres = IHTMLCurrentStyle_get_borderBottomWidth(current_style, &v);
2223 ok(hres == S_OK, "get_borderBottomWidth failed: %08x\n", hres);
2224 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2225 VariantClear(&v);
2227 hres = IHTMLCurrentStyle_get_borderTopWidth(current_style, &v);
2228 ok(hres == S_OK, "get_borderTopWidth failed: %08x\n", hres);
2229 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2230 VariantClear(&v);
2232 hres = IHTMLCurrentStyle_get_color(current_style, &v);
2233 ok(hres == S_OK, "get_color failed: %08x\n", hres);
2234 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2235 VariantClear(&v);
2237 hres = IHTMLCurrentStyle_get_backgroundColor(current_style, &v);
2238 ok(hres == S_OK, "get_backgroundColor failed: %08x\n", hres);
2239 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2240 VariantClear(&v);
2242 hres = IHTMLCurrentStyle_get_borderLeftColor(current_style, &v);
2243 ok(hres == S_OK, "get_borderLeftColor failed: %08x\n", hres);
2244 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2245 VariantClear(&v);
2247 hres = IHTMLCurrentStyle_get_borderTopColor(current_style, &v);
2248 ok(hres == S_OK, "get_borderTopColor failed: %08x\n", hres);
2249 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2250 VariantClear(&v);
2252 hres = IHTMLCurrentStyle_get_borderRightColor(current_style, &v);
2253 ok(hres == S_OK, "get_borderRightColor failed: %08x\n", hres);
2254 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2255 VariantClear(&v);
2257 hres = IHTMLCurrentStyle_get_borderBottomColor(current_style, &v);
2258 ok(hres == S_OK, "get_borderBottomColor failed: %08x\n", hres);
2259 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2260 VariantClear(&v);
2262 hres = IHTMLCurrentStyle_get_paddingTop(current_style, &v);
2263 ok(hres == S_OK, "get_paddingTop failed: %08x\n", hres);
2264 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2265 VariantClear(&v);
2267 hres = IHTMLCurrentStyle_get_paddingRight(current_style, &v);
2268 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2269 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2270 VariantClear(&v);
2272 hres = IHTMLCurrentStyle_get_paddingBottom(current_style, &v);
2273 ok(hres == S_OK, "get_paddingRight failed: %08x\n", hres);
2274 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2275 VariantClear(&v);
2277 hres = IHTMLCurrentStyle_get_letterSpacing(current_style, &v);
2278 ok(hres == S_OK, "get_letterSpacing failed: %08x\n", hres);
2279 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2280 VariantClear(&v);
2282 hres = IHTMLCurrentStyle_get_marginTop(current_style, &v);
2283 ok(hres == S_OK, "get_marginTop failed: %08x\n", hres);
2284 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2285 VariantClear(&v);
2287 hres = IHTMLCurrentStyle_get_marginBottom(current_style, &v);
2288 ok(hres == S_OK, "get_marginBottom failed: %08x\n", hres);
2289 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2290 VariantClear(&v);
2292 hres = IHTMLCurrentStyle_get_right(current_style, &v);
2293 ok(hres == S_OK, "get_Right failed: %08x\n", hres);
2294 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2295 VariantClear(&v);
2297 hres = IHTMLCurrentStyle_get_bottom(current_style, &v);
2298 ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
2299 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2300 VariantClear(&v);
2302 hres = IHTMLCurrentStyle_get_lineHeight(current_style, &v);
2303 ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres);
2304 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2305 VariantClear(&v);
2307 hres = IHTMLCurrentStyle_get_textIndent(current_style, &v);
2308 ok(hres == S_OK, "get_textIndent failed: %08x\n", hres);
2309 ok(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
2310 VariantClear(&v);
2313 static const char basic_test_str[] = "<html><body><div id=\"divid\"></div/</body></html>";
2315 static void basic_style_test(IHTMLDocument2 *doc)
2317 IHTMLCurrentStyle *cstyle;
2318 IHTMLElement *elem;
2319 IHTMLStyle *style;
2320 HRESULT hres;
2322 hres = IHTMLDocument2_get_body(doc, &elem);
2323 ok(hres == S_OK, "get_body failed: %08x\n", hres);
2325 hres = IHTMLElement_get_style(elem, &style);
2326 ok(hres == S_OK, "get_style failed: %08x\n", hres);
2328 test_body_style(style);
2330 cstyle = get_current_style(elem);
2331 test_current_style(cstyle);
2332 IHTMLCurrentStyle_Release(cstyle);
2333 IHTMLElement_Release(elem);
2335 elem = get_element_by_id(doc, "divid");
2336 test_style_filters(elem);
2338 test_set_csstext(style);
2339 IHTMLStyle_Release(style);
2340 IHTMLElement_Release(elem);
2343 static IHTMLDocument2 *notif_doc;
2344 static BOOL doc_complete;
2346 static IHTMLDocument2 *create_document(void)
2348 IHTMLDocument2 *doc;
2349 IHTMLDocument5 *doc5;
2350 HRESULT hres;
2352 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2353 &IID_IHTMLDocument2, (void**)&doc);
2354 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
2355 if(FAILED(hres))
2356 return NULL;
2358 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
2359 if(FAILED(hres)) {
2360 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
2361 IHTMLDocument2_Release(doc);
2362 return NULL;
2365 IHTMLDocument5_Release(doc5);
2366 return doc;
2369 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
2370 REFIID riid, void**ppv)
2372 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2373 *ppv = iface;
2374 return S_OK;
2377 ok(0, "unexpected call\n");
2378 return E_NOINTERFACE;
2381 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
2383 return 2;
2386 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
2388 return 1;
2391 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
2393 if(dispID == DISPID_READYSTATE){
2394 BSTR state;
2395 HRESULT hres;
2397 hres = IHTMLDocument2_get_readyState(notif_doc, &state);
2398 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2400 if(!strcmp_wa(state, "complete"))
2401 doc_complete = TRUE;
2403 SysFreeString(state);
2406 return S_OK;
2409 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
2411 ok(0, "unexpected call\n");
2412 return E_NOTIMPL;
2415 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
2416 PropertyNotifySink_QueryInterface,
2417 PropertyNotifySink_AddRef,
2418 PropertyNotifySink_Release,
2419 PropertyNotifySink_OnChanged,
2420 PropertyNotifySink_OnRequestEdit
2423 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
2425 static IHTMLDocument2 *create_doc_with_string(const char *str)
2427 IPersistStreamInit *init;
2428 IStream *stream;
2429 IHTMLDocument2 *doc;
2430 HGLOBAL mem;
2431 SIZE_T len;
2433 notif_doc = doc = create_document();
2434 if(!doc)
2435 return NULL;
2437 doc_complete = FALSE;
2438 len = strlen(str);
2439 mem = GlobalAlloc(0, len);
2440 memcpy(mem, str, len);
2441 CreateStreamOnHGlobal(mem, TRUE, &stream);
2443 IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
2445 IPersistStreamInit_Load(init, stream);
2446 IPersistStreamInit_Release(init);
2447 IStream_Release(stream);
2449 return doc;
2452 static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
2454 IConnectionPointContainer *container;
2455 IConnectionPoint *cp;
2456 DWORD cookie;
2457 HRESULT hres;
2459 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2460 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2462 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2463 IConnectionPointContainer_Release(container);
2464 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2466 hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
2467 IConnectionPoint_Release(cp);
2468 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2471 typedef void (*style_test_t)(IHTMLDocument2*);
2473 static void run_test(const char *str, style_test_t test)
2475 IHTMLDocument2 *doc;
2476 ULONG ref;
2477 MSG msg;
2479 doc = create_doc_with_string(str);
2480 if(!doc)
2481 return;
2483 do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
2485 while(!doc_complete && GetMessage(&msg, NULL, 0, 0)) {
2486 TranslateMessage(&msg);
2487 DispatchMessage(&msg);
2490 test(doc);
2492 ref = IHTMLDocument2_Release(doc);
2493 ok(!ref || broken(ref == 1), /* Vista */
2494 "ref = %d\n", ref);
2498 START_TEST(style)
2500 CoInitialize(NULL);
2502 run_test(basic_test_str, basic_style_test);
2504 CoUninitialize();