Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/riched20/tests/txtsrv.c | 6 +++--- dlls/riched20/txtsrv.c | 39 +++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c index 7ca6074587d..3cfd5e63753 100644 --- a/dlls/riched20/tests/txtsrv.c +++ b/dlls/riched20/tests/txtsrv.c @@ -705,7 +705,7 @@ static void _check_txgetnaturalsize(HRESULT res, LONG width, LONG height, HDC hd expected_width = expected_rect.right - expected_rect.left; expected_height = expected_rect.bottom - expected_rect.top; ok_(__FILE__,line)(res == S_OK, "ITextServices_TxGetNaturalSize failed: 0x%08x.\n", res); - ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1, + todo_wine ok_(__FILE__,line)(width >= expected_width && width <= expected_width + 1, "got wrong width: %d, expected: %d {+1}.\n", width, expected_width); ok_(__FILE__,line)(height == expected_height, "got wrong height: %d, expected: %d.\n", height, expected_height); @@ -717,7 +717,7 @@ static void test_TxGetNaturalSize(void) ITextHost *host; HRESULT result; SIZEL extent; - static const WCHAR test_text[] = {'T','e','s','t','S','o','m','e','T','e','x','t',0}; + static const WCHAR test_text[] = L"TestSomeText"; LONG width, height; HDC hdcDraw; HWND hwnd; @@ -752,7 +752,7 @@ static void test_TxGetNaturalSize(void) height = 0; result = ITextServices_TxGetNaturalSize(txtserv, DVASPECT_CONTENT, hdcDraw, NULL, NULL, TXTNS_FITTOCONTENT, &extent, &width, &height); - todo_wine CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text); + CHECK_TXGETNATURALSIZE(result, width, height, hdcDraw, rect, test_text);
ReleaseDC(hwnd, hdcDraw); DestroyWindow(hwnd); diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c index 79ade0f6117..5736964c1b1 100644 --- a/dlls/riched20/txtsrv.c +++ b/dlls/riched20/txtsrv.c @@ -366,14 +366,43 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetBaseLinePos(ITextServices *ifa }
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36) -DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize(ITextServices *iface, DWORD dwAspect, HDC hdcDraw, - HDC hicTargetDev, DVTARGETDEVICE *ptd, DWORD dwMode, - const SIZEL *psizelExtent, LONG *pwidth, LONG *pheight) +DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *iface, DWORD aspect, HDC draw, + HDC target, DVTARGETDEVICE *td, DWORD mode, + const SIZEL *extent, LONG *width, LONG *height ) { struct text_services *services = impl_from_ITextServices( iface ); + RECT rect; + HDC dc = draw; + BOOL rewrap = FALSE; + HRESULT hr;
- FIXME( "%p: STUB\n", services ); - return E_NOTIMPL; + TRACE( "%p: aspect %d, draw %p, target %p, td %p, mode %08x, extent %s, *width %d, *height %d\n", services, + aspect, draw, target, td, mode, wine_dbgstr_point( (POINT *)extent ), *width, *height ); + + if (aspect != DVASPECT_CONTENT || target || td || mode != TXTNS_FITTOCONTENT ) + FIXME( "Many arguments are ignored\n" ); + + SetRect( &rect, 0, 0, *width, *height ); + + hr = update_client_rect( services, &rect ); + if (FAILED( hr )) return hr; + if (hr == S_OK) rewrap = TRUE; + + if (!dc && services->editor->in_place_active) + dc = ITextHost_TxGetDC( services->host ); + if (!dc) return E_FAIL; + + if (rewrap) + { + editor_mark_rewrap_all( services->editor ); + wrap_marked_paras_dc( services->editor, dc, FALSE ); + } + + *width = services->editor->nTotalWidth; + *height = services->editor->nTotalLength; + + if (!draw) ITextHost_TxReleaseDC( services->host, dc ); + return S_OK; }
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=87689
Your paranoid android.
=== debiant2 (build log) ===
Task: WineTest did not produce the win32 report
=== debiant2 (build log) ===
Task: Could not create the wow32 wineprefix: Failed to disable the crash dialogs: Task: WineTest did not produce the 0 report
Hi,
This patch is putting me in a bind: it introduces a failure which is in fact a fix. But only in Wine and in the Japanese locale!
https://test.winehq.org/data/patterns.html#riched20:txtsrv
debiant2-win32-ja-JP: txtsrv.c:768: Test succeeded inside todo block: got wrong width: 72, expected: 72 {+1}.
As far as I can tell the test is not wrong: * It succeeds in all the locales on Windows. * The todo is still needed in all the other locales in Wine: the returned width systematically falls 2 to 3 pixels short.
So I don't know how to avoid getting this failure in every nightly WineTest run.
Is it a font problem? Making the todo conditional on the locale feels iffy. Same for skipping the test based on the locale. Fix the implementation some more so it works on all locales?