mshtml: Added IHTMLButtonElement::value property implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-06-16 19:30:18 +02:00 committed by Alexandre Julliard
parent 5f7a55f85e
commit 5a07f80ebe
2 changed files with 56 additions and 4 deletions

View file

@ -1634,15 +1634,33 @@ static HRESULT WINAPI HTMLButtonElement_get_type(IHTMLButtonElement *iface, BSTR
static HRESULT WINAPI HTMLButtonElement_put_value(IHTMLButtonElement *iface, BSTR v)
{
HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMHTMLButtonElement_SetValue(This->nsbutton, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
ERR("SetValue failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLButtonElement_get_value(IHTMLButtonElement *iface, BSTR *p)
{
HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString value_str;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&value_str, NULL);
nsres = nsIDOMHTMLButtonElement_GetValue(This->nsbutton, &value_str);
return return_nsstr(nsres, &value_str, p);
}
static HRESULT WINAPI HTMLButtonElement_put_name(IHTMLButtonElement *iface, BSTR v)

View file

@ -6944,11 +6944,45 @@ static void _test_button_type(unsigned line, IHTMLElement *elem, const char *ext
IHTMLButtonElement_Release(button);
}
#define test_button_value(a,b) _test_button_value(__LINE__,a,b)
static void _test_button_value(unsigned line, IHTMLElement *elem, const char *exvalue)
{
IHTMLButtonElement *button = _get_button_iface(line, (IUnknown*)elem);
BSTR str;
HRESULT hres;
hres = IHTMLButtonElement_get_value(button, &str);
ok_(__FILE__,line)(hres == S_OK, "get_value failed: %08x\n", hres);
if(exvalue)
ok_(__FILE__,line)(!strcmp_wa(str, exvalue), "value = %s, expected %s\n", wine_dbgstr_w(str), exvalue);
else
ok_(__FILE__,line)(!str, "value = %s, expected NULL\n", wine_dbgstr_w(str));
SysFreeString(str);
IHTMLButtonElement_Release(button);
}
#define set_button_value(a,b) _set_button_value(__LINE__,a,b)
static void _set_button_value(unsigned line, IHTMLElement *elem, const char *value)
{
IHTMLButtonElement *button = _get_button_iface(line, (IUnknown*)elem);
BSTR str = a2bstr(value);
HRESULT hres;
hres = IHTMLButtonElement_put_value(button, str);
ok_(__FILE__,line)(hres == S_OK, "put_value failed: %08x\n", hres);
IHTMLButtonElement_Release(button);
_test_button_value(line, elem, value);
}
static void test_button_elem(IHTMLElement *elem)
{
test_button_name(elem, NULL);
set_button_name(elem, "button name");
test_button_type(elem, "submit");
test_button_value(elem, NULL);
set_button_value(elem, "val");
test_elem_istextedit(elem, VARIANT_TRUE);
}