diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 6698606a4c4..0fc21c496fc 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -364,8 +364,15 @@ static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG i static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LONG v) { HTMLSelectElement *This = HTMLSELECT_THIS(iface); - FIXME("(%p)->(%d)\n", This, v); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%d)\n", This, v); + + nsres = nsIDOMHTMLSelectElement_SetLength(This->nsselect, v); + if(NS_FAILED(nsres)) + ERR("SetLength failed: %08x\n", nsres); + + return S_OK; } static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, LONG *p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index c6f54793ce5..4bcaf2a391b 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -673,6 +673,17 @@ static IHTMLAnchorElement *_get_anchor_iface(unsigned line, IUnknown *unk) return anchor; } +#define get_select_iface(u) _get_select_iface(__LINE__,u) +static IHTMLSelectElement *_get_select_iface(unsigned line, IUnknown *unk) +{ + IHTMLSelectElement *select; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLSelectElement, (void**)&select); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLSelectElement: %08x\n", hres); + return select; +} + #define get_text_iface(u) _get_text_iface(__LINE__,u) static IHTMLDOMTextNode *_get_text_iface(unsigned line, IUnknown *unk) { @@ -1275,6 +1286,18 @@ static void _test_select_length(unsigned line, IHTMLSelectElement *select, LONG ok_(__FILE__,line) (len == length, "len=%d, expected %d\n", len, length); } +#define test_select_put_length(s,l) _test_select_put_length(__LINE__,s,l) +static void _test_select_put_length(unsigned line, IUnknown *unk, LONG length) +{ + IHTMLSelectElement *select = _get_select_iface(line, unk); + HRESULT hres; + + hres = IHTMLSelectElement_put_length(select, length); + ok_(__FILE__,line) (hres == S_OK, "put_length failed: %08x\n", hres); + _test_select_length(line, select, length); + IHTMLSelectElement_Release(select); +} + #define test_select_selidx(s,i) _test_select_selidx(__LINE__,s,i) static void _test_select_selidx(unsigned line, IHTMLSelectElement *select, LONG index) { @@ -5553,12 +5576,9 @@ static void test_elems(IHTMLDocument2 *doc) elem = get_elem_by_id(doc, "s", TRUE); if(elem) { - IHTMLSelectElement *select; + IHTMLSelectElement *select = get_select_iface((IUnknown*)elem); IHTMLDocument2 *doc_node, *elem_doc; - hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLSelectElement, (void**)&select); - ok(hres == S_OK, "Could not get IHTMLSelectElement interface: %08x\n", hres); - test_select_elem(select); test_elem_title((IUnknown*)select, NULL); @@ -5854,6 +5874,17 @@ static void test_elems(IHTMLDocument2 *doc) IHTMLDocument3_Release(doc3); + elem = get_elem_by_id(doc, "s", TRUE); + if(elem) { + static const elem_type_t select_types[] = { ET_OPTION, ET_OPTION, ET_OPTION }; + + test_select_put_length((IUnknown*)elem, 3); + test_elem_all((IUnknown*)elem, select_types, sizeof(select_types)/sizeof(*select_types)); + test_select_put_length((IUnknown*)elem, 1); + test_elem_all((IUnknown*)elem, select_types, 1); + IHTMLElement_Release(elem); + } + window = get_doc_window(doc); test_window_name(window, NULL); set_window_name(window, "test name");