mshtml: Added IHTMLTextAreaElement::defaultValue property implementation.

This commit is contained in:
Jacek Caban 2015-03-13 13:07:25 +01:00 committed by Alexandre Julliard
parent 0e24c33332
commit 14e62a0e2d
2 changed files with 59 additions and 4 deletions

View File

@ -229,15 +229,28 @@ static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface,
static HRESULT WINAPI HTMLTextAreaElement_put_defaultValue(IHTMLTextAreaElement *iface, BSTR v)
{
HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(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 = nsIDOMHTMLTextAreaElement_SetDefaultValue(This->nstextarea, &nsstr);
nsAString_Finish(&nsstr);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
}
static HRESULT WINAPI HTMLTextAreaElement_get_defaultValue(IHTMLTextAreaElement *iface, BSTR *p)
{
HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLTextAreaElement_GetDefaultValue(This->nstextarea, &nsstr);
return return_nsstr(nsres, &nsstr, p);
}
static HRESULT WINAPI HTMLTextAreaElement_select(IHTMLTextAreaElement *iface)

View File

@ -1670,6 +1670,38 @@ static void _test_textarea_put_value(unsigned line, IUnknown *unk, const char *v
_test_textarea_value(line, unk, value);
}
#define test_textarea_defaultvalue(t,v) _test_textarea_defaultvalue(__LINE__,t,v)
static void _test_textarea_defaultvalue(unsigned line, IUnknown *unk, const char *exval)
{
IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
BSTR value = (void*)0xdeadbeef;
HRESULT hres;
hres = IHTMLTextAreaElement_get_defaultValue(textarea, &value);
IHTMLTextAreaElement_Release(textarea);
ok_(__FILE__,line)(hres == S_OK, "get_defaultValue failed: %08x\n", hres);
if(exval)
ok_(__FILE__,line)(!strcmp_wa(value, exval), "defaultValue = %s, expected %s\n", wine_dbgstr_w(value), exval);
else
ok_(__FILE__,line)(!value, "value = %p\n", value);
SysFreeString(value);
}
#define test_textarea_put_defaultvalue(t,v) _test_textarea_put_defaultvalue(__LINE__,t,v)
static void _test_textarea_put_defaultvalue(unsigned line, IUnknown *unk, const char *value)
{
IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
BSTR tmp = a2bstr(value);
HRESULT hres;
hres = IHTMLTextAreaElement_put_defaultValue(textarea, tmp);
IHTMLTextAreaElement_Release(textarea);
ok_(__FILE__,line)(hres == S_OK, "put_defaultValue failed: %08x\n", hres);
SysFreeString(tmp);
_test_textarea_defaultvalue(line, unk, value);
}
#define test_textarea_readonly(t,v) _test_textarea_readonly(__LINE__,t,v)
static void _test_textarea_readonly(unsigned line, IUnknown *unk, VARIANT_BOOL ex)
{
@ -8172,6 +8204,9 @@ static void test_elems2(IHTMLDocument2 *doc)
test_textarea_value((IUnknown*)elem, NULL);
test_textarea_put_value((IUnknown*)elem, "test");
test_textarea_defaultvalue((IUnknown*)elem, NULL);
test_textarea_put_defaultvalue((IUnknown*)elem, "defval text");
test_textarea_put_value((IUnknown*)elem, "test");
test_textarea_readonly((IUnknown*)elem, VARIANT_FALSE);
test_textarea_put_readonly((IUnknown*)elem, VARIANT_TRUE);
test_textarea_put_readonly((IUnknown*)elem, VARIANT_FALSE);
@ -8185,6 +8220,13 @@ static void test_elems2(IHTMLDocument2 *doc)
IHTMLElement_Release(elem);
}
test_elem_set_innerhtml((IUnknown*)div, "<textarea id=\"ta\">default text</textarea>");
elem = get_elem_by_id(doc, "ta", TRUE);
if(elem) {
test_textarea_defaultvalue((IUnknown*)elem, "default text");
IHTMLElement_Release(elem);
}
test_elem_set_innerhtml((IUnknown*)div, "<form id=\"fid\"><textarea id=\"ta\"></textarea></form>");
elem = get_elem_by_id(doc, "ta", TRUE);
if(elem) {