riched20: EM_SETCHARFORMAT must fail and return 0 with TM_PLAINTEXT and SF_SELECTION.

This commit is contained in:
Alex Villacís Lasso 2007-09-26 15:50:45 -05:00 committed by Alexandre Julliard
parent 238043784a
commit 03f3a40a03
2 changed files with 18 additions and 8 deletions

View File

@ -1733,13 +1733,19 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
BOOL bRepaint = TRUE;
p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam);
if (p == NULL) return 0;
if (!wParam || (editor->mode & TM_PLAINTEXT))
if (!wParam)
ME_SetDefaultCharFormat(editor, p);
else if (wParam == (SCF_WORD | SCF_SELECTION))
else if (wParam == (SCF_WORD | SCF_SELECTION)) {
FIXME("EM_SETCHARFORMAT: word selection not supported\n");
else if (wParam == SCF_ALL)
ME_SetCharFormat(editor, 0, ME_GetTextLength(editor), p);
else {
return 0;
} else if (wParam == SCF_ALL) {
if (editor->mode & TM_PLAINTEXT)
ME_SetDefaultCharFormat(editor, p);
else
ME_SetCharFormat(editor, 0, ME_GetTextLength(editor), p);
} else if (editor->mode & TM_PLAINTEXT) {
return 0;
} else {
int from, to;
ME_GetSelection(editor, &from, &to);
bRepaint = (from != to);

View File

@ -572,9 +572,13 @@ static void test_TM_PLAINTEXT(void)
cf2.dwEffects = CFE_BOLD ^ cf2.dwEffects;
rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION, (LPARAM) &cf2);
todo_wine {
ok(rc == 0, "EM_SETCHARFORMAT returned %d instead of 0\n", rc);
}
ok(rc == 0, "EM_SETCHARFORMAT returned %d instead of 0\n", rc);
rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_WORD | SCF_SELECTION, (LPARAM) &cf2);
ok(rc == 0, "EM_SETCHARFORMAT returned %d instead of 0\n", rc);
rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_ALL, (LPARAM)&cf2);
ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc);
/*Get the formatting of those characters*/