From e53964c35b8005bf77f9088276604e7b47fdf475 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:38:50 +0800
Subject: riched20: Implement ITextRange::GetStoryLength.

---
 dlls/riched20/tests/richole.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index ae087b7..55d27d4 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3636,6 +3636,37 @@ static void test_ITextRange_IsEqual2(void)
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 }
 
+static void test_ITextRange_GetStoryLength(void)
+{
+  HWND w;
+  IRichEditOle *reOle = NULL;
+  ITextDocument *txtDoc = NULL;
+  ITextRange *txtRge = NULL;
+  HRESULT hres;
+  LONG count;
+  static const CHAR test_text1[] = "TestSomeText";
+  int len = strlen(test_text1) + 1;
+
+  create_interfaces(&w, &reOle, &txtDoc, NULL);
+  SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+  ITextDocument_Range(txtDoc, 0, 0, &txtRge);
+
+  hres = ITextRange_GetStoryLength(txtRge, &count);
+  ok(hres == S_OK, "ITextRange_GetStoryLength\n");
+  ok(count == len, "got wrong length: %d\n", count);
+
+  ITextRange_SetRange(txtRge, 1, 2);
+  hres = ITextRange_GetStoryLength(txtRge, &count);
+  ok(hres == S_OK, "ITextRange_GetStoryLength\n");
+  ok(count == len, "got wrong length: %d\n", count);
+
+  hres = ITextRange_GetStoryLength(txtRge, NULL);
+  ok(hres == E_INVALIDARG, "ITextRange_GetStoryLength\n");
+
+  ITextRange_Release(txtRge);
+  release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
 START_TEST(richole)
 {
   /* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3664,6 +3695,7 @@ START_TEST(richole)
   test_ITextRange_GetText();
   test_ITextRange_SetRange();
   test_ITextRange_IsEqual2();
+  test_ITextRange_GetStoryLength();
   test_GetClientSite();
   test_IOleWindow_GetWindow();
   test_IOleInPlaceSite_GetWindow();
-- 
2.4.2

