ReactOS 0.4.16-dev-197-g92996da
GetSystemMetrics.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for GetSystemMetrics
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8#include "precomp.h"
9
11{
12 INT ret;
13 HDC hDC;
14 BOOL BoolVal;
15 UINT UintVal;
16 RECT rect;
17
18 SetLastError(0);
19 hDC = GetDC(0);
20
22 ok(ret > 0, "ret = %d\n", ret);
23
25 ok(ret == 0, "ret = %d\n", ret);
27 ok(ret == 0, "ret = %d\n", ret);
29 ok(ret == 0, "ret = %d\n", ret);
30
31
33 ok(ret == GetDeviceCaps(hDC, HORZRES), "ret = %d\n", ret);
34 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
35
37 ok(ret == GetDeviceCaps(hDC, VERTRES), "ret = %d\n", ret);
38 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
39
41// TEST(ret == 0);
42 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
43
45// TEST(ret == 0);
46 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
47
49// TEST(ret == 0);
50 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
51
53 SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0);
54 ok(ret == UintVal, "ret = %d\n", ret);
55 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
56
58 SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0);
59 ok(ret == UintVal, "ret = %d\n", ret);
60 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
61
63// TEST(ret == 0);
64 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
65
67// TEST(ret == 0);
68 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
69
71// TEST(ret == 0);
72 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
73
75// TEST(ret == 0);
76 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
77
79// TEST(ret == 0);
80 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
81
83// TEST(ret == 0);
84 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
85
87// TEST(ret == 0);
88 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
89
91// TEST(ret == 0);
92 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
93
95// TEST(ret == 0);
96 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
97
98 SystemParametersInfoW(SPI_GETWORKAREA, 0, &rect, 0);
100 ok(ret == rect.right, "ret = %d\n", ret);
101 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
102
104 ok(ret == rect.bottom - rect.top - GetSystemMetrics(SM_CYCAPTION), "ret = %d\n", ret);
105 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
106
108// TEST(ret == 0);
109 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
110
112 ok(ret == 1, "ret = %d", ret);
113 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
114
116// TEST(ret == 0);
117 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
118
120// TEST(ret == 0);
121 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
122
124// TEST(ret == 0);
125 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
126
128// TEST(ret == 0);
129 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
130
132// TEST(ret == 0);
133 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
134
136// TEST(ret == 0);
137 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
138
140// TEST(ret == 0);
141 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
142
144// TEST(ret == 0);
145 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
146
148// TEST(ret == 0);
149 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
150
152// TEST(ret == 0);
153 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
154
156// TEST(ret == 0);
157 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
158
160// TEST(ret == 0);
161 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
162
164// TEST(ret == 0);
165 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
166
168// TEST(ret == 0);
169 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
170
172// TEST(ret == 0);
173 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
174
176// TEST(ret == 0);
177 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
178
180// TEST(ret == 0);
181 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
182
184// TEST(ret == 0);
185 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
186
188// TEST(ret == 0);
189 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
190
192// TEST(ret == 0);
193 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
194
196// TEST(ret == 0);
197 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
198
200// TEST(ret == 0);
201 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
202
204// TEST(ret == 0);
205 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
206
208// TEST(ret == 0);
209 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
210
211#if(WINVER >= 0x0400)
213// TEST(ret == 0);
214 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
215
217// TEST(ret == 0);
218 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
219
221// TEST(ret == 0);
222 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
223
225// TEST(ret == 0);
226 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
227
229// TEST(ret == 0);
230 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
231
233// TEST(ret == 0);
234 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
235
237// TEST(ret == 0);
238 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
239
241// TEST(ret == 0);
242 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
243
245// TEST(ret == 0);
246 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
247
249// TEST(ret == 0);
250 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
251
253// TEST(ret == 0);
254 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
255
257// TEST(ret == 0);
258 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
259
261// TEST(ret == 0);
262 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
263
265// TEST(ret == 0);
266 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
267
269// TEST(ret == 0);
270 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
271
273// TEST(ret == 0);
274 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
275
277// TEST(ret == 0);
278 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
279
281// TEST(ret == 0);
282 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
283
285// TEST(ret == 0);
286 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
287
289// TEST(ret == 0);
290 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
291
293// TEST(ret == 0);
294 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
295
297// TEST(ret == 0);
298 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
299
301// TEST(ret == 0);
302 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
303
306 ok(ret == BoolVal, "ret = %d\n", ret);
307 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
308
310// TEST(ret == 0);
311 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
312
314// TEST(ret == 0);
315 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
316
318// TEST(ret == 0);
319 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
320
322// TEST(ret == 0);
323 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
324#endif
325
326#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
328// TEST(ret == 0);
329 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
330#endif
331
332#if(WINVER >= 0x0500)
334// TEST(ret == 0);
335 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
336
338// TEST(ret == 0);
339 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
340
342// TEST(ret == 0);
343 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
344
346// TEST(ret == 0);
347 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
348
350// TEST(ret == 0);
351 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
352
354// TEST(ret == 0);
355 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
356#endif
357
358#if(_WIN32_WINNT >= 0x0500)
359 ret = GetSystemMetrics(SM_IMMENABLED);
360 ok(ret == 0 || ret == 1, "ret = %d\n", ret);
361 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
362#endif
363
364#if(_WIN32_WINNT >= 0x0501)
365 ret = GetSystemMetrics(SM_CXFOCUSBORDER);
366 SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0);
367 ok(ret == UintVal, "ret = %d\n", ret);
368 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
369
370 ret = GetSystemMetrics(SM_CYFOCUSBORDER);
371 SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0);
372 ok(ret == UintVal, "ret = %d\n", ret);
373 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
374
375 ret = GetSystemMetrics(SM_TABLETPC);
376// TEST(ret == 0);
377 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
378
379 ret = GetSystemMetrics(SM_MEDIACENTER);
380// TEST(ret == 0);
381 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
382
383 ret = GetSystemMetrics(SM_STARTER);
384// TEST(ret == 0);
385 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
386
387 ret = GetSystemMetrics(SM_SERVERR2);
388// TEST(ret == 0);
389 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
390#endif
391
392#if(_WIN32_WINNT >= 0x0600)
393 ret = GetSystemMetrics(SM_MOUSEHORIZONTALWHEELPRESENT);
394// TEST(ret == 0);
395 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
396
397 ret = GetSystemMetrics(SM_CXPADDEDBORDER);
398// TEST(ret == 0);
399 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError());
400#endif
401
402}
403
405{
407}
static HDC hDC
Definition: 3dtext.c:33
void Test_GetSystemMetrics()
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
static HDC
Definition: imagelist.c:88
unsigned int UINT
Definition: ndis.h:50
& rect
Definition: startmenu.cpp:1413
int32_t INT
Definition: typedefs.h:58
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HORZRES
Definition: wingdi.h:716
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define VERTRES
Definition: wingdi.h:717
#define SM_MENUDROPALIGNMENT
Definition: winuser.h:1006
#define SM_CXMINIMIZED
Definition: winuser.h:1023
#define SM_NETWORK
Definition: winuser.h:1029
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1042
#define SM_CYEDGE
Definition: winuser.h:1012
#define SM_MIDEASTENABLED
Definition: winuser.h:1037
#define SM_CXDRAG
Definition: winuser.h:1031
#define SM_CXDOUBLECLK
Definition: winuser.h:1002
#define SPI_GETSHOWSOUNDS
Definition: winuser.h:1408
#define SM_CXHTHUMB
Definition: winuser.h:974
#define SM_CYSCREEN
Definition: winuser.h:963
#define SM_RESERVED3
Definition: winuser.h:990
#define SM_CXEDGE
Definition: winuser.h:1011
#define SM_CYVSCROLL
Definition: winuser.h:984
#define SM_CMOUSEBUTTONS
Definition: winuser.h:1009
#define SM_CXMENUCHECK
Definition: winuser.h:1034
#define SM_CYSIZE
Definition: winuser.h:995
#define SM_PENWINDOWS
Definition: winuser.h:1007
#define SM_CXMINTRACK
Definition: winuser.h:1000
#define SM_MOUSEPRESENT
Definition: winuser.h:983
#define SM_CXVSCROLL
Definition: winuser.h:964
#define SM_SAMEDISPLAYFORMAT
Definition: winuser.h:1044
#define SM_CYVTHUMB
Definition: winuser.h:973
#define SM_CYMINIMIZED
Definition: winuser.h:1024
#define SM_DEBUG
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:997
#define SM_CYICONSPACING
Definition: winuser.h:1005
#define SM_MOUSEWHEELPRESENT
Definition: winuser.h:1038
#define SM_CYMENU
Definition: winuser.h:979
#define SM_CYSMICON
Definition: winuser.h:1016
#define SM_CYDOUBLECLK
Definition: winuser.h:1003
#define SM_CXSIZE
Definition: winuser.h:994
#define SM_CYFRAME
Definition: winuser.h:999
#define SM_CYHSCROLL
Definition: winuser.h:965
#define SM_CXFULLSCREEN
Definition: winuser.h:980
#define SM_RESERVED1
Definition: winuser.h:988
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1041
#define SM_CXMIN
Definition: winuser.h:992
#define SM_CYBORDER
Definition: winuser.h:968
#define SM_CXSMICON
Definition: winuser.h:1015
#define SM_CYMIN
Definition: winuser.h:993
#define SM_CYMENUCHECK
Definition: winuser.h:1035
#define SM_CYICON
Definition: winuser.h:976
#define SM_CXMAXTRACK
Definition: winuser.h:1025
#define SM_CXMAXIMIZED
Definition: winuser.h:1027
#define SM_CYMINSPACING
Definition: winuser.h:1014
#define SM_CXSMSIZE
Definition: winuser.h:1018
#define SM_CXBORDER
Definition: winuser.h:967
#define SM_RESERVED2
Definition: winuser.h:989
#define SM_CYMAXTRACK
Definition: winuser.h:1026
#define SM_CYFULLSCREEN
Definition: winuser.h:981
HDC WINAPI GetDC(_In_opt_ HWND)
#define SM_DBCSENABLED
Definition: winuser.h:1008
#define SM_CXDLGFRAME
Definition: winuser.h:969
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define SM_CYKANJIWINDOW
Definition: winuser.h:982
#define SM_CXHSCROLL
Definition: winuser.h:985
#define SM_RESERVED4
Definition: winuser.h:991
#define SM_SHOWSOUNDS
Definition: winuser.h:1033
#define SM_CXMENUSIZE
Definition: winuser.h:1020
#define SM_ARRANGE
Definition: winuser.h:1022
#define SM_CYSMCAPTION
Definition: winuser.h:1017
#define SM_CYSMSIZE
Definition: winuser.h:1019
#define SM_CYDLGFRAME
Definition: winuser.h:971
#define SM_CLEANBOOT
Definition: winuser.h:1030
#define SM_CXSCREEN
Definition: winuser.h:962
#define SM_SWAPBUTTON
Definition: winuser.h:987
#define SM_SLOWMACHINE
Definition: winuser.h:1036
#define SM_CYMENUSIZE
Definition: winuser.h:1021
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1039
#define SM_CYCURSOR
Definition: winuser.h:978
#define SM_CYDRAG
Definition: winuser.h:1032
#define SM_CXICON
Definition: winuser.h:975
#define SM_CMONITORS
Definition: winuser.h:1043
#define SM_CYMAXIMIZED
Definition: winuser.h:1028
#define SM_CYCAPTION
Definition: winuser.h:966
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CYMINTRACK
Definition: winuser.h:1001
#define SM_CXICONSPACING
Definition: winuser.h:1004
#define SM_CXMINSPACING
Definition: winuser.h:1013
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1040
#define SM_SECURE
Definition: winuser.h:1010
#define SM_CXCURSOR
Definition: winuser.h:977