riched32: Test for EM_GETTEXTRANGE from middle of end of paragraph run.

EM_GETTEXTRANGE should be able to get part of the end of paragraph run,
for instance just the line feed in a carraige return line feed pair.
This commit is contained in:
Dylan Smith 2009-01-27 03:39:10 -05:00 committed by Alexandre Julliard
parent c94e78a572
commit 5bf9e73dd0
1 changed files with 12 additions and 4 deletions

View File

@ -465,9 +465,10 @@ static void test_EM_GETTEXTRANGE(void)
{ {
HWND hwndRichEdit = new_richedit(NULL); HWND hwndRichEdit = new_richedit(NULL);
const char * text1 = "foo bar\r\nfoo bar"; const char * text1 = "foo bar\r\nfoo bar";
const char * text2 = "foo bar\rfoo bar"; const char * text3 = "foo bar\rfoo bar";
const char * expect1 = "bar\r\nfoo"; const char * expect1 = "bar\r\nfoo";
const char * expect2 = "bar\rfoo"; const char * expect2 = "\nfoo";
const char * expect3 = "bar\rfoo";
char buffer[1024] = {0}; char buffer[1024] = {0};
LRESULT result; LRESULT result;
TEXTRANGEA textRange; TEXTRANGEA textRange;
@ -481,7 +482,14 @@ static void test_EM_GETTEXTRANGE(void)
ok(result == 8, "EM_GETTEXTRANGE returned %ld\n", result); ok(result == 8, "EM_GETTEXTRANGE returned %ld\n", result);
ok(!strcmp(expect1, buffer), "EM_GETTEXTRANGE filled %s\n", buffer); ok(!strcmp(expect1, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text2); textRange.lpstrText = buffer;
textRange.chrg.cpMin = 8;
textRange.chrg.cpMax = 12;
result = SendMessage(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
ok(result == 4, "EM_GETTEXTRANGE returned %ld\n", result);
todo_wine ok(!strcmp(expect2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text3);
textRange.lpstrText = buffer; textRange.lpstrText = buffer;
textRange.chrg.cpMin = 4; textRange.chrg.cpMin = 4;
@ -489,7 +497,7 @@ static void test_EM_GETTEXTRANGE(void)
result = SendMessage(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange); result = SendMessage(hwndRichEdit, EM_GETTEXTRANGE, 0, (LPARAM)&textRange);
ok(result == 7, "EM_GETTEXTRANGE returned %ld\n", result); ok(result == 7, "EM_GETTEXTRANGE returned %ld\n", result);
ok(!strcmp(expect2, buffer), "EM_GETTEXTRANGE filled %s\n", buffer); ok(!strcmp(expect3, buffer), "EM_GETTEXTRANGE filled %s\n", buffer);
DestroyWindow(hwndRichEdit); DestroyWindow(hwndRichEdit);