From d0f7785e04ab22908472a5ec3d8ac4543eb7b05d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 9 Feb 2010 19:35:20 +0100 Subject: [PATCH] mshtml: Forward IHTMLCommentElement::get_text to IHTMLElement::get_outerHTML. --- dlls/mshtml/htmlcomment.c | 6 ++++-- dlls/mshtml/tests/dom.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index 85fd4e175cd..7040d184077 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -103,8 +103,10 @@ static HRESULT WINAPI HTMLCommentElement_put_text(IHTMLCommentElement *iface, BS static HRESULT WINAPI HTMLCommentElement_get_text(IHTMLCommentElement *iface, BSTR *p) { HTMLCommentElement *This = HTMLCOMMENT_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return IHTMLElement_get_outerHTML(HTMLELEM(&This->element), p); } static HRESULT WINAPI HTMLCommentElement_put_atomic(IHTMLCommentElement *iface, LONG v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 7fd9262d8ae..3a008eae99b 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -684,6 +684,17 @@ static IHTMLDOMTextNode *_get_text_iface(unsigned line, IUnknown *unk) return text; } +#define get_comment_iface(u) _get_comment_iface(__LINE__,u) +static IHTMLCommentElement *_get_comment_iface(unsigned line, IUnknown *unk) +{ + IHTMLCommentElement *comment; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLCommentElement, (void**)&comment); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLCommentElement: %08x\n", hres); + return comment; +} + #define test_node_name(u,n) _test_node_name(__LINE__,u,n) static void _test_node_name(unsigned line, IUnknown *unk, const char *exname) { @@ -1102,6 +1113,22 @@ static void _test_option_put_value(unsigned line, IHTMLOptionElement *option, co _test_option_value(line, option, value); } +#define test_comment_text(c,t) _test_comment_text(__LINE__,c,t) +static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext) +{ + IHTMLCommentElement *comment = _get_comment_iface(__LINE__,unk); + BSTR text; + HRESULT hres; + + text = a2bstr(extext); + hres = IHTMLCommentElement_get_text(comment, &text); + ok_(__FILE__,line)(hres == S_OK, "get_text failed: %08x\n", hres); + ok_(__FILE__,line)(!strcmp_wa(text, extext), "text = \"%s\", expected \"%s\"\n", wine_dbgstr_w(text), extext); + + IHTMLCommentElement_Release(comment); + SysFreeString(text); +} + #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) @@ -1654,6 +1681,21 @@ static void _test_elem_set_outerhtml(unsigned line, IUnknown *unk, const char *o SysFreeString(html); } +#define test_elem_outerhtml(e,t) _test_elem_outerhtml(__LINE__,e,t) +static void _test_elem_outerhtml(unsigned line, IUnknown *unk, const char *outer_html) +{ + IHTMLElement *elem = _get_elem_iface(line, unk); + BSTR html; + HRESULT hres; + + hres = IHTMLElement_get_outerHTML(elem, &html); + ok_(__FILE__,line)(hres == S_OK, "get_outerHTML failed: %08x\n", hres); + ok_(__FILE__,line)(!strcmp_wa(html, outer_html), "outerHTML = '%s', expected '%s'\n", wine_dbgstr_w(html), outer_html); + + IHTMLElement_Release(elem); + SysFreeString(html); +} + #define get_first_child(n) _get_first_child(__LINE__,n) static IHTMLDOMNode *_get_first_child(unsigned line, IUnknown *unk) { @@ -5911,6 +5953,8 @@ static void test_create_elems(IHTMLDocument2 *doc) test_elem_title((IUnknown*)comment, NULL); test_elem_set_title((IUnknown*)comment, "comment title"); test_elem_title((IUnknown*)comment, "comment title"); + test_comment_text((IUnknown*)comment, ""); + test_elem_outerhtml((IUnknown*)comment, ""); IHTMLDOMNode_Release(comment); } -- 2.11.4.GIT