Commit 7b24d3ef authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

windowscodecs/tests: Format ok() message for tests/ddsformat.c.

parent 11c68bb5
......@@ -191,11 +191,11 @@ static IWICStream *create_stream(const void *image_data, UINT image_size)
IWICStream *stream = NULL;
hr = IWICImagingFactory_CreateStream(factory, &stream);
ok(hr == S_OK, "CreateStream failed, hr=%x\n", hr);
ok(hr == S_OK, "CreateStream failed, hr %#x\n", hr);
if (hr != S_OK) goto fail;
hr = IWICStream_InitializeFromMemory(stream, (BYTE *)image_data, image_size);
ok(hr == S_OK, "InitializeFromMemory failed, hr=%x\n", hr);
ok(hr == S_OK, "InitializeFromMemory failed, hr %#x\n", hr);
if (hr != S_OK) goto fail;
return stream;
......@@ -220,8 +220,9 @@ static IWICBitmapDecoder *create_decoder(void)
memset(&guidresult, 0, sizeof(guidresult));
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
ok(hr == S_OK, "GetContainerFormat failed, hr=%x\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatDds), "Unexpected container format\n");
ok(hr == S_OK, "GetContainerFormat failed, hr %#x\n", hr);
ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatDds),
"Got unexpected container format %s\n", debugstr_guid(&GUID_ContainerFormatDds));
return decoder;
}
......@@ -232,9 +233,10 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES
hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
if (index == -1) {
ok(hr == S_OK, "Decoder Initialize failed, hr=%x\n", hr);
ok(hr == S_OK, "Decoder initialize failed, hr %#x\n", hr);
} else {
todo_wine_if(index == 1 || index == 3) ok(hr == expected, "%d: Expected hr=%x, got %x\n", index, expected, hr);
todo_wine_if(index == 1 || index == 3)
ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr);
}
return hr;
}
......@@ -329,33 +331,33 @@ static void test_dds_decoder_global_properties(IWICBitmapDecoder *decoder)
UINT count;
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok (hr == S_OK, "CreatePalette failed, hr=%x\n", hr);
ok(hr == S_OK, "CreatePalette failed, hr %#x\n", hr);
if (hr == S_OK) {
hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Expected hr=WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, NULL);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "Expected hr=WINCODEC_ERR_PALETTEUNAVAILABLE, got %x\n", hr);
ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#x\n", hr);
}
hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &metadata_reader);
todo_wine ok (hr == S_OK, "Expected hr=S_OK, got %x\n", hr);
todo_wine ok (hr == S_OK, "GetMetadataQueryReader got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, NULL);
ok (hr == E_INVALIDARG, "Expected hr=E_INVALIDARG, got %x\n", hr);
ok(hr == E_INVALIDARG, "GetMetadataQueryReader got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetPreview(decoder, &preview);
ok (hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Expected hr=WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetPreview(decoder, NULL);
ok (hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Expected hr=WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &color_context, &count);
ok (hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Expected hr=WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, NULL, NULL);
ok (hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Expected hr=WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr);
ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumnail);
ok (hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "Expected hr=WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#x\n", hr);
hr = IWICBitmapDecoder_GetThumbnail(decoder, NULL);
ok (hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "Expected hr=WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr);
ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#x\n", hr);
if (palette) IWICPalette_Release(palette);
if (metadata_reader) IWICMetadataQueryReader_Release(metadata_reader);
......@@ -384,53 +386,53 @@ static void test_dds_decoder_image_parameters(void)
if (!decoder) goto next;
hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
ok(hr == S_OK, "QueryInterface failed, hr %#x\n", hr);
if (hr != S_OK) goto next;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok (hr == WINCODEC_ERR_WRONGSTATE, "%d: Expected hr=WINCODEC_ERR_WRONGSTATE, got %x\n", i, hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "Test %u: GetFrameCount got unexpected hr %#x\n", i, hr);
hr = IWICBitmapDecoder_GetFrameCount(decoder, NULL);
ok (hr == E_INVALIDARG, "%d: Expected hr=E_INVALIDARG, got %x\n", i, hr);
ok(hr == E_INVALIDARG, "Test %u: GetFrameCount got unexpected hr %#x\n", i, hr);
hr = IWICDdsDecoder_GetParameters(dds_decoder, &parameters);
ok(hr == WINCODEC_ERR_WRONGSTATE, "%d: Expected hr=WINCODEC_ERR_WRONGSTATE, got %x\n", i, hr);
ok(hr == WINCODEC_ERR_WRONGSTATE, "Test %u: GetParameters got unexpected hr %#x\n", i, hr);
hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL);
ok(hr == E_INVALIDARG, "%d: Expected hr=E_INVALIDARG, got %x\n", i, hr);
ok(hr == E_INVALIDARG, "Test %u: GetParameters got unexpected hr %#x\n", i, hr);
hr = init_decoder(decoder, stream, S_OK, -1);
if (hr != S_OK) goto next;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok (hr == S_OK, "%d: GetFrameCount failed, hr=%x\n", i, hr);
ok(hr == S_OK, "Test %u: GetFrameCount failed, hr %#x\n", i, hr);
if (hr == S_OK) {
ok (frame_count == test_data[i].expected_frame_count, "%d: expected frame count %d, got %d\n",
i, test_data[i].expected_frame_count, frame_count);
ok(frame_count == test_data[i].expected_frame_count, "Test %u: Expected frame count %u, got %u\n",
i, test_data[i].expected_frame_count, frame_count);
}
hr = IWICBitmapDecoder_GetFrameCount(decoder, NULL);
ok (hr == E_INVALIDARG, "%d: Expected hr=S_OK, got %x\n", i, hr);
ok(hr == E_INVALIDARG, "Test %u: GetParameters got unexpected hr %#x\n", i, hr);
hr = IWICDdsDecoder_GetParameters(dds_decoder, &parameters);
ok (hr == S_OK, "%d: GetParameters failed, hr=%x\n", i, hr);
ok(hr == S_OK, "Test %u: GetParameters failed, hr %#x\n", i, hr);
if (hr == S_OK) {
ok (parameters.Width == test_data[i].expected_parameters.Width,
"%d, Expected Width=%d, got %d\n", i, test_data[i].expected_parameters.Width, parameters.Width);
ok (parameters.Height == test_data[i].expected_parameters.Height,
"%d, Expected Height=%d, got %d\n", i, test_data[i].expected_parameters.Height, parameters.Height);
ok (parameters.Depth == test_data[i].expected_parameters.Depth,
"%d, Expected Depth=%d, got %d\n", i, test_data[i].expected_parameters.Depth, parameters.Depth);
ok (parameters.MipLevels == test_data[i].expected_parameters.MipLevels,
"%d, Expected MipLevels=%d, got %d\n", i, test_data[i].expected_parameters.MipLevels, parameters.MipLevels);
ok (parameters.ArraySize == test_data[i].expected_parameters.ArraySize,
"%d, Expected ArraySize=%d, got %d\n", i, test_data[i].expected_parameters.ArraySize, parameters.ArraySize);
ok (parameters.DxgiFormat == test_data[i].expected_parameters.DxgiFormat,
"%d, Expected DxgiFormat=0x%x, got 0x%x\n", i, test_data[i].expected_parameters.DxgiFormat, parameters.DxgiFormat);
ok (parameters.Dimension == test_data[i].expected_parameters.Dimension,
"%d, Expected Dimension=0x%x, got 0x%x\n", i, test_data[i].expected_parameters.Dimension, parameters.Dimension);
ok (parameters.AlphaMode == test_data[i].expected_parameters.AlphaMode,
"%d, Expected AlphaMode=0x%x, got 0x%x\n", i, test_data[i].expected_parameters.AlphaMode, parameters.AlphaMode);
ok(parameters.Width == test_data[i].expected_parameters.Width,
"Test %u: Expected Width %u, got %u\n", i, test_data[i].expected_parameters.Width, parameters.Width);
ok(parameters.Height == test_data[i].expected_parameters.Height,
"Test %u: Expected Height %u, got %u\n", i, test_data[i].expected_parameters.Height, parameters.Height);
ok(parameters.Depth == test_data[i].expected_parameters.Depth,
"Test %u: Expected Depth %u, got %u\n", i, test_data[i].expected_parameters.Depth, parameters.Depth);
ok(parameters.MipLevels == test_data[i].expected_parameters.MipLevels,
"Test %u: Expected MipLevels %u, got %u\n", i, test_data[i].expected_parameters.MipLevels, parameters.MipLevels);
ok(parameters.ArraySize == test_data[i].expected_parameters.ArraySize,
"Test %u: Expected ArraySize %u, got %u\n", i, test_data[i].expected_parameters.ArraySize, parameters.ArraySize);
ok(parameters.DxgiFormat == test_data[i].expected_parameters.DxgiFormat,
"Test %u: Expected DxgiFormat %#x, got %#x\n", i, test_data[i].expected_parameters.DxgiFormat, parameters.DxgiFormat);
ok(parameters.Dimension == test_data[i].expected_parameters.Dimension,
"Test %u: Expected Dimension %#x, got %#x\n", i, test_data[i].expected_parameters.Dimension, parameters.Dimension);
ok(parameters.AlphaMode == test_data[i].expected_parameters.AlphaMode,
"Test %u: Expected AlphaMode %#x, got %#x\n", i, test_data[i].expected_parameters.AlphaMode, parameters.AlphaMode);
}
hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL);
ok (hr == E_INVALIDARG, "%d: Expected hr=E_INVALIDARG, got %x\n", i, hr);
ok(hr == E_INVALIDARG, "Test %u: GetParameters got unexpected hr %#x\n", i, hr);
next:
if (decoder) IWICBitmapDecoder_Release(decoder);
......@@ -452,13 +454,13 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
/* frame size tests */
hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetSize got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, &height);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetSize got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetSize got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, &height);
ok (hr == S_OK, "%d: GetSize failed for frame %d, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: GetSize failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
depth = params->Depth;
......@@ -472,56 +474,57 @@ static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decod
slice_index -= depth;
if (depth > 1) depth /= 2;
}
ok (width == expected_width, "%d: Expected width %d for frame %d, got %d\n", i, expected_width, frame_index, width);
ok (height == expected_height, "%d: Expected height %d for frame %d, got %d\n", i, expected_height, frame_index, height);
ok(width == expected_width, "Test %u, frame %u: Expected width %u, got %u\n", i, expected_width, frame_index, width);
ok(height == expected_height, "Test %u, frame %u: Expected height %u, got %u\n", i, expected_height, frame_index, height);
/* frame format information tests */
hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetFormatInfo got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, &format_info);
ok (hr == S_OK, "%d: [frame %d] GetFormatInfo failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: GetFormatInfo failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
ok (format_info.DxgiFormat == test_data[i].expected_parameters.DxgiFormat,
"%d: [frame %d] Expected DXGI format 0x%x, got 0x%x\n",
i, frame_index, test_data[i].expected_parameters.DxgiFormat, format_info.DxgiFormat);
ok (format_info.BytesPerBlock == get_bytes_per_block(format_info.DxgiFormat),
"%d: [frame %d] Expected bytes per block %d, got %d\n",
i, frame_index, get_bytes_per_block(format_info.DxgiFormat), format_info.BytesPerBlock);
ok (format_info.BlockWidth == 4 || format_info.BlockWidth == 1,
"%d: [frame %d] Got unexpected block width %d\n", i, frame_index, format_info.BlockWidth);
ok (format_info.BlockHeight == 4 || format_info.BlockHeight == 1,
"%d: [frame %d] Got unexpected block height %d\n", i, frame_index, format_info.BlockHeight);
ok(format_info.DxgiFormat == test_data[i].expected_parameters.DxgiFormat,
"Test %u, frame %u: Expected DXGI format %#x, got %#x\n",
i, frame_index, test_data[i].expected_parameters.DxgiFormat, format_info.DxgiFormat);
ok(format_info.BytesPerBlock == get_bytes_per_block(format_info.DxgiFormat),
"Test %u, frame %u: Expected bytes per block %u, got %u\n",
i, frame_index, get_bytes_per_block(format_info.DxgiFormat), format_info.BytesPerBlock);
ok(format_info.BlockWidth == 4 || format_info.BlockWidth == 1,
"Test %u, frame %u: Got unexpected block width %u\n", i, frame_index, format_info.BlockWidth);
ok(format_info.BlockHeight == 4 || format_info.BlockHeight == 1,
"Test %u, frame %u: Got unexpected block height %u\n", i, frame_index, format_info.BlockHeight);
/* size in blocks tests */
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetSizeInBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, &height_in_blocks);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetSizeInBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: GetSizeInBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
ok (hr == S_OK, "%d: [frame %d] GetSizeInBlocks failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: GetSizeInBlocks failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
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);
ok(width_in_blocks == expected_width_in_blocks,
"Test %u, frame %u: Expected width in blocks %u, got %u\n", i, frame_index, expected_width_in_blocks, width_in_blocks);
ok(height_in_blocks == expected_height_in_blocks,
"Test %u, frame %u: Expected height in blocks %u, got %u\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);
todo_wine ok(hr == E_INVALIDARG, "Test %u, frame %u: 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);
todo_wine ok(hr == S_OK, "Test %u, frame %u: GetPixelFormat failed, hr %#x\n", i, frame_index, hr);
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));
todo_wine ok(IsEqualGUID(&pixel_format, test_data[i].expected_pixel_format),
"Test %u, frame %u: Expected pixel format %s, got %s\n",
i, frame_index, debugstr_guid(test_data[i].expected_pixel_format), debugstr_guid(&pixel_format));
}
static void test_dds_decoder_frame_data(IWICDdsFrameDecode *dds_frame, UINT frame_count, WICDdsParameters *params,
......@@ -538,56 +541,56 @@ static void test_dds_decoder_frame_data(IWICDdsFrameDecode *dds_frame, UINT fram
int slice_index;
hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, &format_info);
ok (hr == S_OK, "%d: [frame %d] GetFormatInfo failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: GetFormatInfo failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
ok (hr == S_OK, "%d: [frame %d] GetSizeInBlocks failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: GetSizeInBlocks failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
stride = rect.Width * format_info.BytesPerBlock;
frame_stride = width_in_blocks * format_info.BytesPerBlock;
frame_size = frame_stride * height_in_blocks;
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, 0, 0, NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_a, stride, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_b, stride, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_c, stride, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_d, stride, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride - 1, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
ok (hr == S_OK, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, sizeof(buffer), buffer);
ok (hr == S_OK, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, frame_stride * height_in_blocks - 1, buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, frame_stride * height_in_blocks, buffer);
ok (hr == S_OK, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, 0, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride - 1, sizeof(buffer), buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride * 2, sizeof(buffer), buffer);
ok (hr == S_OK, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, 0, buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, 1, buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, stride * rect.Height - 1, buffer);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, stride * rect.Height, buffer);
ok (hr == S_OK, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, sizeof(buffer), NULL);
ok (hr == E_INVALIDARG, "%d: [frame %d] Got unexpected hr %x\n", i, frame_index, hr);
ok(hr == E_INVALIDARG, "Test %u, frame %u: CopyBlocks got unexpected hr %#x\n", i, frame_index, hr);
block_offset = 128; /* DDS magic and header */
if (has_extended_header(test_data[i].data)) block_offset += 20; /* DDS extended header */
......@@ -611,22 +614,22 @@ static void test_dds_decoder_frame_data(IWICDdsFrameDecode *dds_frame, UINT fram
}
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, sizeof(buffer), buffer);
ok (hr == S_OK, "%d: [frame %d] CopyBlocks failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
ok (!strncmp((const char *)test_data[i].data + block_offset, (const char *)buffer, format_info.BytesPerBlock),
"%d: [frame %d] Block data mismatch\n", i, frame_index);
ok(!strncmp((const char *)test_data[i].data + block_offset, (const char *)buffer, format_info.BytesPerBlock),
"Test %u, frame %u: Block data mismatch\n", i, frame_index);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, sizeof(buffer), buffer);
ok (hr == S_OK, "%d: [frame %d] CopyBlocks failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
ok (!strncmp((const char *)test_data[i].data + block_offset, (const char *)buffer, frame_size),
"%d: [frame %d] Block data mismatch\n", i, frame_index);
ok(!strncmp((const char *)test_data[i].data + block_offset, (const char *)buffer, frame_size),
"Test %u, frame %u: Block data mismatch\n", i, frame_index);
hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
ok (hr == S_OK, "%d: [frame %d] CopyBlocks failed, hr=%x\n", i, frame_index, hr);
ok(hr == S_OK, "Test %u, frame %u: CopyBlocks failed, hr %#x\n", i, frame_index, hr);
if (hr != S_OK) return;
ok (!strncmp((const char *)test_data[i].data + block_offset, (const char *)buffer, frame_size),
"%d: [frame %d] Block data mismatch\n", i, frame_index);
ok(!strncmp((const char *)test_data[i].data + block_offset, (const char *)buffer, frame_size),
"Test %u, frame %u: Block data mismatch\n", i, frame_index);
}
static void test_dds_decoder_frame(IWICBitmapDecoder *decoder, int i)
......@@ -637,13 +640,13 @@ static void test_dds_decoder_frame(IWICBitmapDecoder *decoder, int i)
WICDdsParameters params;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok (hr == S_OK, "%d: GetFrameCount failed, hr=%x\n", i, hr);
ok(hr == S_OK, "Test %u: GetFrameCount failed, hr %#x\n", i, hr);
if (hr != S_OK) return;
hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
ok(hr == S_OK, "%d: QueryInterface failed, hr=%x\n", i, hr);
ok(hr == S_OK, "Test %u: QueryInterface failed, hr %#x\n", i, hr);
if (hr != S_OK) goto end;
hr = IWICDdsDecoder_GetParameters(dds_decoder, &params);
ok (hr == S_OK, "%d: GetParameters failed, hr=%x\n", i, hr);
ok(hr == S_OK, "Test %u: GetParameters failed, hr %#x\n", i, hr);
if (hr != S_OK) goto end;
for (j = 0; j < frame_count; j++)
......@@ -652,10 +655,10 @@ static void test_dds_decoder_frame(IWICBitmapDecoder *decoder, int i)
IWICDdsFrameDecode *dds_frame = NULL;
hr = IWICBitmapDecoder_GetFrame(decoder, j, &frame_decode);
ok (hr == S_OK, "%d: GetFrame failed for frame %d, hr=%x\n", i, j, hr);
ok(hr == S_OK, "Test %u, frame %u: GetFrame failed, hr %#x\n", i, j, hr);
if (hr != S_OK) goto next;
hr = IWICBitmapFrameDecode_QueryInterface(frame_decode, &IID_IWICDdsFrameDecode, (void **)&dds_frame);
ok(hr == S_OK, "%d: [frame %d] QueryInterface failed, hr=%x\n", i, j, hr);
ok(hr == S_OK, "Test %u, frame %u: QueryInterface failed, hr %#x\n", i, j, hr);
if (hr != S_OK) goto next;
test_dds_decoder_frame_properties(frame_decode, dds_frame, frame_count, &params, i, j);
......@@ -706,12 +709,12 @@ START_TEST(ddsformat)
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed, hr %#x\n", hr);
if (hr != S_OK) goto end;
test_dds_decoder();
end:
if(factory) IWICImagingFactory_Release(factory);
if (factory) IWICImagingFactory_Release(factory);
CoUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment