From 56bf18bcf782cea24efa378eb3ec58b171083e71 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:47:14 +0800
Subject: riched20: Implement ITextSelection::GetStoryLength.

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

diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 55d27d4..854ec09 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3667,6 +3667,35 @@ static void test_ITextRange_GetStoryLength(void)
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 }
 
+static void test_ITextSelection_GetStoryLength(void)
+{
+  HWND w;
+  IRichEditOle *reOle = NULL;
+  ITextDocument *txtDoc = NULL;
+  ITextSelection *txtSel = NULL;
+  HRESULT hres;
+  LONG count;
+  static const CHAR test_text1[] = "TestSomeText";
+  int len = strlen(test_text1) + 1;
+
+  create_interfaces(&w, &reOle, &txtDoc, &txtSel);
+  SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+
+  hres = ITextSelection_GetStoryLength(txtSel, &count);
+  ok(hres == S_OK, "ITextSelection_GetStoryLength\n");
+  ok(count == len, "got wrong length: %d\n", count);
+
+  SendMessageA(w, EM_SETSEL, 1, 2);
+  hres = ITextSelection_GetStoryLength(txtSel, &count);
+  ok(hres == S_OK, "ITextSelection_GetStoryLength\n");
+  ok(count == len, "got wrong length: %d\n", count);
+
+  hres = ITextSelection_GetStoryLength(txtSel, NULL);
+  ok(hres == E_INVALIDARG, "ITextSelection_GetStoryLength\n");
+
+  release_interfaces(&w, &reOle, &txtDoc, &txtSel);
+}
+
 START_TEST(richole)
 {
   /* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3683,6 +3712,7 @@ START_TEST(richole)
   test_ITextSelection_SetEnd();
   test_ITextSelection_Collapse();
   test_ITextSelection_GetFont();
+  test_ITextSelection_GetStoryLength();
   test_ITextDocument_Range();
   test_ITextRange_GetChar();
   test_ITextRange_GetStart_GetEnd();
-- 
2.4.2

