[PATCH v2 4/5] comsvcs: Implement ISharedPropertyGroupManager_get_Group().
Jactry Zeng
jzeng at codeweavers.com
Wed Aug 19 02:49:14 CDT 2020
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/comsvcs/property.c | 16 ++++++++++++++--
dlls/comsvcs/tests/property.c | 25 ++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/dlls/comsvcs/property.c b/dlls/comsvcs/property.c
index 81b13a2cc8..2a10a32285 100644
--- a/dlls/comsvcs/property.c
+++ b/dlls/comsvcs/property.c
@@ -399,8 +399,20 @@ static HRESULT WINAPI group_manager_CreatePropertyGroup(ISharedPropertyGroupMana
static HRESULT WINAPI group_manager_get_Group(ISharedPropertyGroupManager *iface, BSTR name, ISharedPropertyGroup **group)
{
- FIXME("iface %p, name %s, group %p: stub.\n", iface, debugstr_w(name), group);
- return E_NOTIMPL;
+ struct group_manager *manager = impl_from_ISharedPropertyGroupManager(iface);
+ struct property_group *property_group;
+
+ TRACE("iface %p, name %s, group %p.\n", iface, debugstr_w(name), group);
+
+ if (!name || !group)
+ return E_POINTER;
+
+ property_group = find_propery_group(manager, name);
+ if (!property_group)
+ return E_INVALIDARG;
+
+ return ISharedPropertyGroup_QueryInterface(&property_group->ISharedPropertyGroup_iface,
+ &IID_ISharedPropertyGroup, (void **)group);
}
static HRESULT WINAPI group_manager_get__NewEnum(ISharedPropertyGroupManager *iface, IUnknown **retval)
diff --git a/dlls/comsvcs/tests/property.c b/dlls/comsvcs/tests/property.c
index 1008b04c53..555fb8553c 100644
--- a/dlls/comsvcs/tests/property.c
+++ b/dlls/comsvcs/tests/property.c
@@ -163,7 +163,7 @@ static void test_interfaces(void)
static void test_property_group(void)
{
- ISharedPropertyGroup *group, *group1;
+ ISharedPropertyGroup *group, *group1, *group2;
ISharedPropertyGroupManager *manager;
ULONG refcount, expected_refcount;
LONG isolation, release;
@@ -271,6 +271,29 @@ static void test_property_group(void)
TEST_TYPEINFO(dispatch, test_name_ids, ARRAY_SIZE(test_name_ids), &IID_ISharedPropertyGroup);
IDispatch_Release(dispatch);
+ hr = ISharedPropertyGroupManager_get_Group(manager, NULL, &group2);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ name = SysAllocString(L"nonexistgroup");
+ hr = ISharedPropertyGroupManager_get_Group(manager, name, &group2);
+ ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+ SysFreeString(name);
+
+ name = SysAllocString(L"testgroupname");
+ hr = ISharedPropertyGroupManager_get_Group(manager, name, NULL);
+ ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ expected_refcount = get_refcount(manager);
+ hr = ISharedPropertyGroupManager_get_Group(manager, name, &group2);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(group2 == group, "Got unexpected pointer %p.\n", group2);
+ refcount = get_refcount(group);
+ ok(refcount == 2, "Got unexpected refcount: %d.\n", refcount);
+ refcount = get_refcount(manager);
+ ok(refcount == expected_refcount, "Got refcount: %d, expected %d.\n", refcount, expected_refcount);
+ ISharedPropertyGroup_Release(group2);
+ SysFreeString(name);
+
expected_refcount = get_refcount(manager);
ISharedPropertyGroup_Release(group1);
refcount = get_refcount(manager);
--
2.28.0
More information about the wine-devel
mailing list