Commit b1c7b891 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLTableCell::rowSpan property implementation.

parent 7d8cf318
...@@ -100,15 +100,36 @@ static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdM ...@@ -100,15 +100,36 @@ static HRESULT WINAPI HTMLTableCell_Invoke(IHTMLTableCell *iface, DISPID dispIdM
static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v) static HRESULT WINAPI HTMLTableCell_put_rowSpan(IHTMLTableCell *iface, LONG v)
{ {
HTMLTableCell *This = impl_from_IHTMLTableCell(iface); HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
FIXME("(%p)->(%d)\n", This, v); nsresult nsres;
return E_NOTIMPL;
TRACE("(%p)->(%d)\n", This, v);
if(v <= 0)
return E_INVALIDARG;
nsres = nsIDOMHTMLTableCellElement_SetRowSpan(This->nscell, v);
if(NS_FAILED(nsres)) {
ERR("SetRowSpan failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
} }
static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p) static HRESULT WINAPI HTMLTableCell_get_rowSpan(IHTMLTableCell *iface, LONG *p)
{ {
HTMLTableCell *This = impl_from_IHTMLTableCell(iface); HTMLTableCell *This = impl_from_IHTMLTableCell(iface);
FIXME("(%p)->(%p)\n", This, p); nsresult nsres;
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMHTMLTableCellElement_GetRowSpan(This->nscell, p);
if(NS_FAILED(nsres)) {
ERR("GetRowSpan failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
} }
static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v) static HRESULT WINAPI HTMLTableCell_put_colSpan(IHTMLTableCell *iface, LONG v)
......
...@@ -7234,23 +7234,31 @@ static void test_tr_elem(IHTMLElement *elem) ...@@ -7234,23 +7234,31 @@ static void test_tr_elem(IHTMLElement *elem)
IHTMLTableRow_Release(row); IHTMLTableRow_Release(row);
} }
static void test_td_elem(IHTMLElement *elem) static void test_td_elem(IHTMLDocument2 *doc, IHTMLElement *div)
{ {
IHTMLTableCell *cell; IHTMLTableCell *cell;
IHTMLElement *elem;
HRESULT hres; HRESULT hres;
LONG lval; LONG lval;
BSTR str; BSTR str;
VARIANT vbg, vDefaultbg; VARIANT vbg, vDefaultbg;
test_elem_set_innerhtml((IUnknown*)div,
"<table id=\"tbl\"><tbody>"
" <tr></tr>"
" <tr id=\"row2\"><td id=\"td1\">td1 text</td><td id=\"td2\">td2 text</td><td></td></tr>"
" <tr></tr>"
"</tbody></table>");
elem = get_doc_elem_by_id(doc, "td1");
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLTableCell, (void**)&cell); hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLTableCell, (void**)&cell);
ok(hres == S_OK, "Could not get IHTMLTableRow iface: %08x\n", hres); ok(hres == S_OK, "Could not get IHTMLTableRow iface: %08x\n", hres);
if(FAILED(hres)) IHTMLElement_Release(elem);
return;
lval = 0xdeadbeef; lval = 0xdeadbeef;
hres = IHTMLTableCell_get_cellIndex(cell, &lval); hres = IHTMLTableCell_get_cellIndex(cell, &lval);
ok(hres == S_OK, "get cellIndex failed: %08x\n", hres); ok(hres == S_OK, "get cellIndex failed: %08x\n", hres);
ok(lval == 1, "Expected 1, got %d\n", lval); ok(!lval, "Expected 0, got %d\n", lval);
str = a2bstr("left"); str = a2bstr("left");
hres = IHTMLTableCell_put_align(cell, str); hres = IHTMLTableCell_put_align(cell, str);
...@@ -7300,6 +7308,23 @@ static void test_td_elem(IHTMLElement *elem) ...@@ -7300,6 +7308,23 @@ static void test_td_elem(IHTMLElement *elem)
ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); ok(hres == S_OK, "put_bgColor failed: %08x\n", hres);
VariantClear(&vDefaultbg); VariantClear(&vDefaultbg);
hres = IHTMLTableCell_get_rowSpan(cell, &lval);
ok(hres == S_OK, "get_rowSpan failed: %08x\n", hres);
ok(lval == 1, "rowSpan = %d\n", lval);
hres = IHTMLTableCell_put_rowSpan(cell, -1);
ok(hres == E_INVALIDARG, "put_rowSpan failed: %08x\n", hres);
hres = IHTMLTableCell_put_rowSpan(cell, 0);
ok(hres == E_INVALIDARG, "put_rowSpan failed: %08x\n", hres);
hres = IHTMLTableCell_put_rowSpan(cell, 2);
ok(hres == S_OK, "put_rowSpan failed: %08x\n", hres);
hres = IHTMLTableCell_get_rowSpan(cell, &lval);
ok(hres == S_OK, "get_rowSpan failed: %08x\n", hres);
ok(lval == 2, "rowSpan = %d\n", lval);
IHTMLTableCell_Release(cell); IHTMLTableCell_Release(cell);
} }
...@@ -8543,13 +8568,6 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -8543,13 +8568,6 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }
elem = get_doc_elem_by_id(doc, "td2");
ok(elem != NULL, "elem == NULL\n");
if(elem) {
test_td_elem(elem);
IHTMLElement_Release(elem);
}
elem = get_doc_elem_by_id(doc, "row2"); elem = get_doc_elem_by_id(doc, "row2");
ok(elem != NULL, "elem == NULL\n"); ok(elem != NULL, "elem == NULL\n");
if(elem) { if(elem) {
...@@ -9246,6 +9264,7 @@ static void test_elems2(IHTMLDocument2 *doc) ...@@ -9246,6 +9264,7 @@ static void test_elems2(IHTMLDocument2 *doc)
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }
test_td_elem(doc, div);
test_attr(doc, div); test_attr(doc, div);
test_blocked(doc, div); test_blocked(doc, div);
test_elem_names(doc); test_elem_names(doc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment