Commit 272c4a59 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Implement UiaGetUpdatedCache.

Implement UiaGetUpdatedCache for non-conditional, TreeScope_Element cache requests. Signed-off-by: 's avatarConnor McAdams <cmcadams@codeweavers.com>
parent 2de6b571
......@@ -6912,13 +6912,13 @@ static void test_UiaGetUpdatedCache(void)
/* NULL arg tests. */
set_cache_request(&cache_req, NULL, TreeScope_Element, NULL, 0, NULL, 0, AutomationElementMode_Full);
hr = UiaGetUpdatedCache(node, &cache_req, NormalizeState_None, NULL, &out_req, NULL);
todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = UiaGetUpdatedCache(node, NULL, NormalizeState_None, NULL, &out_req, &tree_struct);
todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = UiaGetUpdatedCache(NULL, &cache_req, NormalizeState_None, NULL, &out_req, &tree_struct);
todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/*
* Cache request with NULL view condition, doesn't matter with
......@@ -6929,17 +6929,15 @@ static void test_UiaGetUpdatedCache(void)
add_provider_desc(&exp_node_desc[0], L"Main", L"Provider", TRUE);
set_cache_request(&cache_req, NULL, TreeScope_Element, NULL, 0, NULL, 0, AutomationElementMode_Full);
hr = UiaGetUpdatedCache(node, &cache_req, NormalizeState_None, 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)
{
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_seq1, "cache_req_seq1");
}
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_seq1, "cache_req_seq1");
SafeArrayDestroy(out_req);
SysFreeString(tree_struct);
......
......@@ -1918,7 +1918,59 @@ void WINAPI UiaRegisterProviderCallback(UiaProviderCallback *callback)
HRESULT WINAPI UiaGetUpdatedCache(HUIANODE huianode, struct UiaCacheRequest *cache_req, enum NormalizeState normalize_state,
struct UiaCondition *normalize_cond, SAFEARRAY **out_req, BSTR *tree_struct)
{
FIXME("(%p, %p, %u, %p, %p, %p): stub\n", huianode, cache_req, normalize_state, normalize_cond, out_req,
tree_struct);
return E_NOTIMPL;
struct uia_node *node = unsafe_impl_from_IWineUiaNode((IWineUiaNode *)huianode);
SAFEARRAYBOUND sabound[2];
SAFEARRAY *sa;
LONG idx[2];
HRESULT hr;
VARIANT v;
TRACE("(%p, %p, %u, %p, %p, %p)\n", huianode, cache_req, normalize_state, normalize_cond, out_req, tree_struct);
if (!node || !out_req || !tree_struct || !cache_req)
return E_INVALIDARG;
*tree_struct = NULL;
*out_req = NULL;
if (normalize_state != NormalizeState_None)
{
FIXME("Unsupported NormalizeState %d\n", normalize_state);
return E_NOTIMPL;
}
if (cache_req->Scope != TreeScope_Element)
{
FIXME("Unsupported cache request scope %#x\n", cache_req->Scope);
return E_NOTIMPL;
}
sabound[0].cElements = sabound[1].cElements = 1;
sabound[0].lLbound = sabound[1].lLbound = 0;
if (!(sa = SafeArrayCreate(VT_VARIANT, 2, sabound)))
{
WARN("Failed to create safearray\n");
return E_FAIL;
}
get_variant_for_node(huianode, &v);
idx[0] = idx[1] = 0;
hr = SafeArrayPutElement(sa, idx, &v);
if (FAILED(hr))
{
SafeArrayDestroy(sa);
return hr;
}
/*
* AddRef huianode since we're returning a reference to the same node we
* passed in, rather than creating a new one.
*/
IWineUiaNode_AddRef(&node->IWineUiaNode_iface);
*out_req = sa;
*tree_struct = SysAllocString(L"P)");
return S_OK;
}
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