Module: wine Branch: master Commit: 3d247caab5d8e1854c5129f2410757fa02582e2f URL: https://source.winehq.org/git/wine.git/?a=commit;h=3d247caab5d8e1854c5129f24...
Author: Ziqing Hui zhui@codeweavers.com Date: Wed Apr 22 16:37:51 2020 +0800
windowscodecs/tests: Add tests for DdsDecoder_GetFrameCount().
Signed-off-by: Ziqing Hui zhui@codeweavers.com Signed-off-by: Vincent Povirk vincent@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/windowscodecs/tests/ddsformat.c | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index 342a120a88..99f19eb175 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -276,6 +276,53 @@ static void test_dds_decoder_global_properties(IWICBitmapDecoder *decoder) if (thumnail) IWICBitmapSource_Release(thumnail); }
+static void test_dds_decoder_frame_count(void) +{ + static struct test_data { + void *data; + UINT size; + UINT expected; + } test_data[] = { + { test_dds_image, sizeof(test_dds_image), 1 }, + { test_dds_mipmaps, sizeof(test_dds_mipmaps), 3 }, + { test_dds_volume, sizeof(test_dds_volume), 7 }, + { test_dds_array, sizeof(test_dds_array), 9 }, + }; + + int i; + HRESULT hr; + + for (i = 0; i < ARRAY_SIZE(test_data); i++) + { + UINT frame_count; + IWICStream *stream = NULL; + IWICBitmapDecoder *decoder = NULL; + + stream = create_stream(test_data[i].data, test_data[i].size); + if (!stream) goto next; + + decoder = create_decoder(); + if (!decoder) goto next; + + hr = init_decoder(decoder, stream, S_OK, -1); + if (hr != S_OK) goto next; + + todo_wine { + hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); + ok (hr == S_OK, "GetFrameCount failed, hr=%x\n", hr); + if (hr == S_OK) { + ok (frame_count == test_data[i].expected, "%d: expected frame count %d, got %d\n", + i, test_data[i].expected, frame_count); + } + }; + + next: + if (decoder) IWICBitmapDecoder_Release(decoder); + if (stream) IWICStream_Release(stream); + + } +} + static void test_dds_decoder(void) { HRESULT hr; @@ -293,6 +340,7 @@ static void test_dds_decoder(void)
test_dds_decoder_initialize(); test_dds_decoder_global_properties(decoder); + test_dds_decoder_frame_count();
end: if (decoder) IWICBitmapDecoder_Release(decoder);