Hans Leidekker : windowscodecs: Implement IWICBitmapDecoderInfo:: GetFileExtensions.

Alexandre Julliard julliard at winehq.org
Tue Nov 13 13:46:05 CST 2012


Module: wine
Branch: master
Commit: 853273c98bf4421e8460bb582a9998e8032b31ab
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=853273c98bf4421e8460bb582a9998e8032b31ab

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Nov 13 10:06:20 2012 +0100

windowscodecs: Implement IWICBitmapDecoderInfo::GetFileExtensions.

---

 dlls/windowscodecs/info.c       |    9 +++++++--
 dlls/windowscodecs/tests/info.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index 3c67eb7..3da5b20 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -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,
diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c
index 6c393d7..d9159b1 100644
--- a/dlls/windowscodecs/tests/info.c
+++ b/dlls/windowscodecs/tests/info.c
@@ -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);




More information about the wine-cvs mailing list