mshtml: Added IHTMLElement::outerText tests.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-03-31 14:50:42 +02:00 committed by Alexandre Julliard
parent 7c1fa88ced
commit e35a84360c
1 changed files with 53 additions and 0 deletions

View File

@ -2804,6 +2804,44 @@ static void _test_elem_set_innertext(unsigned line, IHTMLElement *elem, const ch
}
#define test_elem_outertext(e,t) _test_elem_outertext(__LINE__,e,t)
static void _test_elem_outertext(unsigned line, IHTMLElement *elem, const char *extext)
{
BSTR text = NULL;
HRESULT hres;
hres = IHTMLElement_get_outerText(elem, &text);
ok_(__FILE__,line) (hres == S_OK, "get_outerText failed: %08x\n", hres);
if(extext)
ok_(__FILE__,line) (!strcmp_wa(text, extext), "get_outerText returned %s expected %s\n",
wine_dbgstr_w(text), extext);
else
ok_(__FILE__,line) (!text, "get_outerText returned %s expected NULL\n", wine_dbgstr_w(text));
SysFreeString(text);
}
#define test_elem_set_outertext(e,t) _test_elem_set_outertext(__LINE__,e,t)
static void _test_elem_set_outertext(unsigned line, IHTMLElement *elem, const char *text)
{
BSTR str = a2bstr(text);
HRESULT hres;
hres = IHTMLElement_put_outerText(elem, str);
ok_(__FILE__,line) (hres == S_OK, "put_outerText failed: %08x\n", hres);
SysFreeString(str);
}
#define test_elem_set_outertext_fail(a) _test_elem_set_outertext_fail(__LINE__,a)
static void _test_elem_set_outertext_fail(unsigned line, IHTMLElement *elem)
{
BSTR str = a2bstr("test");
HRESULT hres;
hres = IHTMLElement_put_outerText(elem, str);
ok_(__FILE__,line) (hres == 0x800a0258, "put_outerText failed: %08x\n", hres);
SysFreeString(str);
}
#define test_elem_innerhtml(e,t) _test_elem_innerhtml(__LINE__,e,t)
static void _test_elem_innerhtml(unsigned line, IUnknown *unk, const char *inner_html)
{
@ -6315,6 +6353,7 @@ static void test_doc_elem(IHTMLDocument2 *doc)
test_node_name((IUnknown*)elem, "HTML");
test_elem_tag((IUnknown*)elem, "HTML");
todo_wine test_elem_set_outertext_fail(elem);
doc_node = get_doc_node(doc);
owner_doc = get_owner_doc((IUnknown*)elem);
@ -6727,6 +6766,8 @@ static void test_defaults(IHTMLDocument2 *doc)
test_body_funs(body);
IHTMLBodyElement_Release(body);
test_elem_set_outertext_fail(elem);
test_elem_istextedit(elem, VARIANT_TRUE);
hres = IHTMLElement_get_style(elem, &style);
@ -8911,6 +8952,18 @@ static void test_elems2(IHTMLDocument2 *doc)
IHTMLElement_Release(elem2);
}
test_elem_set_innerhtml((IUnknown*)div, "<div id=\"elemid\">test</div>");
elem = get_elem_by_id(doc, "elemid", TRUE);
if(elem) {
test_elem_outertext(elem, "test");
test_elem_set_outertext(elem, "outer text");
test_elem_outertext(elem, NULL);
test_elem_all((IUnknown*)div, NULL, 0);
elem2 = test_elem_get_parent((IUnknown*)elem);
ok(!elem2, "parent != NULL\n");
IHTMLElement_Release(elem);
}
test_attr(doc, div);
test_blocked(doc, div);
test_elem_names(doc);