mshtml: Added IHTMLFormElement_{get/put}_name implementation.

This commit is contained in:
Piotr Caban 2010-10-28 00:30:33 +02:00 committed by Alexandre Julliard
parent bd94cc3b86
commit 990675e52f
2 changed files with 66 additions and 4 deletions

View File

@ -272,15 +272,44 @@ static HRESULT WINAPI HTMLFormElement_get_target(IHTMLFormElement *iface, BSTR *
static HRESULT WINAPI HTMLFormElement_put_name(IHTMLFormElement *iface, BSTR v)
{
HTMLFormElement *This = HTMLFORM_THIS(iface);
FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
return E_NOTIMPL;
nsAString name_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
nsAString_InitDepend(&name_str, v);
nsres = nsIDOMHTMLFormElement_SetName(This->nsform, &name_str);
nsAString_Finish(&name_str);
if(NS_FAILED(nsres))
return E_FAIL;
return S_OK;
}
static HRESULT WINAPI HTMLFormElement_get_name(IHTMLFormElement *iface, BSTR *p)
{
HTMLFormElement *This = HTMLFORM_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString name_str;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&name_str, NULL);
nsres = nsIDOMHTMLFormElement_GetName(This->nsform, &name_str);
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *name;
nsAString_GetData(&name_str, &name);
if(*name) {
*p = SysAllocString(name);
if(!*p)
return E_OUTOFMEMORY;
}else
*p = NULL;
}else
return E_FAIL;
return S_OK;
}
static HRESULT WINAPI HTMLFormElement_put_onsubmit(IHTMLFormElement *iface, VARIANT v)

View File

@ -2629,6 +2629,39 @@ static void _test_form_put_method(unsigned line, IUnknown *unk, HRESULT exp_hres
_test_form_method(line, unk, method);
}
#define test_form_name(f,a) _test_form_name(__LINE__,f,a)
static void _test_form_name(unsigned line, IUnknown *unk, const char *ex)
{
IHTMLFormElement *form = _get_form_iface(line, unk);
BSTR name = (void*)0xdeadbeef;
HRESULT hres;
hres = IHTMLFormElement_get_name(form, &name);
ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres);
if(ex)
ok_(__FILE__,line)(!strcmp_wa(name, ex), "name=%s, expected %s\n", wine_dbgstr_w(name), ex);
else
ok_(__FILE__,line)(!name, "name=%p\n", name);
SysFreeString(name);
IHTMLFormElement_Release(form);
}
#define test_form_put_name(f,a) _test_form_put_name(__LINE__,f,a)
static void _test_form_put_name(unsigned line, IUnknown *unk, const char *name)
{
IHTMLFormElement *form = _get_form_iface(line, unk);
BSTR tmp = a2bstr(name);
HRESULT hres;
hres = IHTMLFormElement_put_name(form, tmp);
ok_(__FILE__,line)(hres == S_OK, "put_name failed: %08x\n", hres);
SysFreeString(tmp);
IHTMLFormElement_Release(form);
_test_form_name(line, unk, name);
}
#define get_elem_doc(e) _get_elem_doc(__LINE__,e)
static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk)
{