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>
This commit is contained in:
Ziqing Hui 2020-07-21 13:49:18 +08:00 committed by Alexandre Julliard
parent 7ca07bc8af
commit 33406cd357
1 changed files with 6 additions and 18 deletions

View File

@ -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");