mshtml: Add IHTMLSelectElement::size property implementation.

This commit is contained in:
Zhenbo Li 2015-08-07 18:12:27 +08:00 committed by Alexandre Julliard
parent 312534f26f
commit 6419ac0f13
2 changed files with 59 additions and 4 deletions

View File

@ -142,15 +142,37 @@ static HRESULT WINAPI HTMLSelectElement_Invoke(IHTMLSelectElement *iface, DISPID
static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, LONG v)
{
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%d)\n", This, v);
return E_NOTIMPL;
nsresult nsres;
TRACE("(%p)->(%d)\n", This, v);
if(v < 0)
return CTL_E_INVALIDPROPERTYVALUE;
nsres = nsIDOMHTMLSelectElement_SetSize(This->nsselect, v);
if(NS_FAILED(nsres)) {
ERR("SetSize failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, LONG *p)
{
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
DWORD val;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
if(!p)
return E_INVALIDARG;
nsres = nsIDOMHTMLSelectElement_GetSize(This->nsselect, &val);
if(NS_FAILED(nsres)) {
ERR("GetSize failed: %08x\n", nsres);
return E_FAIL;
}
*p = val;
return S_OK;
}
static HRESULT WINAPI HTMLSelectElement_put_multiple(IHTMLSelectElement *iface, VARIANT_BOOL v)

View File

@ -2193,6 +2193,30 @@ static void _test_select_set_multiple(unsigned line, IHTMLSelectElement *select,
_test_select_multiple(line, select, val);
}
#define test_select_size(s,v) _test_select_size(__LINE__,s,v)
static void _test_select_size(unsigned line, IHTMLSelectElement *select, LONG exval)
{
HRESULT hres;
LONG val;
hres = IHTMLSelectElement_get_size(select, NULL);
ok_(__FILE__,line) (hres == E_INVALIDARG, "got %08x, expected E_INVALIDARG\n", hres);
val = 0xdeadbeef;
hres = IHTMLSelectElement_get_size(select, &val);
ok_(__FILE__,line) (hres == S_OK, "get_size failed: %08x\n", hres);
ok_(__FILE__,line) (val == exval, "size = %d, expected %d\n", val, exval);
}
#define test_select_set_size(s,v,e) _test_select_set_size(__LINE__,s,v,e)
static void _test_select_set_size(unsigned line, IHTMLSelectElement *select, LONG val, HRESULT exhres)
{
HRESULT hres;
hres = IHTMLSelectElement_put_size(select, val);
ok_(__FILE__,line) (hres == exhres, "put_size(%d) got %08x, expect %08x\n", val, hres, exhres);
}
#define test_range_text(r,t) _test_range_text(__LINE__,r,t)
static void _test_range_text(unsigned line, IHTMLTxtRange *range, const char *extext)
{
@ -4882,6 +4906,15 @@ static void test_select_elem(IHTMLSelectElement *select)
test_select_set_value(select, "val1");
test_select_value(select, "val1");
test_select_size(select, 0);
test_select_set_size(select, 1, S_OK);
test_select_size(select, 1);
test_select_set_size(select, -1, CTL_E_INVALIDPROPERTYVALUE);
test_select_size(select, 1);
test_select_set_size(select, 3, S_OK);
test_select_size(select, 3);
test_select_get_disabled(select, VARIANT_FALSE);
test_select_set_disabled(select, VARIANT_TRUE);
test_select_set_disabled(select, VARIANT_FALSE);