From 67cff368bd607716c627550e71d30cd3e4f906b4 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 26 Mar 2008 14:53:55 -0700 Subject: [PATCH] user32: add a DrawText test for bug 12226. --- dlls/user32/tests/text.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c index 01bd306..e0d09c8 100644 --- a/dlls/user32/tests/text.c +++ b/dlls/user32/tests/text.c @@ -288,9 +288,49 @@ static void test_DrawState(void) DestroyWindow(hwnd); } +static void test_Bug12226(void) +{ + HWND hwnd; + HDC hdc; + INT height; + RECT rect = { 0, 0, 0, 0 }; + RECT rectW = { 0, 0, 0, 0 }; + static WCHAR emptystringW[] = { 0 }; + BOOL ret; + + hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, + 0, 0, 200, 200, 0, 0, 0, NULL); + ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError()); + hdc = GetDC(hwnd); + ok(hdc != 0, "GetDC error %u\n", GetLastError()); + + height = DrawTextA(hdc, "", -1, &rect, + DT_CALCRECT | DT_LEFT | DT_SINGLELINE); + todo_wine ok(16 == height, "expected %d, got %d\n", 16, height); + ok(0 == rect.left, "expected %d, got %d\n", 0, rect.left); + ok(0 == rect.right, "expected %d, got %d\n", 0, rect.right); + ok(0 == rect.top, "expected %d, got %d\n", 0, rect.top); + todo_wine ok(16 == rect.bottom, "expected %d, got %d\n", 16, rect.bottom); + + height = DrawTextW(hdc, emptystringW, -1, &rectW, + DT_CALCRECT | DT_LEFT | DT_SINGLELINE); + todo_wine ok(16 == height, "expected %d, got %d\n", 16, height); + ok(0 == rect.left, "expected %d, got %d\n", 0, rect.left); + ok(0 == rect.right, "expected %d, got %d\n", 0, rect.right); + ok(0 == rect.top, "expected %d, got %d\n", 0, rect.top); + todo_wine ok(16 == rect.bottom, "expected %d, got %d\n", 16, rect.bottom); + + /* Clean up */ + ret = ReleaseDC(hwnd, hdc); + ok( ret, "ReleaseDC error %u\n", GetLastError()); + ret = DestroyWindow(hwnd); + ok( ret, "DestroyWindow error %u\n", GetLastError()); +} + START_TEST(text) { test_TabbedText(); test_DrawTextCalcRect(); test_DrawState(); + test_Bug12226(); } -- 1.5.2.5