Jactry Zeng : propsys/tests: Add tests of IPropertyStore interface.
Alexandre Julliard
julliard at winehq.org
Thu Feb 14 16:19:12 CST 2019
Module: wine
Branch: master
Commit: 2e2fc55009d1c168a7af41bfc31a6b9a1c9acf99
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2e2fc55009d1c168a7af41bfc31a6b9a1c9acf99
Author: Jactry Zeng <jzeng at codeweavers.com>
Date: Thu Feb 7 16:32:38 2019 +0800
propsys/tests: Add tests of IPropertyStore interface.
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/propsys/tests/propstore.c | 60 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c
index 132f5ff..5aeb562 100644
--- a/dlls/propsys/tests/propstore.c
+++ b/dlls/propsys/tests/propstore.c
@@ -34,6 +34,7 @@
#include "initguid.h"
DEFINE_GUID(PKEY_WineTest, 0x7b317433, 0xdfa3, 0x4c44, 0xad, 0x3e, 0x2f, 0x80, 0x4b, 0x90, 0xdb, 0xf4);
+DEFINE_GUID(DUMMY_GUID1, 0x12345678, 0x1234,0x1234, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19);
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
@@ -302,6 +303,64 @@ static void test_PSCreateMemoryPropertyStore(void)
IPropertyStoreCache_Release(propstorecache);
}
+static void test_propertystore(void)
+{
+ IPropertyStore *propstore;
+ HRESULT hr;
+ PROPVARIANT propvar, ret_propvar;
+ PROPERTYKEY propkey;
+ DWORD count = 0;
+
+ hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore);
+ ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
+ ok(propstore != NULL, "got %p.\n", propstore);
+
+ hr = IPropertyStore_GetCount(propstore, &count);
+ ok(hr == S_OK, "IPropertyStore_GetCount failed: 0x%08x.\n", hr);
+ ok(!count, "got wrong property count: %d, expected 0.\n", count);
+
+ PropVariantInit(&propvar);
+ propvar.vt = VT_I4;
+ U(propvar).lVal = 123;
+ propkey.fmtid = DUMMY_GUID1;
+ propkey.pid = PID_FIRST_USABLE;
+ hr = IPropertyStore_SetValue(propstore, &propkey, &propvar);
+ ok(hr == S_OK, "IPropertyStore_SetValue failed: 0x%08x.\n", hr);
+ hr = IPropertyStore_Commit(propstore);
+ ok(hr == S_OK, "IPropertyStore_Commit failed: 0x%08x.\n", hr);
+ hr = IPropertyStore_GetCount(propstore, &count);
+ ok(hr == S_OK, "IPropertyStore_GetCount failed: 0x%08x.\n", hr);
+ ok(count == 1, "got wrong property count: %d, expected 1.\n", count);
+ PropVariantInit(&ret_propvar);
+ ret_propvar.vt = VT_I4;
+ hr = IPropertyStore_GetValue(propstore, &propkey, &ret_propvar);
+ ok(hr == S_OK, "IPropertyStore_GetValue failed: 0x%08x.\n", hr);
+ ok(ret_propvar.vt == VT_I4, "got wrong property type: %x.\n", ret_propvar.vt);
+ ok(U(ret_propvar).lVal == 123, "got wrong value: %d, expected 123.\n", U(ret_propvar).lVal);
+ PropVariantClear(&propvar);
+ PropVariantClear(&ret_propvar);
+
+ PropVariantInit(&propvar);
+ propkey.fmtid = DUMMY_GUID1;
+ propkey.pid = PID_FIRST_USABLE;
+ hr = IPropertyStore_SetValue(propstore, &propkey, &propvar);
+ ok(hr == S_OK, "IPropertyStore_SetValue failed: 0x%08x.\n", hr);
+ hr = IPropertyStore_Commit(propstore);
+ ok(hr == S_OK, "IPropertyStore_Commit failed: 0x%08x.\n", hr);
+ hr = IPropertyStore_GetCount(propstore, &count);
+ ok(hr == S_OK, "IPropertyStore_GetCount failed: 0x%08x.\n", hr);
+ ok(count == 1, "got wrong property count: %d, expected 1.\n", count);
+ PropVariantInit(&ret_propvar);
+ hr = IPropertyStore_GetValue(propstore, &propkey, &ret_propvar);
+ ok(hr == S_OK, "IPropertyStore_GetValue failed: 0x%08x.\n", hr);
+ ok(ret_propvar.vt == VT_EMPTY, "got wrong property type: %x.\n", ret_propvar.vt);
+ ok(!U(ret_propvar).lVal, "got wrong value: %d, expected 0.\n", U(ret_propvar).lVal);
+ PropVariantClear(&propvar);
+ PropVariantClear(&ret_propvar);
+
+ IPropertyStore_Release(propstore);
+}
+
START_TEST(propstore)
{
CoInitialize(NULL);
@@ -309,6 +368,7 @@ START_TEST(propstore)
test_inmemorystore();
test_persistserialized();
test_PSCreateMemoryPropertyStore();
+ test_propertystore();
CoUninitialize();
}
More information about the wine-cvs
mailing list