Module: wine Branch: master Commit: 37892c2f282794377a6b04386a42d42957908464 URL: http://source.winehq.org/git/wine.git/?a=commit;h=37892c2f282794377a6b04386a...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Fri Nov 23 15:40:37 2012 +0800
windowscodecs: Add a test to show that QueryCapability initializes the decoder.
---
dlls/windowscodecs/tests/tiffformat.c | 12 ++++++++++++ dlls/windowscodecs/tiffformat.c | 2 +- 2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c index d8cb10a..f32f6a5 100644 --- a/dlls/windowscodecs/tests/tiffformat.c +++ b/dlls/windowscodecs/tests/tiffformat.c @@ -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);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index bacc9c5..6c29bab 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -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);