gdi32/tests: Some empty string tests for GetTextExtentPoint.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-11-14 00:38:39 +03:00 committed by Alexandre Julliard
parent b1c8e0591c
commit 0e92f07f41
1 changed files with 23 additions and 1 deletions

View File

@ -1410,6 +1410,7 @@ static void test_GetCharABCWidths(void)
static void test_text_extents(void)
{
static const WCHAR wt[] = {'O','n','e','\n','t','w','o',' ','3',0};
static const WCHAR emptyW[] = {0};
LPINT extents;
INT i, len, fit1, fit2, extents2[3];
LOGFONTA lf;
@ -1428,9 +1429,20 @@ static void test_text_extents(void)
hdc = GetDC(0);
hfont = SelectObject(hdc, hfont);
GetTextMetricsA(hdc, &tm);
GetTextExtentPointA(hdc, "o", 1, &sz);
ret = GetTextExtentPointA(hdc, "o", 1, &sz);
ok(ret, "got %d\n", ret);
ok(sz.cy == tm.tmHeight, "cy %d tmHeight %d\n", sz.cy, tm.tmHeight);
memset(&sz, 0xcc, sizeof(sz));
ret = GetTextExtentPointA(hdc, "o", 0, &sz);
ok(ret, "got %d\n", ret);
ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
memset(&sz, 0xcc, sizeof(sz));
ret = GetTextExtentPointA(hdc, "", 0, &sz);
ok(ret, "got %d\n", ret);
ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
SetLastError(0xdeadbeef);
GetTextExtentExPointW(hdc, wt, 1, 1, &fit1, &fit2, &sz1);
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
@ -1442,6 +1454,16 @@ static void test_text_extents(void)
return;
}
memset(&sz, 0xcc, sizeof(sz));
ret = GetTextExtentPointW(hdc, wt, 0, &sz);
ok(ret, "got %d\n", ret);
ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
memset(&sz, 0xcc, sizeof(sz));
ret = GetTextExtentPointW(hdc, emptyW, 0, &sz);
ok(ret, "got %d\n", ret);
ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
len = lstrlenW(wt);
extents = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof extents[0]);
extents[0] = 1; /* So that the increasing sequence test will fail