Module: wine Branch: master Commit: 33406cd357175d0f28322abc462945a28e7949ce URL: https://source.winehq.org/git/wine.git/?a=commit;h=33406cd357175d0f28322abc4...
Author: Ziqing Hui zhui@codeweavers.com Date: Tue Jul 21 13:49:18 2020 +0800
windowscodecs/tests: Simplify init_decoder().
Signed-off-by: Ziqing Hui zhui@codeweavers.com Signed-off-by: Esme Povirk esme@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/windowscodecs/tests/ddsformat.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index 30982fbb30..aebe31c1d5 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -371,27 +371,15 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES IWICWineDecoder *wine_decoder;
hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand); - if (index == -1) { - ok(hr == S_OK || wine_init, "Decoder initialize failed, hr %#x\n", hr); - } else { - ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr); - } + ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr);
if (hr != S_OK && wine_init) { hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICWineDecoder, (void **)&wine_decoder); - if (index == -1) { - ok(hr == S_OK || broken(hr != S_OK), "QueryInterface failed, hr %#x\n", hr); - } else { - ok(hr == S_OK || broken(hr != S_OK), "Test %u: QueryInterface failed, hr %#x\n", index, hr); - } + ok(hr == S_OK || broken(hr != S_OK), "Test %u: QueryInterface failed, hr %#x\n", index, hr); + if (hr == S_OK) { hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand); - if (index == -1) { - ok(hr == S_OK, "Initialize failed, hr %#x\n", hr); - } else { - ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr); - } - + ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr); } }
@@ -511,7 +499,7 @@ static void test_dds_decoder_image_parameters(void)
if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) continue;
- hr = init_decoder(decoder, stream, S_OK, -1, test_data[i].wine_init); + hr = init_decoder(decoder, stream, test_data[i].init_hr, i, test_data[i].wine_init); if (hr != S_OK) { if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) { win_skip("Cube map is not supported\n"); @@ -831,7 +819,7 @@ static void test_dds_decoder(void) if (!stream) goto next; decoder = create_decoder(); if (!decoder) goto next; - hr = init_decoder(decoder, stream, S_OK, -1, test_data[i].wine_init); + hr = init_decoder(decoder, stream, test_data[i].init_hr, i, test_data[i].wine_init); if (hr != S_OK) { if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) { win_skip("Cube map is not supported\n");