mshtml: Added IHTMLTable::bgColor property implementation.
This commit is contained in:
parent
c4a51b0b0a
commit
22c2d81a2d
|
@ -246,15 +246,48 @@ static HRESULT WINAPI HTMLTable_get_background(IHTMLTable *iface, BSTR *p)
|
|||
static HRESULT WINAPI HTMLTable_put_bgColor(IHTMLTable *iface, VARIANT v)
|
||||
{
|
||||
HTMLTable *This = impl_from_IHTMLTable(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
return E_NOTIMPL;
|
||||
nsAString val;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
||||
|
||||
nsAString_InitDepend(&val, V_BSTR(&v));
|
||||
variant_to_nscolor(&v, &val);
|
||||
nsres = nsIDOMHTMLTableElement_SetBgColor(This->nstable, &val);
|
||||
nsAString_Finish(&val);
|
||||
|
||||
if (NS_FAILED(nsres)){
|
||||
ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLTable_get_bgColor(IHTMLTable *iface, VARIANT *p)
|
||||
{
|
||||
HTMLTable *This = impl_from_IHTMLTable(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsAString strColor;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
const PRUnichar *color;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&strColor, NULL);
|
||||
nsres = nsIDOMHTMLTableElement_GetBgColor(This->nstable, &strColor);
|
||||
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsAString_GetData(&strColor, &color);
|
||||
V_VT(p) = VT_BSTR;
|
||||
hres = nscolor_to_str(color, &V_BSTR(p));
|
||||
}else {
|
||||
ERR("SetBgColor failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
}
|
||||
|
||||
nsAString_Finish(&strColor);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLTable_put_borderColor(IHTMLTable *iface, VARIANT v)
|
||||
|
|
|
@ -5729,6 +5729,7 @@ static void test_table_elem(IHTMLElement *elem)
|
|||
VARIANT v;
|
||||
HRESULT hres;
|
||||
BSTR bstr;
|
||||
VARIANT vbg, vDefaultbg;
|
||||
|
||||
static const elem_type_t row_types[] = {ET_TR,ET_TR};
|
||||
static const elem_type_t all_types[] = {ET_TBODY,ET_TR,ET_TR,ET_TD,ET_TD};
|
||||
|
@ -5794,6 +5795,40 @@ static void test_table_elem(IHTMLElement *elem)
|
|||
ok(!strcmp_wa(bstr, "left"), "get_align returned %s\n", wine_dbgstr_w(bstr));
|
||||
SysFreeString(bstr);
|
||||
|
||||
hres = IHTMLTable_get_bgColor(table, &vDefaultbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vDefaultbg) == VT_BSTR, "bstr != NULL\n");
|
||||
ok(!V_BSTR(&vDefaultbg), "V_BSTR(bgColor) = %s\n", wine_dbgstr_w(V_BSTR(&vDefaultbg)));
|
||||
|
||||
V_VT(&vbg) = VT_BSTR;
|
||||
V_BSTR(&vbg) = a2bstr("red");
|
||||
hres = IHTMLTable_put_bgColor(table, vbg);
|
||||
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
|
||||
VariantClear(&vbg);
|
||||
|
||||
hres = IHTMLTable_get_bgColor(table, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n");
|
||||
ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg)));
|
||||
VariantClear(&vbg);
|
||||
|
||||
V_VT(&vbg) = VT_I4;
|
||||
V_I4(&vbg) = 0xff0000;
|
||||
hres = IHTMLTable_put_bgColor(table, vbg);
|
||||
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
|
||||
VariantClear(&vbg);
|
||||
|
||||
hres = IHTMLTable_get_bgColor(table, &vbg);
|
||||
ok(hres == S_OK, "get_bgColor failed: %08x\n", hres);
|
||||
ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n");
|
||||
ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg)));
|
||||
VariantClear(&vbg);
|
||||
|
||||
/* Restore Originial */
|
||||
hres = IHTMLTable_put_bgColor(table, vDefaultbg);
|
||||
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
|
||||
VariantClear(&vDefaultbg);
|
||||
|
||||
IHTMLTable_Release(table);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue