Commit 853273c9 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

windowscodecs: Implement IWICBitmapDecoderInfo::GetFileExtensions.

parent 641a6e6c
......@@ -55,6 +55,7 @@ static const WCHAR numericrepresentation_valuename[] = {'N','u','m','e','r','i',
static const WCHAR supportstransparency_valuename[] = {'S','u','p','p','o','r','t','s','T','r','a','n','s','p','a','r','e','n','c','y',0};
static const WCHAR requiresfullstream_valuename[] = {'R','e','q','u','i','r','e','s','F','u','l','l','S','t','r','e','a','m',0};
static const WCHAR supportspadding_valuename[] = {'S','u','p','p','o','r','t','s','P','a','d','d','i','n','g',0};
static const WCHAR fileextensions_valuename[] = {'F','i','l','e','E','x','t','e','n','s','i','o','n','s',0};
static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value,
UINT buffer_size, WCHAR *buffer, UINT *actual_size)
......@@ -393,8 +394,12 @@ static HRESULT WINAPI BitmapDecoderInfo_GetMimeTypes(IWICBitmapDecoderInfo *ifac
static HRESULT WINAPI BitmapDecoderInfo_GetFileExtensions(IWICBitmapDecoderInfo *iface,
UINT cchFileExtensions, WCHAR *wzFileExtensions, UINT *pcchActual)
{
FIXME("(%p,%u,%p,%p): stub\n", iface, cchFileExtensions, wzFileExtensions, pcchActual);
return E_NOTIMPL;
BitmapDecoderInfo *This = impl_from_IWICBitmapDecoderInfo(iface);
TRACE("(%p,%u,%p,%p)\n", iface, cchFileExtensions, wzFileExtensions, pcchActual);
return ComponentInfo_GetStringValue(This->classkey, fileextensions_valuename,
cchFileExtensions, wzFileExtensions, pcchActual);
}
static HRESULT WINAPI BitmapDecoderInfo_DoesSupportAnimation(IWICBitmapDecoderInfo *iface,
......
......@@ -88,6 +88,7 @@ static void test_decoder_info(void)
ULONG len;
WCHAR value[256];
const WCHAR expected_mimetype[] = {'i','m','a','g','e','/','b','m','p',0};
const WCHAR expected_extensions[] = {'.','b','m','p',',','.','d','i','b',',','.','r','l','e',0};
CLSID clsid;
GUID pixelformats[20];
UINT num_formats, count;
......@@ -168,6 +169,35 @@ static void test_decoder_info(void)
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(count == num_formats, "got %d formats, expected %d\n", count, num_formats);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 0, NULL, NULL);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%x\n", hr);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 1, NULL, &len);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%x\n", hr);
ok(len == lstrlenW(expected_extensions)+1, "GetFileExtensions returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, len, value, NULL);
ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%x\n", hr);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 0, NULL, &len);
ok(hr == S_OK, "GetFileExtensions failed, hr=%x\n", hr);
ok(len == lstrlenW(expected_extensions)+1, "GetFileExtensions returned wrong len %i\n", len);
value[0] = 0;
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, len, value, &len);
ok(hr == S_OK, "GetFileExtensions failed, hr=%x\n", hr);
ok(lstrcmpW(value, expected_extensions) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value));
ok(len == lstrlenW(expected_extensions)+1, "GetFileExtensions returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 1, value, &len);
ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetFileExtensions failed, hr=%x\n", hr);
ok(len == lstrlenW(expected_extensions)+1, "GetFileExtensions returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 256, value, &len);
ok(hr == S_OK, "GetFileExtensions failed, hr=%x\n", hr);
ok(lstrcmpW(value, expected_extensions) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value));
ok(len == lstrlenW(expected_extensions)+1, "GetFileExtensions returned wrong len %i\n", len);
IWICBitmapDecoderInfo_Release(decoder_info);
IWICComponentInfo_Release(info);
......
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