Rebase against 6d05fae6f7ebab83a2f1c6621d9619bbe91833fd

This commit is contained in:
Alistair Leslie-Hughes
2019-05-29 09:41:06 +10:00
parent b9204d93c9
commit 8725e273cc
10 changed files with 104 additions and 480 deletions

View File

@@ -1,17 +1,17 @@
From 3d02c5ffcad36616c63a8814fe98f9b531fce27a Mon Sep 17 00:00:00 2001
From ad837ef7c71cdca27ce947100107bfe5c6982ff7 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}.
Subject: [PATCH] riched20: Implement IText{Selection, Range}::Set{Start, End}.
---
dlls/riched20/tests/richole.c | 135 ++++++++++++++++++++++++++++++++++++++++++
dlls/riched20/tests/richole.c | 135 ++++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 6da3ce3..8047f4b 100644
index 70646202f04..77f93a55c14 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3397,6 +3397,137 @@ static void test_Expand(void)
@@ -3808,6 +3808,137 @@ static void test_MoveEnd(void)
ITextRange_Release(range);
}
@@ -149,7 +149,7 @@ index 6da3ce3..8047f4b 100644
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3409,12 +3540,16 @@ START_TEST(richole)
@@ -3820,6 +3951,8 @@ START_TEST(richole)
test_GetText();
test_ITextSelection_GetChar();
test_ITextSelection_GetStart_GetEnd();
@@ -158,8 +158,9 @@ index 6da3ce3..8047f4b 100644
test_ITextSelection_Collapse();
test_ITextDocument_Range();
test_ITextRange_GetChar();
test_ITextRange_ScrollIntoView();
@@ -3827,6 +3960,8 @@ START_TEST(richole)
test_ITextRange_GetStart_GetEnd();
test_ITextRange_SetRange();
test_ITextRange_GetDuplicate();
+ test_ITextRange_SetStart();
+ test_ITextRange_SetEnd();
@@ -167,5 +168,5 @@ index 6da3ce3..8047f4b 100644
test_GetClientSite();
test_IOleWindow_GetWindow();
--
2.7.1
2.20.1

View File

@@ -1,137 +0,0 @@
From ac8cabefac07d17d2fdf33b26444b74e5c910abf 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 76f70a6..71fdf29 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -2016,6 +2016,23 @@ 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 anchor, LONG active)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
@@ -2025,7 +2042,13 @@ static HRESULT WINAPI ITextRange_fnSetRange(ITextRange *me, LONG anchor, LONG ac
if (!This->child.reole)
return CO_E_RELEASED;
- return E_NOTIMPL;
+ cp2range(This->child.reole->editor, &anchor, &active);
+ if (anchor == This->start && active == This->end)
+ return S_FALSE;
+
+ This->start = anchor;
+ This->end = active;
+ return S_OK;
}
static HRESULT textrange_inrange(LONG start, LONG end, ITextRange *range, LONG *ret)
@@ -4317,26 +4340,12 @@ static HRESULT WINAPI ITextDocument2Old_fnRange(ITextDocument2Old *iface, LONG c
ITextRange **ppRange)
{
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- 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);
return CreateITextRange(This, cp1, cp2, ppRange);
}
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index dfc6799..c98b536 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -4009,6 +4009,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
@@ -4036,6 +4070,7 @@ START_TEST(richole)
test_ITextRange_GetFont();
test_ITextRange_GetPara();
test_ITextRange_GetText();
+ test_ITextRange_SetRange();
test_GetClientSite();
test_IOleWindow_GetWindow();
test_IOleInPlaceSite_GetWindow();
--
2.7.4

View File

@@ -1,18 +1,18 @@
From 52cb6b771a61011c39c4c8f402709d8d119d43f5 Mon Sep 17 00:00:00 2001
From 2d05fb15e16385684dfc1e9f1d2c51fa4d5830d9 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.
Subject: [PATCH] riched20: Implement ITextRange::IsEqual.
---
dlls/riched20/tests/richole.c | 47 +++++++++++++++++++++++++++++++++++++++++++
dlls/riched20/tests/richole.c | 47 +++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 6e00b21..ae087b7 100644
index 4512085ea3..b2bb21d69b 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3590,6 +3590,52 @@ static void test_ITextRange_SetRange(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
@@ -4113,6 +4113,52 @@ static void test_ITextRange_GetText(void)
TEST_TXTRGE_GETTEXT(1, 1, NULL)
}
+static void test_ITextRange_IsEqual2(void)
@@ -64,14 +64,14 @@ index 6e00b21..ae087b7 100644
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3617,6 +3663,7 @@ START_TEST(richole)
@@ -4141,6 +4187,7 @@ START_TEST(richole)
test_ITextRange_GetFont();
test_ITextRange_GetPara();
test_ITextRange_GetText();
test_ITextRange_SetRange();
+ test_ITextRange_IsEqual2();
test_GetClientSite();
test_IOleWindow_GetWindow();
test_IOleInPlaceSite_GetWindow();
--
2.4.2
2.20.1

View File

@@ -1,17 +1,17 @@
From e53964c35b8005bf77f9088276604e7b47fdf475 Mon Sep 17 00:00:00 2001
From a3c18216d981f2f46f3a2572d5ba17f278c259c2 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.
Subject: [PATCH] riched20: Implement ITextRange::GetStoryLength.
---
dlls/riched20/tests/richole.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index ae087b7..55d27d4 100644
index b2bb21d69bc..5e105b3444a 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3636,6 +3636,37 @@ static void test_ITextRange_IsEqual2(void)
@@ -4159,6 +4159,37 @@ static void test_ITextRange_IsEqual2(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
}
@@ -49,14 +49,14 @@ index ae087b7..55d27d4 100644
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3664,6 +3695,7 @@ START_TEST(richole)
@@ -4188,6 +4219,7 @@ START_TEST(richole)
test_ITextRange_GetPara();
test_ITextRange_GetText();
test_ITextRange_SetRange();
test_ITextRange_IsEqual2();
+ test_ITextRange_GetStoryLength();
test_GetClientSite();
test_IOleWindow_GetWindow();
test_IOleInPlaceSite_GetWindow();
--
2.4.2
2.20.1