From 29be901376cb0f0673d4fd7d64372425b6ae4352 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 12 Sep 2007 23:37:33 +0200 Subject: [PATCH] mshtml: Added IHTMLTxtRange::put_text tests. --- dlls/mshtml/tests/dom.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 2a8a522415d..a264d72bba1 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -166,6 +166,16 @@ static void _test_range_moveend(unsigned line, IHTMLTxtRange *range, LPWSTR unit ok_(__FILE__,line) (c == excnt, "count=%ld, expected %ld\n", c, excnt); } +#define test_range_put_text(r,t) _test_range_put_text(__LINE__,r,t) +static void _test_range_put_text(unsigned line, IHTMLTxtRange *range, LPCWSTR text) +{ + HRESULT hres; + + hres = IHTMLTxtRange_put_text(range, (BSTR)text); + ok_(__FILE__,line) (hres == S_OK, "put_text failed: %08x\n", hres); + _test_range_text(line, range, NULL); +} + #define test_range_inrange(r1,r2,b) _test_range_inrange(__LINE__,r1,r2,b) static void _test_range_inrange(unsigned line, IHTMLTxtRange *range1, IHTMLTxtRange *range2, VARIANT_BOOL exb) { @@ -268,6 +278,8 @@ static void test_txtrange(IHTMLDocument2 *doc) test_range_moveend(range, characterW, 2, 2); test_range_text(range, "123\r\ni"); + IHTMLTxtRange_Release(range); + hres = IHTMLTxtRange_duplicate(body_range, &range); ok(hres == S_OK, "duplicate failed: %08x\n", hres); @@ -318,6 +330,16 @@ static void test_txtrange(IHTMLDocument2 *doc) test_range_moveend(range, characterW, 3, 2); test_range_text(range, "t"); + IHTMLTxtRange_Release(range); + + hres = IHTMLTxtRange_duplicate(body_range, &range); + ok(hres == S_OK, "duplicate failed: %08x\n", hres); + + test_range_collapse(range, TRUE); + test_range_expand(range, wordW, VARIANT_TRUE, "test "); + test_range_put_text(range, wordW); + test_range_text(body_range, "wordabc 123\r\nit's text"); + IHTMLTxtRange_Release(range); IHTMLTxtRange_Release(body_range); }