riched20-IText_Interface: Update patches.

This commit is contained in:
Sebastian Lackner 2014-08-23 02:15:02 +02:00
parent 0f9f7dc428
commit 11341b00f6
16 changed files with 618 additions and 15 deletions

View File

@ -559,16 +559,17 @@ quartz-MediaSeeking_Positions.ok:
# |
# | Included patches:
# | * Implement Stubs for ITextRange interface. [rev 3, by Jactry Zeng]
# | * Implement IText{Range,Selection}::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}. [by Jactry Zeng]
# | * Implement Stubs for ITextFont interface. [rev 2, by Jactry Zeng]
# | * Implement Stubs for ITextPara interface. [rev 2, by Jactry Zeng]
# | * Implement ITextRange/Selection::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}. [by Jactry Zeng]
# | * Implement ITextRange/Selection::{GetText,SetRange,IsEqual,GetStoryLength}. [by Jactry Zeng]
# |
# | This patchset fixes the following Wine bugs:
# | * [#12458] Support for ITextDocument_fnRange function
# | * [#18303] Support for ITextRange, ITextFont and ITextPara
# |
# | Modified files:
# | * dlls/riched20/richole.c, dlls/riched20/tests/richole.c
# | * dlls/riched20/richole.c, dlls/riched20/run.c, dlls/riched20/tests/richole.c
# |
.INTERMEDIATE: riched20-IText_Interface.ok
riched20-IText_Interface.ok:
@ -580,11 +581,18 @@ riched20-IText_Interface.ok:
$(call APPLY_FILE,riched20-IText_Interface/0006-riched20-Implement-IText-Selection-Range-Set-Start-E.patch)
$(call APPLY_FILE,riched20-IText_Interface/0007-riched20-Stub-for-ITextFont-interface-and-implement-.patch)
$(call APPLY_FILE,riched20-IText_Interface/0008-riched20-Stub-for-ITextPara-interface-and-implement-.patch)
$(call APPLY_FILE,riched20-IText_Interface/0009-riched20-Fix-ME_RunOfsFromCharOfs-when-nCharOfs-strl.patch)
$(call APPLY_FILE,riched20-IText_Interface/0010-riched20-Implement-ITextRange-GetText.patch)
$(call APPLY_FILE,riched20-IText_Interface/0011-riched20-Implement-ITextRange-SetRange.patch)
$(call APPLY_FILE,riched20-IText_Interface/0012-riched20-Implement-ITextRange-IsEqual.patch)
$(call APPLY_FILE,riched20-IText_Interface/0013-riched20-Implement-ITextRange-GetStoryLength.patch)
$(call APPLY_FILE,riched20-IText_Interface/0014-riched20-Implement-ITextSelection-GetStoryLength.patch)
@( \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextRange interface. [rev 3]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement IText{Range,Selection}::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextFont interface. [rev 2]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextPara interface. [rev 2]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement ITextRange/Selection::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement ITextRange/Selection::{GetText,SetRange,IsEqual,GetStoryLength}." },'; \
) > riched20-IText_Interface.ok
# Patchset server-ACL_Compat

View File

@ -1,4 +1,4 @@
From bbe2850e3277120e570c47fd3dde1e3e90dc84e3 Mon Sep 17 00:00:00 2001
From e2f7556764c4ce3647b67ed687023919b891e9b0 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 11 Aug 2014 13:29:06 +0800
Subject: riched20: Stub for ITextRange interface and implement

View File

@ -1,4 +1,4 @@
From f2671157f09140350a3dccda9dbc65890d4c0567 Mon Sep 17 00:00:00 2001
From 347be1f6538c25517c48c9ff10bd888d13d241b8 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sun, 10 Aug 2014 21:55:44 +0800
Subject: riched20: Implement ITextSelection::GetChar and ITextRange::GetChar.

View File

@ -1,4 +1,4 @@
From 9ec3f81caf3544b782cda012e7737d1784c1978b Mon Sep 17 00:00:00 2001
From 86451a53a9707a545430c25ae124cabc198fd48e Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 11 Aug 2014 10:58:26 +0800
Subject: riched20: Implement IText{Selection, Range}::Get{Start, End}.

View File

@ -1,4 +1,4 @@
From 8f98440f78071eaa1487ddb86749a9850f834811 Mon Sep 17 00:00:00 2001
From 7f4a575af2fa25ca40654127d6b499583c1e5dd9 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sun, 10 Aug 2014 20:43:41 +0800
Subject: riched20: Implement ITextRange::GetDuplicate.

View File

@ -1,4 +1,4 @@
From 3aed8c6d2529035b486cd9cb78c090b882e87db8 Mon Sep 17 00:00:00 2001
From 93048ac9d04e0002cfaefaa97e0ce276303cddb6 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sun, 10 Aug 2014 06:02:02 +0800
Subject: riched20: Implement ITextRange::Collapse and

View File

@ -1,4 +1,4 @@
From 323889ff346b8e10fa13fede8241263fb9f34c0d Mon Sep 17 00:00:00 2001
From 27bf1cd55b38e8f4a36dd18d5dedd7d29c1be409 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 8 Aug 2014 21:32:57 +0800
Subject: riched20: Implement IText{Selection, Range}::Set{Start, End}.

View File

@ -1,4 +1,4 @@
From ee362b1b02e5ca39a70c13628c7c4ca11bf09ba6 Mon Sep 17 00:00:00 2001
From fbef39fb5b1f1cad842289bb8cb16d8df51d0d2c Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 11 Aug 2014 13:51:55 +0800
Subject: riched20: Stub for ITextFont interface and implement

View File

@ -1,4 +1,4 @@
From af810f9f3a3c1ffbdc0099a2eb3088e30be3a8a3 Mon Sep 17 00:00:00 2001
From fee736f4564aadedd78a1fa8f09a6bf7caa8706c Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sun, 10 Aug 2014 22:17:57 +0800
Subject: riched20: Stub for ITextPara interface and implement

View File

@ -0,0 +1,41 @@
From 4c89684f20fd9963709307fc6419d6cbe0eacf0d Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 14:57:52 +0800
Subject: riched20: Fix ME_RunOfsFromCharOfs() when nCharOfs > strlen().
---
dlls/riched20/run.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 38d0270..ad08b82 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -181,9 +181,10 @@ void ME_RunOfsFromCharOfs(ME_TextEditor *editor,
int *pOfs)
{
ME_DisplayItem *item, *next_item;
+ int endOfs = nCharOfs, len = ME_GetTextLength(editor);
nCharOfs = max(nCharOfs, 0);
- nCharOfs = min(nCharOfs, ME_GetTextLength(editor));
+ nCharOfs = min(nCharOfs, len);
/* Find the paragraph at the offset. */
next_item = editor->pBuffer->pFirst->member.para.next_para;
@@ -206,7 +207,11 @@ void ME_RunOfsFromCharOfs(ME_TextEditor *editor,
nCharOfs -= item->member.run.nCharOfs;
if (ppRun) *ppRun = item;
- if (pOfs) *pOfs = nCharOfs;
+ if (pOfs) {
+ if (((*ppRun)->member.run.nFlags & MERF_ENDPARA) && endOfs > len)
+ *pOfs = (*ppRun)->member.run.len;
+ else *pOfs = nCharOfs;
+ }
}
/******************************************************************************
--
1.7.9.5

View File

@ -0,0 +1,148 @@
From c76f8caf18ce72f26901f4a05b0ff13b5ea38e51 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 15:40:11 +0800
Subject: riched20: Implement ITextRange::GetText.
---
dlls/riched20/richole.c | 50 ++++++++++++++++++++++++-----------------
dlls/riched20/tests/richole.c | 38 +++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 21 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 241c681..8b93aad 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -1949,14 +1949,40 @@ static HRESULT WINAPI ITextRange_fnInvoke(ITextRange *me, DISPID dispIdMember, R
return E_NOTIMPL;
}
+static HRESULT range_GetText(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, BSTR *pbstr)
+{
+ int nChars, endOfs;
+ BOOL bEOP;
+
+ endOfs = ME_GetCursorOfs(end);
+ nChars = endOfs - ME_GetCursorOfs(start);
+ if (!nChars)
+ {
+ *pbstr = NULL;
+ return S_OK;
+ }
+
+ *pbstr = SysAllocStringLen(NULL, nChars);
+ if (!*pbstr)
+ return E_OUTOFMEMORY;
+
+ bEOP = (end->pRun->next->type == diTextEnd && endOfs > ME_GetTextLength(editor));
+ ME_GetTextW(editor, *pbstr, nChars, start, nChars, FALSE, bEOP);
+ TRACE("%s\n", wine_dbgstr_w(*pbstr));
+
+ return S_OK;
+}
+
static HRESULT WINAPI ITextRange_fnGetText(ITextRange *me, BSTR *pbstr)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
+ ME_Cursor start, end;
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented %p\n", This);
- return E_NOTIMPL;
+ ME_CursorFromCharOfs(This->reOle->editor, This->start, &start);
+ ME_CursorFromCharOfs(This->reOle->editor, This->end, &end);
+ return range_GetText(This->reOle->editor, &start, &end, pbstr);
}
static HRESULT WINAPI ITextRange_fnSetText(ITextRange *me, BSTR bstr)
@@ -3039,8 +3065,6 @@ static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
ME_Cursor *start = NULL, *end = NULL;
- int nChars, endOfs;
- BOOL bEOP;
if (!This->reOle)
return CO_E_RELEASED;
@@ -3049,23 +3073,7 @@ static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr)
return E_INVALIDARG;
ME_GetSelection(This->reOle->editor, &start, &end);
- endOfs = ME_GetCursorOfs(end);
- nChars = endOfs - ME_GetCursorOfs(start);
- if (!nChars)
- {
- *pbstr = NULL;
- return S_OK;
- }
-
- *pbstr = SysAllocStringLen(NULL, nChars);
- if (!*pbstr)
- return E_OUTOFMEMORY;
-
- bEOP = (end->pRun->next->type == diTextEnd && endOfs > ME_GetTextLength(This->reOle->editor));
- ME_GetTextW(This->reOle->editor, *pbstr, nChars, start, nChars, FALSE, bEOP);
- TRACE("%s\n", wine_dbgstr_w(*pbstr));
-
- return S_OK;
+ return range_GetText(This->reOle->editor, start, end, pbstr);
}
static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR bstr)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index f7f27d1..ae514ec 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1017,6 +1017,43 @@ static void test_ITextRange_GetPara(void)
ITextPara_Release(txtPara);
}
+static void test_ITextRange_GetText(void)
+{
+ HWND w;
+ IRichEditOle *reOle = NULL;
+ ITextDocument *txtDoc = NULL;
+ ITextRange *txtRge = NULL;
+ HRESULT hres;
+ BSTR bstr = NULL;
+ static const CHAR test_text1[] = "TestSomeText";
+ static const WCHAR bufW1[] = {'T', 'e', 's', 't', 0};
+ static const WCHAR bufW2[] = {'T', 'e', 'x', 't', '\r', 0};
+ static const WCHAR bufW3[] = {'T', 'e', 'x', 't', 0};
+ static const WCHAR bufW4[] = {'T', 'e', 's', 't', 'S', 'o', 'm',
+ 'e', 'T', 'e', 'x', 't', '\r', 0};
+ static const WCHAR bufW5[] = {'\r', 0};
+
+
+#define TEST_TXTRGE_GETTEXT(first, lim, expected_string) \
+ create_interfaces(&w, &reOle, &txtDoc, NULL); \
+ SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1); \
+ ITextDocument_Range(txtDoc, first, lim, &txtRge); \
+ hres = ITextRange_GetText(txtRge, &bstr); \
+ ok(hres == S_OK, "ITextRange_GetText\n"); \
+ ok(!lstrcmpW(bstr, expected_string), "got wrong text: %s\n", wine_dbgstr_w(bstr)); \
+ SysFreeString(bstr); \
+ ITextRange_Release(txtRge); \
+ release_interfaces(&w, &reOle, &txtDoc, NULL);
+
+ TEST_TXTRGE_GETTEXT(0, 4, bufW1)
+ TEST_TXTRGE_GETTEXT(4, 0, bufW1)
+ TEST_TXTRGE_GETTEXT(8, 12, bufW3)
+ TEST_TXTRGE_GETTEXT(8, 13, bufW2)
+ TEST_TXTRGE_GETTEXT(12, 13, bufW5)
+ TEST_TXTRGE_GETTEXT(0, 13, bufW4)
+ TEST_TXTRGE_GETTEXT(1, 1, NULL)
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -1041,4 +1078,5 @@ START_TEST(richole)
test_ITextRange_SetEnd();
test_ITextRange_GetFont();
test_ITextRange_GetPara();
+ test_ITextRange_GetText();
}
--
1.7.9.5

View File

@ -0,0 +1,134 @@
From 8403ff90bb26c427c34beb7094d1dbf61e56102f Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 17:17:14 +0800
Subject: riched20: Implement ITextRange::SetRange.
---
dlls/riched20/richole.c | 41 +++++++++++++++++++++++++----------------
dlls/riched20/tests/richole.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 16 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 8b93aad..98f1b1e 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -2311,14 +2311,36 @@ static HRESULT WINAPI ITextRange_fnSetIndex(ITextRange *me, LONG Unit, LONG Inde
return E_NOTIMPL;
}
+static void cp2range(ME_TextEditor *editor, LONG *cp1, LONG *cp2)
+{
+ int len = ME_GetTextLength(editor) + 1;
+ *cp1 = max(*cp1, 0);
+ *cp2 = max(*cp2, 0);
+ *cp1 = min(*cp1, len);
+ *cp2 = min(*cp2, len);
+ if (*cp1 > *cp2)
+ {
+ int tmp = *cp1;
+ *cp1 = *cp2;
+ *cp2 = tmp;
+ }
+ if (*cp1 == len)
+ *cp1 = *cp2 = len - 1;
+}
+
static HRESULT WINAPI ITextRange_fnSetRange(ITextRange *me, LONG cpActive, LONG cpOther)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented %p\n", This);
- return E_NOTIMPL;
+ cp2range(This->reOle->editor, &cpActive, &cpOther);
+ if (cpActive == This->start && cpOther == This->end)
+ return S_FALSE;
+
+ This->start = cpActive;
+ This->end = cpOther;
+ return S_OK;
}
static HRESULT WINAPI ITextRange_fnInRange(ITextRange *me, ITextRange *pRange, LONG *pb)
@@ -2911,25 +2933,12 @@ ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
{
IRichEditOleImpl *This = impl_from_ITextDocument(me);
ITextRangeImpl *txtRge = NULL;
- const int len = ME_GetTextLength(This->editor) + 1;
TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2);
if (!ppRange)
return E_INVALIDARG;
- cp1 = max(cp1, 0);
- cp2 = max(cp2, 0);
- cp1 = min(cp1, len);
- cp2 = min(cp2, len);
- if (cp1 > cp2)
- {
- LONG tmp;
- tmp = cp1;
- cp1 = cp2;
- cp2 = tmp;
- }
- if (cp1 == len)
- cp1 = cp2 = len - 1;
+ cp2range(This->editor, &cp1, &cp2);
txtRge = heap_alloc(sizeof(ITextRangeImpl));
if (!txtRge)
return E_OUTOFMEMORY;
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index ae514ec..6c7c15d 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1054,6 +1054,40 @@ static void test_ITextRange_GetText(void)
TEST_TXTRGE_GETTEXT(1, 1, NULL)
}
+static void test_ITextRange_SetRange(void)
+{
+ HWND w;
+ IRichEditOle *reOle = NULL;
+ ITextDocument *txtDoc = NULL;
+ ITextRange *txtRge = NULL;
+ HRESULT hres;
+ int start, end;
+ static const CHAR test_text1[] = "TestSomeText";
+
+ create_interfaces(&w, &reOle, &txtDoc, NULL);
+ SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+ ITextDocument_Range(txtDoc, 0, 0, &txtRge);
+
+#define TEST_TXTRGE_SETRANGE(first, lim, expected_start, expected_end, expected_return) \
+ hres = ITextRange_SetRange(txtRge, first, lim); \
+ ok(hres == expected_return, "ITextRange_SetRange\n"); \
+ ITextRange_GetStart(txtRge, &start); \
+ ITextRange_GetEnd(txtRge, &end); \
+ ok(start == expected_start, "got wrong start value: %d\n", start); \
+ ok(end == expected_end, "got wrong end value: %d\n", end);
+
+ TEST_TXTRGE_SETRANGE(2, 4, 2, 4, S_OK)
+ TEST_TXTRGE_SETRANGE(2, 4, 2, 4, S_FALSE)
+ TEST_TXTRGE_SETRANGE(4, 2, 2, 4, S_FALSE)
+ TEST_TXTRGE_SETRANGE(14, 14, 12, 12, S_OK)
+ TEST_TXTRGE_SETRANGE(15, 15, 12, 12, S_FALSE)
+ TEST_TXTRGE_SETRANGE(14, 1, 1, 13, S_OK)
+ TEST_TXTRGE_SETRANGE(-1, 4, 0, 4, S_OK)
+
+ ITextRange_Release(txtRge);
+ release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -1079,4 +1113,5 @@ START_TEST(richole)
test_ITextRange_GetFont();
test_ITextRange_GetPara();
test_ITextRange_GetText();
+ test_ITextRange_SetRange();
}
--
1.7.9.5

View File

@ -0,0 +1,112 @@
From e17c9f4954b364347ef6b5eb258ec66f50362db6 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 15 Aug 2014 14:27:21 +0800
Subject: riched20: Implement ITextRange::IsEqual.
---
dlls/riched20/richole.c | 19 +++++++++++++++--
dlls/riched20/tests/richole.c | 47 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 98f1b1e..47ad0f9 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -2363,14 +2363,29 @@ static HRESULT WINAPI ITextRange_fnInStory(ITextRange *me, ITextRange *pRange, L
return E_NOTIMPL;
}
+static HRESULT range_IsEqual(LONG start, LONG end, ITextRange *pRange, LONG *pb)
+{
+ ITextRangeImpl *pRangeImpl = impl_from_ITextRange(pRange);
+ if (start == pRangeImpl->start && end == pRangeImpl->end)
+ {
+ if (pb)
+ *pb = tomTrue;
+ return S_OK;
+ }
+ if (pb)
+ *pb = tomFalse;
+ return S_FALSE;
+}
+
static HRESULT WINAPI ITextRange_fnIsEqual(ITextRange *me, ITextRange *pRange, LONG *pb)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented %p\n", This);
- return E_NOTIMPL;
+ if (!pRange)
+ return S_FALSE;
+ return range_IsEqual(This->start, This->end, pRange, pb);
}
static HRESULT WINAPI ITextRange_fnSelect(ITextRange *me)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 6c7c15d..6642ca3 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1088,6 +1088,52 @@ static void test_ITextRange_SetRange(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
}
+static void test_ITextRange_IsEqual(void)
+{
+ HWND w;
+ IRichEditOle *reOle = NULL;
+ ITextDocument *txtDoc = NULL;
+ ITextRange *txtRge1 = NULL, *txtRge2 = NULL;
+ HRESULT hres;
+ static const CHAR test_text1[] = "TestSomeText";
+ LONG res;
+
+ create_interfaces(&w, &reOle, &txtDoc, NULL);
+ SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+ ITextDocument_Range(txtDoc, 2, 4, &txtRge1);
+ ITextDocument_Range(txtDoc, 2, 4, &txtRge2);
+
+#define TEST_TXTRGE_ISEQUAL(expected_hres, expected_res) \
+ hres = ITextRange_IsEqual(txtRge1, txtRge2, &res); \
+ ok(hres == expected_hres, "ITextRange_IsEqual\n"); \
+ ok(res == expected_res, "got wrong return value: %d\n", res);
+
+ TEST_TXTRGE_ISEQUAL(S_OK, tomTrue)
+ ITextRange_SetRange(txtRge2, 1, 2);
+ TEST_TXTRGE_ISEQUAL(S_FALSE, tomFalse)
+
+ ITextRange_SetRange(txtRge1, 1, 1);
+ ITextRange_SetRange(txtRge2, 2, 2);
+ TEST_TXTRGE_ISEQUAL(S_FALSE, tomFalse)
+
+ ITextRange_SetRange(txtRge2, 1, 1);
+ TEST_TXTRGE_ISEQUAL(S_OK, tomTrue)
+
+ hres = ITextRange_IsEqual(txtRge1, txtRge1, &res);
+ ok(hres == S_OK, "ITextRange_IsEqual\n");
+ ok(res == tomTrue, "got wrong return value: %d\n", res);
+
+ hres = ITextRange_IsEqual(txtRge1, txtRge2, NULL);
+ ok(hres == S_OK, "ITextRange_IsEqual\n");
+
+ hres = ITextRange_IsEqual(txtRge1, NULL, NULL);
+ ok(hres == S_FALSE, "ITextRange_IsEqual\n");
+
+ ITextRange_Release(txtRge1);
+ ITextRange_Release(txtRge2);
+ release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -1114,4 +1160,5 @@ START_TEST(richole)
test_ITextRange_GetPara();
test_ITextRange_GetText();
test_ITextRange_SetRange();
+ test_ITextRange_IsEqual();
}
--
1.7.9.5

View File

@ -0,0 +1,78 @@
From 7c46ccadf6492585c2a2cd3fc9f06ab960fe30f4 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:38:50 +0800
Subject: riched20: Implement ITextRange::GetStoryLength.
---
dlls/riched20/richole.c | 6 ++++--
dlls/riched20/tests/richole.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 47ad0f9..1af7804 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -2244,8 +2244,10 @@ static HRESULT WINAPI ITextRange_fnGetStoryLength(ITextRange *me, LONG *pcch)
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented %p\n", This);
- return E_NOTIMPL;
+ if (!pcch)
+ return E_INVALIDARG;
+ *pcch = ME_GetTextLength(This->reOle->editor) + 1;
+ return S_OK;
}
static HRESULT WINAPI ITextRange_fnGetStoryType(ITextRange *me, LONG *pValue)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 6642ca3..c4f58fd 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1134,6 +1134,37 @@ static void test_ITextRange_IsEqual(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
}
+static void test_ITextRange_GetStoryLength(void)
+{
+ HWND w;
+ IRichEditOle *reOle = NULL;
+ ITextDocument *txtDoc = NULL;
+ ITextRange *txtRge = NULL;
+ HRESULT hres;
+ LONG count;
+ static const CHAR test_text1[] = "TestSomeText";
+ int len = strlen(test_text1) + 1;
+
+ create_interfaces(&w, &reOle, &txtDoc, NULL);
+ SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+ ITextDocument_Range(txtDoc, 0, 0, &txtRge);
+
+ hres = ITextRange_GetStoryLength(txtRge, &count);
+ ok(hres == S_OK, "ITextRange_GetStoryLength\n");
+ ok(count == len, "got wrong length: %d\n", count);
+
+ ITextRange_SetRange(txtRge, 1, 2);
+ hres = ITextRange_GetStoryLength(txtRge, &count);
+ ok(hres == S_OK, "ITextRange_GetStoryLength\n");
+ ok(count == len, "got wrong length: %d\n", count);
+
+ hres = ITextRange_GetStoryLength(txtRge, NULL);
+ ok(hres == E_INVALIDARG, "ITextRange_GetStoryLength\n");
+
+ ITextRange_Release(txtRge);
+ release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -1161,4 +1192,5 @@ START_TEST(richole)
test_ITextRange_GetText();
test_ITextRange_SetRange();
test_ITextRange_IsEqual();
+ test_ITextRange_GetStoryLength();
}
--
1.7.9.5

View File

@ -0,0 +1,78 @@
From f9427d23ca1d7fac8f561fa8ed2563ea187451f4 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:47:14 +0800
Subject: riched20: Implement ITextSelection::GetStoryLength.
---
dlls/riched20/richole.c | 6 ++++--
dlls/riched20/tests/richole.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 1af7804..ed70b8d 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -3284,8 +3284,10 @@ static HRESULT WINAPI ITextSelection_fnGetStoryLength(ITextSelection *me, LONG *
if (!This->reOle)
return CO_E_RELEASED;
- FIXME("not implemented\n");
- return E_NOTIMPL;
+ if (!pcch)
+ return E_INVALIDARG;
+ *pcch = ME_GetTextLength(This->reOle->editor) + 1;
+ return S_OK;
}
static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pValue)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index c4f58fd..a14f88b 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1165,6 +1165,35 @@ static void test_ITextRange_GetStoryLength(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
}
+static void test_ITextSelection_GetStoryLength(void)
+{
+ HWND w;
+ IRichEditOle *reOle = NULL;
+ ITextDocument *txtDoc = NULL;
+ ITextSelection *txtSel = NULL;
+ HRESULT hres;
+ LONG count;
+ static const CHAR test_text1[] = "TestSomeText";
+ int len = strlen(test_text1) + 1;
+
+ create_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+
+ hres = ITextSelection_GetStoryLength(txtSel, &count);
+ ok(hres == S_OK, "ITextSelection_GetStoryLength\n");
+ ok(count == len, "got wrong length: %d\n", count);
+
+ SendMessageA(w, EM_SETSEL, 1, 2);
+ hres = ITextSelection_GetStoryLength(txtSel, &count);
+ ok(hres == S_OK, "ITextSelection_GetStoryLength\n");
+ ok(count == len, "got wrong length: %d\n", count);
+
+ hres = ITextSelection_GetStoryLength(txtSel, NULL);
+ ok(hres == E_INVALIDARG, "ITextSelection_GetStoryLength\n");
+
+ release_interfaces(&w, &reOle, &txtDoc, &txtSel);
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -1180,6 +1209,7 @@ START_TEST(richole)
test_ITextSelection_SetEnd();
test_ITextSelection_Collapse();
test_ITextSelection_GetFont();
+ test_ITextSelection_GetStoryLength();
test_ITextDocument_Range();
test_ITextRange_GetChar();
test_ITextRange_GetDuplicate();
--
1.7.9.5

View File

@ -2,10 +2,6 @@ Author: Jactry Zeng
Subject: Implement Stubs for ITextRange interface.
Revision: 3
Author: Jactry Zeng
Subject: Implement IText{Range,Selection}::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}.
Revision: 1
Author: Jactry Zeng
Subject: Implement Stubs for ITextFont interface.
Revision: 2
@ -14,5 +10,13 @@ Author: Jactry Zeng
Subject: Implement Stubs for ITextPara interface.
Revision: 2
Author: Jactry Zeng
Subject: Implement ITextRange/Selection::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}.
Revision: 1
Author: Jactry Zeng
Subject: Implement ITextRange/Selection::{GetText,SetRange,IsEqual,GetStoryLength}.
Revision: 1
Fixes: [12458] Support for ITextDocument_fnRange function
Fixes: [18303] Support for ITextRange, ITextFont and ITextPara