mshtml: Added IHTMLInputElement::put_name implementation.

This commit is contained in:
Jacek Caban 2010-05-07 15:21:41 +02:00 committed by Alexandre Julliard
parent 1fdbc87e55
commit f00d44f0f6
2 changed files with 50 additions and 8 deletions

View File

@ -196,8 +196,20 @@ static HRESULT WINAPI HTMLInputElement_get_value(IHTMLInputElement *iface, BSTR
static HRESULT WINAPI HTMLInputElement_put_name(IHTMLInputElement *iface, BSTR v)
{
HTMLInputElement *This = HTMLINPUT_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsAString name_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&name_str, v);
nsres = nsIDOMHTMLInputElement_SetName(This->nsinput, &name_str);
nsAString_Finish(&name_str);
if(NS_FAILED(nsres)) {
ERR("SetName failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *p)
@ -206,6 +218,7 @@ static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *
nsAString name_str;
const PRUnichar *name;
nsresult nsres;
HRESULT hres = S_OK;
TRACE("(%p)->(%p)\n", This, p);
@ -214,16 +227,14 @@ static HRESULT WINAPI HTMLInputElement_get_name(IHTMLInputElement *iface, BSTR *
nsres = nsIDOMHTMLInputElement_GetName(This->nsinput, &name_str);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&name_str, &name);
*p = SysAllocString(name);
*p = *name ? SysAllocString(name) : NULL;
}else {
ERR("GetName failed: %08x\n", nsres);
return E_FAIL;
hres = E_FAIL;
}
nsAString_Finish(&name_str);
TRACE("name=%s\n", debugstr_w(*p));
return S_OK;
return hres;
}
static HRESULT WINAPI HTMLInputElement_put_status(IHTMLInputElement *iface, VARIANT_BOOL v)

View File

@ -2029,10 +2029,10 @@ static void _test_img_name(unsigned line, IUnknown *unk, const char *pValue)
hres = IHTMLImgElement_get_name(img, &sName);
ok_(__FILE__,line) (hres == S_OK, "get_Name failed: %08x\n", hres);
ok_(__FILE__,line) (!strcmp_wa (sName, pValue), "expected '%s' got '%s'\n", pValue, wine_dbgstr_w(sName));
IHTMLImgElement_Release(img);
SysFreeString(sName);
}
#define test_input_type(i,t) _test_input_type(__LINE__,i,t)
static void _test_input_type(unsigned line, IHTMLInputElement *input, const char *extype)
{
@ -2045,6 +2045,34 @@ static void _test_input_type(unsigned line, IHTMLInputElement *input, const char
SysFreeString(type);
}
#define test_input_name(u, c) _test_input_name(__LINE__,u, c)
static void _test_input_name(unsigned line, IHTMLInputElement *input, const char *exname)
{
BSTR name = (BSTR)0xdeadbeef;
HRESULT hres;
hres = IHTMLInputElement_get_name(input, &name);
ok_(__FILE__,line) (hres == S_OK, "get_name failed: %08x\n", hres);
if(exname)
ok_(__FILE__,line) (!strcmp_wa (name, exname), "name=%s, expected %s\n", wine_dbgstr_w(name), exname);
else
ok_(__FILE__,line) (!name, "name=%p, expected NULL\n", name);
SysFreeString(name);
}
#define test_input_set_name(u, c) _test_input_set_name(__LINE__,u, c)
static void _test_input_set_name(unsigned line, IHTMLInputElement *input, const char *name)
{
BSTR tmp = a2bstr(name);
HRESULT hres;
hres = IHTMLInputElement_put_name(input, tmp);
ok_(__FILE__,line) (hres == S_OK, "put_name failed: %08x\n", hres);
SysFreeString(tmp);
_test_input_name(line, input, name);
}
#define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b)
static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VARIANT_BOOL exb)
{
@ -5734,6 +5762,9 @@ static void test_elems(IHTMLDocument2 *doc)
test_input_set_checked(input, VARIANT_TRUE);
test_input_set_checked(input, VARIANT_FALSE);
test_input_name(input, NULL);
test_input_set_name(input, "test");
test_input_src(input, NULL);
test_input_set_src(input, "about:blank");