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 <apitest.h> 9 10 #include <wingdi.h> 11 #include <winuser.h> 12 13 void Test_GetSystemMetrics() 14 { 15 INT ret; 16 HDC hDC; 17 BOOL BoolVal; 18 UINT UintVal; 19 RECT rect; 20 21 SetLastError(0); 22 hDC = GetDC(0); 23 24 ret = GetSystemMetrics(0); 25 ok(ret > 0, "ret = %d\n", ret); 26 27 ret = GetSystemMetrics(64); 28 ok(ret == 0, "ret = %d\n", ret); 29 ret = GetSystemMetrics(65); 30 ok(ret == 0, "ret = %d\n", ret); 31 ret = GetSystemMetrics(66); 32 ok(ret == 0, "ret = %d\n", ret); 33 34 35 ret = GetSystemMetrics(SM_CXSCREEN); 36 ok(ret == GetDeviceCaps(hDC, HORZRES), "ret = %d\n", ret); 37 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 38 39 ret = GetSystemMetrics(SM_CYSCREEN); 40 ok(ret == GetDeviceCaps(hDC, VERTRES), "ret = %d\n", ret); 41 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 42 43 ret = GetSystemMetrics(SM_CXVSCROLL); 44 // TEST(ret == 0); 45 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 46 47 ret = GetSystemMetrics(SM_CYHSCROLL); 48 // TEST(ret == 0); 49 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 50 51 ret = GetSystemMetrics(SM_CYCAPTION); 52 // TEST(ret == 0); 53 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 54 55 ret = GetSystemMetrics(SM_CXBORDER); 56 SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0); 57 ok(ret == UintVal, "ret = %d\n", ret); 58 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 59 60 ret = GetSystemMetrics(SM_CYBORDER); 61 SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0); 62 ok(ret == UintVal, "ret = %d\n", ret); 63 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 64 65 ret = GetSystemMetrics(SM_CXDLGFRAME); 66 // TEST(ret == 0); 67 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 68 69 ret = GetSystemMetrics(SM_CYDLGFRAME); 70 // TEST(ret == 0); 71 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 72 73 ret = GetSystemMetrics(SM_CYVTHUMB); 74 // TEST(ret == 0); 75 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 76 77 ret = GetSystemMetrics(SM_CXHTHUMB); 78 // TEST(ret == 0); 79 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 80 81 ret = GetSystemMetrics(SM_CXICON); 82 // TEST(ret == 0); 83 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 84 85 ret = GetSystemMetrics(SM_CYICON); 86 // TEST(ret == 0); 87 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 88 89 ret = GetSystemMetrics(SM_CXCURSOR); 90 // TEST(ret == 0); 91 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 92 93 ret = GetSystemMetrics(SM_CYCURSOR); 94 // TEST(ret == 0); 95 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 96 97 ret = GetSystemMetrics(SM_CYMENU); 98 // TEST(ret == 0); 99 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 100 101 SystemParametersInfoW(SPI_GETWORKAREA, 0, &rect, 0); 102 ret = GetSystemMetrics(SM_CXFULLSCREEN); 103 ok(ret == rect.right, "ret = %d\n", ret); 104 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 105 106 ret = GetSystemMetrics(SM_CYFULLSCREEN); 107 ok(ret == rect.bottom - rect.top - GetSystemMetrics(SM_CYCAPTION), "ret = %d\n", ret); 108 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 109 110 ret = GetSystemMetrics(SM_CYKANJIWINDOW); 111 // TEST(ret == 0); 112 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 113 114 ret = GetSystemMetrics(SM_MOUSEPRESENT); 115 ok(ret == 1, "ret = %d", ret); 116 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 117 118 ret = GetSystemMetrics(SM_CYVSCROLL); 119 // TEST(ret == 0); 120 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 121 122 ret = GetSystemMetrics(SM_CXHSCROLL); 123 // TEST(ret == 0); 124 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 125 126 ret = GetSystemMetrics(SM_DEBUG); 127 // TEST(ret == 0); 128 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 129 130 ret = GetSystemMetrics(SM_SWAPBUTTON); 131 // TEST(ret == 0); 132 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 133 134 ret = GetSystemMetrics(SM_RESERVED1); 135 // TEST(ret == 0); 136 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 137 138 ret = GetSystemMetrics(SM_RESERVED2); 139 // TEST(ret == 0); 140 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 141 142 ret = GetSystemMetrics(SM_RESERVED3); 143 // TEST(ret == 0); 144 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 145 146 ret = GetSystemMetrics(SM_RESERVED4); 147 // TEST(ret == 0); 148 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 149 150 ret = GetSystemMetrics(SM_CXMIN); 151 // TEST(ret == 0); 152 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 153 154 ret = GetSystemMetrics(SM_CYMIN); 155 // TEST(ret == 0); 156 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 157 158 ret = GetSystemMetrics(SM_CXSIZE); 159 // TEST(ret == 0); 160 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 161 162 ret = GetSystemMetrics(SM_CYSIZE); 163 // TEST(ret == 0); 164 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 165 166 ret = GetSystemMetrics(SM_CXFRAME); 167 // TEST(ret == 0); 168 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 169 170 ret = GetSystemMetrics(SM_CYFRAME); 171 // TEST(ret == 0); 172 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 173 174 ret = GetSystemMetrics(SM_CXMINTRACK); 175 // TEST(ret == 0); 176 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 177 178 ret = GetSystemMetrics(SM_CYMINTRACK); 179 // TEST(ret == 0); 180 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 181 182 ret = GetSystemMetrics(SM_CXDOUBLECLK); 183 // TEST(ret == 0); 184 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 185 186 ret = GetSystemMetrics(SM_CYDOUBLECLK); 187 // TEST(ret == 0); 188 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 189 190 ret = GetSystemMetrics(SM_CXICONSPACING); 191 // TEST(ret == 0); 192 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 193 194 ret = GetSystemMetrics(SM_CYICONSPACING); 195 // TEST(ret == 0); 196 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 197 198 ret = GetSystemMetrics(SM_MENUDROPALIGNMENT); 199 // TEST(ret == 0); 200 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 201 202 ret = GetSystemMetrics(SM_PENWINDOWS); 203 // TEST(ret == 0); 204 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 205 206 ret = GetSystemMetrics(SM_DBCSENABLED); 207 // TEST(ret == 0); 208 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 209 210 ret = GetSystemMetrics(SM_CMOUSEBUTTONS); 211 // TEST(ret == 0); 212 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 213 214 #if(WINVER >= 0x0400) 215 ret = GetSystemMetrics(SM_SECURE); 216 // TEST(ret == 0); 217 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 218 219 ret = GetSystemMetrics(SM_CXEDGE); 220 // TEST(ret == 0); 221 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 222 223 ret = GetSystemMetrics(SM_CYEDGE); 224 // TEST(ret == 0); 225 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 226 227 ret = GetSystemMetrics(SM_CXMINSPACING); 228 // TEST(ret == 0); 229 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 230 231 ret = GetSystemMetrics(SM_CYMINSPACING); 232 // TEST(ret == 0); 233 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 234 235 ret = GetSystemMetrics(SM_CXSMICON); 236 // TEST(ret == 0); 237 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 238 239 ret = GetSystemMetrics(SM_CYSMICON); 240 // TEST(ret == 0); 241 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 242 243 ret = GetSystemMetrics(SM_CYSMCAPTION); 244 // TEST(ret == 0); 245 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 246 247 ret = GetSystemMetrics(SM_CXSMSIZE); 248 // TEST(ret == 0); 249 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 250 251 ret = GetSystemMetrics(SM_CYSMSIZE); 252 // TEST(ret == 0); 253 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 254 255 ret = GetSystemMetrics(SM_CXMENUSIZE); 256 // TEST(ret == 0); 257 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 258 259 ret = GetSystemMetrics(SM_CYMENUSIZE); 260 // TEST(ret == 0); 261 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 262 263 ret = GetSystemMetrics(SM_ARRANGE); 264 // TEST(ret == 0); 265 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 266 267 ret = GetSystemMetrics(SM_CXMINIMIZED); 268 // TEST(ret == 0); 269 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 270 271 ret = GetSystemMetrics(SM_CYMINIMIZED); 272 // TEST(ret == 0); 273 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 274 275 ret = GetSystemMetrics(SM_CXMAXTRACK); 276 // TEST(ret == 0); 277 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 278 279 ret = GetSystemMetrics(SM_CYMAXTRACK); 280 // TEST(ret == 0); 281 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 282 283 ret = GetSystemMetrics(SM_CXMAXIMIZED); 284 // TEST(ret == 0); 285 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 286 287 ret = GetSystemMetrics(SM_CYMAXIMIZED); 288 // TEST(ret == 0); 289 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 290 291 ret = GetSystemMetrics(SM_NETWORK); 292 // TEST(ret == 0); 293 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 294 295 ret = GetSystemMetrics(SM_CLEANBOOT); 296 // TEST(ret == 0); 297 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 298 299 ret = GetSystemMetrics(SM_CXDRAG); 300 // TEST(ret == 0); 301 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 302 303 ret = GetSystemMetrics(SM_CYDRAG); 304 // TEST(ret == 0); 305 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 306 307 ret = GetSystemMetrics(SM_SHOWSOUNDS); 308 SystemParametersInfoW(SPI_GETSHOWSOUNDS, 0, &BoolVal, 0); 309 ok(ret == BoolVal, "ret = %d\n", ret); 310 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 311 312 ret = GetSystemMetrics(SM_CXMENUCHECK); 313 // TEST(ret == 0); 314 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 315 316 ret = GetSystemMetrics(SM_CYMENUCHECK); 317 // TEST(ret == 0); 318 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 319 320 ret = GetSystemMetrics(SM_SLOWMACHINE); 321 // TEST(ret == 0); 322 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 323 324 ret = GetSystemMetrics(SM_MIDEASTENABLED); 325 // TEST(ret == 0); 326 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 327 #endif 328 329 #if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) 330 ret = GetSystemMetrics(SM_MOUSEWHEELPRESENT); 331 // TEST(ret == 0); 332 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 333 #endif 334 335 #if(WINVER >= 0x0500) 336 ret = GetSystemMetrics(SM_XVIRTUALSCREEN); 337 // TEST(ret == 0); 338 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 339 340 ret = GetSystemMetrics(SM_YVIRTUALSCREEN); 341 // TEST(ret == 0); 342 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 343 344 ret = GetSystemMetrics(SM_CXVIRTUALSCREEN); 345 // TEST(ret == 0); 346 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 347 348 ret = GetSystemMetrics(SM_CYVIRTUALSCREEN); 349 // TEST(ret == 0); 350 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 351 352 ret = GetSystemMetrics(SM_CMONITORS); 353 // TEST(ret == 0); 354 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 355 356 ret = GetSystemMetrics(SM_SAMEDISPLAYFORMAT); 357 // TEST(ret == 0); 358 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 359 #endif 360 361 #if(_WIN32_WINNT >= 0x0500) 362 ret = GetSystemMetrics(SM_IMMENABLED); 363 ok(ret == 0 || ret == 1, "ret = %d\n", ret); 364 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 365 #endif 366 367 #if(_WIN32_WINNT >= 0x0501) 368 ret = GetSystemMetrics(SM_CXFOCUSBORDER); 369 SystemParametersInfoW(SPI_GETFOCUSBORDERWIDTH, 0, &UintVal, 0); 370 ok(ret == UintVal, "ret = %d\n", ret); 371 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 372 373 ret = GetSystemMetrics(SM_CYFOCUSBORDER); 374 SystemParametersInfoW(SPI_GETFOCUSBORDERHEIGHT, 0, &UintVal, 0); 375 ok(ret == UintVal, "ret = %d\n", ret); 376 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 377 378 ret = GetSystemMetrics(SM_TABLETPC); 379 // TEST(ret == 0); 380 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 381 382 ret = GetSystemMetrics(SM_MEDIACENTER); 383 // TEST(ret == 0); 384 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 385 386 ret = GetSystemMetrics(SM_STARTER); 387 // TEST(ret == 0); 388 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 389 390 ret = GetSystemMetrics(SM_SERVERR2); 391 // TEST(ret == 0); 392 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 393 #endif 394 395 #if(_WIN32_WINNT >= 0x0600) 396 ret = GetSystemMetrics(SM_MOUSEHORIZONTALWHEELPRESENT); 397 // TEST(ret == 0); 398 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 399 400 ret = GetSystemMetrics(SM_CXPADDEDBORDER); 401 // TEST(ret == 0); 402 ok(GetLastError() == 0, "GetLastError() = %ld\n", GetLastError()); 403 #endif 404 405 } 406 407 START_TEST(GetSystemMetrics) 408 { 409 Test_GetSystemMetrics(); 410 } 411 412