mshtml: Implement IHTMLImgElement get_Name.

This commit is contained in:
Alistair Leslie-Hughes 2009-12-13 21:15:28 +11:00 committed by Alexandre Julliard
parent cde3217268
commit 020c75b0fe
2 changed files with 34 additions and 3 deletions

View File

@ -437,8 +437,24 @@ static HRESULT WINAPI HTMLImgElement_put_name(IHTMLImgElement *iface, BSTR v)
static HRESULT WINAPI HTMLImgElement_get_name(IHTMLImgElement *iface, BSTR *p)
{
HTMLImgElement *This = HTMLIMG_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString strName;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&strName, NULL);
nsres = nsIDOMHTMLImageElement_GetName(This->nsimg, &strName);
if(NS_SUCCEEDED(nsres)) {
const PRUnichar *str;
nsAString_GetData(&strName, &str);
*p = *str ? SysAllocString(str) : NULL;
}else {
ERR("GetName failed: %08x\n", nsres);
}
nsAString_Finish(&strName);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
}
static HRESULT WINAPI HTMLImgElement_put_width(IHTMLImgElement *iface, LONG v)

View File

@ -49,7 +49,7 @@ static const char elem_test_str[] =
"<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 />"
"<img id=\"imgid\"/>"
"<img id=\"imgid\" name=\"WineImg\"/>"
"<iframe src=\"about:blank\" id=\"ifr\"></iframe>"
"<form id=\"frm\"></form>"
"</body></html>";
@ -1927,6 +1927,20 @@ static void _test_img_set_alt(unsigned line, IUnknown *unk, const char *alt)
_test_img_alt(line, unk, alt);
}
#define test_img_name(u, c) _test_img_name(__LINE__,u, c)
static void _test_img_name(unsigned line, IUnknown *unk, const char *pValue)
{
IHTMLImgElement *img = _get_img_iface(line, unk);
BSTR sName;
HRESULT hres;
hres = IHTMLImgElement_get_name(img, &sName);
ok_(__FILE__,line) (hres == S_OK, "get_Name failed: %08x\n", hres);
ok_(__FILE__,line) (!strcmp_wa (sName, pValue), "expected '%s' got '%s'\n", pValue, wine_dbgstr_w(sName));
SysFreeString(sName);
}
#define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b)
static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VARIANT_BOOL exb)
{
@ -5526,6 +5540,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_img_set_src((IUnknown*)elem, "about:blank");
test_img_alt((IUnknown*)elem, NULL);
test_img_set_alt((IUnknown*)elem, "alt test");
test_img_name((IUnknown*)elem, "WineImg");
IHTMLElement_Release(elem);
}