Nikolay Sivov : riched20: Added GetStoryType().

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 29 05:29:48 CDT 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu May 28 09:59:02 2015 +0300

riched20: Added GetStoryType().

---

 dlls/riched20/riched_tom.idl  |  2 ++
 dlls/riched20/richole.c       | 24 +++++++++++++-----
 dlls/riched20/tests/richole.c | 57 +++++++++++++++++++++++++++++++++++++++++++
 include/tom.idl               |  2 ++
 4 files changed, 79 insertions(+), 6 deletions(-)

diff --git a/dlls/riched20/riched_tom.idl b/dlls/riched20/riched_tom.idl
index 7aab8bb..cd03339 100644
--- a/dlls/riched20/riched_tom.idl
+++ b/dlls/riched20/riched_tom.idl
@@ -147,6 +147,8 @@ typedef enum tagTomConstants
     tomMatchWord    = 2,
     tomMatchCase    = 4,
     tomMatchPattern = 8,
+
+    /* ITextRange story type values */
     tomUnknownStory         = 0,
     tomMainTextStory        = 1,
     tomFootnotesStory       = 2,
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 5b0c7fc..e35f561 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -1683,14 +1683,20 @@ static HRESULT WINAPI ITextRange_fnGetStoryLength(ITextRange *me, LONG *pcch)
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI ITextRange_fnGetStoryType(ITextRange *me, LONG *pValue)
+static HRESULT WINAPI ITextRange_fnGetStoryType(ITextRange *me, LONG *value)
 {
     ITextRangeImpl *This = impl_from_ITextRange(me);
+
+    TRACE("(%p)->(%p)\n", This, value);
+
     if (!This->reOle)
         return CO_E_RELEASED;
 
-    FIXME("not implemented %p\n", This);
-    return E_NOTIMPL;
+    if (!value)
+        return E_INVALIDARG;
+
+    *value = tomUnknownStory;
+    return S_OK;
 }
 
 static HRESULT range_Collapse(LONG bStart, LONG *start, LONG *end)
@@ -4125,14 +4131,20 @@ static HRESULT WINAPI ITextSelection_fnGetStoryLength(ITextSelection *me, LONG *
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pValue)
+static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *value)
 {
     ITextSelectionImpl *This = impl_from_ITextSelection(me);
+
+    TRACE("(%p)->(%p)\n", This, value);
+
     if (!This->reOle)
         return CO_E_RELEASED;
 
-    FIXME("not implemented\n");
-    return E_NOTIMPL;
+    if (!value)
+        return E_INVALIDARG;
+
+    *value = tomUnknownStory;
+    return S_OK;
 }
 
 static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index f2ad6e2..35fd59c 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -2867,6 +2867,62 @@ static void test_Select(void)
   ITextSelection_Release(selection);
 }
 
+static void test_GetStoryType(void)
+{
+  static const CHAR test_text1[] = "TestSomeText";
+  IRichEditOle *reOle = NULL;
+  ITextDocument *doc = NULL;
+  ITextSelection *selection;
+  ITextRange *range;
+  LONG value;
+  HRESULT hr;
+  HWND hwnd;
+
+  create_interfaces(&hwnd, &reOle, &doc, &selection);
+  SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
+  SendMessageA(hwnd, EM_SETSEL, 1, 2);
+
+  hr = ITextDocument_Range(doc, 0, 4, &range);
+  ok(hr == S_OK, "got 0x%08x\n", hr);
+
+  hr = ITextRange_GetStoryType(range, NULL);
+  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+  value = tomTextFrameStory;
+  hr = ITextRange_GetStoryType(range, &value);
+  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(value == tomUnknownStory, "got %d\n", value);
+
+  hr = ITextSelection_GetStoryType(selection, NULL);
+  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+  value = tomTextFrameStory;
+  hr = ITextSelection_GetStoryType(selection, &value);
+  ok(hr == S_OK, "got 0x%08x\n", hr);
+  ok(value == tomUnknownStory, "got %d\n", value);
+
+  release_interfaces(&hwnd, &reOle, &doc, NULL);
+
+  hr = ITextRange_GetStoryType(range, NULL);
+  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+  value = 123;
+  hr = ITextRange_GetStoryType(range, &value);
+  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(value == 123, "got %d\n", value);
+
+  hr = ITextSelection_GetStoryType(selection, NULL);
+  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+  value = 123;
+  hr = ITextSelection_GetStoryType(selection, &value);
+  ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+  ok(value == 123, "got %d\n", value);
+
+  ITextRange_Release(range);
+  ITextSelection_Release(selection);
+}
+
 START_TEST(richole)
 {
   /* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -2897,4 +2953,5 @@ START_TEST(richole)
   test_InRange();
   test_ITextRange_IsEqual();
   test_Select();
+  test_GetStoryType();
 }
diff --git a/include/tom.idl b/include/tom.idl
index 245a41b..64209b3 100644
--- a/include/tom.idl
+++ b/include/tom.idl
@@ -134,6 +134,8 @@ typedef enum tagTomConstants
     tomMatchWord    = 2,
     tomMatchCase    = 4,
     tomMatchPattern = 8,
+
+    /* ITextRange story type values */
     tomUnknownStory         = 0,
     tomMainTextStory        = 1,
     tomFootnotesStory       = 2,




More information about the wine-cvs mailing list