mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 07:52:56 +00:00
- test GetTextFaceW instead of GetTextFaceA
- test that: - the last error is never set - the buffer size is ignored if the buffer is NULL - the buffer size is returned if the buffer is non-NULL and too small - the function fails if a non-NULL buffer has a size <= 0 - allocate the DC for a GDI test with a GDI routine (CreateCompatibleDC) instead of an USER routine (GetDC) svn path=/trunk/; revision=36779
This commit is contained in:
parent
97d55c7685
commit
8c7bebfed8
1 changed files with 50 additions and 7 deletions
|
@ -4,22 +4,65 @@ Test_GetTextFace(PTESTINFO pti)
|
||||||
{
|
{
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
INT ret;
|
INT ret;
|
||||||
CHAR Buffer[20];
|
INT ret2;
|
||||||
|
WCHAR Buffer[20];
|
||||||
|
|
||||||
hDC = GetDC(NULL);
|
hDC = CreateCompatibleDC(NULL);
|
||||||
ASSERT(hDC);
|
ASSERT(hDC);
|
||||||
|
|
||||||
ret = GetTextFaceA(hDC, 0, NULL);
|
/* Whether asking for the string size (NULL buffer) ignores the size argument */
|
||||||
|
SetLastError(0xE000BEEF);
|
||||||
|
ret = GetTextFaceW(hDC, 0, NULL);
|
||||||
TEST(ret != 0);
|
TEST(ret != 0);
|
||||||
|
TEST(GetLastError() == 0xE000BEEF);
|
||||||
|
ret2 = ret;
|
||||||
|
|
||||||
ret = GetTextFaceA(hDC, 20, Buffer);
|
SetLastError(0xE000BEEF);
|
||||||
|
ret = GetTextFaceW(hDC, -1, NULL);
|
||||||
TEST(ret != 0);
|
TEST(ret != 0);
|
||||||
|
TEST(ret == ret2);
|
||||||
|
TEST(GetLastError() == 0xE000BEEF);
|
||||||
|
ret2 = ret;
|
||||||
|
|
||||||
ret = GetTextFaceA(hDC, 0, Buffer);
|
SetLastError(0xE000BEEF);
|
||||||
|
ret = GetTextFaceW(hDC, 10000, NULL);
|
||||||
|
TEST(ret != 0);
|
||||||
|
TEST(ret == ret2);
|
||||||
|
TEST(GetLastError() == 0xE000BEEF);
|
||||||
|
ret2 = ret;
|
||||||
|
|
||||||
|
/* Whether the buffer is correctly filled */
|
||||||
|
SetLastError(0xE000BEEF);
|
||||||
|
ret = GetTextFaceW(hDC, 20, Buffer);
|
||||||
|
TEST(ret != 0);
|
||||||
|
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(ret == 0);
|
||||||
|
TEST(GetLastError() == 0xE000BEEF);
|
||||||
|
|
||||||
ret = GetTextFaceA(hDC, 20, NULL);
|
SetLastError(0xE000BEEF);
|
||||||
TEST(ret != 0);
|
ret = GetTextFaceW(hDC, -1, Buffer);
|
||||||
|
TEST(ret == 0);
|
||||||
|
TEST(GetLastError() == 0xE000BEEF);
|
||||||
|
|
||||||
|
DeleteDC(hDC);
|
||||||
|
|
||||||
return APISTATUS_NORMAL;
|
return APISTATUS_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue