Jacek Caban : mshtml/tests: Added text selection type tests.

Alexandre Julliard julliard at winehq.org
Wed Jan 25 13:18:53 CST 2017


Module: wine
Branch: master
Commit: f5f4765aab12f24a72e1cf28149b7955e19b95c4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f5f4765aab12f24a72e1cf28149b7955e19b95c4

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jan 25 18:12:45 2017 +0100

mshtml/tests: Added text selection type tests.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/tests/dom.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 8e8a662..e784189 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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)
 static void _insert_adjacent_elem(unsigned line, IHTMLElement *parent, const char *where, IHTMLElement *elem)
 {
@@ -5702,6 +5720,11 @@ static void test_txtrange(IHTMLDocument2 *doc)
 
     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(range2);
     IHTMLTxtRange_Release(body_range);
@@ -6281,17 +6304,13 @@ static void test_default_selection(IHTMLDocument2 *doc)
     IHTMLSelectionObject *selection;
     IHTMLTxtRange *range;
     IDispatch *disp;
-    BSTR str;
     HRESULT hres;
 
+    test_doc_selection_type(doc, "None");
+
     hres = IHTMLDocument2_get_selection(doc, &selection);
     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);
     IHTMLSelectionObject_Release(selection);
     ok(hres == S_OK, "createRange failed: %08x\n", hres);




More information about the wine-cvs mailing list