mshtml: Added IHTMLLinkElement::type property implementation.

This commit is contained in:
Jacek Caban 2012-10-15 11:17:24 +02:00 committed by Alexandre Julliard
parent c11c695b11
commit 9277bf2e01
2 changed files with 51 additions and 4 deletions

View File

@ -161,15 +161,29 @@ static HRESULT WINAPI HTMLLinkElement_get_rev(IHTMLLinkElement *iface, BSTR *p)
static HRESULT WINAPI HTMLLinkElement_put_type(IHTMLLinkElement *iface, BSTR v)
{
HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
nsAString type_str;
nsresult nsres;
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
nsAString_InitDepend(&type_str, v);
nsres = nsIDOMHTMLLinkElement_SetType(This->nslink, &type_str);
nsAString_Finish(&type_str);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
}
static HRESULT WINAPI HTMLLinkElement_get_type(IHTMLLinkElement *iface, BSTR *p)
{
HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString type_str;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&type_str, NULL);
nsres = nsIDOMHTMLLinkElement_GetType(This->nslink, &type_str);
return return_nsstr(nsres, &type_str, p);
}
static HRESULT WINAPI HTMLLinkElement_get_readyState(IHTMLLinkElement *iface, BSTR *p)

View File

@ -3484,6 +3484,37 @@ static void _link_put_rel(unsigned line, IHTMLElement *elem, const char *v)
_test_link_rel(line, elem, v);
}
#define test_link_type(a,b) _test_link_type(__LINE__,a,b)
static void _test_link_type(unsigned line, IHTMLElement *elem, const char *v)
{
IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem);
BSTR type;
HRESULT hres;
hres = IHTMLLinkElement_get_type(link, &type);
ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08x\n", hres);
if(v)
ok_(__FILE__,line)(!strcmp_wa(type, v), "type = %s, expected %s\n", wine_dbgstr_w(type), v);
else
ok_(__FILE__,line)(!type, "type = %s, expected NULL\n", wine_dbgstr_w(type));
IHTMLLinkElement_Release(link);
}
#define link_put_type(a,b) _link_put_type(__LINE__,a,b)
static void _link_put_type(unsigned line, IHTMLElement *elem, const char *v)
{
IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem);
BSTR str = a2bstr(v);
HRESULT hres;
hres = IHTMLLinkElement_put_type(link, str);
ok_(__FILE__,line)(hres == S_OK, "put_disabled failed: %08x\n", hres);
SysFreeString(str);
IHTMLLinkElement_Release(link);
_test_link_type(line, elem, v);
}
#define get_elem_doc(e) _get_elem_doc(__LINE__,e)
static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk)
{
@ -5986,8 +6017,10 @@ static void test_elems2(IHTMLDocument2 *doc)
if(elem) {
test_link_disabled(elem, VARIANT_FALSE);
test_link_rel(elem, "stylesheet");
test_link_type(elem, "text/css");
link_put_disabled(elem, VARIANT_TRUE);
link_put_rel(elem, "prev");
link_put_type(elem, "text/plain");
IHTMLElement_Release(elem);
}