From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/d3dx10_43/tests/d3dx10.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index 75e4b4023d8..1b8fd85be15 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -2884,6 +2884,40 @@ static void check_dds_pixel_format_image_info(unsigned int line, DWORD flags, DW ok_(__FILE__, line)(hr == expected_hr, "Unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr) && hr == expected_hr) ok_(__FILE__, line)(info.Format == expected_format, "Unexpected format %#x.\n", info.Format); + + /* Test again with unused fields set. */ + if (flags & DDS_PF_FOURCC) + rmask = gmask = bmask = amask = bpp = flags = ~0u; + else if ((flags & (DDS_PF_INDEXED | DDS_PF_ALPHA)) == (DDS_PF_INDEXED | DDS_PF_ALPHA)) + rmask = gmask = bmask = fourcc = ~0u; + else if (flags & DDS_PF_INDEXED) + rmask = gmask = bmask = amask = fourcc = ~0u; + else if ((flags & (DDS_PF_RGB | DDS_PF_ALPHA)) == (DDS_PF_RGB | DDS_PF_ALPHA)) + fourcc = ~0u; + else if (flags & DDS_PF_RGB) + fourcc = amask = ~0u; + else if ((flags & (DDS_PF_LUMINANCE | DDS_PF_ALPHA)) == (DDS_PF_LUMINANCE | DDS_PF_ALPHA)) + gmask = bmask = fourcc = ~0u; + else if (flags & DDS_PF_LUMINANCE) + gmask = bmask = amask = fourcc = ~0u; + else if (flags & DDS_PF_ALPHA_ONLY) + rmask = gmask = bmask = fourcc = ~0u; + else if (flags & DDS_PF_BUMPDUDV) + fourcc = ~0u; + else if (flags & DDS_PF_BUMPLUMINANCE) + fourcc = amask = ~0u; + + dds.header.pixel_format.flags = flags; + dds.header.pixel_format.fourcc = fourcc; + dds.header.pixel_format.bpp = bpp; + dds.header.pixel_format.rmask = rmask; + dds.header.pixel_format.gmask = gmask; + dds.header.pixel_format.bmask = bmask; + dds.header.pixel_format.amask = amask; + hr = D3DX10GetImageInfoFromMemory(&dds, sizeof(dds), NULL, &info, NULL); + ok_(__FILE__, line)(hr == expected_hr, "Unexpected hr %#lx.\n", hr); + if (SUCCEEDED(hr) && hr == expected_hr) + ok_(__FILE__, line)(info.Format == expected_format, "Unexpected format %#x.\n", info.Format); }
#define check_dds_pixel_format(flags, fourcc, bpp, rmask, gmask, bmask, amask, format) \ @@ -3387,6 +3421,7 @@ static void test_get_image_info(void) check_dds_pixel_format(DDS_PF_FOURCC, 0x74, 0, 0, 0, 0, 0, DXGI_FORMAT_R32G32B32A32_FLOAT); /* D3DFMT_A32B32G32R32F */
/* Test for DDS pixel formats that are valid on d3dx9, but not d3dx10. */ + check_dds_pixel_format_unsupported(DDS_PF_FOURCC, 0x75, 0, 0, 0, 0, 0, E_FAIL); /* D3DFMT_CxV8U8 */ check_dds_pixel_format_unsupported(DDS_PF_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0, E_FAIL); check_dds_pixel_format_unsupported(DDS_PF_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0, E_FAIL); /* Bumpmap formats aren't supported. */