Nikolay Sivov : riched20: Implement GetPara() for selection range.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu May 28 08:45:59 CDT 2015
Module: wine
Branch: master
Commit: c1ce95dc961a16b8640151e856b92dbb36a52c28
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c1ce95dc961a16b8640151e856b92dbb36a52c28
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed May 27 01:42:04 2015 +0300
riched20: Implement GetPara() for selection range.
---
dlls/riched20/richole.c | 9 +++++++--
dlls/riched20/tests/richole.c | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 14c4c8e..4d4ca89 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -4031,11 +4031,16 @@ static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *pF
static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **para)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
+
+ TRACE("(%p)->(%p)\n", This, para);
+
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented\n");
- return E_NOTIMPL;
+ if (!para)
+ return E_INVALIDARG;
+
+ return create_textpara((ITextRange*)me, para);
}
static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *pPara)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 7d90a98..0e08758 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1650,12 +1650,13 @@ static void test_GetPara(void)
static const CHAR test_text1[] = "TestSomeText";
IRichEditOle *reOle = NULL;
ITextDocument *doc = NULL;
+ ITextSelection *selection;
ITextRange *range = NULL;
ITextPara *para, *para2;
HRESULT hr;
HWND hwnd;
- create_interfaces(&hwnd, &reOle, &doc, NULL);
+ create_interfaces(&hwnd, &reOle, &doc, &selection);
SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text1);
EXPECT_REF(reOle, 3);
@@ -1691,8 +1692,41 @@ static void test_GetPara(void)
ITextPara_Release(para);
ITextPara_Release(para2);
- ITextRange_Release(range);
+
+ EXPECT_REF(reOle, 3);
+ EXPECT_REF(doc, 3);
+ EXPECT_REF(selection, 2);
+
+ hr = ITextSelection_GetPara(selection, ¶);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ EXPECT_REF(reOle, 3);
+ EXPECT_REF(doc, 3);
+ EXPECT_REF(selection, 3);
+ EXPECT_REF(para, 1);
+
+ hr = ITextSelection_GetPara(selection, ¶2);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(para != para2, "got %p, %p\n", para, para2);
+
+ ITextPara_Release(para);
+ ITextPara_Release(para2);
release_interfaces(&hwnd, &reOle, &doc, NULL);
+
+ hr = ITextRange_GetPara(range, NULL);
+ ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+ hr = ITextRange_GetPara(range, ¶);
+ ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+ hr = ITextSelection_GetPara(selection, NULL);
+ ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+ hr = ITextSelection_GetPara(selection, ¶);
+ ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+ ITextSelection_Release(selection);
+ ITextRange_Release(range);
}
static void test_dispatch(void)
More information about the wine-cvs
mailing list