gdi32: Fix coordinates for row copies in mirrored vertical stretching.
[wine/multimedia.git] / dlls / windowscodecs / tests / info.c
blobde2dd3230eb70ed4b4916c6102e29123ba983b72
1 /*
2 * Copyright 2009 Vincent Povirk for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include <math.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "objbase.h"
26 #include "wincodec.h"
27 #include "wine/test.h"
29 static void test_decoder_info(void)
31 IWICImagingFactory *factory;
32 IWICComponentInfo *info;
33 IWICBitmapDecoderInfo *decoder_info;
34 HRESULT hr;
35 ULONG len;
36 WCHAR value[256];
37 const WCHAR expected_mimetype[] = {'i','m','a','g','e','/','b','m','p',0};
38 CLSID clsid;
40 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
41 &IID_IWICImagingFactory, (void**)&factory);
42 ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
43 if (FAILED(hr)) return;
45 hr = IWICImagingFactory_CreateComponentInfo(factory, &CLSID_WICBmpDecoder, &info);
46 ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
48 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICBitmapDecoderInfo, (void**)&decoder_info);
49 ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
51 hr = IWICBitmapDecoderInfo_GetCLSID(decoder_info, NULL);
52 ok(hr == E_INVALIDARG, "GetCLSID failed, hr=%x\n", hr);
54 hr = IWICBitmapDecoderInfo_GetCLSID(decoder_info, &clsid);
55 ok(hr == S_OK, "GetCLSID failed, hr=%x\n", hr);
56 ok(IsEqualGUID(&CLSID_WICBmpDecoder, &clsid), "GetCLSID returned wrong result\n");
58 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, NULL);
59 ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
61 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, NULL, &len);
62 ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
63 ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
65 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, NULL);
66 ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%x\n", hr);
68 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, &len);
69 ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
70 ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
72 value[0] = 0;
73 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, &len);
74 ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
75 ok(lstrcmpW(value, expected_mimetype) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
76 ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
78 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, value, &len);
79 ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetMimeType failed, hr=%x\n", hr);
80 ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
82 hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 256, value, &len);
83 ok(hr == S_OK, "GetMimeType failed, hr=%x\n", hr);
84 ok(lstrcmpW(value, expected_mimetype) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value));
85 ok(len == lstrlenW(expected_mimetype)+1, "GetMimeType returned wrong len %i\n", len);
87 IWICBitmapDecoderInfo_Release(decoder_info);
89 IWICComponentInfo_Release(info);
91 IWICImagingFactory_Release(factory);
94 START_TEST(info)
96 CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
98 test_decoder_info();
100 CoUninitialize();