mshtml: Added IHTMLSelectElement::remove method implementation.

This commit is contained in:
Zhenbo Li 2014-05-04 18:51:32 +08:00 committed by Alexandre Julliard
parent b8aecb92b9
commit 15ccfef080
2 changed files with 27 additions and 2 deletions

View File

@ -407,8 +407,14 @@ static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElem
static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG index) static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG index)
{ {
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface); HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%d)\n", This, index); nsresult nsres;
return E_NOTIMPL; 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) static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LONG v)

View File

@ -2559,6 +2559,24 @@ static void _test_select_get_disabled(unsigned line, IHTMLSelectElement *select,
_test_elem3_get_disabled(line, (IUnknown*)select, exb); _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) #define test_text_length(u,l) _test_text_length(__LINE__,u,l)
static void _test_text_length(unsigned line, IUnknown *unk, LONG 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_multiple(select, VARIANT_FALSE);
test_select_set_multiple(select, VARIANT_TRUE); test_select_set_multiple(select, VARIANT_TRUE);
test_select_remove(select);
} }
static void test_form_item(IHTMLElement *elem) static void test_form_item(IHTMLElement *elem)