mshtml: Added IHTMLObjectElement::name property implementation.

This commit is contained in:
Jacek Caban 2012-11-07 12:55:28 +01:00 committed by Alexandre Julliard
parent a56c5b185e
commit 1017c2b3ee
2 changed files with 55 additions and 5 deletions

View File

@ -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)

View File

@ -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);
}