uiautomationcore: Implement IUIAutomation::get_ControlViewCondition.

Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
This commit is contained in:
Connor McAdams 2023-03-06 11:47:17 -05:00 committed by Alexandre Julliard
parent f5d562b789
commit a4bb7c12b2
2 changed files with 72 additions and 2 deletions

View file

@ -10386,6 +10386,50 @@ static void test_CUIAutomation_condition_ifaces(IUIAutomation *uia_iface)
CoTaskMemFree(cond_arr);
IUIAutomationOrCondition_Release(or_cond);
/*
* Condition used to get the control TreeView. Equivalent to:
* if (!(UIA_IsControlElementPropertyId == VARIANT_FALSE))
*/
hr = IUIAutomation_get_ControlViewCondition(uia_iface, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
cond = NULL;
hr = IUIAutomation_get_ControlViewCondition(uia_iface, &cond);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!cond, "cond == NULL\n");
hr = IUIAutomationCondition_QueryInterface(cond, &IID_IUIAutomationNotCondition, (void **)&not_cond);
IUIAutomationCondition_Release(cond);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!not_cond, "not_cond == NULL\n");
cond = NULL;
hr = IUIAutomationNotCondition_GetChild(not_cond, &cond);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!cond, "cond == NULL\n");
hr = IUIAutomationCondition_QueryInterface(cond, &IID_IUIAutomationPropertyCondition, (void **)&prop_cond);
IUIAutomationCondition_Release(cond);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!prop_cond, "prop_cond == NULL\n");
hr = IUIAutomationPropertyCondition_get_PropertyId(prop_cond, &prop_id);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(prop_id == UIA_IsControlElementPropertyId, "Unexpected prop_id %d.\n", prop_id);
VariantInit(&v);
hr = IUIAutomationPropertyCondition_get_PropertyValue(prop_cond, &v);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(check_variant_bool(&v, FALSE), "Unexpected BOOL %#x\n", V_BOOL(&v));
VariantClear(&v);
hr = IUIAutomationPropertyCondition_get_PropertyConditionFlags(prop_cond, &prop_flags);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(prop_flags == PropertyConditionFlags_None, "Unexpected flags %#x.\n", prop_flags);
IUIAutomationPropertyCondition_Release(prop_cond);
IUIAutomationNotCondition_Release(not_cond);
}
struct uia_com_classes {

View file

@ -1769,8 +1769,34 @@ static HRESULT WINAPI uia_iface_get_RawViewCondition(IUIAutomation6 *iface, IUIA
static HRESULT WINAPI uia_iface_get_ControlViewCondition(IUIAutomation6 *iface, IUIAutomationCondition **out_condition)
{
FIXME("%p, %p: stub\n", iface, out_condition);
return E_NOTIMPL;
IUIAutomationCondition *prop_cond, *not_cond;
HRESULT hr;
VARIANT v;
TRACE("%p, %p\n", iface, out_condition);
if (!out_condition)
return E_POINTER;
*out_condition = NULL;
VariantInit(&v);
V_VT(&v) = VT_BOOL;
V_BOOL(&v) = VARIANT_FALSE;
hr = create_uia_property_condition_iface(&prop_cond, UIA_IsControlElementPropertyId, v, PropertyConditionFlags_None);
if (FAILED(hr))
return hr;
hr = create_uia_not_condition_iface(&not_cond, prop_cond);
if (FAILED(hr))
{
IUIAutomationCondition_Release(prop_cond);
return hr;
}
*out_condition = not_cond;
return S_OK;
}
static HRESULT WINAPI uia_iface_get_ContentViewCondition(IUIAutomation6 *iface, IUIAutomationCondition **out_condition)