2013-11-14 23:11:23 +00:00
|
|
|
|
2017-12-02 20:17:22 +00:00
|
|
|
#include "precomp.h"
|
2013-11-14 23:11:23 +00:00
|
|
|
|
2016-09-11 19:50:16 +00:00
|
|
|
#define SIZEOF_DEVMODEW_300_W 188
|
|
|
|
#define SIZEOF_DEVMODEW_400_W 212
|
|
|
|
#define SIZEOF_DEVMODEW_500_W 220
|
|
|
|
|
|
|
|
#define SIZEOF_DEVMODEW_300_A 124
|
|
|
|
#define SIZEOF_DEVMODEW_400_A 148
|
|
|
|
#define SIZEOF_DEVMODEW_500_A 156
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
START_TEST(EnumDisplaySettings)
|
|
|
|
{
|
2016-09-11 19:50:16 +00:00
|
|
|
DEVMODEW dmW;
|
|
|
|
DEVMODEA dmA;
|
2013-11-14 23:11:23 +00:00
|
|
|
HDC icDisplay;
|
|
|
|
|
|
|
|
/* TODO: test with a printer driver */
|
|
|
|
|
|
|
|
icDisplay = CreateICW(L"DISPLAY", NULL, NULL, NULL);
|
|
|
|
ok(icDisplay != NULL, "\n");
|
|
|
|
|
2016-09-11 19:50:16 +00:00
|
|
|
dmW.dmDriverExtra = 0x7777;
|
|
|
|
|
|
|
|
/* Try ridiculous size */
|
|
|
|
dmW.dmSize = 0x8888;
|
|
|
|
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n");
|
|
|
|
ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
|
|
|
|
ok(dmW.dmDriverExtra == 0, "%d\n", dmW.dmDriverExtra);
|
|
|
|
|
|
|
|
/* Try a tiny size */
|
|
|
|
dmW.dmSize = 4;
|
|
|
|
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n");
|
|
|
|
ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
|
|
|
|
|
|
|
|
/* Something in between */
|
|
|
|
dmW.dmSize = (SIZEOF_DEVMODEW_300_W + SIZEOF_DEVMODEW_400_W) / 2 ;
|
|
|
|
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n");
|
|
|
|
ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
|
|
|
|
|
|
|
|
/* WINVER < 0x0400 */
|
|
|
|
dmW.dmSize = SIZEOF_DEVMODEW_300_W;
|
|
|
|
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n");
|
|
|
|
ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
|
|
|
|
|
|
|
|
/* WINVER < 0x0500 */
|
|
|
|
dmW.dmSize = SIZEOF_DEVMODEW_400_W;
|
|
|
|
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n");
|
|
|
|
ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
|
|
|
|
|
|
|
|
/* "Modern" windows */
|
|
|
|
dmW.dmSize = SIZEOF_DEVMODEW_500_W;
|
|
|
|
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n");
|
|
|
|
ok(dmW.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmW.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmW.dmSize == SIZEOF_DEVMODEW_300_W, "%d\n", dmW.dmSize);
|
|
|
|
|
|
|
|
DeleteDC(icDisplay);
|
|
|
|
|
|
|
|
icDisplay = CreateICA("DISPLAY", NULL, NULL, NULL);
|
|
|
|
ok(icDisplay != NULL, "\n");
|
|
|
|
|
|
|
|
dmA.dmDriverExtra = 0x7777;
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
/* Try ridiculous size */
|
2016-09-11 19:50:16 +00:00
|
|
|
dmA.dmSize = 0x8888;
|
|
|
|
ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n");
|
|
|
|
ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
|
|
|
|
ok(dmA.dmDriverExtra == 0, "%d\n", dmA.dmDriverExtra);
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
/* Try a tiny size */
|
2016-09-11 19:50:16 +00:00
|
|
|
dmA.dmSize = 4;
|
|
|
|
ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n");
|
|
|
|
ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
/* Something in between */
|
2016-09-11 19:50:16 +00:00
|
|
|
dmA.dmSize = (SIZEOF_DEVMODEW_300_A + SIZEOF_DEVMODEW_400_A) / 2 ;
|
|
|
|
ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n");
|
|
|
|
ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
/* WINVER < 0x0400 */
|
2016-09-11 19:50:16 +00:00
|
|
|
dmA.dmSize = SIZEOF_DEVMODEW_300_A;
|
|
|
|
ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n");
|
|
|
|
ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
/* WINVER < 0x0500 */
|
2016-09-11 19:50:16 +00:00
|
|
|
dmA.dmSize = SIZEOF_DEVMODEW_400_A;
|
|
|
|
ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n");
|
|
|
|
ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
/* "Modern" windows */
|
2016-09-11 19:50:16 +00:00
|
|
|
dmA.dmSize = SIZEOF_DEVMODEW_500_A;
|
|
|
|
ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n");
|
|
|
|
ok(dmA.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dmA.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
|
|
|
|
ok(dmA.dmSize == SIZEOF_DEVMODEW_300_A, "%d\n", dmA.dmSize);
|
2013-11-14 23:11:23 +00:00
|
|
|
|
|
|
|
DeleteDC(icDisplay);
|
|
|
|
}
|