mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
propsys/tests: Added InitVariantFromBuffer tests.
This commit is contained in:
parent
f8dd85f246
commit
4a740c8a80
@ -508,10 +508,65 @@ static void test_InitPropVariantFromGUIDAsString(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void test_InitPropVariantFromBuffer(void)
|
||||
{
|
||||
static const char data_in[] = "test";
|
||||
PROPVARIANT propvar;
|
||||
VARIANT var;
|
||||
HRESULT hres;
|
||||
void *data_out;
|
||||
LONG size;
|
||||
|
||||
hres = InitPropVariantFromBuffer(NULL, 0, &propvar);
|
||||
ok(hres == S_OK, "InitPropVariantFromBuffer returned %x\n", hres);
|
||||
ok(propvar.vt == (VT_VECTOR|VT_UI1), "propvar.vt = %d\n", propvar.vt);
|
||||
ok(propvar.u.caub.cElems == 0, "cElems = %d\n", propvar.u.caub.cElems == 0);
|
||||
PropVariantClear(&propvar);
|
||||
|
||||
hres = InitPropVariantFromBuffer(data_in, 4, &propvar);
|
||||
ok(hres == S_OK, "InitPropVariantFromBuffer returned %x\n", hres);
|
||||
ok(propvar.vt == (VT_VECTOR|VT_UI1), "propvar.vt = %d\n", propvar.vt);
|
||||
ok(propvar.u.caub.cElems == 4, "cElems = %d\n", propvar.u.caub.cElems == 0);
|
||||
ok(!memcmp(propvar.u.caub.pElems, data_in, 4), "Data inside array is incorrect\n");
|
||||
PropVariantClear(&propvar);
|
||||
|
||||
hres = InitVariantFromBuffer(NULL, 0, &var);
|
||||
ok(hres == S_OK, "InitVariantFromBuffer returned %x\n", hres);
|
||||
ok(V_VT(&var) == (VT_ARRAY|VT_UI1), "V_VT(&var) = %d\n", V_VT(&var));
|
||||
size = SafeArrayGetDim(V_ARRAY(&var));
|
||||
ok(size == 1, "SafeArrayGetDim returned %d\n", size);
|
||||
hres = SafeArrayGetLBound(V_ARRAY(&var), 1, &size);
|
||||
ok(hres == S_OK, "SafeArrayGetLBound returned %x\n", hres);
|
||||
ok(size == 0, "LBound = %d\n", size);
|
||||
hres = SafeArrayGetUBound(V_ARRAY(&var), 1, &size);
|
||||
ok(hres == S_OK, "SafeArrayGetUBound returned %x\n", hres);
|
||||
ok(size == -1, "UBound = %d\n", size);
|
||||
VariantClear(&var);
|
||||
|
||||
hres = InitVariantFromBuffer(data_in, 4, &var);
|
||||
ok(hres == S_OK, "InitVariantFromBuffer returned %x\n", hres);
|
||||
ok(V_VT(&var) == (VT_ARRAY|VT_UI1), "V_VT(&var) = %d\n", V_VT(&var));
|
||||
size = SafeArrayGetDim(V_ARRAY(&var));
|
||||
ok(size == 1, "SafeArrayGetDim returned %d\n", size);
|
||||
hres = SafeArrayGetLBound(V_ARRAY(&var), 1, &size);
|
||||
ok(hres == S_OK, "SafeArrayGetLBound returned %x\n", hres);
|
||||
ok(size == 0, "LBound = %d\n", size);
|
||||
hres = SafeArrayGetUBound(V_ARRAY(&var), 1, &size);
|
||||
ok(hres == S_OK, "SafeArrayGetUBound returned %x\n", hres);
|
||||
ok(size == 3, "UBound = %d\n", size);
|
||||
hres = SafeArrayAccessData(V_ARRAY(&var), &data_out);
|
||||
ok(hres == S_OK, "SafeArrayAccessData failed %x\n", hres);
|
||||
ok(!memcmp(data_in, data_out, 4), "Data inside safe array is incorrect\n");
|
||||
hres = SafeArrayUnaccessData(V_ARRAY(&var));
|
||||
ok(hres == S_OK, "SafeArrayUnaccessData failed %x\n", hres);
|
||||
VariantClear(&var);
|
||||
}
|
||||
|
||||
START_TEST(propsys)
|
||||
{
|
||||
test_PSStringFromPropertyKey();
|
||||
test_PSPropertyKeyFromString();
|
||||
test_PSRefreshPropertySchema();
|
||||
test_InitPropVariantFromGUIDAsString();
|
||||
test_InitPropVariantFromBuffer();
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
|
||||
PROPVAR_CHANGE_FLAGS flags, VARTYPE vt);
|
||||
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
|
||||
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
|
||||
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
|
||||
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user