mshtml: Added IHTMLAnchorElement::name implementation.
This commit is contained in:
parent
4c96957fc6
commit
e140cd338d
|
@ -314,15 +314,32 @@ static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, B
|
|||
static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
|
||||
{
|
||||
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(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 = nsIDOMHTMLAnchorElement_SetName(This->nsanchor, &nsstr);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLAnchorElement *This = impl_from_IHTMLAnchorElement(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 = nsIDOMHTMLAnchorElement_GetName(This->nsanchor, &name_str);
|
||||
|
||||
return return_nsstr(nsres, &name_str, p);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
|
||||
|
|
|
@ -1296,6 +1296,37 @@ static void _test_anchor_put_target(unsigned line, IUnknown *unk, const char *ta
|
|||
SysFreeString(str);
|
||||
}
|
||||
|
||||
#define test_anchor_name(a,h) _test_anchor_name(__LINE__,a,h)
|
||||
static void _test_anchor_name(unsigned line, IUnknown *unk, const char *name)
|
||||
{
|
||||
IHTMLAnchorElement *anchor = _get_anchor_iface(line, unk);
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLAnchorElement_get_name(anchor, &str);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres);
|
||||
if(name)
|
||||
ok_(__FILE__,line)(!strcmp_wa(str, name), "name = %s, expected %s\n", wine_dbgstr_w(str), name);
|
||||
else
|
||||
ok_(__FILE__,line)(str == NULL, "name = %s, expected NULL\n", wine_dbgstr_w(str));
|
||||
SysFreeString(str);
|
||||
}
|
||||
|
||||
#define test_anchor_put_name(a,h) _test_anchor_put_name(__LINE__,a,h)
|
||||
static void _test_anchor_put_name(unsigned line, IUnknown *unk, const char *name)
|
||||
{
|
||||
IHTMLAnchorElement *anchor = _get_anchor_iface(line, unk);
|
||||
BSTR str;
|
||||
HRESULT hres;
|
||||
|
||||
str = name ? a2bstr(name) : NULL;
|
||||
hres = IHTMLAnchorElement_put_name(anchor, str);
|
||||
ok_(__FILE__,line)(hres == S_OK, "put_name failed: %08x\n", hres);
|
||||
SysFreeString(str);
|
||||
|
||||
_test_anchor_name(line, unk, name);
|
||||
}
|
||||
|
||||
|
||||
#define test_option_text(o,t) _test_option_text(__LINE__,o,t)
|
||||
static void _test_option_text(unsigned line, IHTMLOptionElement *option, const char *text)
|
||||
|
@ -5408,6 +5439,11 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
test_anchor_put_target((IUnknown*)elem, NULL);
|
||||
test_anchor_get_target((IUnknown*)elem, NULL);
|
||||
|
||||
test_anchor_name((IUnknown*)elem, "x");
|
||||
test_anchor_put_name((IUnknown*)elem, "anchor name");
|
||||
test_anchor_put_name((IUnknown*)elem, NULL);
|
||||
test_anchor_put_name((IUnknown*)elem, "x");
|
||||
|
||||
IHTMLElement_Release(elem);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue