Commit 2cfcddb2 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Add support for UIAutomationType_IntArray property comparisons.

parent c183afbf
......@@ -7257,17 +7257,15 @@ static void test_UiaGetUpdatedCache(void)
tree_struct = NULL; out_req = NULL;
hr = UiaGetUpdatedCache(node, &cache_req, NormalizeState_View, NULL, &out_req, &tree_struct);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine ok(!!out_req, "out_req == NULL\n");
todo_wine ok(!!tree_struct, "tree_struct == NULL\n");
if (out_req)
{
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!out_req, "out_req == NULL\n");
ok(!!tree_struct, "tree_struct == NULL\n");
exp_lbound[0] = exp_lbound[1] = 0;
exp_elems[0] = exp_elems[1] = 1;
test_cache_req_sa(out_req, exp_lbound, exp_elems, exp_node_desc);
ok(!wcscmp(tree_struct, L"P)"), "tree structure %s\n", debugstr_w(tree_struct));
ok_method_sequence(cache_req_seq4, NULL);
}
SafeArrayDestroy(out_req);
SysFreeString(tree_struct);
......@@ -7286,13 +7284,12 @@ static void test_UiaGetUpdatedCache(void)
tree_struct = NULL; out_req = NULL;
hr = UiaGetUpdatedCache(node, &cache_req, NormalizeState_View, NULL, &out_req, &tree_struct);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (SUCCEEDED(hr))
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_method_sequence(cache_req_seq5, NULL);
ok(!out_req, "out_req != NULL\n");
todo_wine ok(!!tree_struct, "tree_struct == NULL\n");
if (tree_struct)
ok(!!tree_struct, "tree_struct == NULL\n");
ok(!wcscmp(tree_struct, L""), "tree structure %s\n", debugstr_w(tree_struct));
SysFreeString(tree_struct);
VariantClear(&v);
}
......@@ -7312,17 +7309,15 @@ static void test_UiaGetUpdatedCache(void)
tree_struct = NULL; out_req = NULL;
hr = UiaGetUpdatedCache(node, &cache_req, NormalizeState_View, NULL, &out_req, &tree_struct);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine ok(!!out_req, "out_req == NULL\n");
todo_wine ok(!!tree_struct, "tree_struct == NULL\n");
if (out_req)
{
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!out_req, "out_req == NULL\n");
ok(!!tree_struct, "tree_struct == NULL\n");
exp_lbound[0] = exp_lbound[1] = 0;
exp_elems[0] = exp_elems[1] = 1;
test_cache_req_sa(out_req, exp_lbound, exp_elems, exp_node_desc);
ok(!wcscmp(tree_struct, L"P)"), "tree structure %s\n", debugstr_w(tree_struct));
ok_method_sequence(cache_req_seq6, NULL);
}
SafeArrayDestroy(out_req);
SysFreeString(tree_struct);
......
......@@ -49,7 +49,7 @@ static HRESULT get_safearray_bounds(SAFEARRAY *sa, LONG *lbound, LONG *elems)
return S_OK;
}
int uia_compare_runtime_ids(SAFEARRAY *sa1, SAFEARRAY *sa2)
int uia_compare_safearrays(SAFEARRAY *sa1, SAFEARRAY *sa2, int prop_type)
{
LONG i, idx, lbound[2], elems[2];
int val[2];
......@@ -72,6 +72,12 @@ int uia_compare_runtime_ids(SAFEARRAY *sa1, SAFEARRAY *sa2)
if (elems[0] != elems[1])
return (elems[0] > elems[1]) - (elems[0] < elems[1]);
if (prop_type != UIAutomationType_IntArray)
{
FIXME("Array type %#x value comparsion currently unimplemented.\n", prop_type);
return -1;
}
for (i = 0; i < elems[0]; i++)
{
idx = lbound[0] + i;
......@@ -1932,24 +1938,42 @@ static HRESULT uia_property_condition_check(HUIANODE node, struct UiaPropertyCon
switch (prop_info->type)
{
case UIAutomationType_Bool:
case UIAutomationType_IntArray:
break;
default:
FIXME("PropertyCondition comparison unimplemented for type %#x\n", prop_info->type);
return E_NOTIMPL;
}
hr = UiaGetPropertyValue(node, prop_info->prop_id, &v);
if (FAILED(hr) || V_VT(&v) == VT_UNKNOWN)
return S_FALSE;
if (V_VT(&v) == V_VT(&prop_cond->Value))
{
switch (prop_info->type)
{
case UIAutomationType_Bool:
if (V_BOOL(&v) == V_BOOL(&prop_cond->Value))
hr = S_OK;
else
hr = S_FALSE;
break;
}
if ((V_VT(&v) == V_VT(&prop_cond->Value)) && (V_BOOL(&v) == V_BOOL(&prop_cond->Value)))
case UIAutomationType_IntArray:
if (!uia_compare_safearrays(V_ARRAY(&v), V_ARRAY(&prop_cond->Value), prop_info->type))
hr = S_OK;
else
hr = S_FALSE;
break;
default:
FIXME("PropertyCondition comparison unimplemented for type %#x\n", prop_info->type);
return E_NOTIMPL;
break;
}
}
else
hr = S_FALSE;
VariantClear(&v);
return hr;
......
......@@ -87,7 +87,7 @@ static inline struct uia_provider *impl_from_IWineUiaProvider(IWineUiaProvider *
}
/* uia_client.c */
int uia_compare_runtime_ids(SAFEARRAY *sa1, SAFEARRAY *sa2) DECLSPEC_HIDDEN;
int uia_compare_safearrays(SAFEARRAY *sa1, SAFEARRAY *sa2, int prop_type) DECLSPEC_HIDDEN;
int get_node_provider_type_at_idx(struct uia_node *node, int idx) DECLSPEC_HIDDEN;
HRESULT create_uia_node_from_elprov(IRawElementProviderSimple *elprov, HUIANODE *out_node,
BOOL get_hwnd_providers) DECLSPEC_HIDDEN;
......
......@@ -1159,7 +1159,7 @@ struct uia_provider_thread_map_entry
static int uia_runtime_id_compare(const void *key, const struct rb_entry *entry)
{
struct uia_provider_thread_map_entry *prov_entry = RB_ENTRY_VALUE(entry, struct uia_provider_thread_map_entry, entry);
return uia_compare_runtime_ids(prov_entry->runtime_id, (SAFEARRAY *)key);
return uia_compare_safearrays(prov_entry->runtime_id, (SAFEARRAY *)key, UIAutomationType_IntArray);
}
void uia_provider_thread_remove_node(HUIANODE node)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment