74d594556366a56f7da0be48b6cbaf1743588f85
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for ...
5 * PROGRAMMERS: Timo Kreuzer
12 void Test_DPtoLP_Params()
22 SetLastError(ERROR_SUCCESS
);
23 ok_int(DPtoLP(NULL
, NULL
, 0), 1);
24 ok_err(ERROR_SUCCESS
);
26 ok_int(DPtoLP(NULL
, NULL
, -1), 1);
27 ok_err(ERROR_SUCCESS
);
29 ok_int(DPtoLP(NULL
, (PVOID
)0x80000000, -1), 1);
30 ok_err(ERROR_SUCCESS
);
32 ok_int(DPtoLP(NULL
, NULL
, 2), 0);
33 ok_err(ERROR_INVALID_PARAMETER
);
35 SetLastError(ERROR_SUCCESS
);
36 ok_int(DPtoLP(NULL
, apt
, 2), 0);
37 ok_err(ERROR_INVALID_PARAMETER
);
39 SetLastError(ERROR_SUCCESS
);
40 ok_int(DPtoLP(NULL
, apt
, 0), 1);
41 ok(GetLastError() == ERROR_SUCCESS
, "Exected ERROR_SUCCESS, got %ld\n", GetLastError());
43 SetLastError(ERROR_SUCCESS
);
44 ok_int(DPtoLP(NULL
, apt
, -2), 1);
45 ok_err(ERROR_SUCCESS
);
47 SetLastError(ERROR_SUCCESS
);
48 ok_int(DPtoLP((HDC
)-4, apt
, -2), 1);
49 ok_err(ERROR_SUCCESS
);
52 SetLastError(ERROR_SUCCESS
);
53 ok_int(DPtoLP(hdc
, NULL
, 2), 1);
54 ok_err(ERROR_SUCCESS
);
57 SetLastError(ERROR_SUCCESS
);
58 ok_int(DPtoLP(hdc
, (PVOID
)0x80000000, 2), 1);
59 ok_err(ERROR_SUCCESS
);
70 LONG lLogPixelsX
, lLogPixelsY
;
78 lLogPixelsX
= GetDeviceCaps(hdc
, LOGPIXELSX
);
79 lLogPixelsY
= GetDeviceCaps(hdc
, LOGPIXELSY
);
81 SetMapMode(hdc
, MM_TEXT
);
82 ok_int(DPtoLP(hdc
, apt
, 2), 1);
85 ok_int(apt
[1].x
, -1000);
86 ok_int(apt
[1].y
, 1000);
88 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
89 SetMapMode(hdc
, MM_LOMETRIC
);
90 ok_int(DPtoLP(hdc
, apt
, 2), 1);
91 ok_int(apt
[0].x
* lLogPixelsX
, 33888 );
92 ok_int(apt
[0].y
* lLogPixelsY
, -86688 );
93 ok_int(apt
[1].x
* lLogPixelsX
, -338688 );
94 ok_int(apt
[1].y
* lLogPixelsY
, -338688 );
95 SetGraphicsMode(hdc
, GM_ADVANCED
);
96 SetMapMode(hdc
, MM_ANISOTROPIC
);
102 xform
.eDx
= (FLOAT
)4294967167.999999761;
104 ok_int(SetWorldTransform(hdc
, &xform
), 1);
106 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
107 ok_int(DPtoLP(hdc
, apt
, 2), 1);
108 ok_int(apt
[0].x
* lLogPixelsX
, 58464 );
109 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
110 ok_int(apt
[1].x
* lLogPixelsX
, -314112 );
111 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
113 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
114 xform
.eM11
= 10000000.;
115 ok_int(SetWorldTransform(hdc
, &xform
), 1);
116 ok_int(DPtoLP(hdc
, apt
, 2), 1);
117 ok_int(apt
[0].x
* lLogPixelsX
, -41184 );
118 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
119 ok_int(apt
[1].x
* lLogPixelsX
, -41184 );
120 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
122 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
124 xform
.eDx
= (FLOAT
)4294967167.999999762; // this is too big
125 ok_int(SetWorldTransform(hdc
, &xform
), 1);
126 ok_int(DPtoLP(hdc
, apt
, 2), 0);
127 ok_int(apt
[0].x
, 100 );
128 ok_int(apt
[0].y
, 256 );
129 ok_int(apt
[1].x
, -1000 );
130 ok_int(apt
[1].y
, 1000 );
133 xform
.eDx
= (FLOAT
)4294967167.999999762;
134 ok_int(SetWorldTransform(hdc
, &xform
), 1);
135 ok_int(DPtoLP(hdc
, apt
, 2), 1);
136 ok_int(apt
[0].x
* lLogPixelsX
, 16896 );
137 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
138 ok_int(apt
[1].x
* lLogPixelsX
, -169344 );
139 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
141 apt
[0].x
= 100; apt
[0].y
= 256; apt
[1].x
= -1000; apt
[1].y
= 1000;
142 xform
.eM11
= 10000000.;
143 ok_int(SetWorldTransform(hdc
, &xform
), 1);
144 ok_int(DPtoLP(hdc
, apt
, 2), 1);
145 ok_int(apt
[0].x
* lLogPixelsX
, -41184 );
146 ok_int(apt
[0].y
* lLogPixelsY
, -86784 );
147 ok_int(apt
[1].x
* lLogPixelsX
, -41184 );
148 ok_int(apt
[1].y
* lLogPixelsY
, -338784 );
150 xform
.eM11
= 1000000.;
151 ok_int(SetWorldTransform(hdc
, &xform
), 1);
152 ok_int(DPtoLP(hdc
, apt
, 2), 1);
153 ok_int(apt
[0].x
* lLogPixelsX
, -412320 );
154 ok_int(apt
[0].y
* lLogPixelsY
, 306048 );
155 ok_int(apt
[1].x
* lLogPixelsX
, -412320 );
156 ok_int(apt
[1].y
* lLogPixelsY
, 1195104 );
163 Test_DPtoLP_Params();