[PATCH 0/1] MR8177: user32/tests: Add tests for DrawTextExW.
@alexhenrie @zhiyi The corresponding Windows test demo is as follows: [test_DrawTextExW.exe](/uploads/ff1eafc9c58ac03b598699a93136484c/test_DrawTextExW.exe) [test_DrawTextExW.c](/uploads/a41719a33c2ee0e057c911933bf55180/test_DrawTextExW.c) Signed-off-by: chenjiangyi <chenjiangyi(a)uniontech.com> Change-Id: I64052ba8aa8161ad83c1811d642aedbe462ef5ea -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8177
From: chenjiangyi <chenjiangyi(a)uniontech.com> Log: Signed-off-by: chenjiangyi <chenjiangyi(a)uniontech.com> Change-Id: I64052ba8aa8161ad83c1811d642aedbe462ef5ea --- dlls/user32/tests/text.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c index d3228eae1e0..4e7c2235583 100644 --- a/dlls/user32/tests/text.c +++ b/dlls/user32/tests/text.c @@ -656,6 +656,45 @@ static void test_DrawTextCalcRect(void) ok(rect.top == rect2.top, "unexpected value %ld, got %ld\n", rect.top, rect2.top); ok(rect.bottom == rect2.bottom , "unexpected value %ld, got %ld\n", rect.bottom, rect2.bottom); + /* further tests for dtp */ + SelectObject(hdc, hOldFont); + ret = DeleteObject(hFont); + ok(ret, "DeleteObject error %lu\n", GetLastError()); + lf.lfHeight = 200 * 9 / 72; + hFont = CreateFontIndirectA(&lf); + ok(hFont != 0, "CreateFontIndirectA error %lu\n", GetLastError()); + hOldFont = SelectObject(hdc, hFont); + + SetRect( &rect, 0,0, 100, 25); + memset(&dtp, 0, sizeof(dtp)); + dtp.cbSize = sizeof(dtp); + textheight = DrawTextExW(hdc, textW, lstrlenW(textW), &rect, DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK, &dtp); + todo_wine ok(dtp.uiLengthDrawn == 10, "Unexpected uiLengthDrawn %d\n", dtp.uiLengthDrawn ); + + memset(&dtp, 0, sizeof(dtp)); + dtp.cbSize = sizeof(dtp); + textheight = DrawTextExW(hdc, textW, lstrlenW(textW), &rect, DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT, &dtp); + todo_wine ok(dtp.uiLengthDrawn == 16, "Unexpected uiLengthDrawn %d\n", dtp.uiLengthDrawn ); + + memset(&dtp, 0, sizeof(dtp)); + dtp.cbSize = sizeof(dtp); + textheight = DrawTextExW(hdc, (LPWSTR)L"a 1\tb2c3", lstrlenW(L"a 1\tb2c3"), &rect, DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK, &dtp); + todo_wine ok(dtp.uiLengthDrawn == 8, "Unexpected uiLengthDrawn %d\n", dtp.uiLengthDrawn ); + + memset(&dtp, 0, sizeof(dtp)); + dtp.cbSize = sizeof(dtp); + textheight = DrawTextExW(hdc, (LPWSTR)L"a 1\tb2c3", lstrlenW(L"a 1\tb2c3"), &rect, DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT, &dtp); + ok(dtp.uiLengthDrawn == 8, "Unexpected uiLengthDrawn %d\n", dtp.uiLengthDrawn ); + + memset(&dtp, 0, sizeof(dtp)); + dtp.cbSize = sizeof(dtp); + textheight = DrawTextExW(hdc, (LPWSTR)L" a1b2c3", lstrlenW(L" a1b2c3"), &rect, DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK, &dtp); + todo_wine ok(dtp.uiLengthDrawn == 7, "Unexpected uiLengthDrawn %d\n", dtp.uiLengthDrawn ); + + memset(&dtp, 0, sizeof(dtp)); + dtp.cbSize = sizeof(dtp); + textheight = DrawTextExW(hdc, (LPWSTR)L" a1b2c3", lstrlenW(L" a1b2c3"), &rect, DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT, &dtp); + ok(dtp.uiLengthDrawn == 7, "Unexpected uiLengthDrawn %d\n", dtp.uiLengthDrawn ); SelectObject(hdc, hOldFont); ret = DeleteObject(hFont); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8177
This merge request was closed by JiangYi Chen. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8177
participants (2)
-
chenjiangyi -
JiangYi Chen (@meshine)