Commit 37892c2f authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: Add a test to show that QueryCapability initializes the decoder.

parent 55542922
......@@ -185,6 +185,7 @@ static void test_QueryCapability(void)
HRESULT hr;
IStream *stream;
IWICBitmapDecoder *decoder;
IWICBitmapFrameDecode *frame;
static const DWORD exp_caps = WICBitmapDecoderCapabilityCanDecodeAllImages |
WICBitmapDecoderCapabilityCanDecodeSomeImages |
WICBitmapDecoderCapabilityCanEnumerateMetadata;
......@@ -206,6 +207,9 @@ static void test_QueryCapability(void)
ok(hr == S_OK || broken(hr == E_POINTER) /* XP */, "GetFrameCount error %#x\n", hr);
ok(frame_count == 0, "expected 0, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == WINCODEC_ERR_FRAMEMISSING || broken(hr == E_POINTER) /* XP */, "expected WINCODEC_ERR_FRAMEMISSING, got %#x\n", hr);
pos.QuadPart = 4;
hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
......@@ -221,6 +225,10 @@ static void test_QueryCapability(void)
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
IWICBitmapFrameDecode_Release(frame);
pos.QuadPart = 0;
hr = IStream_Seek(stream, pos, SEEK_CUR, &cur_pos);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
......@@ -251,6 +259,10 @@ todo_wine
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
ok(hr == S_OK, "GetFrame error %#x\n", hr);
IWICBitmapFrameDecode_Release(frame);
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
......
......@@ -702,7 +702,7 @@ static HRESULT WINAPI TiffDecoder_GetFrame(IWICBitmapDecoder *iface,
TRACE("(%p,%u,%p)\n", iface, index, ppIBitmapFrame);
if (!This->tiff)
return WINCODEC_ERR_WRONGSTATE;
return WINCODEC_ERR_FRAMEMISSING;
EnterCriticalSection(&This->lock);
res = pTIFFSetDirectory(This->tiff, index);
......
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