[ROSTESTS:APITESTS]
[reactos.git] / rostests / apitests / gdi32 / GetTextExtentExPoint.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for GetTextExtentExPoint
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8 #include <apitest.h>
9
10 #include <stdio.h>
11 #include <wingdi.h>
12 #include <winuser.h>
13
14 #define TEST(x) ok(x, #x"\n")
15 #define RTEST(x) ok(x, #x"\n")
16
17 void Test_GetTextExtentExPoint()
18 {
19 INT nFit;
20 SIZE size;
21 BOOL result;
22
23 SetLastError(0);
24
25 result = GetTextExtentExPointA(GetDC(0), "test", 4, 1000, &nFit, NULL, &size);
26 TEST(result == 1);
27 TEST(nFit == 4);
28 TEST(GetLastError() == 0);
29 printf("nFit = %d\n", nFit);
30
31 result = GetTextExtentExPointA(GetDC(0), "test", 4, 1, &nFit, NULL, &size);
32 TEST(result == 1);
33 TEST(nFit == 0);
34 TEST(GetLastError() == 0);
35 printf("nFit = %d\n", nFit);
36
37 result = GetTextExtentExPointA(GetDC(0), "test", 4, 0, &nFit, NULL, &size);
38 TEST(result == 1);
39 TEST(nFit == 0);
40 TEST(GetLastError() == 0);
41
42 result = GetTextExtentExPointA(GetDC(0), "test", 4, -1, &nFit, NULL, &size);
43 TEST(result == 1);
44 TEST(nFit == 4);
45 TEST(GetLastError() == 0);
46
47 result = GetTextExtentExPointA(GetDC(0), "test", 4, -2, &nFit, NULL, &size);
48 TEST(result == 0);
49 TEST(GetLastError() == 87);
50
51 result = GetTextExtentExPointW(GetDC(0), L"test", 4, -10, &nFit, NULL, &size);
52 TEST(result == 1);
53
54 result = GetTextExtentExPointA(GetDC(0), "test", 4, -10, &nFit, NULL, &size);
55 TEST(result == 0);
56 }
57
58 START_TEST(GetTextExtentExPoint)
59 {
60 Test_GetTextExtentExPoint();
61 }
62