Ziqing Hui : windowscodecs/tests: Add tests for DdsFrameDecode_Dds_GetSizeInBlocks().

Alexandre Julliard julliard at winehq.org
Mon Jun 1 15:14:56 CDT 2020


Module: wine
Branch: master
Commit: 81da1f6b5daf2454018689ee51b511ff6d83db43
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=81da1f6b5daf2454018689ee51b511ff6d83db43

Author: Ziqing Hui <zhui at codeweavers.com>
Date:   Mon Jun  1 12:59:32 2020 +0800

windowscodecs/tests: Add tests for DdsFrameDecode_Dds_GetSizeInBlocks().

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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c
index 7d001e6338..d1f9b40ff2 100644
--- a/dlls/windowscodecs/tests/ddsformat.c
+++ b/dlls/windowscodecs/tests/ddsformat.c
@@ -395,6 +395,7 @@ static void test_dds_decoder_frame_properties(IWICBitmapDecoder *decoder, IWICBi
     IWICDdsDecoder *dds_decoder = NULL;
     IWICDdsFrameDecode *dds_frame = NULL;
     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;
 
     hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
@@ -452,6 +453,25 @@ static void test_dds_decoder_frame_properties(IWICBitmapDecoder *decoder, IWICBi
     ok (format_info.BlockHeight == 4 || format_info.BlockHeight == 1,
         "%d: [frame %d] Got unexpected block height %d\n", i, frame_index, format_info.BlockHeight);
 
+    /* size in blocks tests */
+
+    hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, NULL);
+    todo_wine ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
+    hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, &height_in_blocks);
+    todo_wine ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
+    hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, NULL);
+    todo_wine ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
+    hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
+    todo_wine ok (hr == S_OK, "%d: [frame %d] GetSizeInBlocks failed, hr=%x\n", i, frame_index, hr);
+    if (hr != S_OK) goto end;
+
+    expected_width_in_blocks = (expected_width + format_info.BlockWidth - 1) / format_info.BlockWidth;
+    expected_height_in_blocks = (expected_height + format_info.BlockHeight - 1) / format_info.BlockHeight;
+    ok (width_in_blocks == expected_width_in_blocks,
+        "%d: [frame %d] Expected width in blocks %d, got %d\n", i, frame_index, expected_width_in_blocks, width_in_blocks);
+    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);
+
 end:
     if (dds_decoder) IWICDdsDecoder_Release(dds_decoder);
     if (dds_frame) IWICDdsFrameDecode_Release(dds_frame);




More information about the wine-cvs mailing list