This mr fixes https://bugs.winehq.org/show_bug.cgi?id=40444
-- v3: riched20/test: Add scrolling test for richole.
From: Santino Mazza mazzasantino1206@gmail.com
Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/riched20/tests/editor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 03c07829ee4..2667e7d3fdc 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5018,6 +5018,24 @@ static void check_EM_SETSEL(HWND hwnd, const struct exsetsel_s *setsel, int id) id, setsel->expected_getsel_start, setsel->expected_getsel_end, start, end); }
+/* When the selection is out of the windows view, the scrollbar should move. */ +static void check_EM_SETSEL_multiline(HWND hwnd) +{ + int oldY; + int curY; + const char textwithlines[] = "This is a text\n" + "with lines\n" + "I expect this text\n" + "to be\nlarge\nenough\n"; + + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)textwithlines); + oldY = get_scroll_pos_y(hwnd); + SendMessageA(hwnd, EM_SETSEL, 59, 59); + curY = get_scroll_pos_y(hwnd); + todo_wine + ok(oldY < curY, "oldY %d >= curY %d\n", oldY, curY); +} + static void test_EM_SETSEL(void) { char buffA[32] = {0}; @@ -5058,6 +5076,8 @@ static void test_EM_SETSEL(void) ok(sel_end == 8, "Selection end incorrectly: %d expected 8\n", sel_end); }
+ check_EM_SETSEL_multiline(hwndRichEdit); + DestroyWindow(hwndRichEdit); }
From: Santino Mazza mazzasantino1206@gmail.com
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=40444 Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/riched20/editor.c | 1 + dlls/riched20/tests/editor.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 108c37a7f30..57601745ab2 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2142,6 +2142,7 @@ int set_selection( ME_TextEditor *editor, int to, int from )
if (!editor->bHideSelection) ME_InvalidateSelection( editor ); end = set_selection_cursors( editor, to, from ); + editor_ensure_visible( editor, &editor->pCursors[0] ); if (!editor->bHideSelection) ME_InvalidateSelection( editor ); update_caret( editor ); ME_SendSelChange( editor ); diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 2667e7d3fdc..1661654aa11 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5032,7 +5032,6 @@ static void check_EM_SETSEL_multiline(HWND hwnd) oldY = get_scroll_pos_y(hwnd); SendMessageA(hwnd, EM_SETSEL, 59, 59); curY = get_scroll_pos_y(hwnd); - todo_wine ok(oldY < curY, "oldY %d >= curY %d\n", oldY, curY); }
From: Santino Mazza mazzasantino1206@gmail.com
Signed-off-by: Santino Mazza mazzasantino1206@gmail.com --- dlls/riched20/tests/richole.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 1ebc12a27ab..d648354729e 100644 --- a/dlls/riched20/tests/richole.c +++ b/dlls/riched20/tests/richole.c @@ -3579,13 +3579,25 @@ static void test_ITextRange_IsEqual(void) ITextSelection_Release(selection); }
+static int get_scroll_pos_y(HWND hwnd) +{ + POINT p = {-1, -1}; + SendMessageA(hwnd, EM_GETSCROLLPOS, 0, (LPARAM)&p); + ok(p.x != -1 && p.y != -1, "p.x:%ld p.y:%ld\n", p.x, p.y); + return p.y; +} + static void test_Select(void) { static const CHAR test_text1[] = "TestSomeText"; + static const CHAR test_text2[] = "text\nwith\nbreak\n" + "lines\ntest\ntest\n"; IRichEditOle *reOle = NULL; ITextDocument *doc = NULL; ITextSelection *selection; ITextRange *range; + int scroll_pos1; + int scroll_pos2; LONG value; HRESULT hr; HWND hwnd; @@ -3597,8 +3609,11 @@ static void test_Select(void) hr = ITextDocument_Range(doc, 0, 4, &range); ok(hr == S_OK, "got 0x%08lx\n", hr);
+ scroll_pos1 = get_scroll_pos_y(hwnd); hr = ITextRange_Select(range); ok(hr == S_OK, "got 0x%08lx\n", hr); + scroll_pos2 = get_scroll_pos_y(hwnd); + ok(scroll_pos1 == scroll_pos2, "%d != %d\n", scroll_pos1, scroll_pos2);
value = 1; hr = ITextSelection_GetStart(selection, &value); @@ -3611,6 +3626,16 @@ static void test_Select(void) hr = ITextSelection_Select(selection); ok(hr == S_OK, "got 0x%08lx\n", hr);
+ SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)test_text2); + SendMessageA(hwnd, EM_SETSEL, 1, 2); + hr = ITextDocument_Range(doc, 10, 16, &range); + ok(hr == S_OK, "got 0x%08lx\n", hr); + scroll_pos1 = get_scroll_pos_y(hwnd); + hr = ITextRange_Select(range); + ok(hr == S_OK, "got 0x%08lx\n", hr); + scroll_pos2 = get_scroll_pos_y(hwnd); + ok(scroll_pos1 != scroll_pos2, "%d == %d\n", scroll_pos1, scroll_pos2); + release_interfaces(&hwnd, &reOle, &doc, NULL);
hr = ITextRange_Select(range);
Hope I didn't break anything, I had to unprotect the master branch and do some force push because I didn't create a new branch in the fork. lol.
Is that error normal? I didn't touch anything in that test.
Hope I didn't break anything, I had to unprotect the master branch and do some force push because I didn't create a new branch in the fork. lol.
Please do create a new branch. Using master will also prevent others (including me) from updating your merge request.
I don't think I can change the source branch from a merge request, so I'm creating a new one.
This merge request was closed by Santino Mazza.