From: Zhenbo Li Subject: mshtml: Added IHTMLSelectElement::remove method implementation. Message-Id: <53661BB4.6020809@gmail.com> Date: Sun, 04 May 2014 18:51:32 +0800 --- dlls/mshtml/htmlselect.c | 10 ++++++++-- dlls/mshtml/tests/dom.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index aef0bf0..08a374a 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -407,8 +407,14 @@ static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElem static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG index) { HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface); - FIXME("(%p)->(%d)\n", This, index); - return E_NOTIMPL; + nsresult nsres; + TRACE("(%p)->(%d)\n", This, index); + nsres = nsIDOMHTMLSelectElement_select_Remove(This->nsselect, index); + if(NS_FAILED(nsres)) { + ERR("Remove failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LONG v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 02e0d00..4378ad3 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2559,6 +2559,24 @@ static void _test_select_get_disabled(unsigned line, IHTMLSelectElement *select, _test_elem3_get_disabled(line, (IUnknown*)select, exb); } +static void test_select_remove(IHTMLSelectElement *select) +{ + HRESULT hres; + + hres = IHTMLSelectElement_remove(select, 3); + ok(hres == S_OK, "remove failed: %08x, expected S_OK\n", hres); + test_select_length(select, 2); + + hres = IHTMLSelectElement_remove(select, -1); + todo_wine + ok(hres == E_INVALIDARG, "remove failed: %08x, expected E_INVALIDARG\n", hres); + test_select_length(select, 2); + + hres = IHTMLSelectElement_remove(select, 0); + ok(hres == S_OK, "remove failed:%08x\n", hres); + test_select_length(select, 1); +} + #define test_text_length(u,l) _test_text_length(__LINE__,u,l) static void _test_text_length(unsigned line, IUnknown *unk, LONG l) { @@ -4324,6 +4342,7 @@ static void test_select_elem(IHTMLSelectElement *select) test_select_multiple(select, VARIANT_FALSE); test_select_set_multiple(select, VARIANT_TRUE); + test_select_remove(select); } static void test_form_item(IHTMLElement *elem)