2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for ...
5 * PROGRAMMERS: Timo Kreuzer
13 void Test_DPtoLP_Params()
23 SetLastError(ERROR_SUCCESS
);
24 ok_int(DPtoLP(NULL
, NULL
, 0), 1);
25 ok_err(ERROR_SUCCESS
);
27 ok_int(DPtoLP(NULL
, NULL
, -1), 1);
28 ok_err(ERROR_SUCCESS
);
30 ok_int(DPtoLP(NULL
, (PVOID
)0x80000000, -1), 1);
31 ok_err(ERROR_SUCCESS
);
33 ok_int(DPtoLP(NULL
, NULL
, 2), 0);
34 ok_err(ERROR_INVALID_PARAMETER
);
36 SetLastError(ERROR_SUCCESS
);
37 ok_int(DPtoLP(NULL
, apt
, 2), 0);
38 ok_err(ERROR_INVALID_PARAMETER
);
40 SetLastError(ERROR_SUCCESS
);
41 ok_int(DPtoLP(NULL
, apt
, 0), 1);
42 ok(GetLastError() == ERROR_SUCCESS
, "Exected ERROR_SUCCESS, got %ld\n", GetLastError());
44 SetLastError(ERROR_SUCCESS
);
45 ok_int(DPtoLP(NULL
, apt
, -2), 1);
46 ok_err(ERROR_SUCCESS
);
48 SetLastError(ERROR_SUCCESS
);
49 ok_int(DPtoLP((HDC
)-4, apt
, -2), 1);
50 ok_err(ERROR_SUCCESS
);
53 SetLastError(ERROR_SUCCESS
);
54 ok_int(DPtoLP(hdc
, NULL
, 2), 1);
55 ok_err(ERROR_SUCCESS
);
58 SetLastError(ERROR_SUCCESS
);
59 ok_int(DPtoLP(hdc
, (PVOID
)0x80000000, 2), 1);
60 ok_err(ERROR_SUCCESS
);
71 LONG lLogPixelsX
, lLogPixelsY
;
79 lLogPixelsX
= GetDeviceCaps(hdc
, LOGPIXELSX
);
80 lLogPixelsY
= GetDeviceCaps(hdc
, LOGPIXELSY
);
82 SetMapMode(hdc
, MM_TEXT
);
83 ok_int(DPtoLP(hdc
, apt
, 2), 1);
86 ok_int(apt
[1].x
, -1000);
87 ok_int(apt
[1].y
, 1000);
89 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
90 SetMapMode(hdc
, MM_LOMETRIC
);
91 ok_int(DPtoLP(hdc
, apt
, 2), 1);
92 ok_int(apt
[0].x
* lLogPixelsX
, 33888 );
93 ok_int(apt
[0].y
* lLogPixelsY
, -86688 );
94 ok_int(apt
[1].x
* lLogPixelsX
, -338688 );
95 ok_int(apt
[1].y
* lLogPixelsY
, -338688 );
96 SetGraphicsMode(hdc
, GM_ADVANCED
);
97 SetMapMode(hdc
, MM_ANISOTROPIC
);
103 xform
.eDx
= (FLOAT
)4294967167.999999761;
105 ok_int(SetWorldTransform(hdc
, &xform
), 1);
107 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
108 ok_int(DPtoLP(hdc
, apt
, 2), 1);
109 ok_int(apt
[0].x
* lLogPixelsX
, 58464 );
110 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
111 ok_int(apt
[1].x
* lLogPixelsX
, -314112 );
112 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
114 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
115 xform
.eM11
= 10000000.;
116 ok_int(SetWorldTransform(hdc
, &xform
), 1);
117 ok_int(DPtoLP(hdc
, apt
, 2), 1);
118 ok_int(apt
[0].x
* lLogPixelsX
, -41184 );
119 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
120 ok_int(apt
[1].x
* lLogPixelsX
, -41184 );
121 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
123 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
125 xform
.eDx
= (FLOAT
)4294967167.999999762; // this is too big
126 ok_int(SetWorldTransform(hdc
, &xform
), 1);
127 ok_int(DPtoLP(hdc
, apt
, 2), 0);
128 ok_int(apt
[0].x
, 100 );
129 ok_int(apt
[0].y
, 256 );
130 ok_int(apt
[1].x
, -1000 );
131 ok_int(apt
[1].y
, 1000 );
134 xform
.eDx
= (FLOAT
)4294967167.999999762;
135 ok_int(SetWorldTransform(hdc
, &xform
), 1);
136 ok_int(DPtoLP(hdc
, apt
, 2), 1);
137 ok_int(apt
[0].x
* lLogPixelsX
, 16896 );
138 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
139 ok_int(apt
[1].x
* lLogPixelsX
, -169344 );
140 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
142 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
143 xform
.eM11
= 10000000.;
144 ok_int(SetWorldTransform(hdc
, &xform
), 1);
145 ok_int(DPtoLP(hdc
, apt
, 2), 1);
146 ok_int(apt
[0].x
* lLogPixelsX
, -41184 );
147 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
148 ok_int(apt
[1].x
* lLogPixelsX
, -41184 );
149 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
151 xform
.eM11
= 1000000.;
152 ok_int(SetWorldTransform(hdc
, &xform
), 1);
153 ok_int(DPtoLP(hdc
, apt
, 2), 1);
154 ok_int(apt
[0].x
* lLogPixelsX
, -412320 );
155 ok_int(apt
[0].y
* lLogPixelsY
, 306048 );
156 ok_int(apt
[1].x
* lLogPixelsX
, -412320 );
157 ok_int(apt
[1].y
* lLogPixelsY
, 1195104 );
164 Test_DPtoLP_Params();