2008-10-16 20:16:38 +00:00
|
|
|
|
|
|
|
INT
|
|
|
|
Test_GetTextFace(PTESTINFO pti)
|
|
|
|
{
|
|
|
|
HDC hDC;
|
|
|
|
INT ret;
|
2008-10-17 00:28:47 +00:00
|
|
|
INT ret2;
|
|
|
|
WCHAR Buffer[20];
|
2008-10-16 20:16:38 +00:00
|
|
|
|
2008-10-17 00:28:47 +00:00
|
|
|
hDC = CreateCompatibleDC(NULL);
|
2008-10-16 20:16:38 +00:00
|
|
|
ASSERT(hDC);
|
|
|
|
|
2008-10-17 00:28:47 +00:00
|
|
|
/* Whether asking for the string size (NULL buffer) ignores the size argument */
|
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, 0, NULL);
|
2008-10-16 20:16:38 +00:00
|
|
|
TEST(ret != 0);
|
2008-10-17 00:28:47 +00:00
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
ret2 = ret;
|
2008-10-16 20:16:38 +00:00
|
|
|
|
2008-10-17 00:28:47 +00:00
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, -1, NULL);
|
2008-10-16 20:16:38 +00:00
|
|
|
TEST(ret != 0);
|
2008-10-17 00:28:47 +00:00
|
|
|
TEST(ret == ret2);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
ret2 = ret;
|
2008-10-16 20:16:38 +00:00
|
|
|
|
2008-10-17 00:28:47 +00:00
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, 10000, NULL);
|
|
|
|
TEST(ret != 0);
|
|
|
|
TEST(ret == ret2);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
ret2 = ret;
|
2008-10-16 20:16:38 +00:00
|
|
|
|
2008-10-17 00:28:47 +00:00
|
|
|
/* Whether the buffer is correctly filled */
|
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, 20, Buffer);
|
2008-10-16 20:16:38 +00:00
|
|
|
TEST(ret != 0);
|
2008-10-17 00:28:47 +00:00
|
|
|
TEST(ret <= 20);
|
|
|
|
TEST(Buffer[ret - 1] == 0);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
|
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, 1, Buffer);
|
|
|
|
TEST(ret == 1);
|
|
|
|
TEST(Buffer[ret - 1] == 0);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
|
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, 2, Buffer);
|
|
|
|
TEST(ret == 2);
|
|
|
|
TEST(Buffer[ret - 1] == 0);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
|
|
|
|
/* Whether invalid buffer sizes are correctly ignored */
|
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, 0, Buffer);
|
|
|
|
TEST(ret == 0);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
|
|
|
|
SetLastError(0xE000BEEF);
|
|
|
|
ret = GetTextFaceW(hDC, -1, Buffer);
|
|
|
|
TEST(ret == 0);
|
|
|
|
TEST(GetLastError() == 0xE000BEEF);
|
|
|
|
|
|
|
|
DeleteDC(hDC);
|
2008-10-16 20:16:38 +00:00
|
|
|
|
|
|
|
return APISTATUS_NORMAL;
|
|
|
|
}
|