static void test_propertybag_write(IPropertyBag2 *property) { HRESULT hr; PROPBAG2 options[2] = {{0}}; VARIANT values[2]; VariantInit(&values[0]); VariantInit(&values[1]); /* 1. One unknown property */ options[0].pstrName = (LPOLESTR)wszTestInvalidProperty; hr = IPropertyBag2_Write(property, 1, options, values); ok(hr == E_FAIL, "Write for an unknown property did not fail with expected code, hr=%x\n", hr); /* 2. One property without correct type */ options[0].pstrName = (LPOLESTR)wszTestProperty1; V_VT(&values[0]) = VT_UI1; V_UNION(&values[0], bVal) = 1; hr = IPropertyBag2_Write(property, 1, options, values); ok(hr == S_OK, "Write for one property failed, hr=%x\n", hr); /* 3. One property with mismatching type */ options[0].pstrName = (LPOLESTR)wszTestProperty1; V_VT(&values[0]) = VT_I1; V_UNION(&values[0], bVal) = 2; hr = IPropertyBag2_Write(property, 1, options, values); ok(hr == WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE, "Write with mismatching type did not fail with expected code hr=%x\n", hr); /* 4. Reset one property to empty */ options[0].pstrName = (LPOLESTR)wszTestProperty1; VariantClear(&values[0]); hr = IPropertyBag2_Write(property, 1, options, values); ok(hr == WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE, "Write to reset to empty value does not fail with expected code, hr=%x\n", hr); /* 5. Set two properties */ options[0].pstrName = (LPOLESTR)wszTestProperty1; V_VT(&values[0]) = VT_UI1; V_UNION(&values[0], bVal) = 12; options[1].pstrName = (LPOLESTR)wszTestProperty2; V_VT(&values[1]) = VT_R4; V_UNION(&values[1], fltVal) = (float)3.14; hr = IPropertyBag2_Write(property, 2, options, values); ok(hr == S_OK, "Write for two properties failed, hr=%x\n", hr); }
HRESULT WINAPI IPropertyBag2_Write_Proxy(IPropertyBag2 *iface, ULONG cProperties, PROPBAG2 *ppropbag, VARIANT *pvarValue) { return IPropertyBag2_Write(iface, cProperties, ppropbag, pvarValue); }