mshtml: Add IHTMLOpinionElement::index property's getter implementation.

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

View File

@ -187,8 +187,21 @@ static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LON
static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LONG *p)
{
HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
LONG val;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
if(!p)
return E_INVALIDARG;
nsres = nsIDOMHTMLOptionElement_GetIndex(This->nsoption, &val);
if(NS_FAILED(nsres)) {
ERR("GetIndex failed: %08x\n", nsres);
return E_FAIL;
}
*p = val;
return S_OK;
}
static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)

View File

@ -1676,6 +1676,22 @@ static void _test_option_put_selected(unsigned line, IHTMLOptionElement *option,
_test_option_selected(line, option, b);
}
#define test_option_get_index(o,s) _test_option_get_index(__LINE__,o,s)
static void _test_option_get_index(unsigned line, IHTMLOptionElement *option, LONG exval)
{
HRESULT hres;
LONG val;
hres = IHTMLOptionElement_get_index(option, NULL);
ok_(__FILE__,line)(hres == E_INVALIDARG, "Expect E_INVALIDARG, got %08x\n", hres);
val = 12345678;
hres = IHTMLOptionElement_get_index(option, &val);
ok_(__FILE__,line)(hres == S_OK, "get_index failed: %08x\n", hres);
ok_(__FILE__,line)(val == exval || broken(val == 12345678), /* Win2k doesn't touch it*/
"value = %d, expected = %d\n", val, exval);
}
#define test_textarea_value(t,v) _test_textarea_value(__LINE__,t,v)
static void _test_textarea_value(unsigned line, IUnknown *unk, const char *exval)
{
@ -4966,6 +4982,7 @@ static void test_create_option_elem(IHTMLDocument2 *doc)
test_option_put_text(option, "new text");
test_option_put_value(option, "new value");
test_option_get_index(option, 0);
test_option_put_selected(option, VARIANT_TRUE);
test_option_put_selected(option, VARIANT_FALSE);