Alistair Leslie-Hughes : mshtml: Implement IHTMLImgElement get_Name.
Alexandre Julliard
julliard at winehq.org
Tue Dec 15 09:40:20 CST 2009
Module: wine
Branch: master
Commit: 020c75b0fefaf4f24223653d459d689e4299e6cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=020c75b0fefaf4f24223653d459d689e4299e6cc
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Sun Dec 13 21:15:28 2009 +1100
mshtml: Implement IHTMLImgElement get_Name.
---
dlls/mshtml/htmlimg.c | 20 ++++++++++++++++++--
dlls/mshtml/tests/dom.c | 17 ++++++++++++++++-
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 60333c6..87fe498 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -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)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 6f1a064..10d802a 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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);
}
More information about the wine-cvs
mailing list