[ROSTESTS:APITESTS]
[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 #include <pseh/pseh2.h>
12
13 void Test_Set(ULONG ulLine, HDC hdc, INT x, INT y, LPPOINT ppt, BOOL bExp, DWORD dwErrExp)
14 {
15 BOOL bResult;
16
17 SetLastError(0);
18
19 _SEH2_TRY
20 {
21 bResult = SetBrushOrgEx(hdc, x, y, ppt);
22 }
23 _SEH2_EXCEPT(1)
24 {
25 bResult = -1;
26 }
27 _SEH2_END;
28
29 ok(bResult == bExp, "line %ld: Wrong result, expected %d, got %d\n",
30 ulLine, bExp, bResult);
31 ok(GetLastError() == dwErrExp,"line %ld: Wrong error, expected %lx, got %lx\n",
32 ulLine, dwErrExp, GetLastError());
33 }
34
35 #define TEST_SET(hdc, x, y, ppt, bExp, dwErrExp) \
36 Test_Set(__LINE__, hdc, x, y, ppt, bExp, dwErrExp)
37
38 void Test_SetBrushOrgEx()
39 {
40 HDC hdc;
41 POINT ptOldOrg;
42
43 hdc = CreateCompatibleDC(0);
44 ok(hdc != 0, "could not ceate DC\n");
45
46 TEST_SET(0, 0, 0, NULL, 0, ERROR_INVALID_HANDLE);
47 TEST_SET(0, 0, 0, (LPPOINT)-1, 0, ERROR_INVALID_HANDLE);
48 TEST_SET(0, 0, 0, &ptOldOrg, 0, ERROR_INVALID_HANDLE);
49 TEST_SET(hdc, 1, 2, &ptOldOrg, 1, 0);
50 ok_long(ptOldOrg.x, 0);
51 ok_long(ptOldOrg.y, 0);
52 SetBrushOrgEx(hdc, 0, 0, &ptOldOrg);
53 ok_long(ptOldOrg.x, 1);
54 ok_long(ptOldOrg.y, 2);
55
56 ptOldOrg.x = 0; ptOldOrg.y = 0;
57 TEST_SET(hdc, 1, 2, (LPPOINT)-1, -1, 0);
58 SetBrushOrgEx(hdc, 0, 0, &ptOldOrg);
59 ok_long(ptOldOrg.x, 0);
60 ok_long(ptOldOrg.y, 0);
61
62
63 TEST_SET(hdc, -10000, -20000000, &ptOldOrg, 1, 0);
64 ok_long(ptOldOrg.x, 0);
65 ok_long(ptOldOrg.y, 0);
66 SetBrushOrgEx(hdc, 0, 0, &ptOldOrg);
67 ok_long(ptOldOrg.x, -10000);
68 ok_long(ptOldOrg.y, -20000000);
69
70
71 }
72
73 START_TEST(SetBrushOrgEx)
74 {
75 Test_SetBrushOrgEx();
76 }
77