From bff346836022eee669b6849c1c3298bfe70d3521 Mon Sep 17 00:00:00 2001 From: Zhenbo Li Date: Sun, 18 May 2014 16:24:23 +0800 Subject: [PATCH] mshtml: Added IHTMLTableRow::deleteCell method implementation. --- dlls/mshtml/htmltablerow.c | 11 ++++++++-- dlls/mshtml/tests/dom.c | 42 +++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmltablerow.c b/dlls/mshtml/htmltablerow.c index 331d6c919a1..731b40345ff 100644 --- a/dlls/mshtml/htmltablerow.c +++ b/dlls/mshtml/htmltablerow.c @@ -315,8 +315,15 @@ static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%d)\n", This, index); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%d)\n", This, index); + nsres = nsIDOMHTMLTableRowElement_DeleteCell(This->nsrow, index); + if(NS_FAILED(nsres)) { + ERR("Delete Cell failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } static const IHTMLTableRowVtbl HTMLTableRowVtbl = { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 8af98dd52bc..0d6c3acafae 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -56,7 +56,7 @@ static const char elem_test_str[] = "" "" "" - "
td1 texttd2 text
" + "
td1 texttd2 text
" "" "" "" @@ -5679,6 +5679,44 @@ static void test_button_elem(IHTMLElement *elem) set_button_name(elem, "button name"); } +#define test_tr_possess(e,r,l,i) _test_tr_possess(__LINE__,e,r,l,i) +static void _test_tr_possess(unsigned line, IHTMLElement *elem, + IHTMLTableRow *row, LONG len, const char *id) +{ + IHTMLElementCollection *col; + IDispatch *disp; + HRESULT hres; + LONG lval; + VARIANT var; + + hres = IHTMLTableRow_get_cells(row, &col); + ok_(__FILE__, line)(hres == S_OK, "get_cells failed: %08x\n", hres); + ok_(__FILE__, line)(col != NULL, "get_cells returned NULL\n"); + + hres = IHTMLElementCollection_get_length(col, &lval); + ok_(__FILE__, line)(hres == S_OK, "get length failed: %08x\n", hres); + ok_(__FILE__, line)(lval == len, "expected len = %d, got %d\n", len, lval); + + V_VT(&var) = VT_BSTR; + V_BSTR(&var) = a2bstr(id); + hres = IHTMLElementCollection_tags(col, var, &disp); + ok_(__FILE__, line)(hres == S_OK, "search by tags(%s) failed: %08x\n", id, hres); + ok_(__FILE__, line)(disp != NULL, "disp == NULL\n"); + + VariantClear(&var); + IDispatch_Release(disp); + IHTMLElementCollection_Release(col); +} + +static void test_tr_modify(IHTMLElement *elem, IHTMLTableRow *row) +{ + HRESULT hres; + + hres = IHTMLTableRow_deleteCell(row, 0); + ok(hres == S_OK, "deleteCell failed: %08x\n", hres); + test_tr_possess(elem, row, 1, "td2"); +} + static void test_tr_elem(IHTMLElement *elem) { IHTMLElementCollection *col; @@ -5771,6 +5809,8 @@ static void test_tr_elem(IHTMLElement *elem) ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); VariantClear(&vDefaultbg); + test_tr_modify(elem, row); + IHTMLTableRow_Release(row); }