Commit f5f4765a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml/tests: Added text selection type tests.

parent af8e6ee6
...@@ -5378,6 +5378,24 @@ static void test_create_img_elem(IHTMLDocument2 *doc) ...@@ -5378,6 +5378,24 @@ static void test_create_img_elem(IHTMLDocument2 *doc)
} }
} }
#define test_doc_selection_type(a,b) _test_doc_selection_type(__LINE__,a,b)
static void _test_doc_selection_type(unsigned line, IHTMLDocument2 *doc, const char *type)
{
IHTMLSelectionObject *selection;
BSTR str;
HRESULT hres;
hres = IHTMLDocument2_get_selection(doc, &selection);
ok_(__FILE__,line)(hres == S_OK, "get_selection failed: %08x\n", hres);
hres = IHTMLSelectionObject_get_type(selection, &str);
ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08x\n", hres);
ok_(__FILE__,line)(!strcmp_wa(str, type), "type = %s, expected %s\n", wine_dbgstr_w(str), type);
SysFreeString(str);
IHTMLSelectionObject_Release(selection);
}
#define insert_adjacent_elem(a,b,c) _insert_adjacent_elem(__LINE__,a,b,c) #define insert_adjacent_elem(a,b,c) _insert_adjacent_elem(__LINE__,a,b,c)
static void _insert_adjacent_elem(unsigned line, IHTMLElement *parent, const char *where, IHTMLElement *elem) static void _insert_adjacent_elem(unsigned line, IHTMLElement *parent, const char *where, IHTMLElement *elem)
{ {
...@@ -5702,6 +5720,11 @@ static void test_txtrange(IHTMLDocument2 *doc) ...@@ -5702,6 +5720,11 @@ static void test_txtrange(IHTMLDocument2 *doc)
test_range_set_end_point(range, "xxx", body_range, E_INVALIDARG); test_range_set_end_point(range, "xxx", body_range, E_INVALIDARG);
hres = IHTMLTxtRange_select(range);
ok(hres == S_OK, "select failed: %08x\n", hres);
test_doc_selection_type(doc, "Text");
IHTMLTxtRange_Release(range); IHTMLTxtRange_Release(range);
IHTMLTxtRange_Release(range2); IHTMLTxtRange_Release(range2);
IHTMLTxtRange_Release(body_range); IHTMLTxtRange_Release(body_range);
...@@ -6281,17 +6304,13 @@ static void test_default_selection(IHTMLDocument2 *doc) ...@@ -6281,17 +6304,13 @@ static void test_default_selection(IHTMLDocument2 *doc)
IHTMLSelectionObject *selection; IHTMLSelectionObject *selection;
IHTMLTxtRange *range; IHTMLTxtRange *range;
IDispatch *disp; IDispatch *disp;
BSTR str;
HRESULT hres; HRESULT hres;
test_doc_selection_type(doc, "None");
hres = IHTMLDocument2_get_selection(doc, &selection); hres = IHTMLDocument2_get_selection(doc, &selection);
ok(hres == S_OK, "get_selection failed: %08x\n", hres); ok(hres == S_OK, "get_selection failed: %08x\n", hres);
hres = IHTMLSelectionObject_get_type(selection, &str);
ok(hres == S_OK, "get_type failed: %08x\n", hres);
ok(!strcmp_wa(str, "None"), "type = %s\n", wine_dbgstr_w(str));
SysFreeString(str);
hres = IHTMLSelectionObject_createRange(selection, &disp); hres = IHTMLSelectionObject_createRange(selection, &disp);
IHTMLSelectionObject_Release(selection); IHTMLSelectionObject_Release(selection);
ok(hres == S_OK, "createRange failed: %08x\n", hres); ok(hres == S_OK, "createRange failed: %08x\n", hres);
......
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