riched20: Added GetStoryType().

This commit is contained in:
Nikolay Sivov 2015-05-28 09:59:02 +03:00 committed by Alexandre Julliard
parent b4959154ca
commit d178e7ba68
4 changed files with 79 additions and 6 deletions

View File

@ -147,6 +147,8 @@ typedef enum tagTomConstants
tomMatchWord = 2,
tomMatchCase = 4,
tomMatchPattern = 8,
/* ITextRange story type values */
tomUnknownStory = 0,
tomMainTextStory = 1,
tomFootnotesStory = 2,

View File

@ -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)

View File

@ -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();
}

View File

@ -134,6 +134,8 @@ typedef enum tagTomConstants
tomMatchWord = 2,
tomMatchCase = 4,
tomMatchPattern = 8,
/* ITextRange story type values */
tomUnknownStory = 0,
tomMainTextStory = 1,
tomFootnotesStory = 2,