static void test_propertybag_countproperties(IPropertyBag2 *property, ULONG expected_count) { ULONG count = (ULONG)-1; HRESULT hr; hr = IPropertyBag2_CountProperties(property, NULL); ok(hr == E_INVALIDARG, "CountProperties returned unexpected result, hr=%x\n", hr); hr = IPropertyBag2_CountProperties(property, &count); ok(hr == S_OK, "CountProperties failed, hr=%x\n", hr); if (FAILED(hr)) return; ok(count == expected_count, "CountProperties returned invalid value, count=%i\n", count); }
static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *options) { HRESULT hr; ULONG cProperties = 0; ULONG cProperties2 = 0; PROPBAG2 all_props[64] = {{0}}; /* Should be enough for every encoder out there */ int i; /* CountProperties */ { hr = IPropertyBag2_CountProperties(options, &cProperties); ok(SUCCEEDED(hr), "Reading property count, hr=%x\n", hr); } /* GetPropertyInfo */ { hr = IPropertyBag2_GetPropertyInfo(options, cProperties, 1, all_props, &cProperties2); ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - iProperty out of bounce handled wrong, hr=%x\n", hr); hr = IPropertyBag2_GetPropertyInfo(options, 0, cProperties+1, all_props, &cProperties2); ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "IPropertyBag2::GetPropertyInfo - cProperty out of bounce handled wrong, hr=%x\n", hr); if (cProperties == 0) /* GetPropertyInfo can be called for zero items on Windows 8 but not on Windows 7 (wine behaves like Win8) */ { cProperties2 = cProperties; hr = S_OK; } else { hr = IPropertyBag2_GetPropertyInfo(options, 0, min(64, cProperties), all_props, &cProperties2); ok(SUCCEEDED(hr), "Reading infos from property bag failed, hr=%x\n", hr); } if (FAILED(hr)) return; ok(cProperties == cProperties2, "Missmatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n", (int)cProperties, (int)cProperties2); } if (clsid_encoder == &CLSID_WICTiffEncoder) test_specific_encoder_properties(options, testdata_tiff_props, all_props, cProperties2); for (i=0; i < cProperties2; i++) { ok(all_props[i].pstrName != NULL, "Unset property name in output of IPropertyBag2::GetPropertyInfo\n"); CoTaskMemFree(all_props[i].pstrName); } }