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 12 START_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; 27 ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n"); 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; 34 ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n"); 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 */ 39 dmW.dmSize = (SIZEOF_DEVMODEW_300_W + SIZEOF_DEVMODEW_400_W) / 2 ; 40 ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n"); 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 */ 45 dmW.dmSize = SIZEOF_DEVMODEW_300_W; 46 ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n"); 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 */ 51 dmW.dmSize = SIZEOF_DEVMODEW_400_W; 52 ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n"); 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 */ 57 dmW.dmSize = SIZEOF_DEVMODEW_500_W; 58 ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW), "\n"); 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; 71 ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n"); 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; 78 ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n"); 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 */ 83 dmA.dmSize = (SIZEOF_DEVMODEW_300_A + SIZEOF_DEVMODEW_400_A) / 2 ; 84 ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n"); 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 */ 89 dmA.dmSize = SIZEOF_DEVMODEW_300_A; 90 ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n"); 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 */ 95 dmA.dmSize = SIZEOF_DEVMODEW_400_A; 96 ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n"); 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 */ 101 dmA.dmSize = SIZEOF_DEVMODEW_500_A; 102 ok(EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA), "\n"); 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 } 108