riched20: Check for NULL in fnTextSrv_TxSetText and add test.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
24d71ad7e7
commit
9f37f6afb4
|
@ -681,6 +681,16 @@ static void test_TxSetText(void)
|
||||||
ok(memcmp(rettext,settext,SysStringByteLen(rettext)) == 0,
|
ok(memcmp(rettext,settext,SysStringByteLen(rettext)) == 0,
|
||||||
"String returned differs\n");
|
"String returned differs\n");
|
||||||
|
|
||||||
|
/* Null-pointer should behave the same as empty-string */
|
||||||
|
|
||||||
|
hres = ITextServices_TxSetText(txtserv, 0);
|
||||||
|
ok(hres == S_OK, "ITextServices_TxSetText failed (result = %x)\n", hres);
|
||||||
|
|
||||||
|
hres = ITextServices_TxGetText(txtserv, &rettext);
|
||||||
|
ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
|
||||||
|
ok(SysStringLen(rettext) == 0,
|
||||||
|
"String returned of wrong length (expected 0, got %d)\n", SysStringLen(rettext));
|
||||||
|
|
||||||
SysFreeString(rettext);
|
SysFreeString(rettext);
|
||||||
ITextServices_Release(txtserv);
|
ITextServices_Release(txtserv);
|
||||||
ITextHost_Release(host);
|
ITextHost_Release(host);
|
||||||
|
|
|
@ -286,10 +286,9 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSetText(ITextServices *iface, LPCWSTR
|
||||||
ME_Cursor cursor;
|
ME_Cursor cursor;
|
||||||
|
|
||||||
ME_SetCursorToStart(This->editor, &cursor);
|
ME_SetCursorToStart(This->editor, &cursor);
|
||||||
ME_InternalDeleteText(This->editor, &cursor,
|
ME_InternalDeleteText(This->editor, &cursor, ME_GetTextLength(This->editor), FALSE);
|
||||||
ME_GetTextLength(This->editor), FALSE);
|
if(pszText)
|
||||||
ME_InsertTextFromCursor(This->editor, 0, pszText, -1,
|
ME_InsertTextFromCursor(This->editor, 0, pszText, -1, This->editor->pBuffer->pDefaultStyle);
|
||||||
This->editor->pBuffer->pDefaultStyle);
|
|
||||||
ME_SetSelection(This->editor, 0, 0);
|
ME_SetSelection(This->editor, 0, 0);
|
||||||
This->editor->nModifyStep = 0;
|
This->editor->nModifyStep = 0;
|
||||||
OleFlushClipboard();
|
OleFlushClipboard();
|
||||||
|
|
Loading…
Reference in New Issue