ReactOS 0.4.16-dev-91-g764881a
EnumDisplaySettings.c
Go to the documentation of this file.
1
2#include "precomp.h"
3
4#define SIZEOF_DEVMODEW_300_W 188
5#define SIZEOF_DEVMODEW_400_W 212
6#define SIZEOF_DEVMODEW_500_W 220
7
8#define SIZEOF_DEVMODEW_300_A 124
9#define SIZEOF_DEVMODEW_400_A 148
10#define SIZEOF_DEVMODEW_500_A 156
11
12START_TEST(EnumDisplaySettings)
13{
14 DEVMODEW dmW;
15 DEVMODEA dmA;
16 HDC icDisplay;
17
18 /* TODO: test with a printer driver */
19
20 icDisplay = CreateICW(L"DISPLAY", NULL, NULL, NULL);
21 ok(icDisplay != NULL, "\n");
22
23 dmW.dmDriverExtra = 0x7777;
24
25 /* Try ridiculous size */
26 dmW.dmSize = 0x8888;
28 ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
29 ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
30 ok(dmW.dmDriverExtra == 0, "%d\n", dmW.dmDriverExtra);
31
32 /* Try a tiny size */
33 dmW.dmSize = 4;
35 ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
36 ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
37
38 /* Something in between */
41 ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
42 ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
43
44 /* WINVER < 0x0400 */
47 ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
48 ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
49
50 /* WINVER < 0x0500 */
53 ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
54 ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
55
56 /* "Modern" windows */
59 ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
60 ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
61
62 DeleteDC(icDisplay);
63
64 icDisplay = CreateICA("DISPLAY", NULL, NULL, NULL);
65 ok(icDisplay != NULL, "\n");
66
67 dmA.dmDriverExtra = 0x7777;
68
69 /* Try ridiculous size */
70 dmA.dmSize = 0x8888;
72 ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
73 ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
74 ok(dmA.dmDriverExtra == 0, "%d\n", dmA.dmDriverExtra);
75
76 /* Try a tiny size */
77 dmA.dmSize = 4;
79 ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
80 ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
81
82 /* Something in between */
85 ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
86 ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
87
88 /* WINVER < 0x0400 */
91 ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
92 ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
93
94 /* WINVER < 0x0500 */
97 ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
98 ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
99
100 /* "Modern" windows */
103 ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
104 ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
105
106 DeleteDC(icDisplay);
107}
#define SIZEOF_DEVMODEW_500_W
#define SIZEOF_DEVMODEW_300_A
#define SIZEOF_DEVMODEW_300_W
#define SIZEOF_DEVMODEW_500_A
#define SIZEOF_DEVMODEW_400_A
#define SIZEOF_DEVMODEW_400_W
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
static HDC
Definition: imagelist.c:88
#define L(x)
Definition: ntvdm.h:50
DWORD dmBitsPerPel
Definition: wingdi.h:1595
WORD dmDriverExtra
Definition: wingdi.h:1569
WORD dmSize
Definition: wingdi.h:1568
DWORD dmBitsPerPel
Definition: wingdi.h:1647
WORD dmDriverExtra
Definition: wingdi.h:1621
WORD dmSize
Definition: wingdi.h:1620
BOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode)
Definition: display.c:408
BOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEA lpDevMode)
Definition: display.c:312
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HDC WINAPI CreateICA(_In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_opt_ const DEVMODEA *)
HDC WINAPI CreateICW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ const DEVMODEW *)
#define BITSPIXEL
Definition: wingdi.h:720
BOOL WINAPI DeleteDC(_In_ HDC)
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179