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