riched20: Implement Select().

This commit is contained in:
Nikolay Sivov 2015-05-27 02:36:49 +03:00 committed by Alexandre Julliard
parent 6ccfde327a
commit cb095a82a2
2 changed files with 55 additions and 4 deletions

View File

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

View File

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