gdi32, winex11drv: Add a test for compatible bitmap depths.
This commit is contained in:
parent
ab8deb275e
commit
aa390e840b
|
@ -1555,7 +1555,8 @@ static void test_select_object(void)
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HBITMAP hbm, hbm_old;
|
HBITMAP hbm, hbm_old;
|
||||||
INT planes, bpp;
|
INT planes, bpp, i;
|
||||||
|
DWORD depths[] = {8, 15, 16, 24, 32};
|
||||||
|
|
||||||
hdc = GetDC(0);
|
hdc = GetDC(0);
|
||||||
ok(hdc != 0, "GetDC(0) failed\n");
|
ok(hdc != 0, "GetDC(0) failed\n");
|
||||||
|
@ -1594,17 +1595,30 @@ static void test_select_object(void)
|
||||||
|
|
||||||
DeleteObject(hbm);
|
DeleteObject(hbm);
|
||||||
|
|
||||||
/* test a color bitmap that doesn't match the dc's bpp */
|
for(i = 0; i < sizeof(depths)/sizeof(depths[0]); i++) {
|
||||||
|
/* test a color bitmap to dc bpp matching */
|
||||||
planes = GetDeviceCaps(hdc, PLANES);
|
planes = GetDeviceCaps(hdc, PLANES);
|
||||||
bpp = GetDeviceCaps(hdc, BITSPIXEL) == 24 ? 8 : 24;
|
bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
||||||
|
|
||||||
hbm = CreateBitmap(10, 10, planes, bpp, NULL);
|
hbm = CreateBitmap(10, 10, planes, depths[i], NULL);
|
||||||
ok(hbm != 0, "CreateBitmap failed\n");
|
ok(hbm != 0, "CreateBitmap failed\n");
|
||||||
|
|
||||||
hbm_old = SelectObject(hdc, hbm);
|
hbm_old = SelectObject(hdc, hbm);
|
||||||
ok(hbm_old == 0, "SelectObject should fail\n");
|
if(depths[i] == bpp ||
|
||||||
|
(bpp == 16 && depths[i] == 15) /* 16 and 15 bpp are compatible */
|
||||||
|
) {
|
||||||
|
ok(hbm_old != 0, "SelectObject failed, BITSPIXEL: %d, created depth: %d\n", bpp, depths[i]);
|
||||||
|
SelectObject(hdc, hbm_old);
|
||||||
|
} else {
|
||||||
|
if(bpp == 24 && depths[i] == 32) {
|
||||||
|
todo_wine ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]);
|
||||||
|
} else {
|
||||||
|
ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DeleteObject(hbm);
|
DeleteObject(hbm);
|
||||||
|
}
|
||||||
|
|
||||||
DeleteDC(hdc);
|
DeleteDC(hdc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,10 +124,10 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBit
|
||||||
/* check if bpp is compatible with screen depth */
|
/* check if bpp is compatible with screen depth */
|
||||||
if (!((bitmap.bmBitsPixel == 1) ||
|
if (!((bitmap.bmBitsPixel == 1) ||
|
||||||
(bitmap.bmBitsPixel == screen_depth) ||
|
(bitmap.bmBitsPixel == screen_depth) ||
|
||||||
(bitmap.bmBitsPixel == 24 && screen_depth == 32) ||
|
(bitmap.bmBitsPixel == 24 && screen_depth == 32) || /* FIXME: Not compatible */
|
||||||
(bitmap.bmBitsPixel == 32 && screen_depth == 24) ||
|
(bitmap.bmBitsPixel == 32 && screen_depth == 24) || /* FIXME: Not compatible */
|
||||||
(bitmap.bmBitsPixel == 15 && screen_depth == 16) ||
|
(bitmap.bmBitsPixel == 15 && screen_depth == 16) || /* Confirmed by tests */
|
||||||
(bitmap.bmBitsPixel == 16 && screen_depth == 15)))
|
(bitmap.bmBitsPixel == 16 && screen_depth == 15))) /* TODO: Confirm this */
|
||||||
{
|
{
|
||||||
ERR("Trying to make bitmap with planes=%d, bpp=%d\n",
|
ERR("Trying to make bitmap with planes=%d, bpp=%d\n",
|
||||||
bitmap.bmPlanes, bitmap.bmBitsPixel);
|
bitmap.bmPlanes, bitmap.bmBitsPixel);
|
||||||
|
|
Loading…
Reference in New Issue