Commit 42349000 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added get_tagName implementation.

parent 9650cf9b
......@@ -279,8 +279,24 @@ static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
{
HTMLElement *This = HTMLELEM_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
const PRUnichar *tag;
nsAString tag_str;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&tag_str, NULL);
nsres = nsIDOMHTMLElement_GetTagName(This->nselem, &tag_str);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&tag_str, &tag, NULL);
*p = SysAllocString(tag);
}else {
ERR("GetTagName failed: %08x\n", nsres);
*p = NULL;
}
nsAString_Finish(&tag_str);
return S_OK;
}
static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
......
......@@ -80,11 +80,29 @@ static void _test_node_name(unsigned line, IUnknown *unk, const char *exname)
hres = IHTMLDOMNode_get_nodeName(node, &name);
IHTMLDOMNode_Release(node);
ok_(__FILE__, line) (hres == S_OK, "get_nodeName failed: %08x\n", hres);
ok_(__FILE__, line) (!strcmp_wa(name, exname), "got name: %s, expected HTML\n", dbgstr_w(name));
ok_(__FILE__, line) (!strcmp_wa(name, exname), "got name: %s, expected %s\n", dbgstr_w(name), exname);
SysFreeString(name);
}
#define test_elem_tag(u,n) _test_elem_tag(__LINE__,u,n)
static void _test_elem_tag(unsigned line, IUnknown *unk, const char *extag)
{
IHTMLElement *elem;
BSTR tag;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement, (void**)&elem);
ok_(__FILE__, line) (hres == S_OK, "QueryInterface(IID_IHTMLElement) failed: %08x\n", hres);
hres = IHTMLElement_get_tagName(elem, &tag);
IHTMLElement_Release(elem);
ok_(__FILE__, line) (hres == S_OK, "get_tagName failed: %08x\n", hres);
ok_(__FILE__, line) (!strcmp_wa(tag, extag), "got tag: %s, expected %s\n", dbgstr_w(tag), extag);
SysFreeString(tag);
}
static void test_doc_elem(IHTMLDocument2 *doc)
{
IHTMLElement *elem;
......@@ -99,6 +117,7 @@ static void test_doc_elem(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
test_node_name((IUnknown*)elem, "HTML");
test_elem_tag((IUnknown*)elem, "HTML");
IHTMLElement_Release(elem);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment