Commit 866880fb authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml/tests: Fix comment tests on recent IE versions.

parent aa58676a
...@@ -567,11 +567,16 @@ static const elem_type_info_t elem_type_infos[] = { ...@@ -567,11 +567,16 @@ static const elem_type_info_t elem_type_infos[] = {
{"tspan", tspan_iids, NULL} {"tspan", tspan_iids, NULL}
}; };
static int strncmp_wa(LPCWSTR strw, const char *stra, size_t len)
{
WCHAR buf[512];
size_t wlen = MultiByteToWideChar(CP_ACP, 0, stra, len, buf, sizeof(buf));
return wlen == len && memcmp(strw, buf, len * sizeof(WCHAR));
}
static int strcmp_wa(LPCWSTR strw, const char *stra) static int strcmp_wa(LPCWSTR strw, const char *stra)
{ {
CHAR buf[512]; return strncmp_wa(strw, stra, strlen(stra));
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
return lstrcmpA(stra, buf);
} }
static BOOL is_prefix_wa(const WCHAR *strw, const char *prefix) static BOOL is_prefix_wa(const WCHAR *strw, const char *prefix)
...@@ -2033,11 +2038,15 @@ static IHTMLFormElement *_get_textarea_form(unsigned line, IUnknown *unk) ...@@ -2033,11 +2038,15 @@ static IHTMLFormElement *_get_textarea_form(unsigned line, IUnknown *unk)
static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext) static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext)
{ {
IHTMLCommentElement *comment = _get_comment_iface(__LINE__,unk); IHTMLCommentElement *comment = _get_comment_iface(__LINE__,unk);
const char *p;
BSTR text; BSTR text;
HRESULT hres; HRESULT hres;
hres = IHTMLCommentElement_get_text(comment, &text); hres = IHTMLCommentElement_get_text(comment, &text);
ok_(__FILE__,line)(hres == S_OK, "get_text failed: %08x\n", hres); ok_(__FILE__,line)(hres == S_OK, "get_text failed: %08x\n", hres);
if((p = strstr(extext, "-->")) && SysStringLen(text) == p - extext) /* Some IEs drop comment ending */
ok_(__FILE__,line)(!strncmp_wa(text, extext, p - extext), "text = \"%s\", expected \"%s\"\n", wine_dbgstr_w(text), extext);
else
ok_(__FILE__,line)(!strcmp_wa(text, extext), "text = \"%s\", expected \"%s\"\n", wine_dbgstr_w(text), extext); ok_(__FILE__,line)(!strcmp_wa(text, extext), "text = \"%s\", expected \"%s\"\n", wine_dbgstr_w(text), extext);
IHTMLCommentElement_Release(comment); IHTMLCommentElement_Release(comment);
...@@ -3050,11 +3059,16 @@ static void _test_elem_set_outerhtml(unsigned line, IUnknown *unk, const char *o ...@@ -3050,11 +3059,16 @@ static void _test_elem_set_outerhtml(unsigned line, IUnknown *unk, const char *o
static void _test_elem_outerhtml(unsigned line, IUnknown *unk, const char *outer_html) static void _test_elem_outerhtml(unsigned line, IUnknown *unk, const char *outer_html)
{ {
IHTMLElement *elem = _get_elem_iface(line, unk); IHTMLElement *elem = _get_elem_iface(line, unk);
const char *p;
BSTR html; BSTR html;
HRESULT hres; HRESULT hres;
hres = IHTMLElement_get_outerHTML(elem, &html); hres = IHTMLElement_get_outerHTML(elem, &html);
ok_(__FILE__,line)(hres == S_OK, "get_outerHTML failed: %08x\n", hres); ok_(__FILE__,line)(hres == S_OK, "get_outerHTML failed: %08x\n", hres);
if((p = strstr(outer_html, "-->")) && !p[3] && SysStringLen(html) == p - outer_html) /* Some IEs drop comment ending */
ok_(__FILE__,line)(!strncmp_wa(html, outer_html, p - outer_html), "text = \"%s\", expected \"%s\"\n",
wine_dbgstr_w(html), outer_html);
else
ok_(__FILE__,line)(!strcmp_wa(html, outer_html), "outerHTML = '%s', expected '%s'\n", wine_dbgstr_w(html), outer_html); ok_(__FILE__,line)(!strcmp_wa(html, outer_html), "outerHTML = '%s', expected '%s'\n", wine_dbgstr_w(html), outer_html);
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment