Ziqing Hui : windowscodecs/tests: Add tests for DdsFrameDecode_GetPixelFormat().
Alexandre Julliard
julliard at winehq.org
Wed Jun 17 15:54:00 CDT 2020
Module: wine
Branch: master
Commit: 67a50f125298a4888d7f9df27d35559b06d4c8fd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=67a50f125298a4888d7f9df27d35559b06d4c8fd
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Tue Jun 16 13:52:01 2020 +0800
windowscodecs/tests: Add tests for DdsFrameDecode_GetPixelFormat().
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Esme Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windowscodecs/tests/ddsformat.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c
index a69ff35dcb..5e0340bdef 100644
--- a/dlls/windowscodecs/tests/ddsformat.c
+++ b/dlls/windowscodecs/tests/ddsformat.c
@@ -168,17 +168,18 @@ static struct test_data {
BYTE *data;
UINT size;
UINT expected_frame_count;
+ const GUID *expected_pixel_format;
WICDdsParameters expected_parameters;
} test_data[] = {
- { test_dds_image, sizeof(test_dds_image), 1,
+ { test_dds_image, sizeof(test_dds_image), 1, &GUID_WICPixelFormat32bppPBGRA,
{ 4, 4, 1, 1, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTexture2D, WICDdsAlphaModePremultiplied } },
- { test_dds_mipmaps, sizeof(test_dds_mipmaps), 3,
+ { test_dds_mipmaps, sizeof(test_dds_mipmaps), 3, &GUID_WICPixelFormat32bppPBGRA,
{ 4, 4, 1, 3, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTexture2D, WICDdsAlphaModePremultiplied } },
- { test_dds_volume, sizeof(test_dds_volume), 7,
+ { test_dds_volume, sizeof(test_dds_volume), 7, &GUID_WICPixelFormat32bppPBGRA,
{ 4, 4, 4, 3, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTexture3D, WICDdsAlphaModePremultiplied } },
- { test_dds_array, sizeof(test_dds_array), 9,
+ { test_dds_array, sizeof(test_dds_array), 9, &GUID_WICPixelFormat32bppBGRA,
{ 4, 4, 1, 3, 3, DXGI_FORMAT_BC1_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown } },
- { test_dds_dxt3, sizeof(test_dds_dxt3), 8,
+ { test_dds_dxt3, sizeof(test_dds_dxt3), 8, &GUID_WICPixelFormat32bppBGRA,
{ 12, 12, 1, 4, 2, DXGI_FORMAT_BC2_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown } },
};
@@ -446,6 +447,7 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
UINT width, height ,expected_width, expected_height, slice_index, depth;
UINT width_in_blocks, height_in_blocks, expected_width_in_blocks, expected_height_in_blocks;
WICDdsFormatInfo format_info;
+ GUID pixel_format;
/* frame size tests */
@@ -511,6 +513,15 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
ok (height_in_blocks == expected_height_in_blocks,
"%d: [frame %d] Expected height in blocks %d, got %d\n", i, frame_index, expected_height_in_blocks, height_in_blocks);
+ /* pixel format tests */
+
+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame_decode, NULL);
+ todo_wine ok (hr == E_INVALIDARG, "[%d, frame %d] GetPixelFormat got unexpected hr %x\n", i, frame_index, hr);
+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame_decode, &pixel_format);
+ todo_wine ok (hr == S_OK, "[%d, frame %d] GetPixelFormat failed\n", i, frame_index);
+ if (hr != S_OK) return;
+ todo_wine ok (IsEqualGUID(&pixel_format, test_data[i].expected_pixel_format),
+ "[%d, frame %d] Got unexpected pixel format %s\n", i, frame_index, debugstr_guid(&pixel_format));
}
static void test_dds_decoder_frame_data(IWICDdsFrameDecode *dds_frame, UINT frame_count, WICDdsParameters *params,
More information about the wine-cvs
mailing list