Author: akhaldi Date: Wed Oct 8 19:32:14 2014 New Revision: 64616
URL: http://svn.reactos.org/svn/reactos?rev=64616&view=rev Log: [WINDOWSCODECS_WINETEST] * Sync with Wine 1.7.27. CORE-8540
Modified: trunk/rostests/winetests/windowscodecs/converter.c trunk/rostests/winetests/windowscodecs/metadata.c trunk/rostests/winetests/windowscodecs/propertybag.c trunk/rostests/winetests/windowscodecs/tiffformat.c
Modified: trunk/rostests/winetests/windowscodecs/converter.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/co... ============================================================================== --- trunk/rostests/winetests/windowscodecs/converter.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/converter.c [iso-8859-1] Wed Oct 8 19:32:14 2014 @@ -383,6 +383,7 @@
static const WCHAR wszTiffCompressionMethod[] = {'T','i','f','f','C','o','m','p','r','e','s','s','i','o','n','M','e','t','h','o','d',0}; static const WCHAR wszCompressionQuality[] = {'C','o','m','p','r','e','s','s','i','o','n','Q','u','a','l','i','t','y',0}; +static const WCHAR wszInterlaceOption[] = {'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0};
static const struct property_opt_test_data testdata_tiff_props[] = { { wszTiffCompressionMethod, VT_UI1, VT_UI1, WICTiffCompressionDontCare }, @@ -513,8 +514,16 @@ } }
+struct setting { + const WCHAR *name; + PROPBAG2_TYPE type; + VARTYPE vt; + void *value; +}; + static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* clsid_encoder, - const struct bitmap_data **dsts, const CLSID *clsid_decoder, const char *name) + const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc, + const struct setting *settings, const char *name) { HRESULT hr; IWICBitmapEncoder *encoder; @@ -559,6 +568,26 @@ if(options) test_encoder_properties(clsid_encoder, options);
+ if (settings) + { + int j; + for (j=0; settings[j].name; j++) + { + PROPBAG2 propbag; + VARIANT var; + + memset(&propbag, 0, sizeof(propbag)); + memset(&var, 0, sizeof(var)); + propbag.pstrName = (LPOLESTR)settings[j].name; + propbag.dwType = settings[j].type; + V_VT(&var) = settings[j].vt; + V_UNKNOWN(&var) = settings[j].value; + + hr = IPropertyBag2_Write(options, 1, &propbag, &var); + ok(SUCCEEDED(hr), "Writing property %s failed, hr=%x\n", wine_dbgstr_w(settings[j].name), hr); + } + } + hr = IWICBitmapFrameEncode_Initialize(frameencode, options); ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
@@ -570,8 +599,14 @@ hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height); ok(SUCCEEDED(hr), "SetSize failed, hr=%x\n", hr);
- hr = IWICBitmapFrameEncode_WriteSource(frameencode, &src_obj->IWICBitmapSource_iface, NULL); - ok(SUCCEEDED(hr), "WriteSource failed, hr=%x\n", hr); + hr = IWICBitmapFrameEncode_WriteSource(frameencode, &src_obj->IWICBitmapSource_iface, rc); + if (rc && (rc->Width <= 0 || rc->Height <= 0)) + { + /* WriteSource fails but WriteSource_Proxy succeeds. */ + ok(hr == E_INVALIDARG, "WriteSource failed, hr=%x (%s)\n", hr, name); + hr = IWICBitmapFrameEncode_WriteSource_Proxy(frameencode, &src_obj->IWICBitmapSource_iface, rc); + } + ok(SUCCEEDED(hr), "WriteSource failed, hr=%x (%s)\n", hr, name);
hr = IWICBitmapFrameEncode_Commit(frameencode); ok(SUCCEEDED(hr), "Commit failed, hr=%x\n", hr); @@ -640,7 +675,39 @@ dsts[0] = dst; dsts[1] = NULL;
- test_multi_encoder(srcs, clsid_encoder, dsts, clsid_decoder, name); + test_multi_encoder(srcs, clsid_encoder, dsts, clsid_decoder, NULL, NULL, name); +} + +static void test_encoder_rects(void) +{ + const struct bitmap_data *srcs[2]; + const struct bitmap_data *dsts[2]; + WICRect rc; + + srcs[0] = &testdata_24bppBGR; + srcs[1] = NULL; + dsts[0] = &testdata_24bppBGR; + dsts[1] = NULL; + + rc.X = 0; + rc.Y = 0; + rc.Width = 4; + rc.Height = 2; + + test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects full"); + + rc.Width = 0; + test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=0"); + + rc.Width = -1; + test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=-1"); + + rc.Width = 4; + rc.Height = 0; + test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=0"); + + rc.Height = -1; + test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=-1"); }
static const struct bitmap_data *multiple_frames[3] = { @@ -648,6 +715,15 @@ &testdata_24bppBGR, NULL};
+static const struct bitmap_data *single_frame[2] = { + &testdata_24bppBGR, + NULL}; + +static const struct setting png_interlace_settings[] = { + {wszInterlaceOption, PROPBAG2_TYPE_DATA, VT_BOOL, (void*)VARIANT_TRUE}, + {NULL} +}; + START_TEST(converter) { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); @@ -678,7 +754,12 @@ &testdata_24bppBGR, &CLSID_WICTiffDecoder, "TIFF encoder 24bppBGR");
test_multi_encoder(multiple_frames, &CLSID_WICTiffEncoder, - multiple_frames, &CLSID_WICTiffDecoder, "TIFF encoder multi-frame"); + multiple_frames, &CLSID_WICTiffDecoder, NULL, NULL, "TIFF encoder multi-frame"); + + test_encoder_rects(); + + test_multi_encoder(single_frame, &CLSID_WICPngEncoder, + single_frame, &CLSID_WICPngDecoder, NULL, png_interlace_settings, "PNG encoder interlaced");
CoUninitialize(); }
Modified: trunk/rostests/winetests/windowscodecs/metadata.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/me... ============================================================================== --- trunk/rostests/winetests/windowscodecs/metadata.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/metadata.c [iso-8859-1] Wed Oct 8 19:32:14 2014 @@ -850,7 +850,13 @@ stream, &reader); todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); - if (FAILED(hr)) return; + /* NOTE: removed once Wine is fixed */ + if (FAILED(hr)) + { + IStream_Release(stream); + IWICComponentFactory_Release(factory); + return; + }
if (SUCCEEDED(hr)) {
Modified: trunk/rostests/winetests/windowscodecs/propertybag.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/pr... ============================================================================== --- trunk/rostests/winetests/windowscodecs/propertybag.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/propertybag.c [iso-8859-1] Wed Oct 8 19:32:14 2014 @@ -72,10 +72,12 @@ ok(pb[0].vt == VT_UI1, "Invalid variant type, pb[0].vt=%x\n", pb[0].vt); ok(pb[0].dwType == PROPBAG2_TYPE_DATA, "Invalid variant type, pb[0].dwType=%x\n", pb[0].dwType); ok(lstrcmpW(pb[0].pstrName, wszTestProperty1) == 0, "Invalid property name, pb[0].pstrName=%s\n", wine_dbgstr_w(pb[0].pstrName)); + CoTaskMemFree(pb[0].pstrName);
ok(pb[1].vt == VT_R4, "Invalid variant type, pb[1].vt=%x\n", pb[1].vt); ok(pb[1].dwType == PROPBAG2_TYPE_DATA, "Invalid variant type, pb[1].dwType=%x\n", pb[1].dwType); ok(lstrcmpW(pb[1].pstrName, wszTestProperty2) == 0, "Invalid property name, pb[1].pstrName=%s\n", wine_dbgstr_w(pb[1].pstrName)); + CoTaskMemFree(pb[1].pstrName); }
static void test_propertybag_countproperties(IPropertyBag2 *property, ULONG expected_count)
Modified: trunk/rostests/winetests/windowscodecs/tiffformat.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/ti... ============================================================================== --- trunk/rostests/winetests/windowscodecs/tiffformat.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/tiffformat.c [iso-8859-1] Wed Oct 8 19:32:14 2014 @@ -241,6 +241,9 @@ todo_wine ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "expected WINCODEC_ERR_COMPONENTNOTFOUND, got %#x\n", hr);
+ if (SUCCEEDED(hr)) + IWICBitmapDecoder_Release(decoder); + pos.QuadPart = 0; hr = IStream_Seek(stream, pos, SEEK_SET, NULL); ok(hr == S_OK, "IStream_Seek error %#x\n", hr);