Nikolay Sivov : riched20: Implement Select().
Alexandre Julliard
julliard at wine.codeweavers.com
Thu May 28 08:45:59 CDT 2015
Module: wine
Branch: master
Commit: cb095a82a25b3b296227de5c3e3de588d801d1ec
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cb095a82a25b3b296227de5c3e3de588d801d1ec
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed May 27 02:36:49 2015 +0300
riched20: Implement Select().
---
dlls/riched20/richole.c | 14 ++++++++++----
dlls/riched20/tests/richole.c | 45 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index db002a9..e25f2ea 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -1825,11 +1825,14 @@ static HRESULT WINAPI ITextRange_fnIsEqual(ITextRange *me, ITextRange *range, LO
static HRESULT WINAPI ITextRange_fnSelect(ITextRange *me)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
+
+ TRACE("(%p)\n", This);
+
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented %p\n", This);
- return E_NOTIMPL;
+ ME_SetSelection(This->reOle->editor, This->start, This->end);
+ return S_OK;
}
static HRESULT WINAPI ITextRange_fnStartOf(ITextRange *me, LONG Unit, LONG Extend,
@@ -4240,11 +4243,14 @@ static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *r
static HRESULT WINAPI ITextSelection_fnSelect(ITextSelection *me)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
+
+ TRACE("(%p)\n", This);
+
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented\n");
- return E_NOTIMPL;
+ /* nothing to do */
+ return S_OK;
}
static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG Unit, LONG Extend,
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index f4bf6f9..33a433a 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -2746,6 +2746,50 @@ static void test_ITextRange_IsEqual(void)
ITextSelection_Release(selection);
}
+static void test_Select(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_Select(range);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ value = 1;
+ hr = ITextSelection_GetStart(selection, &value);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(value == 0, "got %d\n", value);
+
+ hr = ITextRange_Select(range);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = ITextSelection_Select(selection);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ release_interfaces(&hwnd, &reOle, &doc, NULL);
+
+ hr = ITextRange_Select(range);
+ ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+ hr = ITextSelection_Select(selection);
+ ok(hr == CO_E_RELEASED, "got 0x%08x\n", hr);
+
+ ITextRange_Release(range);
+ ITextSelection_Release(selection);
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -2775,4 +2819,5 @@ START_TEST(richole)
test_SetText();
test_InRange();
test_ITextRange_IsEqual();
+ test_Select();
}
More information about the wine-cvs
mailing list