Commit 8ec1008f authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: Add a bunch of tests for GIF Comment Extenstion metadata reader.

parent 32a5a11b
...@@ -1558,6 +1558,77 @@ todo_wine ...@@ -1558,6 +1558,77 @@ todo_wine
IStream_Release(stream); IStream_Release(stream);
} }
static void test_metadata_GIF_comment(void)
{
static const WCHAR GIF_comment_name[] = {'C','o','m','m','e','n','t',' ','E','x','t','e','n','s','i','o','n',' ','R','e','a','d','e','r',0};
static const char GIF_comment_data[] = { 0x21,0xfe,
/*sub-block*/5,'H','e','l','l','o',
/*sub-block*/1,' ',
/*sub-block*/6,'W','o','r','l','d','!',
/*terminator*/0 };
static const struct test_data td[1] =
{
{ VT_LPSTR, 0, 12, { 0 }, "Hello World!", { 'T','e','x','t','E','n','t','r','y',0 } }
};
HRESULT hr;
IStream *stream;
IWICPersistStream *persist;
IWICMetadataReader *reader;
IWICMetadataHandlerInfo *info;
WCHAR name[64];
UINT count, dummy;
GUID format;
CLSID id;
hr = CoCreateInstance(&CLSID_WICGifCommentMetadataReader, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICMetadataReader, (void **)&reader);
todo_wine
ok(hr == S_OK || broken(hr == E_NOINTERFACE || hr == REGDB_E_CLASSNOTREG) /* before Win7 */,
"CoCreateInstance error %#x\n", hr);
stream = create_stream(GIF_comment_data, sizeof(GIF_comment_data));
if (SUCCEEDED(hr))
{
hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist);
ok(hr == S_OK, "QueryInterface error %#x\n", hr);
hr = IWICPersistStream_Load(persist, stream);
ok(hr == S_OK, "Load error %#x\n", hr);
IWICPersistStream_Release(persist);
}
if (SUCCEEDED(hr))
{
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
hr = IWICMetadataReader_GetMetadataFormat(reader, &format);
ok(hr == S_OK, "GetMetadataFormat error %#x\n", hr);
ok(IsEqualGUID(&format, &GUID_MetadataFormatGifComment), "wrong format %s\n", debugstr_guid(&format));
hr = IWICMetadataReader_GetMetadataHandlerInfo(reader, &info);
ok(hr == S_OK, "GetMetadataHandlerInfo error %#x\n", hr);
hr = IWICMetadataHandlerInfo_GetCLSID(info, &id);
ok(hr == S_OK, "GetCLSID error %#x\n", hr);
ok(IsEqualGUID(&id, &CLSID_WICGifCommentMetadataReader), "wrong CLSID %s\n", debugstr_guid(&id));
hr = IWICMetadataHandlerInfo_GetFriendlyName(info, 64, name, &dummy);
ok(hr == S_OK, "GetFriendlyName error %#x\n", hr);
ok(lstrcmpW(name, GIF_comment_name) == 0, "wrong APE reader name %s\n", wine_dbgstr_w(name));
IWICMetadataHandlerInfo_Release(info);
IWICMetadataReader_Release(reader);
}
IStream_Release(stream);
}
START_TEST(metadata) START_TEST(metadata)
{ {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
...@@ -1573,6 +1644,7 @@ START_TEST(metadata) ...@@ -1573,6 +1644,7 @@ START_TEST(metadata)
test_metadata_IMD(); test_metadata_IMD();
test_metadata_GCE(); test_metadata_GCE();
test_metadata_APE(); test_metadata_APE();
test_metadata_GIF_comment();
CoUninitialize(); CoUninitialize();
} }
...@@ -47,6 +47,7 @@ cpp_quote("DEFINE_GUID(GUID_MetadataFormatIMD, 0xbd2bb086,0x4d52,0x48dd,0x96,0x7 ...@@ -47,6 +47,7 @@ cpp_quote("DEFINE_GUID(GUID_MetadataFormatIMD, 0xbd2bb086,0x4d52,0x48dd,0x96,0x7
cpp_quote("DEFINE_GUID(GUID_MetadataFormatLSD, 0xe256031e,0x6299,0x4929,0xb9,0x8d,0x5a,0xc8,0x84,0xaf,0xba,0x92);") cpp_quote("DEFINE_GUID(GUID_MetadataFormatLSD, 0xe256031e,0x6299,0x4929,0xb9,0x8d,0x5a,0xc8,0x84,0xaf,0xba,0x92);")
cpp_quote("DEFINE_GUID(GUID_MetadataFormatGCE, 0x2a25cad8,0xdeeb,0x4c69,0xa7,0x88,0x0e,0xc2,0x26,0x6d,0xca,0xfd);") cpp_quote("DEFINE_GUID(GUID_MetadataFormatGCE, 0x2a25cad8,0xdeeb,0x4c69,0xa7,0x88,0x0e,0xc2,0x26,0x6d,0xca,0xfd);")
cpp_quote("DEFINE_GUID(GUID_MetadataFormatAPE, 0x2e043dc2,0xc967,0x4e05,0x87,0x5e,0x61,0x8b,0xf6,0x7e,0x85,0xc3);") cpp_quote("DEFINE_GUID(GUID_MetadataFormatAPE, 0x2e043dc2,0xc967,0x4e05,0x87,0x5e,0x61,0x8b,0xf6,0x7e,0x85,0xc3);")
cpp_quote("DEFINE_GUID(GUID_MetadataFormatGifComment, 0xc4b6e0e0,0xcfb4,0x4ad3,0xab,0x33,0x9a,0xad,0x23,0x55,0xa3,0x4a);")
cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataReader, 0x699745c2,0x5066,0x4b82,0xa8,0xe3,0xd4,0x04,0x78,0xdb,0xec,0x8c);") cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataReader, 0x699745c2,0x5066,0x4b82,0xa8,0xe3,0xd4,0x04,0x78,0xdb,0xec,0x8c);")
cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataWriter, 0xa09cca86,0x27ba,0x4f39,0x90,0x53,0x12,0x1f,0xa4,0xdc,0x08,0xfc);") cpp_quote("DEFINE_GUID(CLSID_WICUnknownMetadataWriter, 0xa09cca86,0x27ba,0x4f39,0x90,0x53,0x12,0x1f,0xa4,0xdc,0x08,0xfc);")
...@@ -66,6 +67,8 @@ cpp_quote("DEFINE_GUID(CLSID_WICGCEMetadataReader, 0xb92e345d,0xf52d,0x41f3,0xb5 ...@@ -66,6 +67,8 @@ cpp_quote("DEFINE_GUID(CLSID_WICGCEMetadataReader, 0xb92e345d,0xf52d,0x41f3,0xb5
cpp_quote("DEFINE_GUID(CLSID_WICGCEMetadataWriter, 0xaf95dc76,0x16b2,0x47f4,0xb3,0xea,0x3c,0x31,0x79,0x66,0x93,0xe7);") cpp_quote("DEFINE_GUID(CLSID_WICGCEMetadataWriter, 0xaf95dc76,0x16b2,0x47f4,0xb3,0xea,0x3c,0x31,0x79,0x66,0x93,0xe7);")
cpp_quote("DEFINE_GUID(CLSID_WICAPEMetadataReader, 0x1767b93a,0xb021,0x44ea,0x92,0x0f,0x86,0x3c,0x11,0xf4,0xf7,0x68);") cpp_quote("DEFINE_GUID(CLSID_WICAPEMetadataReader, 0x1767b93a,0xb021,0x44ea,0x92,0x0f,0x86,0x3c,0x11,0xf4,0xf7,0x68);")
cpp_quote("DEFINE_GUID(CLSID_WICAPEMetadataWriter, 0xbd6edfca,0x2890,0x482f,0xb2,0x33,0x8d,0x73,0x39,0xa1,0xcf,0x8d);") cpp_quote("DEFINE_GUID(CLSID_WICAPEMetadataWriter, 0xbd6edfca,0x2890,0x482f,0xb2,0x33,0x8d,0x73,0x39,0xa1,0xcf,0x8d);")
cpp_quote("DEFINE_GUID(CLSID_WICGifCommentMetadataReader, 0x32557d3b,0x69dc,0x4f95,0x83,0x6e,0xf5,0x97,0x2b,0x2f,0x61,0x59);")
cpp_quote("DEFINE_GUID(CLSID_WICGifCommentMetadataWriter, 0xa02797fc,0xc4ae,0x418c,0xaf,0x95,0xe6,0x37,0xc7,0xea,0xd2,0xa1);")
typedef struct WICMetadataPattern { typedef struct WICMetadataPattern {
ULARGE_INTEGER Position; ULARGE_INTEGER Position;
......
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