[RAPPS] Stopped GCC whining (fixed GCC build)
[reactos.git] / rostests / apitests / gdi32 / SetBrushOrgEx.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for SetBrushOrgEx
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8 #include <apitest.h>
9
10 #include <wingdi.h>
11
12 void Test_Set(ULONG ulLine, HDC hdc, INT x, INT y, LPPOINT ppt, BOOL bExp, DWORD dwErrExp)
13 {
14 BOOL bResult;
15
16 SetLastError(0);
17
18 _SEH2_TRY
19 {
20 bResult = SetBrushOrgEx(hdc, x, y, ppt);
21 }
22 _SEH2_EXCEPT(1)
23 {
24 bResult = -1;
25 }
26 _SEH2_END;
27
28 ok(bResult == bExp, "line %ld: Wrong result, expected %d, got %d\n",
29 ulLine, bExp, bResult);
30 ok(GetLastError() == dwErrExp,"line %ld: Wrong error, expected %lx, got %lx\n",
31 ulLine, dwErrExp, GetLastError());
32 }
33
34 #define TEST_SET(hdc, x, y, ppt, bExp, dwErrExp) \
35 Test_Set(__LINE__, hdc, x, y, ppt, bExp, dwErrExp)
36
37 void Test_SetBrushOrgEx()
38 {
39 HDC hdc;
40 POINT ptOldOrg;
41
42 hdc = CreateCompatibleDC(0);
43 ok(hdc != 0, "could not ceate DC\n");
44
45 TEST_SET(0, 0, 0, NULL, 0, ERROR_INVALID_HANDLE);
46 TEST_SET(0, 0, 0, (LPPOINT)-1, 0, ERROR_INVALID_HANDLE);
47 TEST_SET(0, 0, 0, &ptOldOrg, 0, ERROR_INVALID_HANDLE);
48 TEST_SET(hdc, 1, 2, &ptOldOrg, 1, 0);
49 ok_long(ptOldOrg.x, 0);
50 ok_long(ptOldOrg.y, 0);
51 SetBrushOrgEx(hdc, 0, 0, &ptOldOrg);
52 ok_long(ptOldOrg.x, 1);
53 ok_long(ptOldOrg.y, 2);
54
55 ptOldOrg.x = 0; ptOldOrg.y = 0;
56 TEST_SET(hdc, 1, 2, (LPPOINT)-1, -1, 0);
57 SetBrushOrgEx(hdc, 0, 0, &ptOldOrg);
58 ok_long(ptOldOrg.x, 0);
59 ok_long(ptOldOrg.y, 0);
60
61
62 TEST_SET(hdc, -10000, -20000000, &ptOldOrg, 1, 0);
63 ok_long(ptOldOrg.x, 0);
64 ok_long(ptOldOrg.y, 0);
65 SetBrushOrgEx(hdc, 0, 0, &ptOldOrg);
66 ok_long(ptOldOrg.x, -10000);
67 ok_long(ptOldOrg.y, -20000000);
68
69
70 }
71
72 START_TEST(SetBrushOrgEx)
73 {
74 Test_SetBrushOrgEx();
75 }
76