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

This commit is contained in:
Dmitry Timoshkov 2012-11-23 15:40:37 +08:00 committed by Alexandre Julliard
parent 5554292284
commit 37892c2f28
2 changed files with 13 additions and 1 deletions

View File

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

View File

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