Commit 1017c2b3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLObjectElement::name property implementation.

parent a56c5b18
......@@ -162,15 +162,28 @@ static HRESULT WINAPI HTMLObjectElement_get_align(IHTMLObjectElement *iface, BST
static HRESULT WINAPI HTMLObjectElement_put_name(IHTMLObjectElement *iface, BSTR v)
{
HTMLObjectElement *This = impl_from_IHTMLObjectElement(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 = nsIDOMHTMLObjectElement_SetName(This->nsobject, &nsstr);
nsAString_Finish(&nsstr);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
}
static HRESULT WINAPI HTMLObjectElement_get_name(IHTMLObjectElement *iface, BSTR *p)
{
HTMLObjectElement *This = impl_from_IHTMLObjectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString nsstr;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&nsstr, NULL);
nsres = nsIDOMHTMLObjectElement_GetName(This->nsobject, &nsstr);
return return_nsstr(nsres, &nsstr, p);
}
static HRESULT WINAPI HTMLObjectElement_put_codeBase(IHTMLObjectElement *iface, BSTR v)
......
......@@ -56,7 +56,7 @@ static const char elem_test_str[] =
"<textarea id=\"X\">text text</textarea>"
"<table id=\"tbl\"><tbody><tr></tr><tr id=\"row2\"><td>td1 text</td><td>td2 text</td></tr></tbody></table>"
"<script id=\"sc\" type=\"text/javascript\"><!--\nfunction Testing() {}\n// -->\n</script>"
"<test /><object id=\"objid\" vspace=100></object><embed />"
"<test /><object id=\"objid\" name=\"objname\" vspace=100></object><embed />"
"<img id=\"imgid\" name=\"WineImg\"/>"
"<iframe src=\"about:blank\" id=\"ifr\"></iframe>"
"<form id=\"frm\"></form>"
......@@ -1573,6 +1573,40 @@ static void _test_object_vspace(unsigned line, IUnknown *unk, LONG exl)
IHTMLObjectElement_Release(object);
}
#define test_object_name(a,b) _test_object_name(__LINE__,a,b)
static void _test_object_name(unsigned line, IHTMLElement *elem, const char *exname)
{
IHTMLObjectElement *object = _get_object_iface(line, (IUnknown*)elem);
BSTR str;
HRESULT hres;
str = (void*)0xdeadbeef;
hres = IHTMLObjectElement_get_name(object, &str);
ok_(__FILE__,line)(hres == S_OK, "get_name failed: %08x\n", hres);
if(exname)
ok_(__FILE__,line)(!strcmp_wa(str, exname), "name=%s, expected %s\n", wine_dbgstr_w(str), exname);
else
ok_(__FILE__,line)(!str, "name=%s, expected NULL\n", wine_dbgstr_w(str));
SysFreeString(str);
IHTMLObjectElement_Release(object);
}
#define set_object_name(a,b) _set_object_name(__LINE__,a,b)
static void _set_object_name(unsigned line, IHTMLElement *elem, const char *name)
{
IHTMLObjectElement *object = _get_object_iface(line, (IUnknown*)elem);
BSTR str;
HRESULT hres;
str = a2bstr(name);
hres = IHTMLObjectElement_put_name(object, str);
ok_(__FILE__,line)(hres == S_OK, "put_name failed: %08x\n", hres);
SysFreeString(str);
IHTMLObjectElement_Release(object);
_test_object_name(line, elem, name);
}
#define create_option_elem(d,t,v) _create_option_elem(__LINE__,d,t,v)
static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *doc,
const char *txt, const char *val)
......@@ -5914,6 +5948,9 @@ static void test_elems(IHTMLDocument2 *doc)
ok(elem != NULL, "elem == NULL\n");
if(elem) {
test_object_vspace((IUnknown*)elem, 100);
test_object_name(elem, "objname");
set_object_name(elem, "test");
set_object_name(elem, NULL);
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