From: Charlotte Pabst cpabst@codeweavers.com
Signed-off-by: Charlotte Pabst cpabst@codeweavers.com --- dlls/riched20/tests/txtsrv.c | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c index adb36642f4f..da986291474 100644 --- a/dlls/riched20/tests/txtsrv.c +++ b/dlls/riched20/tests/txtsrv.c @@ -103,6 +103,7 @@ static ITextServicesVtbl itextServicesStdcallVtbl; /* ITextHost implementation for conformance testing. */
DEFINE_EXPECT(ITextHostImpl_TxViewChange); +DEFINE_EXPECT(ITextHostImpl_TxScrollWindowEx);
typedef struct ITextHostTestImpl { @@ -268,6 +269,7 @@ static void __thiscall ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx, ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n", This, dx, dy, lprcScroll, lprcClip, hRgnUpdate, lprcUpdate, fuScroll); + INCREASE_CALL_COUNTER(ITextHostImpl_TxScrollWindowEx); }
static void __thiscall ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture) @@ -1396,6 +1398,54 @@ static void test_scrollcaret( void ) ITextHost_Release( host ); }
+static void test_replace_selection( void ) +{ + ITextServices *txtserv; + ITextHost *host; + LRESULT result; + HRESULT hr; + + ITextHostTestImpl *host_impl; + if (!init_texthost(&txtserv, &host)) + return; + + host_impl = impl_from_ITextHost( host ); + host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, NULL ); + host_impl->client_rect = (RECT) { 0, 0, 150, 150 }; + host_impl->scrollbars = WS_VSCROLL | ES_AUTOVSCROLL; + host_impl->props = TXTBIT_MULTILINE | TXTBIT_RICHTEXT | TXTBIT_WORDWRAP; + ITextServices_OnTxPropertyBitsChange( txtserv, TXTBIT_SCROLLBARCHANGE | TXTBIT_MULTILINE | TXTBIT_RICHTEXT | TXTBIT_WORDWRAP, host_impl->props ); + + CLEAR_COUNTER(ITextHostImpl_TxScrollWindowEx); + + hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, GetDC(host_impl->window), NULL, (RECTL *)&host_impl->client_rect, NULL, NULL, NULL, 0, TXTVIEW_INACTIVE ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, -1, &result); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ITextServices_TxSendMessage(txtserv, EM_REPLACESEL, TRUE, (LPARAM) lorem, &result); + ok( hr == S_OK, "got %08lx\n", hr ); + + CHECK_NOT_CALLED(ITextHostImpl_TxScrollWindowEx); + CLEAR_COUNTER(ITextHostImpl_TxScrollWindowEx); + + hr = ITextServices_OnTxInPlaceActivate( txtserv, &host_impl->client_rect ); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ITextServices_TxSendMessage(txtserv, EM_SETSEL, 0, -1, &result); + ok( hr == S_OK, "got %08lx\n", hr ); + + hr = ITextServices_TxSendMessage(txtserv, EM_REPLACESEL, TRUE, (LPARAM) lorem, &result); + ok( hr == S_OK, "got %08lx\n", hr ); + + CHECK_CALLED(ITextHostImpl_TxScrollWindowEx); + + DestroyWindow( host_impl->window ); + ITextServices_Release( txtserv ); + ITextHost_Release( host ); +} + START_TEST( txtsrv ) { ITextServices *txtserv; @@ -1431,6 +1481,7 @@ START_TEST( txtsrv ) test_notifications(); test_set_selection_message(); test_scrollcaret(); + test_replace_selection(); } if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE); }