Module: wine Branch: master Commit: 100546686c8adb94d5b8a61fcab557c9fadd344f URL: http://source.winehq.org/git/wine.git/?a=commit;h=100546686c8adb94d5b8a61fca...
Author: Vincent Povirk vincent@codeweavers.com Date: Tue Jul 28 17:21:42 2009 -0500
windowscodecs: Add test for IWICImagingFactory::CreateDecoderFromStream.
---
dlls/windowscodecs/tests/bmpformat.c | 49 ++++++++++++++++++++++++++++++++++ 1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c index 6f6b83a..39bb3b4 100644 --- a/dlls/windowscodecs/tests/bmpformat.c +++ b/dlls/windowscodecs/tests/bmpformat.c @@ -986,6 +986,54 @@ static void test_componentinfo(void) } }
+static void test_createfromstream(void) +{ + IWICBitmapDecoder *decoder; + IWICImagingFactory *factory; + HRESULT hr; + HGLOBAL hbmpdata; + char *bmpdata; + IStream *bmpstream; + GUID guidresult; + + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICImagingFactory, (void**)&factory); + ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); + if (!SUCCEEDED(hr)) return; + + hbmpdata = GlobalAlloc(GMEM_MOVEABLE, sizeof(testbmp_1bpp)); + ok(hbmpdata != 0, "GlobalAlloc failed\n"); + if (hbmpdata) + { + bmpdata = GlobalLock(hbmpdata); + memcpy(bmpdata, testbmp_1bpp, sizeof(testbmp_1bpp)); + GlobalUnlock(hbmpdata); + + hr = CreateStreamOnHGlobal(hbmpdata, FALSE, &bmpstream); + ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICImagingFactory_CreateDecoderFromStream(factory, bmpstream, + NULL, WICDecodeMetadataCacheOnDemand, &decoder); + ok(SUCCEEDED(hr), "CreateDecoderFromStream failed, hr=%x\n", hr); + if (SUCCEEDED(hr)) + { + hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult); + ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr); + ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n"); + + IWICBitmapDecoder_Release(decoder); + } + + IStream_Release(bmpstream); + } + + GlobalFree(hbmpdata); + } + + IWICImagingFactory_Release(factory); +} + START_TEST(bmpformat) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); @@ -996,6 +1044,7 @@ START_TEST(bmpformat) test_decode_rle8(); test_decode_rle4(); test_componentinfo(); + test_createfromstream();
CoUninitialize(); }