mshtml: Implement IHTMLAnchorElement_put_href.

This commit is contained in:
Alistair Leslie-Hughes 2011-02-17 14:29:48 +11:00 committed by Alexandre Julliard
parent 15c322c235
commit df25f0d9a6
2 changed files with 35 additions and 2 deletions

View File

@ -102,8 +102,18 @@ static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID
static HRESULT WINAPI HTMLAnchorElement_put_href(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_SetHref(This->nsanchor, &nsstr);
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres))
return E_FAIL;
return S_OK;
}
static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)

View File

@ -1168,6 +1168,21 @@ static void _test_anchor_href(unsigned line, IUnknown *unk, const char *exhref)
_test_disp_value(line, unk, exhref);
}
#define test_anchor_put_href(a,h) _test_anchor_put_href(__LINE__,a,h)
static void _test_anchor_put_href(unsigned line, IUnknown *unk, const char *exhref)
{
IHTMLAnchorElement *anchor = _get_anchor_iface(line, unk);
BSTR str;
HRESULT hres;
str = a2bstr(exhref);
hres = IHTMLAnchorElement_put_href(anchor, str);
ok_(__FILE__,line)(hres == S_OK, "get_href failed: %08x\n", hres);
SysFreeString(str);
_test_disp_value(line, unk, exhref);
}
#define test_option_text(o,t) _test_option_text(__LINE__,o,t)
static void _test_option_text(unsigned line, IHTMLOptionElement *option, const char *text)
{
@ -6481,6 +6496,14 @@ static void test_elems(IHTMLDocument2 *doc)
elem = get_elem_by_id(doc, "a", TRUE);
if(elem) {
test_anchor_href((IUnknown*)elem, "http://test/");
/* Change the href */
test_anchor_put_href((IUnknown*)elem, "http://test1/");
test_anchor_href((IUnknown*)elem, "http://test1/");
/* Restore the href */
test_anchor_put_href((IUnknown*)elem, "http://test/");
test_anchor_href((IUnknown*)elem, "http://test/");
IHTMLElement_Release(elem);
}