mshtml: Added IHTMLTable::cellSpacing property implementation.

This commit is contained in:
Jacek Caban 2013-07-30 14:10:16 +02:00 committed by Alexandre Julliard
parent 792eafa465
commit c897306d24
2 changed files with 71 additions and 4 deletions

View File

@ -170,15 +170,49 @@ static HRESULT WINAPI HTMLTable_get_rules(IHTMLTable *iface, BSTR *p)
static HRESULT WINAPI HTMLTable_put_cellSpacing(IHTMLTable *iface, VARIANT v)
{
HTMLTable *This = impl_from_IHTMLTable(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL;
nsAString nsstr;
WCHAR buf[64];
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
switch(V_VT(&v)) {
case VT_BSTR:
nsAString_InitDepend(&nsstr, V_BSTR(&v));
break;
case VT_I4: {
static const WCHAR formatW[] = {'%','d',0};
sprintfW(buf, formatW, V_I4(&v));
nsAString_InitDepend(&nsstr, buf);
break;
}
default:
FIXME("unsupported arg %s\n", debugstr_variant(&v));
return E_NOTIMPL;
}
nsres = nsIDOMHTMLTableElement_SetCellSpacing(This->nstable, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("SetCellSpacing failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLTable_get_cellSpacing(IHTMLTable *iface, VARIANT *p)
{
HTMLTable *This = impl_from_IHTMLTable(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLTableElement_GetCellSpacing(This->nstable, &nsstr);
V_VT(p) = VT_BSTR;
return return_nsstr(nsres, &nsstr, &V_BSTR(p));
}
static HRESULT WINAPI HTMLTable_put_cellPadding(IHTMLTable *iface, VARIANT v)

View File

@ -5513,11 +5513,29 @@ static void test_tr_elem(IHTMLElement *elem)
IHTMLTableRow_Release(row);
}
#define test_table_cell_spacing(a,b) _test_table_cell_spacing(__LINE__,a,b)
static void _test_table_cell_spacing(unsigned line, IHTMLTable *table, const char *exstr)
{
VARIANT v;
HRESULT hres;
V_VT(&v) = VT_ERROR;
hres = IHTMLTable_get_cellSpacing(table, &v);
ok_(__FILE__,line)(hres == S_OK, "get_cellSpacing failed: %08x\n", hres);
ok_(__FILE__,line)(V_VT(&v) == VT_BSTR, "V_VT(v) = %d\n", V_VT(&v));
if(exstr)
ok_(__FILE__,line)(!strcmp_wa(V_BSTR(&v), exstr), "cellSpacing = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exstr);
else
ok_(__FILE__,line)(!V_BSTR(&v), "cellSpacing = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
VariantClear(&v);
}
static void test_table_elem(IHTMLElement *elem)
{
IHTMLElementCollection *col;
IHTMLTable *table;
IHTMLDOMNode *node;
VARIANT v;
HRESULT hres;
static const elem_type_t row_types[] = {ET_TR,ET_TR};
@ -5557,6 +5575,21 @@ static void test_table_elem(IHTMLElement *elem)
test_elem_collection((IUnknown*)col, tbodies_types, sizeof(tbodies_types)/sizeof(*tbodies_types));
IHTMLElementCollection_Release(col);
test_table_cell_spacing(table, NULL);
V_VT(&v) = VT_I4;
V_I4(&v) = 10;
hres = IHTMLTable_put_cellSpacing(table, v);
ok(hres == S_OK, "put_cellSpacing = %08x\n", hres);
test_table_cell_spacing(table, "10");
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = a2bstr("11");
hres = IHTMLTable_put_cellSpacing(table, v);
ok(hres == S_OK, "put_cellSpacing = %08x\n", hres);
test_table_cell_spacing(table, "11");
VariantClear(&v);
IHTMLTable_Release(table);
}