reactos/rostests/apitests/user32/EnumDisplaySettings.c
Jérôme Gardou cd3af3c4c8 [USER32_APITEST]
- Add tests for LookupIconIdFromDirectoryEx
 - Add a workaround in GetIconInfo tests for a ReactOS bug in EnumDisplaySettings
 - Add tests for EnumDisplaySettings demonstrating the bug.
 - Add some traces to better follow the test run

svn path=/trunk/; revision=60994
2013-11-14 23:11:23 +00:00

61 lines
2.5 KiB
C

#include <apitest.h>
#include <wingdi.h>
#include <winuser.h>
#define SIZEOF_DEVMODEW_300 188
#define SIZEOF_DEVMODEW_400 212
#define SIZEOF_DEVMODEW_500 220
START_TEST(EnumDisplaySettings)
{
DEVMODEW dm;
HDC icDisplay;
/* TODO: test with a printer driver */
icDisplay = CreateICW(L"DISPLAY", NULL, NULL, NULL);
ok(icDisplay != NULL, "\n");
dm.dmDriverExtra = 0x7777;
/* Try ridiculous size */
dm.dmSize = 0x8888;
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm), "\n");
ok(dm.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dm.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
ok(dm.dmSize == SIZEOF_DEVMODEW_300, "%d\n", dm.dmSize);
ok(dm.dmDriverExtra == 0, "%d\n", dm.dmDriverExtra);
/* Try a tiny size */
dm.dmSize = 4;
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm), "\n");
ok(dm.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dm.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
ok(dm.dmSize == SIZEOF_DEVMODEW_300, "%d\n", dm.dmSize);
/* Something in between */
dm.dmSize = (SIZEOF_DEVMODEW_300 + SIZEOF_DEVMODEW_400) / 2 ;
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm), "\n");
ok(dm.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dm.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
ok(dm.dmSize == SIZEOF_DEVMODEW_300, "%d\n", dm.dmSize);
/* WINVER < 0x0400 */
dm.dmSize = SIZEOF_DEVMODEW_300;
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm), "\n");
ok(dm.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dm.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
ok(dm.dmSize == SIZEOF_DEVMODEW_300, "%d\n", dm.dmSize);
/* WINVER < 0x0500 */
dm.dmSize = SIZEOF_DEVMODEW_400;
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm), "\n");
ok(dm.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dm.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
ok(dm.dmSize == SIZEOF_DEVMODEW_300, "%d\n", dm.dmSize);
/* "Modern" windows */
dm.dmSize = SIZEOF_DEVMODEW_500;
ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dm), "\n");
ok(dm.dmBitsPerPel == GetDeviceCaps(icDisplay, BITSPIXEL), "%lu, should be %d.\n", dm.dmBitsPerPel, GetDeviceCaps(icDisplay, BITSPIXEL));
ok(dm.dmSize == SIZEOF_DEVMODEW_300, "%d\n", dm.dmSize);
DeleteDC(icDisplay);
}