From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/tests/info.c | 69 ++++++++-------- dlls/windowscodecs/tests/metadata.c | 121 +++++++++++++--------------- 2 files changed, 90 insertions(+), 100 deletions(-)
diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c index 29a2d87e9ce..031e83c9d7d 100644 --- a/dlls/windowscodecs/tests/info.c +++ b/dlls/windowscodecs/tests/info.c @@ -107,51 +107,51 @@ static BOOL is_pixelformat(GUID *format)
static void test_decoder_info(void) { - struct decoder_info_test + static const struct decoder_info_test { const CLSID *clsid; - const char *mimetype; - const char *extensions; + const WCHAR *mimetype; + const WCHAR *extensions; unsigned int todo; } decoder_info_tests[] = { { &CLSID_WICBmpDecoder, - "image/bmp", - ".bmp,.dib,.rle" + L"image/bmp", + L".bmp,.dib,.rle" }, { &CLSID_WICGifDecoder, - "image/gif", - ".gif" + L"image/gif", + L".gif" }, { &CLSID_WICIcoDecoder, - "image/ico,image/x-icon", - ".ico,.icon", + L"image/ico,image/x-icon", + L".ico,.icon", 1 }, { &CLSID_WICJpegDecoder, - "image/jpeg,image/jpe,image/jpg", - ".jpeg,.jpe,.jpg,.jfif,.exif", + L"image/jpeg,image/jpe,image/jpg", + L".jpeg,.jpe,.jpg,.jfif,.exif", 1 }, { &CLSID_WICPngDecoder, - "image/png", - ".png" + L"image/png", + L".png" }, { &CLSID_WICTiffDecoder, - "image/tiff,image/tif", - ".tiff,.tif", + L"image/tiff,image/tif", + L".tiff,.tif", 1 }, { &CLSID_WICDdsDecoder, - "image/vnd.ms-dds", - ".dds", + L"image/vnd.ms-dds", + L".dds", } }; IWICBitmapDecoderInfo *decoder_info, *decoder_info2; @@ -166,10 +166,8 @@ static void test_decoder_info(void)
for (i = 0; i < ARRAY_SIZE(decoder_info_tests); i++) { - struct decoder_info_test *test = &decoder_info_tests[i]; + const struct decoder_info_test *test = &decoder_info_tests[i]; IWICBitmapDecoder *decoder, *decoder2; - WCHAR extensionsW[64]; - WCHAR mimetypeW[64];
hr = CoCreateInstance(test->clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IWICBitmapDecoder, (void **)&decoder); if (test->clsid == &CLSID_WICDdsDecoder && hr != S_OK) { @@ -198,9 +196,6 @@ static void test_decoder_info(void) } IWICBitmapDecoder_Release(decoder);
- MultiByteToWideChar(CP_ACP, 0, test->mimetype, -1, mimetypeW, ARRAY_SIZE(mimetypeW)); - MultiByteToWideChar(CP_ACP, 0, test->extensions, -1, extensionsW, ARRAY_SIZE(extensionsW)); - hr = get_component_info(test->clsid, &info); ok(hr == S_OK, "CreateComponentInfo failed, hr=%lx\n", hr);
@@ -221,7 +216,7 @@ static void test_decoder_info(void) hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, NULL, &len); ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%lx\n", hr); todo_wine_if(test->todo) - ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len); + ok(len == lstrlenW(test->mimetype) + 1, "GetMimeType returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, NULL); ok(hr == E_INVALIDARG, "GetMimeType failed, hr=%lx\n", hr); @@ -230,25 +225,25 @@ static void test_decoder_info(void) hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 0, NULL, &len); ok(hr == S_OK, "GetMimeType failed, hr=%lx\n", hr); todo_wine_if(test->todo) - ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len); + ok(len == lstrlenW(test->mimetype) + 1, "GetMimeType returned wrong len %i\n", len);
value[0] = 0; hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, len, value, &len); ok(hr == S_OK, "GetMimeType failed, hr=%lx\n", hr); todo_wine_if(test->todo) { - ok(lstrcmpW(value, mimetypeW) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value)); - ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len); + ok(!lstrcmpW(value, test->mimetype), "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value)); + ok(len == lstrlenW(test->mimetype) + 1, "GetMimeType returned wrong len %i\n", len); } hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 1, value, &len); ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "GetMimeType failed, hr=%lx\n", hr); todo_wine_if(test->todo) - ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len); + ok(len == lstrlenW(test->mimetype) + 1, "GetMimeType returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetMimeTypes(decoder_info, 256, value, &len); ok(hr == S_OK, "GetMimeType failed, hr=%lx\n", hr); todo_wine_if(test->todo) { - ok(lstrcmpW(value, mimetypeW) == 0, "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value)); - ok(len == lstrlenW(mimetypeW) + 1, "GetMimeType returned wrong len %i\n", len); + ok(!lstrcmpW(value, test->mimetype), "GetMimeType returned wrong value %s\n", wine_dbgstr_w(value)); + ok(len == lstrlenW(test->mimetype) + 1, "GetMimeType returned wrong len %i\n", len); } num_formats = 0xdeadbeef; hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, 0, NULL, &num_formats); @@ -294,7 +289,7 @@ static void test_decoder_info(void) hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 1, NULL, &len); ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%lx\n", hr); todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder)) - ok(len == lstrlenW(extensionsW) + 1, "%u: GetFileExtensions returned wrong len %i\n", i, len); + ok(len == lstrlenW(test->extensions) + 1, "%u: GetFileExtensions returned wrong len %i\n", i, len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, len, value, NULL); ok(hr == E_INVALIDARG, "GetFileExtensions failed, hr=%lx\n", hr); @@ -302,27 +297,27 @@ static void test_decoder_info(void) hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 0, NULL, &len); ok(hr == S_OK, "GetFileExtensions failed, hr=%lx\n", hr); todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder)) - ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len); + ok(len == lstrlenW(test->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=%lx\n", hr); todo_wine_if(test->todo) - ok(lstrcmpW(value, extensionsW) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value)); + ok(lstrcmpW(value, test->extensions) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value)); todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder)) - ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len); + ok(len == lstrlenW(test->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=%lx\n", hr); todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder)) - ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len); + ok(len == lstrlenW(test->extensions) + 1, "GetFileExtensions returned wrong len %i\n", len);
hr = IWICBitmapDecoderInfo_GetFileExtensions(decoder_info, 256, value, &len); ok(hr == S_OK, "GetFileExtensions failed, hr=%lx\n", hr); todo_wine_if(test->todo) - ok(lstrcmpW(value, extensionsW) == 0, "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value)); + ok(!lstrcmpW(value, test->extensions), "GetFileExtensions returned wrong value %s\n", wine_dbgstr_w(value)); todo_wine_if(test->todo && !IsEqualCLSID(test->clsid, &CLSID_WICTiffDecoder)) - ok(len == lstrlenW(extensionsW) + 1, "GetFileExtensions returned wrong len %i\n", len); + ok(len == lstrlenW(test->extensions) + 1, "GetFileExtensions returned wrong len %i\n", len);
IWICBitmapDecoderInfo_Release(decoder_info); IWICComponentInfo_Release(info); diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index d051c187d3d..e8e74839aff 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -3173,28 +3173,28 @@ static void test_metadata_gif(void) { static const struct { - const char *query; + const WCHAR *query; HRESULT hr; UINT vt; } decoder_data[] = { - { "/logscrdesc/Signature", S_OK, VT_UI1 | VT_VECTOR }, - { "/[0]logscrdesc/Signature", S_OK, VT_UI1 | VT_VECTOR }, - { "/logscrdesc/\Signature", S_OK, VT_UI1 | VT_VECTOR }, - { "/Logscrdesc/\signature", S_OK, VT_UI1 | VT_VECTOR }, - { "/logscrdesc/{str=signature}", S_OK, VT_UI1 | VT_VECTOR }, - { "/[0]logscrdesc/{str=signature}", S_OK, VT_UI1 | VT_VECTOR }, - { "/logscrdesc/{wstr=signature}", S_OK, VT_UI1 | VT_VECTOR }, - { "/[0]logscrdesc/{wstr=signature}", S_OK, VT_UI1 | VT_VECTOR }, - { "/appext/Application", S_OK, VT_UI1 | VT_VECTOR }, - { "/appext/{STR=APPlication}", S_OK, VT_UI1 | VT_VECTOR }, - { "/appext/{WSTR=APPlication}", S_OK, VT_UI1 | VT_VECTOR }, - { "/LogSCRdesC", S_OK, VT_UNKNOWN }, - { "/[0]LogSCRdesC", S_OK, VT_UNKNOWN }, - { "/appEXT", S_OK, VT_UNKNOWN }, - { "/[0]appEXT", S_OK, VT_UNKNOWN }, - { "grctlext", WINCODEC_ERR_PROPERTYNOTSUPPORTED, 0 }, - { "/imgdesc", WINCODEC_ERR_PROPERTYNOTFOUND, 0 }, + { L"/logscrdesc/Signature", S_OK, VT_UI1 | VT_VECTOR }, + { L"/[0]logscrdesc/Signature", S_OK, VT_UI1 | VT_VECTOR }, + { L"/logscrdesc/\Signature", S_OK, VT_UI1 | VT_VECTOR }, + { L"/Logscrdesc/\signature", S_OK, VT_UI1 | VT_VECTOR }, + { L"/logscrdesc/{str=signature}", S_OK, VT_UI1 | VT_VECTOR }, + { L"/[0]logscrdesc/{str=signature}", S_OK, VT_UI1 | VT_VECTOR }, + { L"/logscrdesc/{wstr=signature}", S_OK, VT_UI1 | VT_VECTOR }, + { L"/[0]logscrdesc/{wstr=signature}", S_OK, VT_UI1 | VT_VECTOR }, + { L"/appext/Application", S_OK, VT_UI1 | VT_VECTOR }, + { L"/appext/{STR=APPlication}", S_OK, VT_UI1 | VT_VECTOR }, + { L"/appext/{WSTR=APPlication}", S_OK, VT_UI1 | VT_VECTOR }, + { L"/LogSCRdesC", S_OK, VT_UNKNOWN }, + { L"/[0]LogSCRdesC", S_OK, VT_UNKNOWN }, + { L"/appEXT", S_OK, VT_UNKNOWN }, + { L"/[0]appEXT", S_OK, VT_UNKNOWN }, + { L"grctlext", WINCODEC_ERR_PROPERTYNOTSUPPORTED, 0 }, + { L"/imgdesc", WINCODEC_ERR_PROPERTYNOTFOUND, 0 }, }; WCHAR name[256]; UINT len, i, j; @@ -3215,18 +3215,14 @@ static void test_metadata_gif(void)
for (i = 0; i < ARRAY_SIZE(decoder_data); i++) { - WCHAR queryW[256]; + winetest_push_context("%s", wine_dbgstr_w(decoder_data[i].query));
- if (winetest_debug > 1) - trace("query: %s\n", decoder_data[i].query); - MultiByteToWideChar(CP_ACP, 0, decoder_data[i].query, -1, queryW, 256); - - hr = IWICMetadataQueryReader_GetMetadataByName(queryreader, queryW, NULL); - ok(hr == decoder_data[i].hr, "GetMetadataByName(%s) returned %#lx, expected %#lx\n", wine_dbgstr_w(queryW), hr, decoder_data[i].hr); + hr = IWICMetadataQueryReader_GetMetadataByName(queryreader, decoder_data[i].query, NULL); + ok(hr == decoder_data[i].hr, "Unexpected hr %#lx.\n", hr);
PropVariantInit(&value); - hr = IWICMetadataQueryReader_GetMetadataByName(queryreader, queryW, &value); - ok(hr == decoder_data[i].hr, "GetMetadataByName(%s) returned %#lx, expected %#lx\n", wine_dbgstr_w(queryW), hr, decoder_data[i].hr); + hr = IWICMetadataQueryReader_GetMetadataByName(queryreader, decoder_data[i].query, &value); + ok(hr == decoder_data[i].hr, "Unexpected hr %#lx.\n", hr); ok(value.vt == decoder_data[i].vt, "expected %#x, got %#x\n", decoder_data[i].vt, value.vt); if (hr == S_OK && value.vt == VT_UNKNOWN) { @@ -3237,20 +3233,16 @@ static void test_metadata_gif(void) len = 0xdeadbeef; hr = IWICMetadataQueryReader_GetLocation(meta_reader, 256, name, &len); ok(hr == S_OK, "GetLocation error %#lx\n", hr); - ok(len == lstrlenW(queryW) + 1, "expected %u, got %u\n", lstrlenW(queryW) + 1, len); - ok(!lstrcmpW(name, queryW), "expected %s, got %s\n", wine_dbgstr_w(queryW), wine_dbgstr_w(name)); + ok(len == lstrlenW(decoder_data[i].query) + 1, "expected %u, got %u\n", lstrlenW(decoder_data[i].query) + 1, len); + ok(!lstrcmpW(name, decoder_data[i].query), "expected %s, got %s\n", wine_dbgstr_w(decoder_data[i].query), wine_dbgstr_w(name));
for (j = 0; j < ARRAY_SIZE(decoder_data); j++) { - MultiByteToWideChar(CP_ACP, 0, decoder_data[j].query, -1, queryW, 256); - - if (CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, queryW, len-1, name, len-1) == CSTR_EQUAL && decoder_data[j].query[len - 1] != 0) + if (CompareStringW(LOCALE_NEUTRAL, NORM_IGNORECASE, decoder_data[j].query, len-1, name, len-1) == CSTR_EQUAL && decoder_data[j].query[len - 1] != 0) { - if (winetest_debug > 1) - trace("query: %s\n", wine_dbgstr_w(queryW + len - 1)); PropVariantClear(&value); - hr = IWICMetadataQueryReader_GetMetadataByName(meta_reader, queryW + len - 1, &value); - ok(hr == decoder_data[j].hr, "GetMetadataByName(%s) returned %#lx, expected %#lx\n", wine_dbgstr_w(queryW + len - 1), hr, decoder_data[j].hr); + hr = IWICMetadataQueryReader_GetMetadataByName(meta_reader, decoder_data[j].query + len - 1, &value); + ok(hr == S_OK, "GetLocation error %#lx\n", hr); ok(value.vt == decoder_data[j].vt, "expected %#x, got %#x\n", decoder_data[j].vt, value.vt); } } @@ -3259,6 +3251,8 @@ static void test_metadata_gif(void) }
PropVariantClear(&value); + + winetest_pop_context(); }
IWICMetadataQueryReader_Release(queryreader); @@ -3271,31 +3265,31 @@ static void test_metadata_gif(void) { static const struct { - const char *query; + const WCHAR *query; HRESULT hr; UINT vt; } frame_data[] = { - { "/grctlext/Delay", S_OK, VT_UI2 }, - { "/[0]grctlext/Delay", S_OK, VT_UI2 }, - { "/grctlext/{str=delay}", S_OK, VT_UI2 }, - { "/[0]grctlext/{str=delay}", S_OK, VT_UI2 }, - { "/grctlext/{wstr=delay}", S_OK, VT_UI2 }, - { "/[0]grctlext/{wstr=delay}", S_OK, VT_UI2 }, - { "/imgdesc/InterlaceFlag", S_OK, VT_BOOL }, - { "/imgdesc/{STR=interlaceFLAG}", S_OK, VT_BOOL }, - { "/imgdesc/{WSTR=interlaceFLAG}", S_OK, VT_BOOL }, - { "/grctlext", S_OK, VT_UNKNOWN }, - { "/[0]grctlext", S_OK, VT_UNKNOWN }, - { "/imgdesc", S_OK, VT_UNKNOWN }, - { "/[0]imgdesc", S_OK, VT_UNKNOWN }, - { "/LogSCRdesC", WINCODEC_ERR_PROPERTYNOTFOUND, 0 }, - { "/appEXT", WINCODEC_ERR_PROPERTYNOTFOUND, 0 }, - { "/grctlext/{\str=delay}", WINCODEC_ERR_WRONGSTATE, 0 }, - { "/grctlext/{str=\delay}", S_OK, VT_UI2 }, - { "grctlext/Delay", WINCODEC_ERR_PROPERTYNOTSUPPORTED, 0 }, + { L"/grctlext/Delay", S_OK, VT_UI2 }, + { L"/[0]grctlext/Delay", S_OK, VT_UI2 }, + { L"/grctlext/{str=delay}", S_OK, VT_UI2 }, + { L"/[0]grctlext/{str=delay}", S_OK, VT_UI2 }, + { L"/grctlext/{wstr=delay}", S_OK, VT_UI2 }, + { L"/[0]grctlext/{wstr=delay}", S_OK, VT_UI2 }, + { L"/imgdesc/InterlaceFlag", S_OK, VT_BOOL }, + { L"/imgdesc/{STR=interlaceFLAG}", S_OK, VT_BOOL }, + { L"/imgdesc/{WSTR=interlaceFLAG}", S_OK, VT_BOOL }, + { L"/grctlext", S_OK, VT_UNKNOWN }, + { L"/[0]grctlext", S_OK, VT_UNKNOWN }, + { L"/imgdesc", S_OK, VT_UNKNOWN }, + { L"/[0]imgdesc", S_OK, VT_UNKNOWN }, + { L"/LogSCRdesC", WINCODEC_ERR_PROPERTYNOTFOUND, 0 }, + { L"/appEXT", WINCODEC_ERR_PROPERTYNOTFOUND, 0 }, + { L"/grctlext/{\str=delay}", WINCODEC_ERR_WRONGSTATE, 0 }, + { L"/grctlext/{str=\delay}", S_OK, VT_UI2 }, + { L"grctlext/Delay", WINCODEC_ERR_PROPERTYNOTSUPPORTED, 0 }, }; - static const WCHAR guidW[] = {'/','{','g','u','i','d','=','\',0}; + static const WCHAR guidW[] = L"/{guid=\"; WCHAR name[256], queryW[256]; UINT len, i; PROPVARIANT value; @@ -3315,12 +3309,11 @@ static void test_metadata_gif(void)
for (i = 0; i < ARRAY_SIZE(frame_data); i++) { - if (winetest_debug > 1) - trace("query: %s\n", frame_data[i].query); - MultiByteToWideChar(CP_ACP, 0, frame_data[i].query, -1, queryW, 256); + winetest_push_context("%s", wine_dbgstr_w(frame_data[i].query)); + PropVariantInit(&value); - hr = IWICMetadataQueryReader_GetMetadataByName(queryreader, queryW, &value); - ok(hr == frame_data[i].hr, "GetMetadataByName(%s) returned %#lx, expected %#lx\n", wine_dbgstr_w(queryW), hr, frame_data[i].hr); + hr = IWICMetadataQueryReader_GetMetadataByName(queryreader, frame_data[i].query, &value); + ok(hr == frame_data[i].hr, "Unexpected hr %#lx.\n", hr); ok(value.vt == frame_data[i].vt, "expected %#x, got %#x\n", frame_data[i].vt, value.vt); if (hr == S_OK && value.vt == VT_UNKNOWN) { @@ -3331,13 +3324,15 @@ static void test_metadata_gif(void) len = 0xdeadbeef; hr = IWICMetadataQueryReader_GetLocation(meta_reader, 256, name, &len); ok(hr == S_OK, "GetLocation error %#lx\n", hr); - ok(len == lstrlenW(queryW) + 1, "expected %u, got %u\n", lstrlenW(queryW) + 1, len); - ok(!lstrcmpW(name, queryW), "expected %s, got %s\n", wine_dbgstr_w(queryW), wine_dbgstr_w(name)); + ok(len == lstrlenW(frame_data[i].query) + 1, "expected %u, got %u\n", lstrlenW(frame_data[i].query) + 1, len); + ok(!lstrcmpW(name, frame_data[i].query), "expected %s, got %s\n", wine_dbgstr_w(frame_data[i].query), wine_dbgstr_w(name));
IWICMetadataQueryReader_Release(meta_reader); }
PropVariantClear(&value); + + winetest_pop_context(); }
name[0] = 0;