16#include "gmock/gmock.h"
17#include "gtest/gtest.h"
28using Microsoft::WRL::ComPtr;
44#define EXPECT_UIA_ELEMENTNOTAVAILABLE(expr) \
45 EXPECT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), (expr))
46#define EXPECT_UIA_INVALIDOPERATION(expr) \
47 EXPECT_EQ(static_cast<HRESULT>(UIA_E_INVALIDOPERATION), (expr))
48#define EXPECT_UIA_ELEMENTNOTENABLED(expr) \
49 EXPECT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTENABLED), (expr))
50#define EXPECT_UIA_NOTSUPPORTED(expr) \
51 EXPECT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr))
53#define ASSERT_UIA_ELEMENTNOTAVAILABLE(expr) \
54 ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), (expr))
55#define ASSERT_UIA_INVALIDOPERATION(expr) \
56 ASSERT_EQ(static_cast<HRESULT>(UIA_E_INVALIDOPERATION), (expr))
57#define ASSERT_UIA_ELEMENTNOTENABLED(expr) \
58 ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTENABLED), (expr))
59#define ASSERT_UIA_NOTSUPPORTED(expr) \
60 ASSERT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr))
68#define EXPECT_UIA_EMPTY(node, property_id) \
70 ScopedVariant actual; \
71 ASSERT_HRESULT_SUCCEEDED( \
72 node->GetPropertyValue(property_id, actual.Receive())); \
73 EXPECT_EQ(VT_EMPTY, actual.type()); \
76#define EXPECT_UIA_VALUE_EQ(node, property_id, expectedVariant) \
78 ScopedVariant actual; \
79 ASSERT_HRESULT_SUCCEEDED( \
80 node->GetPropertyValue(property_id, actual.Receive())); \
81 EXPECT_EQ(0, actual.Compare(expectedVariant)); \
84#define EXPECT_UIA_BSTR_EQ(node, property_id, expected) \
86 ScopedVariant expectedVariant(expected); \
87 ASSERT_EQ(VT_BSTR, expectedVariant.type()); \
88 ASSERT_NE(nullptr, expectedVariant.ptr()->bstrVal); \
89 ScopedVariant actual; \
90 ASSERT_HRESULT_SUCCEEDED( \
91 node->GetPropertyValue(property_id, actual.Receive())); \
92 ASSERT_EQ(VT_BSTR, actual.type()); \
93 ASSERT_NE(nullptr, actual.ptr()->bstrVal); \
94 EXPECT_STREQ(expectedVariant.ptr()->bstrVal, actual.ptr()->bstrVal); \
97#define EXPECT_UIA_BOOL_EQ(node, property_id, expected) \
99 ScopedVariant expectedVariant(expected); \
100 ASSERT_EQ(VT_BOOL, expectedVariant.type()); \
101 ScopedVariant actual; \
102 ASSERT_HRESULT_SUCCEEDED( \
103 node->GetPropertyValue(property_id, actual.Receive())); \
104 EXPECT_EQ(expectedVariant.ptr()->boolVal, actual.ptr()->boolVal); \
107#define EXPECT_UIA_DOUBLE_ARRAY_EQ(node, array_property_id, \
108 expected_property_values) \
110 ScopedVariant array; \
111 ASSERT_HRESULT_SUCCEEDED( \
112 node->GetPropertyValue(array_property_id, array.Receive())); \
113 ASSERT_EQ(VT_ARRAY | VT_R8, array.type()); \
114 ASSERT_EQ(1u, SafeArrayGetDim(array.ptr()->parray)); \
115 LONG array_lower_bound; \
116 ASSERT_HRESULT_SUCCEEDED( \
117 SafeArrayGetLBound(array.ptr()->parray, 1, &array_lower_bound)); \
118 LONG array_upper_bound; \
119 ASSERT_HRESULT_SUCCEEDED( \
120 SafeArrayGetUBound(array.ptr()->parray, 1, &array_upper_bound)); \
121 double* array_data; \
122 ASSERT_HRESULT_SUCCEEDED(::SafeArrayAccessData( \
123 array.ptr()->parray, reinterpret_cast<void**>(&array_data))); \
124 size_t count = array_upper_bound - array_lower_bound + 1; \
125 ASSERT_EQ(expected_property_values.size(), count); \
126 for (size_t i = 0; i < count; ++i) { \
127 EXPECT_EQ(array_data[i], expected_property_values[i]); \
129 ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(array.ptr()->parray)); \
132#define EXPECT_UIA_INT_EQ(node, property_id, expected) \
134 ScopedVariant expectedVariant(expected); \
135 ASSERT_EQ(VT_I4, expectedVariant.type()); \
136 ScopedVariant actual; \
137 ASSERT_HRESULT_SUCCEEDED( \
138 node->GetPropertyValue(property_id, actual.Receive())); \
139 EXPECT_EQ(expectedVariant.ptr()->intVal, actual.ptr()->intVal); \
142#define EXPECT_UIA_ELEMENT_ARRAY_BSTR_EQ(array, element_test_property_id, \
143 expected_property_values) \
145 ASSERT_EQ(1u, SafeArrayGetDim(array)); \
146 LONG array_lower_bound; \
147 ASSERT_HRESULT_SUCCEEDED( \
148 SafeArrayGetLBound(array, 1, &array_lower_bound)); \
149 LONG array_upper_bound; \
150 ASSERT_HRESULT_SUCCEEDED( \
151 SafeArrayGetUBound(array, 1, &array_upper_bound)); \
152 IUnknown** array_data; \
153 ASSERT_HRESULT_SUCCEEDED( \
154 ::SafeArrayAccessData(array, reinterpret_cast<void**>(&array_data))); \
155 size_t count = array_upper_bound - array_lower_bound + 1; \
156 ASSERT_EQ(expected_property_values.size(), count); \
157 for (size_t i = 0; i < count; ++i) { \
158 ComPtr<IRawElementProviderSimple> element; \
159 ASSERT_HRESULT_SUCCEEDED( \
160 array_data[i]->QueryInterface(IID_PPV_ARGS(&element))); \
161 EXPECT_UIA_BSTR_EQ(element, element_test_property_id, \
162 expected_property_values[i].c_str()); \
164 ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(array)); \
167#define EXPECT_UIA_PROPERTY_ELEMENT_ARRAY_BSTR_EQ(node, array_property_id, \
168 element_test_property_id, \
169 expected_property_values) \
171 ScopedVariant array; \
172 ASSERT_HRESULT_SUCCEEDED( \
173 node->GetPropertyValue(array_property_id, array.Receive())); \
174 ASSERT_EQ(VT_ARRAY | VT_UNKNOWN, array.type()); \
175 EXPECT_UIA_ELEMENT_ARRAY_BSTR_EQ(array.ptr()->parray, \
176 element_test_property_id, \
177 expected_property_values); \
180#define EXPECT_UIA_PROPERTY_UNORDERED_ELEMENT_ARRAY_BSTR_EQ( \
181 node, array_property_id, element_test_property_id, \
182 expected_property_values) \
184 ScopedVariant array; \
185 ASSERT_HRESULT_SUCCEEDED( \
186 node->GetPropertyValue(array_property_id, array.Receive())); \
187 ASSERT_EQ(VT_ARRAY | VT_UNKNOWN, array.type()); \
188 ASSERT_EQ(1u, SafeArrayGetDim(array.ptr()->parray)); \
189 LONG array_lower_bound; \
190 ASSERT_HRESULT_SUCCEEDED( \
191 SafeArrayGetLBound(array.ptr()->parray, 1, &array_lower_bound)); \
192 LONG array_upper_bound; \
193 ASSERT_HRESULT_SUCCEEDED( \
194 SafeArrayGetUBound(array.ptr()->parray, 1, &array_upper_bound)); \
195 IUnknown** array_data; \
196 ASSERT_HRESULT_SUCCEEDED(::SafeArrayAccessData( \
197 array.ptr()->parray, reinterpret_cast<void**>(&array_data))); \
198 size_t count = array_upper_bound - array_lower_bound + 1; \
199 ASSERT_EQ(expected_property_values.size(), count); \
200 std::vector<std::wstring> property_values; \
201 for (size_t i = 0; i < count; ++i) { \
202 ComPtr<IRawElementProviderSimple> element; \
203 ASSERT_HRESULT_SUCCEEDED( \
204 array_data[i]->QueryInterface(IID_PPV_ARGS(&element))); \
205 ScopedVariant actual; \
206 ASSERT_HRESULT_SUCCEEDED(element->GetPropertyValue( \
207 element_test_property_id, actual.Receive())); \
208 ASSERT_EQ(VT_BSTR, actual.type()); \
209 ASSERT_NE(nullptr, actual.ptr()->bstrVal); \
210 property_values.push_back(std::wstring( \
211 V_BSTR(actual.ptr()), SysStringLen(V_BSTR(actual.ptr())))); \
213 ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(array.ptr()->parray)); \
214 EXPECT_THAT(property_values, \
215 testing::UnorderedElementsAreArray(expected_property_values)); \
223 IRawElementProviderSimple** provider) {
224 CComObject<MockIRawElementProviderSimple>* raw_element_provider =
nullptr;
225 HRESULT hr = CComObject<MockIRawElementProviderSimple>::CreateInstance(
226 &raw_element_provider);
228 *provider = raw_element_provider;
238 PATTERNID pattern_id,
244 PROPERTYID property_id,
255 IRawElementProviderSimple** provider) {
292 if (!ax_platform_node)
295 EXPECT_HRESULT_SUCCEEDED(
301ComPtr<IRawElementProviderSimple>
303 return QueryInterfaceFromNode<IRawElementProviderSimple>(
GetRootAsAXNode());
306ComPtr<IRawElementProviderSimple>
310 static_cast<size_t>(child_index) >=
312 return ComPtr<IRawElementProviderSimple>();
315 return QueryInterfaceFromNode<IRawElementProviderSimple>(
319Microsoft::WRL::ComPtr<IRawElementProviderSimple>
323 return QueryInterfaceFromNode<IRawElementProviderSimple>(
327ComPtr<IRawElementProviderFragment>
329 return QueryInterfaceFromNode<IRawElementProviderFragment>(
GetRootAsAXNode());
332Microsoft::WRL::ComPtr<IRawElementProviderFragment>
337 ComPtr<IUnknown> unknown_node = native_view;
338 ComPtr<IRawElementProviderFragment> fragment_node;
339 unknown_node.As(&fragment_node);
341 return fragment_node;
345 return QueryInterfaceFromNode<IAccessible>(node);
353 const wchar_t* expected_name) {
354 ASSERT_NE(
nullptr, variant.
ptr());
355 ComPtr<IAccessible> accessible;
356 ASSERT_HRESULT_SUCCEEDED(
357 V_DISPATCH(variant.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
359 EXPECT_EQ(S_OK, accessible->get_accName(SELF,
name.Receive()));
360 EXPECT_STREQ(expected_name,
name.Get());
380ComPtr<IRawElementProviderFragmentRoot>
382 ComPtr<IRawElementProviderFragmentRoot> fragment_root_provider;
384 IID_PPV_ARGS(&fragment_root_provider));
385 return fragment_root_provider;
390 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
391 QueryInterfaceFromNodeId<IRawElementProviderSimple>(
id);
393 static const std::vector<LONG> all_supported_patterns_ = {
394 UIA_TextChildPatternId, UIA_TextEditPatternId,
395 UIA_TextPatternId, UIA_WindowPatternId,
396 UIA_InvokePatternId, UIA_ExpandCollapsePatternId,
397 UIA_GridPatternId, UIA_GridItemPatternId,
398 UIA_RangeValuePatternId, UIA_ScrollPatternId,
399 UIA_ScrollItemPatternId, UIA_TablePatternId,
400 UIA_TableItemPatternId, UIA_SelectionItemPatternId,
401 UIA_SelectionPatternId, UIA_TogglePatternId,
404 for (
LONG property_id : all_supported_patterns_) {
405 ComPtr<IUnknown> provider;
406 if (
SUCCEEDED(raw_element_provider_simple->GetPatternProvider(property_id,
409 supported_patterns.insert(property_id);
412 return supported_patterns;
436 root.SetName(
"Name");
439 ComPtr<IAccessible> root_obj(GetRootIAccessible());
441 EXPECT_EQ(S_OK, root_obj->get_accName(SELF,
name.Receive()));
442 EXPECT_STREQ(
L"Name",
name.Get());
445 SetTree(std::make_unique<AXTree>());
447 EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.
Receive()));
460 root.child_ids.push_back(node1.
id);
467 root.child_ids.push_back(node2.
id);
471 ComPtr<IAccessible> root_obj(GetRootIAccessible());
475 EXPECT_EQ(S_FALSE, root_obj->accHitTest(50, 50, obj_1.
Receive()));
476 EXPECT_EQ(VT_EMPTY, obj_1.
type());
479 EXPECT_EQ(S_OK, root_obj->accHitTest(5, 5, obj_1.
Receive()));
480 ASSERT_NE(
nullptr, obj_1.
ptr());
481 CheckVariantHasName(obj_1,
L"Name1");
485 std::unique_ptr<base::AutoReset<float>> scale_factor_reset =
487 EXPECT_EQ(S_OK, root_obj->accHitTest(38, 38, obj_2.
Receive()));
488 ASSERT_NE(
nullptr, obj_2.
ptr());
489 CheckVariantHasName(obj_2,
L"Name2");
502 root.child_ids.push_back(node1.
id);
513 ComPtr<IAccessible> root_obj(GetRootIAccessible());
515 EXPECT_EQ(S_OK, root_obj->accHitTest(5, 5, obj_1.
Receive()));
516 ASSERT_NE(
nullptr, obj_1.
ptr());
517 CheckVariantHasName(obj_1,
L"Name1");
524 root.SetName(
"Name");
527 ComPtr<IAccessible> root_obj(GetRootIAccessible());
529 EXPECT_EQ(S_OK, root_obj->get_accName(SELF,
name.Receive()));
530 EXPECT_STREQ(
L"Name",
name.Get());
532 EXPECT_EQ(E_INVALIDARG, root_obj->get_accName(SELF,
nullptr));
535 EXPECT_EQ(E_INVALIDARG, root_obj->get_accName(bad_id, name2.
Receive()));
545 ComPtr<IAccessible> root_obj(GetRootIAccessible());
547 EXPECT_EQ(S_OK, root_obj->get_accDescription(SELF, description.
Receive()));
548 EXPECT_STREQ(
L"Description", description.
Get());
550 EXPECT_EQ(E_INVALIDARG, root_obj->get_accDescription(SELF,
nullptr));
553 EXPECT_EQ(E_INVALIDARG, root_obj->get_accDescription(bad_id, d2.
Receive()));
563 ComPtr<IAccessible> root_obj(GetRootIAccessible());
565 EXPECT_EQ(S_OK, root_obj->get_accValue(SELF,
value.Receive()));
566 EXPECT_STREQ(
L"Value",
value.Get());
568 EXPECT_EQ(E_INVALIDARG, root_obj->get_accValue(SELF,
nullptr));
571 EXPECT_EQ(E_INVALIDARG, root_obj->get_accValue(bad_id,
v2.Receive()));
581 ComPtr<IAccessible> root_obj(GetRootIAccessible());
583 EXPECT_EQ(S_OK, root_obj->get_accKeyboardShortcut(SELF, shortcut.
Receive()));
584 EXPECT_STREQ(
L"Shortcut", shortcut.
Get());
586 EXPECT_EQ(E_INVALIDARG, root_obj->get_accKeyboardShortcut(SELF,
nullptr));
589 EXPECT_EQ(E_INVALIDARG,
590 root_obj->get_accKeyboardShortcut(bad_id, k2.Receive()));
594 IAccessibleSelectionListBoxOptionNothingSelected) {
612 Init(list, list_item_1, list_item_2);
614 ComPtr<IAccessible> root_obj(GetRootIAccessible());
615 ASSERT_NE(
nullptr, root_obj.Get());
618 EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.
Receive()));
619 EXPECT_EQ(VT_EMPTY, selection.
type());
641 Init(list, list_item_1, list_item_2);
643 ComPtr<IAccessible> root_obj(GetRootIAccessible());
644 ASSERT_NE(
nullptr, root_obj.Get());
647 EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.
Receive()));
648 EXPECT_EQ(VT_DISPATCH, selection.
type());
650 CheckVariantHasName(selection,
L"Name1");
654 IAccessibleSelectionListBoxOptionMultipleSelected) {
680 Init(list, list_item_1, list_item_2, list_item_3);
682 ComPtr<IAccessible> root_obj(GetRootIAccessible());
683 ASSERT_NE(
nullptr, root_obj.Get());
686 EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.
Receive()));
687 EXPECT_EQ(VT_UNKNOWN, selection.
type());
688 ASSERT_NE(
nullptr, selection.
ptr());
691 ComPtr<IEnumVARIANT> accessibles;
692 ASSERT_HRESULT_SUCCEEDED(
693 V_UNKNOWN(selection.
ptr())->QueryInterface(IID_PPV_ARGS(&accessibles)));
694 ULONG retrieved_count;
699 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
702 ComPtr<IAccessible> accessible;
703 ASSERT_HRESULT_SUCCEEDED(
704 V_DISPATCH(item.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
706 EXPECT_EQ(S_OK, accessible->get_accName(SELF,
name.Receive()));
707 EXPECT_STREQ(
L"Name1",
name.Get());
713 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
716 ComPtr<IAccessible> accessible;
717 ASSERT_HRESULT_SUCCEEDED(
718 V_DISPATCH(item.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
720 EXPECT_EQ(S_OK, accessible->get_accName(SELF,
name.Receive()));
721 EXPECT_STREQ(
L"Name2",
name.Get());
727 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
728 EXPECT_EQ(S_FALSE, hr);
733 Init(Build3X3Table());
735 ComPtr<IAccessible> root_obj(GetRootIAccessible());
736 ASSERT_NE(
nullptr, root_obj.Get());
739 EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.
Receive()));
740 EXPECT_EQ(VT_EMPTY, selection.
type());
751 ComPtr<IAccessible> root_obj(GetRootIAccessible());
752 ASSERT_NE(
nullptr, root_obj.Get());
755 EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.
Receive()));
756 EXPECT_EQ(VT_DISPATCH, selection.
type());
757 ASSERT_NE(
nullptr, selection.
ptr());
759 ComPtr<IAccessible> row;
760 ASSERT_HRESULT_SUCCEEDED(
761 V_DISPATCH(selection.
ptr())->QueryInterface(IID_PPV_ARGS(&row)));
764 EXPECT_HRESULT_SUCCEEDED(row->get_accRole(SELF, role.
Receive()));
765 EXPECT_EQ(ROLE_SYSTEM_ROW, V_I4(role.
ptr()));
778 ComPtr<IAccessible> root_obj(GetRootIAccessible());
779 ASSERT_NE(
nullptr, root_obj.Get());
782 EXPECT_EQ(S_OK, root_obj->get_accSelection(selection.
Receive()));
783 EXPECT_EQ(VT_UNKNOWN, selection.
type());
784 ASSERT_NE(
nullptr, selection.
ptr());
787 ComPtr<IEnumVARIANT> accessibles;
788 ASSERT_HRESULT_SUCCEEDED(
789 V_UNKNOWN(selection.
ptr())->QueryInterface(IID_PPV_ARGS(&accessibles)));
790 ULONG retrieved_count;
795 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
798 ComPtr<IAccessible> accessible;
799 ASSERT_HRESULT_SUCCEEDED(
800 V_DISPATCH(item.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
802 EXPECT_HRESULT_SUCCEEDED(accessible->get_accRole(SELF, role.
Receive()));
803 EXPECT_EQ(ROLE_SYSTEM_ROW, V_I4(role.
ptr()));
809 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
812 ComPtr<IAccessible> accessible;
813 ASSERT_HRESULT_SUCCEEDED(
814 V_DISPATCH(item.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
816 EXPECT_HRESULT_SUCCEEDED(accessible->get_accRole(SELF, role.
Receive()));
817 EXPECT_EQ(ROLE_SYSTEM_ROW, V_I4(role.
ptr()));
823 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
824 EXPECT_EQ(S_FALSE, hr);
836 ComPtr<IAccessible> root_obj(GetRootIAccessible());
837 ASSERT_NE(
nullptr, root_obj.Get());
839 ComPtr<IDispatch> row2;
840 ASSERT_HRESULT_SUCCEEDED(root_obj->get_accChild(
ScopedVariant(2), &row2));
841 ComPtr<IAccessible> row2_accessible;
842 ASSERT_HRESULT_SUCCEEDED(row2.As(&row2_accessible));
845 EXPECT_EQ(S_OK, row2_accessible->get_accSelection(selection.
Receive()));
846 EXPECT_EQ(VT_DISPATCH, selection.
type());
847 ASSERT_NE(
nullptr, selection.
ptr());
849 ComPtr<IAccessible> cell;
850 ASSERT_HRESULT_SUCCEEDED(
851 V_DISPATCH(selection.
ptr())->QueryInterface(IID_PPV_ARGS(&cell)));
854 EXPECT_HRESULT_SUCCEEDED(cell->get_accRole(SELF, role.
Receive()));
855 EXPECT_EQ(ROLE_SYSTEM_CELL, V_I4(role.
ptr()));
858 EXPECT_EQ(S_OK, cell->get_accName(SELF,
name.Receive()));
859 EXPECT_STREQ(
L"1",
name.Get());
872 ComPtr<IAccessible> root_obj(GetRootIAccessible());
873 ASSERT_NE(
nullptr, root_obj.Get());
875 ComPtr<IDispatch> row3;
876 ASSERT_HRESULT_SUCCEEDED(root_obj->get_accChild(
ScopedVariant(3), &row3));
877 ComPtr<IAccessible> row3_accessible;
878 ASSERT_HRESULT_SUCCEEDED(row3.As(&row3_accessible));
881 EXPECT_EQ(S_OK, row3_accessible->get_accSelection(selection.
Receive()));
882 EXPECT_EQ(VT_UNKNOWN, selection.
type());
883 ASSERT_NE(
nullptr, selection.
ptr());
886 ComPtr<IEnumVARIANT> accessibles;
887 ASSERT_HRESULT_SUCCEEDED(
888 V_UNKNOWN(selection.
ptr())->QueryInterface(IID_PPV_ARGS(&accessibles)));
889 ULONG retrieved_count;
894 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
897 ComPtr<IAccessible> accessible;
898 ASSERT_HRESULT_SUCCEEDED(
899 V_DISPATCH(item.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
901 EXPECT_EQ(S_OK, accessible->get_accName(SELF,
name.Receive()));
902 EXPECT_STREQ(
L"3",
name.Get());
908 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
911 ComPtr<IAccessible> accessible;
912 ASSERT_HRESULT_SUCCEEDED(
913 V_DISPATCH(item.
ptr())->QueryInterface(IID_PPV_ARGS(&accessible)));
915 EXPECT_EQ(S_OK, accessible->get_accName(SELF,
name.Receive()));
916 EXPECT_STREQ(
L"4",
name.Get());
922 HRESULT hr = accessibles->Next(1, item.
Receive(), &retrieved_count);
923 EXPECT_EQ(S_FALSE, hr);
930 root.child_ids.push_back(2);
937 ComPtr<IAccessible> child_iaccessible(IAccessibleFromNode(child_node));
943 EXPECT_EQ(S_OK, child_iaccessible->get_accRole(SELF, role.
Receive()));
944 EXPECT_EQ(ROLE_SYSTEM_ALERT, V_I4(role.
ptr()));
948 EXPECT_EQ(S_OK, child_iaccessible->get_accRole(SELF, role.
Receive()));
949 EXPECT_EQ(ROLE_SYSTEM_PUSHBUTTON, V_I4(role.
ptr()));
953 EXPECT_EQ(S_OK, child_iaccessible->get_accRole(SELF, role.
Receive()));
954 EXPECT_EQ(ROLE_SYSTEM_BUTTONMENU, V_I4(role.
ptr()));
956 EXPECT_EQ(E_INVALIDARG, child_iaccessible->get_accRole(SELF,
nullptr));
958 EXPECT_EQ(E_INVALIDARG,
959 child_iaccessible->get_accRole(bad_id, role.
Receive()));
971 EXPECT_EQ(S_OK, GetRootIAccessible()->accLocation(&x_left, &y_top, &
width,
973 EXPECT_EQ(110, x_left);
974 EXPECT_EQ(240, y_top);
975 EXPECT_EQ(800,
width);
978 EXPECT_EQ(E_INVALIDARG, GetRootIAccessible()->accLocation(
980 EXPECT_EQ(E_INVALIDARG, GetRootIAccessible()->accLocation(
982 EXPECT_EQ(E_INVALIDARG, GetRootIAccessible()->accLocation(
983 &x_left, &y_top,
nullptr, &
height, SELF));
984 EXPECT_EQ(E_INVALIDARG, GetRootIAccessible()->accLocation(
985 &x_left, &y_top, &
width,
nullptr, SELF));
987 EXPECT_EQ(E_INVALIDARG, GetRootIAccessible()->accLocation(
997 root.child_ids.push_back(2);
998 root.child_ids.push_back(3);
1011 ComPtr<IAccessible> root_iaccessible(GetRootIAccessible());
1012 ComPtr<IAccessible> button_iaccessible(IAccessibleFromNode(button_node));
1013 ComPtr<IAccessible> checkbox_iaccessible(IAccessibleFromNode(checkbox_node));
1016 EXPECT_EQ(S_OK, root_iaccessible->get_accChildCount(&child_count));
1017 EXPECT_EQ(2L, child_count);
1018 EXPECT_EQ(S_OK, button_iaccessible->get_accChildCount(&child_count));
1019 EXPECT_EQ(0
L, child_count);
1020 EXPECT_EQ(S_OK, checkbox_iaccessible->get_accChildCount(&child_count));
1021 EXPECT_EQ(0
L, child_count);
1024 ComPtr<IDispatch>
result;
1025 EXPECT_EQ(S_OK, root_iaccessible->get_accChild(SELF, &
result));
1026 EXPECT_EQ(
result.Get(), root_iaccessible.Get());
1030 ComPtr<IDispatch>
result;
1032 EXPECT_EQ(S_OK, root_iaccessible->get_accChild(child1, &
result));
1033 EXPECT_EQ(
result.Get(), button_iaccessible.Get());
1037 ComPtr<IDispatch>
result;
1039 EXPECT_EQ(S_OK, root_iaccessible->get_accChild(child2, &
result));
1040 EXPECT_EQ(
result.Get(), checkbox_iaccessible.Get());
1045 ComPtr<IDispatch>
result;
1047 EXPECT_EQ(E_INVALIDARG, root_iaccessible->get_accChild(child3, &
result));
1052 ComPtr<IDispatch>
result;
1053 EXPECT_EQ(S_OK, button_iaccessible->get_accParent(&
result));
1054 EXPECT_EQ(
result.Get(), root_iaccessible.Get());
1058 ComPtr<IDispatch>
result;
1059 EXPECT_EQ(S_OK, checkbox_iaccessible->get_accParent(&
result));
1060 EXPECT_EQ(
result.Get(), root_iaccessible.Get());
1064 ComPtr<IDispatch>
result;
1065 EXPECT_EQ(S_FALSE, root_iaccessible->get_accParent(&
result));
1077 root.child_ids.push_back(2);
1082 root.child_ids.push_back(3);
1085 ComPtr<IAccessible> ia_root(GetRootIAccessible());
1086 ComPtr<IDispatch> disp_root;
1087 ASSERT_HRESULT_SUCCEEDED(ia_root.As(&disp_root));
1089 ComPtr<IAccessible> ia_child1(
1090 IAccessibleFromNode(GetRootAsAXNode()->children()[0]));
1091 ComPtr<IDispatch> disp_child1;
1092 ASSERT_HRESULT_SUCCEEDED(ia_child1.As(&disp_child1));
1094 ComPtr<IAccessible> ia_child2(
1095 IAccessibleFromNode(GetRootAsAXNode()->children()[1]));
1096 ComPtr<IDispatch> disp_child2;
1097 ASSERT_HRESULT_SUCCEEDED(ia_child2.As(&disp_child2));
1104 ia_root->accNavigate(NAVDIR_NEXT, ScopedVariant::kEmptyVariant,
nullptr));
1105 EXPECT_EQ(E_INVALIDARG,
1106 ia_child1->accNavigate(NAVDIR_NEXT, ScopedVariant::kEmptyVariant,
1108 EXPECT_EQ(VT_EMPTY,
end.type());
1111 EXPECT_EQ(E_INVALIDARG,
1112 ia_root->accNavigate(NAVDIR_FIRSTCHILD, var_root,
end.AsInput()));
1113 EXPECT_EQ(VT_EMPTY,
end.type());
1114 EXPECT_EQ(E_INVALIDARG,
1115 ia_root->accNavigate(NAVDIR_LASTCHILD, var_root,
end.AsInput()));
1116 EXPECT_EQ(VT_EMPTY,
end.type());
1119 EXPECT_EQ(E_NOTIMPL, ia_child1->accNavigate(NAVDIR_UP, SELF,
end.AsInput()));
1120 EXPECT_EQ(E_NOTIMPL, ia_root->accNavigate(NAVDIR_DOWN, SELF,
end.AsInput()));
1121 EXPECT_EQ(E_NOTIMPL,
1122 ia_child1->accNavigate(NAVDIR_RIGHT, SELF,
end.AsInput()));
1123 EXPECT_EQ(E_NOTIMPL,
1124 ia_child2->accNavigate(NAVDIR_LEFT, SELF,
end.AsInput()));
1125 EXPECT_EQ(VT_EMPTY,
end.type());
1128 EXPECT_EQ(S_OK, ia_root->accNavigate(NAVDIR_FIRSTCHILD, SELF,
end.AsInput()));
1129 EXPECT_EQ(VT_DISPATCH,
end.type());
1130 EXPECT_EQ(V_DISPATCH(var_child1.
ptr()), V_DISPATCH(
end.ptr()));
1132 EXPECT_EQ(S_OK, ia_root->accNavigate(NAVDIR_LASTCHILD, SELF,
end.AsInput()));
1133 EXPECT_EQ(VT_DISPATCH,
end.type());
1134 EXPECT_EQ(V_DISPATCH(var_child2.
ptr()), V_DISPATCH(
end.ptr()));
1136 EXPECT_EQ(S_OK, ia_child1->accNavigate(NAVDIR_NEXT, SELF,
end.AsInput()));
1137 EXPECT_EQ(VT_DISPATCH,
end.type());
1138 EXPECT_EQ(V_DISPATCH(var_child2.
ptr()), V_DISPATCH(
end.ptr()));
1140 EXPECT_EQ(S_OK, ia_child2->accNavigate(NAVDIR_PREVIOUS, SELF,
end.AsInput()));
1141 EXPECT_EQ(VT_DISPATCH,
end.type());
1142 EXPECT_EQ(V_DISPATCH(var_child1.
ptr()), V_DISPATCH(
end.ptr()));
1148 EXPECT_EQ(VT_DISPATCH,
end.type());
1149 EXPECT_EQ(V_DISPATCH(var_child2.
ptr()), V_DISPATCH(
end.ptr()));
1151 EXPECT_EQ(S_OK, ia_root->accNavigate(NAVDIR_PREVIOUS,
ScopedVariant(2),
1153 EXPECT_EQ(VT_DISPATCH,
end.type());
1154 EXPECT_EQ(V_DISPATCH(var_child1.
ptr()), V_DISPATCH(
end.ptr()));
1158 ia_child1->accNavigate(NAVDIR_PREVIOUS, SELF,
end.AsInput()));
1159 EXPECT_EQ(VT_EMPTY,
end.type());
1160 EXPECT_EQ(S_FALSE, ia_child2->accNavigate(NAVDIR_NEXT, SELF,
end.AsInput()));
1161 EXPECT_EQ(VT_EMPTY,
end.type());
1163 EXPECT_EQ(S_FALSE, ia_root->accNavigate(NAVDIR_PREVIOUS,
ScopedVariant(1),
1165 EXPECT_EQ(VT_EMPTY,
end.type());
1168 EXPECT_EQ(VT_EMPTY,
end.type());
1172 std::vector<const wchar_t*> expected_names;
1176 tree.
nodes.resize(11);
1177 tree.
nodes[0].id = 1;
1178 tree.
nodes[0].child_ids = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
1182 tree.
nodes[1].id = 2;
1186 tree.
nodes[1].SetImageAnnotationStatus(
1188 expected_names.push_back(
1189 L"To get missing image descriptions, open the context menu.");
1193 tree.
nodes[2].id = 3;
1197 tree.
nodes[2].SetName(
"ExistingLabel");
1198 tree.
nodes[2].SetImageAnnotationStatus(
1200 expected_names.push_back(
1201 L"ExistingLabel. To get missing image descriptions, open the context "
1206 tree.
nodes[3].id = 4;
1210 tree.
nodes[3].SetName(
"ExistingLabel");
1211 tree.
nodes[3].SetImageAnnotationStatus(
1213 expected_names.push_back(
L"ExistingLabel");
1216 tree.
nodes[4].id = 5;
1220 tree.
nodes[4].SetName(
"ExistingLabel");
1221 tree.
nodes[4].SetImageAnnotationStatus(
1223 expected_names.push_back(
L"ExistingLabel");
1227 tree.
nodes[5].id = 6;
1231 tree.
nodes[5].SetName(
"ExistingLabel");
1232 tree.
nodes[5].SetImageAnnotationStatus(
1234 expected_names.push_back(
L"ExistingLabel. Getting description...");
1238 tree.
nodes[6].id = 7;
1240 tree.
nodes[6].SetName(
"ExistingLabel");
1241 tree.
nodes[6].SetImageAnnotationStatus(
1243 expected_names.push_back(
L"ExistingLabel");
1247 tree.
nodes[7].id = 8;
1251 tree.
nodes[7].SetName(
"ExistingLabel");
1252 tree.
nodes[7].SetImageAnnotationStatus(
1254 expected_names.push_back(
L"ExistingLabel. Annotation");
1258 tree.
nodes[8].id = 9;
1262 tree.
nodes[8].SetName(
"ExistingLabel");
1263 tree.
nodes[8].SetImageAnnotationStatus(
1265 expected_names.push_back(
L"ExistingLabel. No description available.");
1269 tree.
nodes[9].id = 10;
1273 tree.
nodes[9].SetName(
"ExistingLabel");
1274 tree.
nodes[9].SetImageAnnotationStatus(
1276 expected_names.push_back(
1277 L"ExistingLabel. Appears to contain adult content. No description "
1282 tree.
nodes[10].id = 11;
1284 tree.
nodes[10].AddStringAttribute(
1286 tree.
nodes[10].SetName(
"ExistingLabel");
1287 tree.
nodes[10].SetImageAnnotationStatus(
1289 expected_names.push_back(
L"ExistingLabel. No description available.");
1292 ASSERT_EQ(expected_names.size(), tree.
nodes[0].child_ids.size());
1293 int child_count =
static_cast<int>(expected_names.size());
1297 ComPtr<IAccessible> root_obj(GetRootIAccessible());
1299 for (
int child_index = 0; child_index < child_count; child_index++) {
1300 ComPtr<IDispatch> child_dispatch;
1301 ASSERT_HRESULT_SUCCEEDED(root_obj->get_accChild(
1303 ComPtr<IAccessible> child;
1304 ASSERT_HRESULT_SUCCEEDED(child_dispatch.As(&child));
1307 EXPECT_EQ(S_OK, child->get_accName(SELF,
name.Receive()));
1308 EXPECT_STREQ(expected_names[child_index],
name.Get());
1313 Init(BuildAriaColumnAndRowCountGrids());
1316 ComPtr<IGridProvider> grid1_provider =
1317 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[0]);
1320 ComPtr<IGridProvider> grid2_provider =
1321 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[1]);
1324 ComPtr<IGridProvider> grid3_provider =
1325 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[2]);
1328 ComPtr<IGridProvider> grid4_provider =
1329 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[3]);
1333 EXPECT_HRESULT_SUCCEEDED(grid1_provider->get_RowCount(&row_count));
1334 EXPECT_EQ(row_count, 0);
1336 EXPECT_HRESULT_SUCCEEDED(grid2_provider->get_RowCount(&row_count));
1337 EXPECT_EQ(row_count, 4);
1339 EXPECT_HRESULT_SUCCEEDED(grid3_provider->get_RowCount(&row_count));
1340 EXPECT_EQ(row_count, 2);
1342 EXPECT_EQ(E_UNEXPECTED, grid4_provider->get_RowCount(&row_count));
1346 Init(BuildAriaColumnAndRowCountGrids());
1349 ComPtr<IGridProvider> grid1_provider =
1350 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[0]);
1353 ComPtr<IGridProvider> grid2_provider =
1354 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[1]);
1357 ComPtr<IGridProvider> grid3_provider =
1358 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[2]);
1361 ComPtr<IGridProvider> grid4_provider =
1362 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()->children()[3]);
1366 EXPECT_HRESULT_SUCCEEDED(grid1_provider->get_ColumnCount(&column_count));
1367 EXPECT_EQ(column_count, 0);
1369 EXPECT_HRESULT_SUCCEEDED(grid2_provider->get_ColumnCount(&column_count));
1370 EXPECT_EQ(column_count, 5);
1372 EXPECT_HRESULT_SUCCEEDED(grid3_provider->get_ColumnCount(&column_count));
1373 EXPECT_EQ(column_count, 3);
1375 EXPECT_EQ(E_UNEXPECTED, grid4_provider->get_ColumnCount(&column_count));
1388 root.child_ids.push_back(row1.
id);
1397 ComPtr<IGridProvider> root_igridprovider(
1398 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode()));
1400 ComPtr<IRawElementProviderSimple> cell1_irawelementprovidersimple(
1401 QueryInterfaceFromNode<IRawElementProviderSimple>(
1402 GetRootAsAXNode()->children()[0]->children()[0]));
1404 IRawElementProviderSimple* grid_item =
nullptr;
1405 EXPECT_HRESULT_SUCCEEDED(root_igridprovider->GetItem(0, 0, &grid_item));
1406 EXPECT_NE(
nullptr, grid_item);
1407 EXPECT_EQ(cell1_irawelementprovidersimple.Get(), grid_item);
1418 root.child_ids.push_back(row1.
id);
1421 column_header.
id = 3;
1423 column_header.
SetName(u
"column_header");
1429 row_header.
SetName(u
"row_header");
1432 Init(
root, row1, column_header, row_header);
1434 ComPtr<ITableProvider> root_itableprovider(
1435 QueryInterfaceFromNode<ITableProvider>(GetRootAsAXNode()));
1438 EXPECT_HRESULT_SUCCEEDED(
1439 root_itableprovider->GetColumnHeaders(safearray.
Receive()));
1440 EXPECT_NE(
nullptr, safearray.
Get());
1442 std::vector<std::wstring> expected_names = {
L"column_header"};
1449 GetTree(), GetRootAsAXNode()->children()[0]->children()[0]);
1453 EXPECT_HRESULT_SUCCEEDED(
1454 root_itableprovider->GetColumnHeaders(safearray.
Receive()));
1455 EXPECT_EQ(
nullptr, safearray.
Get());
1488 root.child_ids.push_back(row1.
id);
1493 root.child_ids.push_back(row2.
id);
1498 root.child_ids.push_back(row3.
id);
1506 header_r1c1.
SetName(u
"header_r1c1");
1512 header_r1c2.
SetName(u
"header_r1c2");
1518 header_r1c3.
SetName(u
"header_r1c3");
1527 cell_r2c1.
SetName(u
"cell_r2c1");
1533 cell_r2c2.
SetName(u
"cell_r2c2");
1539 cell_r2c3.
SetName(u
"cell_r2c3");
1548 cell_r3c1.
SetName(u
"cell_r3c1");
1552 header_r3c2.
id = 12;
1554 header_r3c2.
SetName(u
"header_r3c2");
1557 Init(
root, row1, row2, row3, header_r1c1, header_r1c2, header_r1c3, cell_r2c1,
1558 cell_r2c2, cell_r2c3, cell_r3c1, header_r3c2);
1560 ComPtr<ITableProvider> root_itableprovider(
1561 QueryInterfaceFromNode<ITableProvider>(GetRootAsAXNode()));
1564 EXPECT_HRESULT_SUCCEEDED(
1565 root_itableprovider->GetColumnHeaders(safearray.
Receive()));
1566 EXPECT_NE(
nullptr, safearray.
Get());
1570 std::vector<std::wstring> expected_names = {
L"header_r1c1",
L"header_r1c2",
1571 L"header_r3c2",
L"header_r1c3"};
1584 root.child_ids.push_back(row1.
id);
1587 column_header.
id = 3;
1589 column_header.
SetName(u
"column_header");
1595 row_header.
SetName(u
"row_header");
1598 Init(
root, row1, column_header, row_header);
1600 ComPtr<ITableProvider> root_itableprovider(
1601 QueryInterfaceFromNode<ITableProvider>(GetRootAsAXNode()));
1604 EXPECT_HRESULT_SUCCEEDED(
1605 root_itableprovider->GetRowHeaders(safearray.
Receive()));
1606 EXPECT_NE(
nullptr, safearray.
Get());
1607 std::vector<std::wstring> expected_names = {
L"row_header"};
1613 GetTree(), GetRootAsAXNode()->children()[0]->children()[1]);
1617 EXPECT_HRESULT_SUCCEEDED(
1618 root_itableprovider->GetRowHeaders(safearray.
Receive()));
1619 EXPECT_EQ(
nullptr, safearray.
Get());
1629 ComPtr<ITableProvider> root_itableprovider(
1630 QueryInterfaceFromNode<ITableProvider>(GetRootAsAXNode()));
1632 RowOrColumnMajor row_or_column_major;
1633 EXPECT_HRESULT_SUCCEEDED(
1634 root_itableprovider->get_RowOrColumnMajor(&row_or_column_major));
1635 EXPECT_EQ(row_or_column_major, RowOrColumnMajor_RowMajor);
1646 root.child_ids.push_back(row1.
id);
1649 column_header_1.
id = 3;
1651 column_header_1.
SetName(u
"column_header_1");
1655 column_header_2.
id = 4;
1657 column_header_2.
SetName(u
"column_header_2");
1663 root.child_ids.push_back(row2.
id);
1670 Init(
root, row1, column_header_1, column_header_2, row2, cell);
1676 ComPtr<ITableItemProvider> cell_itableitemprovider(
1677 QueryInterfaceFromNode<ITableItemProvider>(
1678 GetRootAsAXNode()->children()[1]->children()[0]));
1681 EXPECT_HRESULT_SUCCEEDED(
1682 cell_itableitemprovider->GetColumnHeaderItems(safearray.
Receive()));
1683 EXPECT_NE(
nullptr, safearray.
Get());
1685 std::vector<std::wstring> expected_names = {
L"column_header_1"};
1692 GetTree(), GetRootAsAXNode()->children()[0]->children()[0]);
1696 EXPECT_HRESULT_SUCCEEDED(
1697 cell_itableitemprovider->GetColumnHeaderItems(safearray.
Receive()));
1698 EXPECT_EQ(
nullptr, safearray.
Get());
1709 root.child_ids.push_back(row1.
id);
1712 row_header_1.
id = 3;
1714 row_header_1.
SetName(u
"row_header_1");
1725 root.child_ids.push_back(row2.
id);
1728 row_header_2.
id = 6;
1730 row_header_2.
SetName(u
"row_header_2");
1733 Init(
root, row1, row_header_1, cell, row2, row_header_2);
1739 ComPtr<ITableItemProvider> cell_itableitemprovider(
1740 QueryInterfaceFromNode<ITableItemProvider>(
1741 GetRootAsAXNode()->children()[0]->children()[1]));
1744 EXPECT_HRESULT_SUCCEEDED(
1745 cell_itableitemprovider->GetRowHeaderItems(safearray.
Receive()));
1746 EXPECT_NE(
nullptr, safearray.
Get());
1747 std::vector<std::wstring> expected_names = {
L"row_header_1"};
1754 GetTree(), GetRootAsAXNode()->children()[0]->children()[0]);
1758 EXPECT_HRESULT_SUCCEEDED(
1759 cell_itableitemprovider->GetRowHeaderItems(safearray.
Receive()));
1760 EXPECT_EQ(
nullptr, safearray.
Get());
1766 root.SetName(
"fake name");
1771 "fake description");
1781 root.child_ids.push_back(child1.
id);
1785 ComPtr<IRawElementProviderSimple> root_node =
1786 GetRootIRawElementProviderSimple();
1790 ASSERT_HRESULT_SUCCEEDED(root_node->GetPropertyValue(
1791 UIA_AutomationIdPropertyId, uia_id.
Receive()));
1793 uia_id.
ptr()->bstrVal);
1795 L"fake description");
1798 L"readonly=true;expanded=false;multiline=false;"
1799 L"multiselectable=false;required=false;setsize=2");
1800 constexpr int en_us_lcid = 1033;
1804 int{UIA_ListControlTypeId});
1806 int{OrientationType_None});
1809 int{ToggleState_Off});
1817 ComPtr<IRawElementProviderSimple> child_node1 =
1818 QueryInterfaceFromNode<IRawElementProviderSimple>(
1819 GetRootAsAXNode()->children()[0]);
1830 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
1831 GetRootIRawElementProviderSimple();
1835 std::vector<double> expected_values = {70, 130};
1837 UIA_ClickablePointPropertyId, expected_values);
1844 root.child_ids = {2, 3};
1847 alert_dialog.
id = 2;
1859 UIA_IsDialogPropertyId,
true);
1861 UIA_IsDialogPropertyId,
true);
1865 UIAGetPropertyValueIsControlElementIgnoredInvisible) {
1869 root.child_ids = {2, 3, 4, 5, 6, 7, 8};
1872 normal_button.
id = 2;
1876 ignored_button.
id = 3;
1881 invisible_button.
id = 4;
1886 invisible_focusable_button.
id = 5;
1892 focusable_generic_container.
id = 6;
1896 AXNodeData ignored_focusable_generic_container;
1897 ignored_focusable_generic_container.
id = 7;
1902 AXNodeData invisible_focusable_generic_container;
1903 invisible_focusable_generic_container.
id = 8;
1904 invisible_focusable_generic_container.
role =
1909 Init(
root, normal_button, ignored_button, invisible_button,
1910 invisible_focusable_button, focusable_generic_container,
1911 ignored_focusable_generic_container,
1912 invisible_focusable_generic_container);
1920 UIA_IsControlElementPropertyId,
true);
1924 UIA_IsControlElementPropertyId,
false);
1928 UIA_IsControlElementPropertyId,
false);
1933 UIA_IsControlElementPropertyId,
false);
1938 UIA_IsControlElementPropertyId,
true);
1943 UIA_IsControlElementPropertyId,
false);
1948 UIA_IsControlElementPropertyId,
false);
1955 root.child_ids = {2, 3, 4};
1961 std::vector<AXNode::AXID> controller_ids = {3, 4};
1980 ComPtr<IRawElementProviderSimple> tab_node =
1981 QueryInterfaceFromNode<IRawElementProviderSimple>(
1982 GetRootAsAXNode()->children()[0]);
1984 std::vector<std::wstring> expected_names_1 = {
L"panel1",
L"panel2"};
1986 tab_node, UIA_ControllerForPropertyId, UIA_NamePropertyId,
1991 GetTree(), GetRootAsAXNode()->children()[1]);
1993 std::vector<std::wstring> expected_names_2 = {
L"panel2"};
1995 tab_node, UIA_ControllerForPropertyId, UIA_NamePropertyId,
2001 std::vector<AXNode::AXID> describedby_ids = {2, 3, 4};
2006 root.SetName(
"root");
2013 root.child_ids.push_back(child1.
id);
2020 root.child_ids.push_back(child2.
id);
2024 ComPtr<IRawElementProviderSimple> root_node =
2025 GetRootIRawElementProviderSimple();
2027 std::vector<std::wstring> expected_names = {
L"child1",
L"child2"};
2029 root_node, UIA_DescribedByPropertyId, UIA_NamePropertyId, expected_names);
2042 root.child_ids.push_back(row1.
id);
2075 Init(
root, row1, header1, header2, header3, header4);
2077 auto* row_node = GetRootAsAXNode()->children()[0];
2080 row_node->children()[0]),
2081 UIA_ItemStatusPropertyId,
L"ascending");
2084 row_node->children()[1]),
2085 UIA_ItemStatusPropertyId,
L"descending");
2088 row_node->children()[2]),
2089 UIA_ItemStatusPropertyId,
L"other");
2092 row_node->children()[3]),
2093 UIA_ItemStatusPropertyId, ScopedVariant::kEmptyVariant);
2096 QueryInterfaceFromNode<IRawElementProviderSimple>(row_node),
2097 UIA_ItemStatusPropertyId, ScopedVariant::kEmptyVariant);
2102 std::vector<AXNode::AXID> flowto_ids = {2, 3, 4};
2106 root.SetName(
"root");
2113 root.child_ids.push_back(child1.
id);
2120 root.child_ids.push_back(child2.
id);
2124 ComPtr<IRawElementProviderSimple> root_node =
2125 GetRootIRawElementProviderSimple();
2126 std::vector<std::wstring> expected_names = {
L"child1",
L"child2"};
2128 UIA_NamePropertyId, expected_names);
2135 root.SetName(
"root");
2139 ComPtr<IRawElementProviderSimple> root_node =
2140 GetRootIRawElementProviderSimple();
2143 EXPECT_HRESULT_SUCCEEDED(root_node->GetPropertyValue(
2144 UIA_FlowsFromPropertyId, property_value.
Receive()));
2145 EXPECT_EQ(VT_ARRAY | VT_UNKNOWN, property_value.
type());
2146 EXPECT_EQ(
nullptr, V_ARRAY(property_value.
ptr()));
2153 root.SetName(
"root");
2160 root.child_ids.push_back(child1.
id);
2166 ComPtr<IRawElementProviderSimple> child_node1 =
2167 QueryInterfaceFromNode<IRawElementProviderSimple>(
2168 GetRootAsAXNode()->children()[0]);
2169 std::vector<std::wstring> expected_names = {
L"root"};
2171 child_node1, UIA_FlowsFromPropertyId, UIA_NamePropertyId, expected_names);
2178 root.SetName(
"root");
2186 root.child_ids.push_back(child1.
id);
2192 root.child_ids.push_back(child2.
id);
2198 GetTree(), GetRootAsAXNode()->children()[0]));
2200 ComPtr<IRawElementProviderSimple> child_node2 =
2201 QueryInterfaceFromNode<IRawElementProviderSimple>(
2202 GetRootAsAXNode()->children()[1]);
2203 std::vector<std::wstring> expected_names_1 = {
L"root",
L"child1"};
2205 child_node2, UIA_FlowsFromPropertyId, UIA_NamePropertyId,
2210 GetTree(), GetRootAsAXNode()->children()[0]);
2212 std::vector<std::wstring> expected_names_2 = {
L"root"};
2214 child_node2, UIA_FlowsFromPropertyId, UIA_NamePropertyId,
2220 root_ax_node_data.
id = 1;
2222 Init(root_ax_node_data);
2224 ComPtr<IRawElementProviderSimple> root_raw_element_provider_simple =
2225 GetRootIRawElementProviderSimple();
2227 UIA_FrameworkIdPropertyId,
L"Chrome");
2248 static_text_3.
id = 3;
2251 static_text_6.
id = 6;
2259 {static_text_3.
id});
2263 static_text_3.
SetName(
"Hello");
2274 static_text_6.
SetName(
"3.14");
2278 {static_text_6.
id});
2280 Init(root_1, gc_2, static_text_3, gc_4, gc_5, static_text_6, alert_7);
2282 AXNode* root_node = GetRootAsAXNode();
2286 AXNode* static_text_6_node = gc_4_node->
children()[0]->children()[0];
2291 ComPtr<IRawElementProviderSimple> gc_2_provider =
2292 GetIRawElementProviderSimpleFromTree(gc_2_node->
tree()->
GetAXTreeID(),
2295 EXPECT_EQ(S_OK, gc_2_provider->GetPropertyValue(UIA_LabeledByPropertyId,
2297 ASSERT_EQ(property_value.
type(), VT_UNKNOWN);
2298 ComPtr<IRawElementProviderSimple> static_text_3_provider;
2299 EXPECT_EQ(S_OK, property_value.
ptr()->punkVal->QueryInterface(
2300 IID_PPV_ARGS(&static_text_3_provider)));
2306 ComPtr<IRawElementProviderSimple> gc_4_provider =
2307 GetIRawElementProviderSimpleFromTree(gc_4_node->
tree()->
GetAXTreeID(),
2309 property_value.
Reset();
2310 EXPECT_EQ(S_OK, gc_4_provider->GetPropertyValue(UIA_LabeledByPropertyId,
2312 ASSERT_EQ(property_value.
type(), VT_UNKNOWN);
2313 ComPtr<IRawElementProviderSimple> static_text_6_provider;
2314 EXPECT_EQ(S_OK, property_value.
ptr()->punkVal->QueryInterface(
2315 IID_PPV_ARGS(&static_text_6_provider)));
2323 ComPtr<IRawElementProviderSimple> alert_7_provider =
2324 GetIRawElementProviderSimpleFromTree(alert_7_node->
tree()->
GetAXTreeID(),
2325 alert_7_node->
id());
2326 property_value.
Reset();
2327 EXPECT_EQ(S_OK, alert_7_provider->GetPropertyValue(UIA_LabeledByPropertyId,
2329 ASSERT_EQ(property_value.
type(), VT_EMPTY);
2339 property_value.
Reset();
2340 EXPECT_EQ(S_OK, gc_2_provider->GetPropertyValue(UIA_LabeledByPropertyId,
2342 EXPECT_EQ(property_value.
type(), VT_EMPTY);
2349 property_value.
Reset();
2350 EXPECT_EQ(S_OK, gc_4_provider->GetPropertyValue(UIA_LabeledByPropertyId,
2352 EXPECT_EQ(property_value.
type(), VT_EMPTY);
2364 input1.
SetName(
"name-from-title");
2369 root.child_ids.push_back(input1.
id);
2375 input2.
SetName(
"name-from-title");
2378 root.child_ids.push_back(input2.
id);
2384 input3.
SetName(
"name-from-placeholder");
2387 root.child_ids.push_back(input3.
id);
2393 input4.
SetName(
"name-from-attribute");
2397 root.child_ids.push_back(input4.
id);
2404 input5.
SetName(
"name-from-attribute");
2407 root.child_ids.push_back(input5.
id);
2409 Init(
root, input1, input2, input3, input4, input5);
2411 auto* root_node = GetRootAsAXNode();
2413 root_node->children()[0]),
2414 UIA_HelpTextPropertyId,
L"placeholder");
2416 root_node->children()[1]),
2417 UIA_HelpTextPropertyId,
L"name-from-title");
2419 root_node->children()[2]),
2420 UIA_HelpTextPropertyId,
L"name-from-placeholder");
2422 root_node->children()[3]),
2423 UIA_HelpTextPropertyId,
L"tooltip");
2425 root_node->children()[4]),
2426 UIA_HelpTextPropertyId, ScopedVariant::kEmptyVariant);
2434 "root role description");
2440 "child1 role description");
2441 root.child_ids.push_back(2);
2446 root.child_ids.push_back(3);
2450 ComPtr<IRawElementProviderSimple> root_node =
2451 GetRootIRawElementProviderSimple();
2453 L"root role description");
2455 GetRootAsAXNode()->children()[0]),
2456 UIA_LocalizedControlTypePropertyId,
2457 L"child1 role description");
2459 GetRootAsAXNode()->children()[1]),
2460 UIA_LocalizedControlTypePropertyId,
L"search box");
2466 update.tree_data.tree_id = tree_id;
2467 update.has_tree_data =
true;
2472 update.nodes[0].child_ids = {2, 4, 6, 7, 8, 9, 10,
2473 11, 12, 13, 14, 15, 16, 17};
2476 update.nodes[1].child_ids = {3};
2479 update.nodes[2].SetName(
"some text");
2482 update.nodes[3].child_ids = {5};
2485 update.nodes[4].SetName(
"more text");
2496 update.nodes[9].SetNameExplicitlyEmpty();
2497 update.nodes[10].id = 11;
2499 update.nodes[11].id = 12;
2503 update.nodes[12].id = 13;
2507 update.nodes[13].id = 14;
2509 update.nodes[13].SetName(
"name");
2510 update.nodes[14].id = 15;
2512 update.nodes[14].SetDescription(
"description");
2513 update.nodes[15].id = 16;
2516 update.nodes[16].id = 17;
2518 update.nodes[16].SetName(
"name");
2524 UIA_IsControlElementPropertyId,
true);
2526 UIA_IsControlElementPropertyId,
false);
2528 UIA_IsControlElementPropertyId,
false);
2530 UIA_IsControlElementPropertyId,
true);
2532 UIA_IsControlElementPropertyId,
true);
2534 UIA_IsControlElementPropertyId,
true);
2536 UIA_IsControlElementPropertyId,
false);
2538 UIA_IsControlElementPropertyId,
true);
2540 UIA_IsControlElementPropertyId,
false);
2542 UIA_IsControlElementPropertyId,
true);
2544 UIA_IsControlElementPropertyId,
true);
2546 UIA_IsControlElementPropertyId,
true);
2548 UIA_IsControlElementPropertyId,
true);
2550 UIA_IsControlElementPropertyId,
true);
2552 UIA_IsControlElementPropertyId,
true);
2554 UIA_IsControlElementPropertyId,
true);
2562 ComPtr<IRawElementProviderSimple> root_node =
2563 GetRootIRawElementProviderSimple();
2565 ProviderOptions provider_options =
static_cast<ProviderOptions
>(0);
2566 EXPECT_HRESULT_SUCCEEDED(root_node->get_ProviderOptions(&provider_options));
2567 EXPECT_EQ(ProviderOptions_ServerSideProvider |
2568 ProviderOptions_UseComThreading |
2569 ProviderOptions_RefuseNonClientSupport |
2570 ProviderOptions_HasNativeIAccessible,
2579 ComPtr<IRawElementProviderSimple> root_node =
2580 GetRootIRawElementProviderSimple();
2582 ComPtr<IRawElementProviderSimple> host_provider;
2583 EXPECT_HRESULT_SUCCEEDED(
2584 root_node->get_HostRawElementProvider(&host_provider));
2585 EXPECT_EQ(
nullptr, host_provider.Get());
2594 ComPtr<IRawElementProviderFragment> root_node =
2595 GetRootIRawElementProviderFragment();
2597 UiaRect bounding_rectangle;
2598 EXPECT_HRESULT_SUCCEEDED(
2599 root_node->get_BoundingRectangle(&bounding_rectangle));
2600 EXPECT_EQ(10, bounding_rectangle.left);
2601 EXPECT_EQ(20, bounding_rectangle.top);
2602 EXPECT_EQ(30, bounding_rectangle.width);
2603 EXPECT_EQ(50, bounding_rectangle.height);
2613 element1_data.
id = 2;
2616 Init(root_data, element1_data);
2619 AXNode* root_node = GetRootAsAXNode();
2622 ComPtr<IRawElementProviderFragment> element1_provider =
2623 QueryInterfaceFromNode<IRawElementProviderFragment>(element1_node);
2624 ComPtr<IRawElementProviderFragmentRoot> expected_fragment_root =
2627 ComPtr<IRawElementProviderFragmentRoot> actual_fragment_root;
2628 EXPECT_HRESULT_SUCCEEDED(
2629 element1_provider->get_FragmentRoot(&actual_fragment_root));
2630 EXPECT_EQ(expected_fragment_root.Get(), actual_fragment_root.Get());
2633 ax_fragment_root_.reset();
2634 actual_fragment_root.Reset();
2636 element1_provider->get_FragmentRoot(&actual_fragment_root));
2643 element1_provider->get_FragmentRoot(&actual_fragment_root));
2651 ComPtr<IRawElementProviderFragment> root_provider =
2652 GetRootIRawElementProviderFragment();
2655 EXPECT_HRESULT_SUCCEEDED(root_provider->GetEmbeddedFragmentRoots(
2656 embedded_fragment_roots.
Receive()));
2657 EXPECT_EQ(
nullptr, embedded_fragment_roots.
Get());
2665 ComPtr<IRawElementProviderFragment> root_provider =
2666 GetRootIRawElementProviderFragment();
2669 EXPECT_HRESULT_SUCCEEDED(root_provider->GetRuntimeId(runtime_id.
Receive()));
2671 LONG array_lower_bound;
2672 EXPECT_HRESULT_SUCCEEDED(
2673 ::SafeArrayGetLBound(runtime_id.
Get(), 1, &array_lower_bound));
2674 EXPECT_EQ(0, array_lower_bound);
2676 LONG array_upper_bound;
2677 EXPECT_HRESULT_SUCCEEDED(
2678 ::SafeArrayGetUBound(runtime_id.
Get(), 1, &array_upper_bound));
2679 EXPECT_EQ(1, array_upper_bound);
2682 EXPECT_HRESULT_SUCCEEDED(::SafeArrayAccessData(
2683 runtime_id.
Get(),
reinterpret_cast<void**
>(&array_data)));
2684 EXPECT_EQ(UiaAppendRuntimeId, array_data[0]);
2685 EXPECT_NE(-1, array_data[1]);
2687 EXPECT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(runtime_id.
Get()));
2696 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
2697 GetRootIRawElementProviderSimple();
2698 ComPtr<IWindowProvider> window_provider;
2699 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
2700 UIA_WindowPatternId, &window_provider));
2701 ASSERT_EQ(
nullptr, window_provider.Get());
2711 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
2712 GetRootIRawElementProviderSimple();
2713 ComPtr<IWindowProvider> window_provider;
2714 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
2715 UIA_WindowPatternId, &window_provider));
2716 ASSERT_NE(
nullptr, window_provider.Get());
2719 EXPECT_HRESULT_SUCCEEDED(window_provider->get_IsModal(&is_modal));
2720 ASSERT_FALSE(is_modal);
2730 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
2731 GetRootIRawElementProviderSimple();
2732 ComPtr<IWindowProvider> window_provider;
2733 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
2734 UIA_WindowPatternId, &window_provider));
2735 ASSERT_NE(
nullptr, window_provider.Get());
2738 EXPECT_HRESULT_SUCCEEDED(window_provider->get_IsModal(&is_modal));
2739 ASSERT_TRUE(is_modal);
2749 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
2750 GetRootIRawElementProviderSimple();
2751 ComPtr<IWindowProvider> window_provider;
2752 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
2753 UIA_WindowPatternId, &window_provider));
2754 ASSERT_NE(
nullptr, window_provider.Get());
2756 ASSERT_EQ(E_INVALIDARG, window_provider->WaitForInputIdle(0,
nullptr));
2757 ASSERT_EQ(E_INVALIDARG, window_provider->get_CanMaximize(
nullptr));
2758 ASSERT_EQ(E_INVALIDARG, window_provider->get_CanMinimize(
nullptr));
2759 ASSERT_EQ(E_INVALIDARG, window_provider->get_IsModal(
nullptr));
2760 ASSERT_EQ(E_INVALIDARG, window_provider->get_WindowVisualState(
nullptr));
2761 ASSERT_EQ(E_INVALIDARG, window_provider->get_WindowInteractionState(
nullptr));
2762 ASSERT_EQ(E_INVALIDARG, window_provider->get_IsTopmost(
nullptr));
2772 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
2773 GetRootIRawElementProviderSimple();
2774 ComPtr<IWindowProvider> window_provider;
2775 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
2776 UIA_WindowPatternId, &window_provider));
2777 ASSERT_NE(
nullptr, window_provider.Get());
2780 WindowVisualState window_visual_state_result;
2781 WindowInteractionState window_interaction_state_result;
2783 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2784 window_provider->SetVisualState(
2785 WindowVisualState::WindowVisualState_Normal));
2786 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED), window_provider->Close());
2787 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2788 window_provider->WaitForInputIdle(0, &bool_result));
2789 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2790 window_provider->get_CanMaximize(&bool_result));
2791 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2792 window_provider->get_CanMinimize(&bool_result));
2794 static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2795 window_provider->get_WindowVisualState(&window_visual_state_result));
2796 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2797 window_provider->get_WindowInteractionState(
2798 &window_interaction_state_result));
2799 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_NOTSUPPORTED),
2800 window_provider->get_IsTopmost(&bool_result));
2808 element1_data.
id = 2;
2812 element2_data.
id = 3;
2816 element3_data.
id = 4;
2817 element1_data.
child_ids.push_back(element3_data.
id);
2819 Init(root_data, element1_data, element2_data, element3_data);
2821 AXNode* root_node = GetRootAsAXNode();
2826 auto TestNavigate = [
this](
AXNode* element_node,
AXNode* parent,
2829 ComPtr<IRawElementProviderFragment> element_provider =
2830 QueryInterfaceFromNode<IRawElementProviderFragment>(element_node);
2832 auto TestNavigateSingle = [&](NavigateDirection direction,
2834 ComPtr<IRawElementProviderFragment> expected_provider =
2835 QueryInterfaceFromNode<IRawElementProviderFragment>(expected_node);
2837 ComPtr<IRawElementProviderFragment> navigated_to_fragment;
2838 EXPECT_HRESULT_SUCCEEDED(
2839 element_provider->Navigate(direction, &navigated_to_fragment));
2840 EXPECT_EQ(expected_provider.Get(), navigated_to_fragment.Get());
2843 TestNavigateSingle(NavigateDirection_Parent, parent);
2844 TestNavigateSingle(NavigateDirection_NextSibling, next_sibling);
2845 TestNavigateSingle(NavigateDirection_PreviousSibling, prev_sibling);
2846 TestNavigateSingle(NavigateDirection_FirstChild, first_child);
2847 TestNavigateSingle(NavigateDirection_LastChild, last_child);
2850 TestNavigate(root_node,
2857 TestNavigate(element1_node, root_node, element2_node,
nullptr, element3_node,
2860 TestNavigate(element2_node, root_node,
nullptr, element1_node,
nullptr,
2863 TestNavigate(element3_node, element1_node,
nullptr,
nullptr,
nullptr,
2868 Init(BuildListBox(
false,
2872 ComPtr<ISelectionProvider> selection_provider(
2873 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2876 EXPECT_HRESULT_SUCCEEDED(
2877 selection_provider->get_CanSelectMultiple(&multiple));
2878 EXPECT_FALSE(multiple);
2882 const std::vector<ax::mojom::State>
state = {
2884 Init(BuildListBox(
false,
2889 ComPtr<ISelectionProvider> selection_provider(
2890 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2893 EXPECT_HRESULT_SUCCEEDED(
2894 selection_provider->get_CanSelectMultiple(&multiple));
2899 Init(BuildListBox(
false,
2904 ComPtr<ISelectionProvider> selection_provider(
2905 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2908 EXPECT_HRESULT_SUCCEEDED(
2909 selection_provider->get_IsSelectionRequired(&selection_required));
2910 EXPECT_FALSE(selection_required);
2914 Init(BuildListBox(
false,
2919 ComPtr<ISelectionProvider> selection_provider(
2920 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2923 EXPECT_HRESULT_SUCCEEDED(
2924 selection_provider->get_IsSelectionRequired(&selection_required));
2929 Init(BuildListBox(
false,
2934 ComPtr<ISelectionProvider> selection_provider(
2935 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2938 EXPECT_HRESULT_SUCCEEDED(
2939 selection_provider->GetSelection(selected_items.
Receive()));
2940 EXPECT_NE(
nullptr, selected_items.
Get());
2942 LONG array_lower_bound;
2943 EXPECT_HRESULT_SUCCEEDED(
2944 ::SafeArrayGetLBound(selected_items.
Get(), 1, &array_lower_bound));
2945 EXPECT_EQ(0, array_lower_bound);
2947 LONG array_upper_bound;
2948 EXPECT_HRESULT_SUCCEEDED(
2949 ::SafeArrayGetUBound(selected_items.
Get(), 1, &array_upper_bound));
2950 EXPECT_EQ(-1, array_upper_bound);
2954 ISelectionProviderGetSelectionSingleItemSelected) {
2955 Init(BuildListBox(
false,
2960 ComPtr<ISelectionProvider> selection_provider(
2961 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2962 ComPtr<IRawElementProviderSimple> option2_provider(
2963 QueryInterfaceFromNode<IRawElementProviderSimple>(
2964 GetRootAsAXNode()->children()[1]));
2967 EXPECT_HRESULT_SUCCEEDED(
2968 selection_provider->GetSelection(selected_items.
Receive()));
2969 EXPECT_NE(
nullptr, selected_items.
Get());
2971 LONG array_lower_bound;
2972 EXPECT_HRESULT_SUCCEEDED(
2973 ::SafeArrayGetLBound(selected_items.
Get(), 1, &array_lower_bound));
2974 EXPECT_EQ(0, array_lower_bound);
2976 LONG array_upper_bound;
2977 EXPECT_HRESULT_SUCCEEDED(
2978 ::SafeArrayGetUBound(selected_items.
Get(), 1, &array_upper_bound));
2979 EXPECT_EQ(0, array_upper_bound);
2981 IRawElementProviderSimple** array_data;
2982 EXPECT_HRESULT_SUCCEEDED(::SafeArrayAccessData(
2983 selected_items.
Get(),
reinterpret_cast<void**
>(&array_data)));
2984 EXPECT_EQ(option2_provider.Get(), array_data[0]);
2985 EXPECT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(selected_items.
Get()));
2989 ISelectionProviderGetSelectionMultipleItemsSelected) {
2990 const std::vector<ax::mojom::State>
state = {
2992 Init(BuildListBox(
true,
2997 ComPtr<ISelectionProvider> selection_provider(
2998 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode()));
2999 ComPtr<IRawElementProviderSimple> option1_provider(
3000 QueryInterfaceFromNode<IRawElementProviderSimple>(
3001 GetRootAsAXNode()->children()[0]));
3002 ComPtr<IRawElementProviderSimple> option2_provider(
3003 QueryInterfaceFromNode<IRawElementProviderSimple>(
3004 GetRootAsAXNode()->children()[1]));
3005 ComPtr<IRawElementProviderSimple> option3_provider(
3006 QueryInterfaceFromNode<IRawElementProviderSimple>(
3007 GetRootAsAXNode()->children()[2]));
3010 EXPECT_HRESULT_SUCCEEDED(
3011 selection_provider->GetSelection(selected_items.
Receive()));
3012 EXPECT_NE(
nullptr, selected_items.
Get());
3014 LONG array_lower_bound;
3015 EXPECT_HRESULT_SUCCEEDED(
3016 ::SafeArrayGetLBound(selected_items.
Get(), 1, &array_lower_bound));
3017 EXPECT_EQ(0, array_lower_bound);
3019 LONG array_upper_bound;
3020 EXPECT_HRESULT_SUCCEEDED(
3021 ::SafeArrayGetUBound(selected_items.
Get(), 1, &array_upper_bound));
3022 EXPECT_EQ(2, array_upper_bound);
3024 IRawElementProviderSimple** array_data;
3025 EXPECT_HRESULT_SUCCEEDED(::SafeArrayAccessData(
3026 selected_items.
Get(),
reinterpret_cast<void**
>(&array_data)));
3027 EXPECT_EQ(option1_provider.Get(), array_data[0]);
3028 EXPECT_EQ(option2_provider.Get(), array_data[1]);
3029 EXPECT_EQ(option3_provider.Get(), array_data[2]);
3031 EXPECT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(selected_items.
Get()));
3041 child1.
id = child1_id;
3043 root.child_ids.push_back(child1_id);
3047 child2.
id = child2_id;
3049 root.child_ids.push_back(child2_id);
3053 child3.
id = child3_id;
3055 root.child_ids.push_back(child3_id);
3059 child4.
id = child4_id;
3061 root.child_ids.push_back(child4_id);
3063 Init(
root, child1, child2, child3, child4);
3066 QueryInterfaceFromNodeId<IRawElementProviderSimple>(child1_id),
3067 UIA_ControlTypePropertyId,
int{UIA_TableControlTypeId});
3069 QueryInterfaceFromNodeId<IRawElementProviderSimple>(child2_id),
3070 UIA_ControlTypePropertyId,
int{UIA_TableControlTypeId});
3072 QueryInterfaceFromNodeId<IRawElementProviderSimple>(child3_id),
3073 UIA_ControlTypePropertyId,
int{UIA_EditControlTypeId});
3075 QueryInterfaceFromNodeId<IRawElementProviderSimple>(child4_id),
3076 UIA_ControlTypePropertyId,
int{UIA_EditControlTypeId});
3081 std::optional<LONG> expected_landmark_type,
3082 const std::string& node_name = {}) {
3085 root_data.
role = node_role;
3086 if (!node_name.empty())
3090 ComPtr<IRawElementProviderSimple> root_provider =
3091 GetRootIRawElementProviderSimple();
3093 if (expected_landmark_type) {
3095 expected_landmark_type.value());
3124 auto TestLocalizedLandmarkType =
3126 const std::wstring& expected_localized_landmark,
3127 const std::string& node_name = {}) {
3130 root_data.
role = node_role;
3131 if (!node_name.empty())
3135 ComPtr<IRawElementProviderSimple> root_provider =
3136 GetRootIRawElementProviderSimple();
3138 if (expected_localized_landmark.empty()) {
3142 expected_localized_landmark.c_str());
3149 L"content information");
3171 element1_data.
id = 2;
3175 element2_data.
id = 3;
3178 Init(root_data, element1_data, element2_data);
3180 AXNode* root_node = GetRootAsAXNode();
3184 ComPtr<IRawElementProviderSimple2> root_provider =
3185 QueryInterfaceFromNode<IRawElementProviderSimple2>(root_node);
3186 ComPtr<IRawElementProviderSimple2> element1_provider =
3187 QueryInterfaceFromNode<IRawElementProviderSimple2>(element1_node);
3188 ComPtr<IRawElementProviderSimple2> element2_provider =
3189 QueryInterfaceFromNode<IRawElementProviderSimple2>(element2_node);
3191 EXPECT_HRESULT_SUCCEEDED(element1_provider->ShowContextMenu());
3193 EXPECT_HRESULT_SUCCEEDED(element2_provider->ShowContextMenu());
3195 EXPECT_HRESULT_SUCCEEDED(root_provider->ShowContextMenu());
3204 ComPtr<IRawElementProviderSimple> simple_provider =
3205 GetRootIRawElementProviderSimple();
3206 ComPtr<IRawElementProviderSimple2> simple2_provider =
3207 QueryInterfaceFromNode<IRawElementProviderSimple2>(GetRootAsAXNode());
3208 ComPtr<IRawElementProviderFragment> fragment_provider =
3209 GetRootIRawElementProviderFragment();
3210 ComPtr<IGridItemProvider> grid_item_provider =
3211 QueryInterfaceFromNode<IGridItemProvider>(GetRootAsAXNode());
3212 ComPtr<IGridProvider> grid_provider =
3213 QueryInterfaceFromNode<IGridProvider>(GetRootAsAXNode());
3214 ComPtr<IScrollItemProvider> scroll_item_provider =
3215 QueryInterfaceFromNode<IScrollItemProvider>(GetRootAsAXNode());
3216 ComPtr<IScrollProvider> scroll_provider =
3217 QueryInterfaceFromNode<IScrollProvider>(GetRootAsAXNode());
3218 ComPtr<ISelectionItemProvider> selection_item_provider =
3219 QueryInterfaceFromNode<ISelectionItemProvider>(GetRootAsAXNode());
3220 ComPtr<ISelectionProvider> selection_provider =
3221 QueryInterfaceFromNode<ISelectionProvider>(GetRootAsAXNode());
3222 ComPtr<ITableItemProvider> table_item_provider =
3223 QueryInterfaceFromNode<ITableItemProvider>(GetRootAsAXNode());
3224 ComPtr<ITableProvider> table_provider =
3225 QueryInterfaceFromNode<ITableProvider>(GetRootAsAXNode());
3226 ComPtr<IExpandCollapseProvider> expand_collapse_provider =
3227 QueryInterfaceFromNode<IExpandCollapseProvider>(GetRootAsAXNode());
3228 ComPtr<IToggleProvider> toggle_provider =
3229 QueryInterfaceFromNode<IToggleProvider>(GetRootAsAXNode());
3230 ComPtr<IValueProvider> value_provider =
3231 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode());
3232 ComPtr<IRangeValueProvider> range_value_provider =
3233 QueryInterfaceFromNode<IRangeValueProvider>(GetRootAsAXNode());
3234 ComPtr<IWindowProvider> window_provider =
3235 QueryInterfaceFromNode<IWindowProvider>(GetRootAsAXNode());
3238 SetTree(std::make_unique<AXTree>());
3242 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3243 grid_item_provider->get_Column(&int_result));
3244 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3245 grid_item_provider->get_ColumnSpan(&int_result));
3246 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3247 grid_item_provider->get_Row(&int_result));
3248 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3249 grid_item_provider->get_RowSpan(&int_result));
3252 ExpandCollapseState expand_collapse_state;
3253 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3254 expand_collapse_provider->Collapse());
3255 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3256 expand_collapse_provider->Expand());
3257 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3258 expand_collapse_provider->get_ExpandCollapseState(
3259 &expand_collapse_state));
3262 ComPtr<IRawElementProviderSimple> temp_simple_provider;
3263 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3264 grid_provider->GetItem(0, 0, &temp_simple_provider));
3265 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3266 grid_provider->get_RowCount(&int_result));
3267 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3268 grid_provider->get_ColumnCount(&int_result));
3271 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3272 scroll_item_provider->ScrollIntoView());
3276 double double_result = 3.14;
3277 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3278 scroll_provider->SetScrollPercent(0, 0));
3279 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3280 scroll_provider->get_HorizontallyScrollable(&bool_result));
3281 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3282 scroll_provider->get_HorizontalScrollPercent(&double_result));
3283 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3284 scroll_provider->get_HorizontalViewSize(&double_result));
3285 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3286 scroll_provider->get_VerticallyScrollable(&bool_result));
3287 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3288 scroll_provider->get_VerticalScrollPercent(&double_result));
3289 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3290 scroll_provider->get_VerticalViewSize(&double_result));
3293 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3294 selection_item_provider->AddToSelection());
3295 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3296 selection_item_provider->RemoveFromSelection());
3297 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3298 selection_item_provider->Select());
3299 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3300 selection_item_provider->get_IsSelected(&bool_result));
3302 static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3303 selection_item_provider->get_SelectionContainer(&temp_simple_provider));
3307 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3308 selection_provider->GetSelection(array_result.
Receive()));
3309 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3310 selection_provider->get_CanSelectMultiple(&bool_result));
3311 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3312 selection_provider->get_IsSelectionRequired(&bool_result));
3315 RowOrColumnMajor row_or_column_major_result;
3316 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3317 table_item_provider->GetColumnHeaderItems(array_result.
Receive()));
3318 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3319 table_item_provider->GetRowHeaderItems(array_result.
Receive()));
3322 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3323 table_provider->GetColumnHeaders(array_result.
Receive()));
3324 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3325 table_provider->GetRowHeaders(array_result.
Receive()));
3326 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3327 table_provider->get_RowOrColumnMajor(&row_or_column_major_result));
3331 ComPtr<IUnknown> unknown;
3332 ComPtr<IRawElementProviderSimple> host_provider;
3334 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3335 simple_provider->GetPatternProvider(UIA_WindowPatternId, &unknown));
3336 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3337 simple_provider->GetPropertyValue(UIA_FrameworkIdPropertyId,
3339 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3340 simple_provider->get_ProviderOptions(&
options));
3341 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3342 simple_provider->get_HostRawElementProvider(&host_provider));
3345 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3346 simple2_provider->ShowContextMenu());
3349 ComPtr<IRawElementProviderFragment> navigated_to_fragment;
3351 UiaRect bounding_rectangle;
3352 ComPtr<IRawElementProviderFragmentRoot> fragment_root;
3353 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3354 fragment_provider->Navigate(NavigateDirection_Parent,
3355 &navigated_to_fragment));
3356 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3357 fragment_provider->GetRuntimeId(safearray.
Receive()));
3358 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3359 fragment_provider->get_BoundingRectangle(&bounding_rectangle));
3360 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3361 fragment_provider->GetEmbeddedFragmentRoots(safearray.
Receive()));
3362 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3363 fragment_provider->get_FragmentRoot(&fragment_root));
3364 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3365 fragment_provider->SetFocus());
3369 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3370 value_provider->SetValue(
L"3.14"));
3371 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3372 value_provider->get_Value(bstr_value.
Receive()));
3375 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3376 range_value_provider->SetValue(double_result));
3377 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3378 range_value_provider->get_LargeChange(&double_result));
3379 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3380 range_value_provider->get_Maximum(&double_result));
3381 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3382 range_value_provider->get_Minimum(&double_result));
3383 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3384 range_value_provider->get_SmallChange(&double_result));
3385 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3386 range_value_provider->get_Value(&double_result));
3389 ToggleState toggle_state;
3390 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3391 toggle_provider->Toggle());
3392 EXPECT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3393 toggle_provider->get_ToggleState(&toggle_state));
3396 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3397 window_provider->SetVisualState(
3398 WindowVisualState::WindowVisualState_Normal));
3399 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3400 window_provider->Close());
3401 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3402 window_provider->WaitForInputIdle(0,
nullptr));
3403 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3404 window_provider->get_CanMaximize(
nullptr));
3405 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3406 window_provider->get_CanMinimize(
nullptr));
3407 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3408 window_provider->get_IsModal(
nullptr));
3409 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3410 window_provider->get_WindowVisualState(
nullptr));
3411 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3412 window_provider->get_WindowInteractionState(
nullptr));
3413 ASSERT_EQ(
static_cast<HRESULT
>(UIA_E_ELEMENTNOTAVAILABLE),
3414 window_provider->get_IsTopmost(
nullptr));
3419 constexpr AXNode::AXID text_field_with_combo_box_id = 2;
3425 constexpr AXNode::AXID table_without_header_cell_id = 8;
3427 constexpr AXNode::AXID table_with_header_row_1_id = 10;
3428 constexpr AXNode::AXID table_with_header_column_header_id = 11;
3429 constexpr AXNode::AXID table_with_header_row_2_id = 12;
3432 constexpr AXNode::AXID grid_without_header_cell_id = 15;
3435 constexpr AXNode::AXID grid_with_header_column_header_id = 18;
3441 update.has_tree_data =
true;
3442 update.root_id = root_id;
3444 update.nodes[0].id = root_id;
3446 update.nodes[0].child_ids = {text_field_with_combo_box_id,
3448 group_with_scroll_id,
3451 table_without_header_id,
3452 table_with_header_id,
3453 grid_without_header_id,
3454 grid_with_header_id};
3455 update.nodes[1].id = text_field_with_combo_box_id;
3457 update.nodes[2].id = meter_id;
3459 update.nodes[3].id = group_with_scroll_id;
3464 update.nodes[4].id = checkbox_id;
3466 update.nodes[5].id = link_id;
3468 update.nodes[6].id = table_without_header_id;
3470 update.nodes[6].child_ids = {table_without_header_cell_id};
3471 update.nodes[7].id = table_without_header_cell_id;
3473 update.nodes[8].id = table_with_header_id;
3475 update.nodes[8].child_ids = {table_with_header_row_1_id,
3476 table_with_header_row_2_id};
3477 update.nodes[9].id = table_with_header_row_1_id;
3479 update.nodes[9].child_ids = {table_with_header_column_header_id};
3480 update.nodes[10].id = table_with_header_column_header_id;
3482 update.nodes[11].id = table_with_header_row_2_id;
3484 update.nodes[11].child_ids = {table_with_header_cell_id};
3485 update.nodes[12].id = table_with_header_cell_id;
3487 update.nodes[13].id = grid_without_header_id;
3489 update.nodes[13].child_ids = {grid_without_header_cell_id};
3490 update.nodes[14].id = grid_without_header_cell_id;
3493 update.nodes[15].id = grid_with_header_id;
3495 update.nodes[15].child_ids = {grid_with_header_row_1_id,
3496 grid_with_header_row_2_id};
3497 update.nodes[16].id = grid_with_header_row_1_id;
3499 update.nodes[16].child_ids = {grid_with_header_column_header_id};
3500 update.nodes[17].id = grid_with_header_column_header_id;
3503 update.nodes[18].id = grid_with_header_row_2_id;
3505 update.nodes[18].child_ids = {grid_with_header_cell_id};
3506 update.nodes[19].id = grid_with_header_cell_id;
3512 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_TextPatternId,
3513 UIA_TextEditPatternId}),
3514 GetSupportedPatternsFromNodeId(root_id));
3516 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3517 UIA_ExpandCollapsePatternId, UIA_TextPatternId,
3518 UIA_TextEditPatternId}),
3519 GetSupportedPatternsFromNodeId(text_field_with_combo_box_id));
3521 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3522 UIA_RangeValuePatternId}),
3523 GetSupportedPatternsFromNodeId(meter_id));
3525 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ScrollPatternId}),
3526 GetSupportedPatternsFromNodeId(group_with_scroll_id));
3528 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3529 UIA_TogglePatternId}),
3530 GetSupportedPatternsFromNodeId(checkbox_id));
3532 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3533 UIA_InvokePatternId}),
3534 GetSupportedPatternsFromNodeId(link_id));
3536 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridPatternId}),
3537 GetSupportedPatternsFromNodeId(table_without_header_id));
3539 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridItemPatternId}),
3540 GetSupportedPatternsFromNodeId(table_without_header_cell_id));
3542 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridPatternId,
3543 UIA_TablePatternId}),
3544 GetSupportedPatternsFromNodeId(table_with_header_id));
3546 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridItemPatternId,
3547 UIA_TableItemPatternId}),
3548 GetSupportedPatternsFromNodeId(table_with_header_column_header_id));
3550 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridItemPatternId,
3551 UIA_TableItemPatternId}),
3552 GetSupportedPatternsFromNodeId(table_with_header_cell_id));
3554 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3555 UIA_SelectionPatternId, UIA_GridPatternId}),
3556 GetSupportedPatternsFromNodeId(grid_without_header_id));
3558 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3559 UIA_SelectionItemPatternId, UIA_GridItemPatternId}),
3560 GetSupportedPatternsFromNodeId(grid_without_header_cell_id));
3562 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3563 UIA_SelectionPatternId, UIA_GridPatternId,
3564 UIA_TablePatternId}),
3565 GetSupportedPatternsFromNodeId(grid_with_header_id));
3567 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3568 UIA_GridItemPatternId, UIA_TableItemPatternId,
3569 UIA_SelectionItemPatternId}),
3570 GetSupportedPatternsFromNodeId(grid_with_header_column_header_id));
3572 EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId,
3573 UIA_GridItemPatternId, UIA_TableItemPatternId,
3574 UIA_SelectionItemPatternId}),
3575 GetSupportedPatternsFromNodeId(grid_with_header_cell_id));
3595 menu_list_option.
id = 5;
3597 combo_box_grouping.
id = 7;
3598 combo_box_menu_button.
id = 8;
3599 disclosure_triangle.
id = 9;
3600 text_field_with_combo_box.
id = 10;
3602 root.child_ids.push_back(list_box.
id);
3603 root.child_ids.push_back(list_item.
id);
3604 root.child_ids.push_back(menu_item.
id);
3605 root.child_ids.push_back(menu_list_option.
id);
3606 root.child_ids.push_back(tree_item.
id);
3607 root.child_ids.push_back(combo_box_grouping.
id);
3608 root.child_ids.push_back(combo_box_menu_button.
id);
3609 root.child_ids.push_back(disclosure_triangle.
id);
3610 root.child_ids.push_back(text_field_with_combo_box.
id);
3635 Init(
root, list_box, list_item, menu_item, menu_list_option, tree_item,
3636 combo_box_grouping, combo_box_menu_button, disclosure_triangle,
3637 text_field_with_combo_box);
3640 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
3641 GetIRawElementProviderSimpleFromChildIndex(0);
3642 ComPtr<IExpandCollapseProvider> expandcollapse_provider;
3643 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3644 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3645 EXPECT_EQ(
nullptr, expandcollapse_provider.Get());
3648 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(1);
3649 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3650 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3651 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3654 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(2);
3655 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3656 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3657 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3660 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(3);
3661 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3662 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3663 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3666 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(4);
3667 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3668 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3669 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3672 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(5);
3673 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3674 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3675 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3678 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(6);
3679 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3680 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3681 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3684 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(7);
3685 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3686 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3687 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3690 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(8);
3691 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3692 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3693 EXPECT_NE(
nullptr, expandcollapse_provider.Get());
3706 generic_container.
id = 3;
3707 combo_box_grouping.
id = 4;
3711 root.child_ids.push_back(generic_container.
id);
3712 root.child_ids.push_back(combo_box_grouping.
id);
3713 root.child_ids.push_back(check_box.
id);
3730 Init(
root,
link, generic_container, combo_box_grouping, check_box);
3734 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
3735 GetIRawElementProviderSimpleFromChildIndex(0);
3736 ComPtr<IInvokeProvider> invoke_provider;
3737 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3738 UIA_InvokePatternId, &invoke_provider));
3739 EXPECT_NE(
nullptr, invoke_provider.Get());
3743 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(1);
3744 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3745 UIA_InvokePatternId, &invoke_provider));
3746 EXPECT_EQ(
nullptr, invoke_provider.Get());
3750 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(2);
3751 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3752 UIA_InvokePatternId, &invoke_provider));
3753 EXPECT_EQ(
nullptr, invoke_provider.Get());
3756 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(3);
3757 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3758 UIA_InvokePatternId, &invoke_provider));
3759 EXPECT_EQ(
nullptr, invoke_provider.Get());
3775 combo_box_grouping_has_popup.
id = 2;
3776 combo_box_grouping_expanded.
id = 3;
3777 combo_box_grouping_collapsed.
id = 4;
3778 combo_box_grouping_disabled.
id = 5;
3779 button_has_popup_menu.
id = 6;
3780 button_has_popup_menu_pressed.
id = 7;
3781 button_has_popup_true.
id = 8;
3782 generic_container_has_popup_menu.
id = 9;
3785 combo_box_grouping_has_popup.
id, combo_box_grouping_expanded.
id,
3786 combo_box_grouping_collapsed.
id, combo_box_grouping_disabled.
id,
3787 button_has_popup_menu.
id, button_has_popup_menu_pressed.
id,
3788 button_has_popup_true.
id, generic_container_has_popup_menu.
id};
3832 Init(
root, combo_box_grouping_has_popup, combo_box_grouping_disabled,
3833 combo_box_grouping_expanded, combo_box_grouping_collapsed,
3834 combo_box_grouping_disabled, button_has_popup_menu,
3835 button_has_popup_menu_pressed, button_has_popup_true,
3836 generic_container_has_popup_menu);
3840 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
3841 GetIRawElementProviderSimpleFromChildIndex(0);
3842 ComPtr<IExpandCollapseProvider> expandcollapse_provider;
3843 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3844 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3845 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3846 EXPECT_HRESULT_SUCCEEDED(expandcollapse_provider->Collapse());
3847 EXPECT_HRESULT_SUCCEEDED(expandcollapse_provider->Expand());
3848 ExpandCollapseState
state;
3849 EXPECT_HRESULT_SUCCEEDED(
3850 expandcollapse_provider->get_ExpandCollapseState(&
state));
3851 EXPECT_EQ(ExpandCollapseState_LeafNode,
state);
3855 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(1);
3856 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3857 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3858 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3859 EXPECT_HRESULT_SUCCEEDED(expandcollapse_provider->Collapse());
3860 EXPECT_HRESULT_FAILED(expandcollapse_provider->Expand());
3861 EXPECT_HRESULT_SUCCEEDED(
3862 expandcollapse_provider->get_ExpandCollapseState(&
state));
3863 EXPECT_EQ(ExpandCollapseState_Expanded,
state);
3867 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(2);
3868 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3869 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3870 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3871 EXPECT_HRESULT_FAILED(expandcollapse_provider->Collapse());
3872 EXPECT_HRESULT_SUCCEEDED(expandcollapse_provider->Expand());
3873 EXPECT_HRESULT_SUCCEEDED(
3874 expandcollapse_provider->get_ExpandCollapseState(&
state));
3875 EXPECT_EQ(ExpandCollapseState_Collapsed,
state);
3879 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(3);
3880 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3881 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3882 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3883 EXPECT_HRESULT_FAILED(expandcollapse_provider->Collapse());
3884 EXPECT_HRESULT_FAILED(expandcollapse_provider->Expand());
3885 EXPECT_HRESULT_SUCCEEDED(
3886 expandcollapse_provider->get_ExpandCollapseState(&
state));
3887 EXPECT_EQ(ExpandCollapseState_LeafNode,
state);
3891 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(4);
3892 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3893 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3894 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3895 EXPECT_HRESULT_SUCCEEDED(
3896 expandcollapse_provider->get_ExpandCollapseState(&
state));
3897 EXPECT_EQ(ExpandCollapseState_Collapsed,
state);
3901 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(5);
3902 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3903 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3904 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3905 EXPECT_HRESULT_SUCCEEDED(
3906 expandcollapse_provider->get_ExpandCollapseState(&
state));
3907 EXPECT_EQ(ExpandCollapseState_Expanded,
state);
3911 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(6);
3912 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3913 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3914 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3915 EXPECT_HRESULT_SUCCEEDED(
3916 expandcollapse_provider->get_ExpandCollapseState(&
state));
3917 EXPECT_EQ(ExpandCollapseState_LeafNode,
state);
3922 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(7);
3923 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3924 UIA_ExpandCollapsePatternId, &expandcollapse_provider));
3925 ASSERT_NE(
nullptr, expandcollapse_provider.Get());
3926 EXPECT_HRESULT_SUCCEEDED(
3927 expandcollapse_provider->get_ExpandCollapseState(&
state));
3928 EXPECT_EQ(ExpandCollapseState_LeafNode,
state);
3939 button_disabled.
id = 3;
3941 root.child_ids.push_back(button.
id);
3942 root.child_ids.push_back(button_disabled.
id);
3951 Init(
root, button, button_disabled);
3955 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
3956 GetIRawElementProviderSimpleFromChildIndex(0);
3957 ComPtr<IInvokeProvider> invoke_provider;
3958 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3959 UIA_InvokePatternId, &invoke_provider));
3960 EXPECT_NE(
nullptr, invoke_provider.Get());
3961 EXPECT_HRESULT_SUCCEEDED(invoke_provider->Invoke());
3965 raw_element_provider_simple = GetIRawElementProviderSimpleFromChildIndex(1);
3966 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3967 UIA_InvokePatternId, &invoke_provider));
3968 EXPECT_NE(
nullptr, invoke_provider.Get());
3979 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
3980 GetRootIRawElementProviderSimple();
3981 ComPtr<ISelectionItemProvider> selection_item_provider;
3982 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
3983 UIA_SelectionItemPatternId, &selection_item_provider));
3984 ASSERT_EQ(
nullptr, selection_item_provider.Get());
3997 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
3998 GetRootIRawElementProviderSimple();
3999 ComPtr<ISelectionItemProvider> selection_item_provider;
4000 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
4001 UIA_SelectionItemPatternId, &selection_item_provider));
4002 ASSERT_NE(
nullptr, selection_item_provider.Get());
4009 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4020 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
4021 GetRootIRawElementProviderSimple();
4022 ComPtr<ISelectionItemProvider> selection_item_provider;
4023 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
4024 UIA_SelectionItemPatternId, &selection_item_provider));
4025 ASSERT_EQ(
nullptr, selection_item_provider.Get());
4037 root.child_ids.push_back(option1.
id);
4041 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
4042 GetIRawElementProviderSimpleFromChildIndex(0);
4043 ComPtr<ISelectionItemProvider> option1_provider;
4044 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
4045 UIA_SelectionItemPatternId, &option1_provider));
4046 ASSERT_NE(
nullptr, option1_provider.Get());
4054 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4055 EXPECT_FALSE(selected);
4058 EXPECT_HRESULT_SUCCEEDED(option1_provider->AddToSelection());
4059 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4063 EXPECT_HRESULT_SUCCEEDED(option1_provider->AddToSelection());
4064 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4068 EXPECT_HRESULT_SUCCEEDED(option1_provider->RemoveFromSelection());
4069 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4070 EXPECT_FALSE(selected);
4073 EXPECT_HRESULT_SUCCEEDED(option1_provider->RemoveFromSelection());
4074 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4075 EXPECT_FALSE(selected);
4078 EXPECT_HRESULT_SUCCEEDED(option1_provider->Select());
4079 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4083 EXPECT_HRESULT_SUCCEEDED(option1_provider->Select());
4084 EXPECT_HRESULT_SUCCEEDED(option1_provider->get_IsSelected(&selected));
4099 root.child_ids.push_back(option1.
id);
4107 root.child_ids.push_back(option2.
id);
4115 root.child_ids.push_back(option3.
id);
4123 root.child_ids.push_back(option4.
id);
4125 Init(
root, option1, option2, option3, option4);
4130 ComPtr<ISelectionItemProvider> option1_provider;
4131 EXPECT_HRESULT_SUCCEEDED(
4132 GetIRawElementProviderSimpleFromChildIndex(0)->GetPatternProvider(
4133 UIA_SelectionItemPatternId, &option1_provider));
4134 ASSERT_EQ(
nullptr, option1_provider.Get());
4137 ComPtr<ISelectionItemProvider> option2_provider;
4138 EXPECT_HRESULT_SUCCEEDED(
4139 GetIRawElementProviderSimpleFromChildIndex(1)->GetPatternProvider(
4140 UIA_SelectionItemPatternId, &option2_provider));
4141 ASSERT_NE(
nullptr, option2_provider.Get());
4143 EXPECT_HRESULT_SUCCEEDED(option2_provider->get_IsSelected(&selected));
4144 EXPECT_FALSE(selected);
4146 EXPECT_HRESULT_SUCCEEDED(option2_provider->Select());
4147 EXPECT_HRESULT_SUCCEEDED(option2_provider->get_IsSelected(&selected));
4151 ComPtr<ISelectionItemProvider> option3_provider;
4152 EXPECT_HRESULT_SUCCEEDED(
4153 GetIRawElementProviderSimpleFromChildIndex(2)->GetPatternProvider(
4154 UIA_SelectionItemPatternId, &option3_provider));
4155 ASSERT_NE(
nullptr, option3_provider.Get());
4157 EXPECT_HRESULT_SUCCEEDED(option3_provider->get_IsSelected(&selected));
4160 EXPECT_HRESULT_SUCCEEDED(option3_provider->RemoveFromSelection());
4161 EXPECT_HRESULT_SUCCEEDED(option3_provider->get_IsSelected(&selected));
4162 EXPECT_FALSE(selected);
4164 EXPECT_HRESULT_SUCCEEDED(option3_provider->AddToSelection());
4165 EXPECT_HRESULT_SUCCEEDED(option3_provider->get_IsSelected(&selected));
4169 ComPtr<ISelectionItemProvider> option4_provider;
4170 EXPECT_HRESULT_SUCCEEDED(
4171 GetIRawElementProviderSimpleFromChildIndex(3)->GetPatternProvider(
4172 UIA_SelectionItemPatternId, &option4_provider));
4173 ASSERT_EQ(
nullptr, option4_provider.Get());
4187 root.child_ids.push_back(option1.
id);
4195 root.child_ids.push_back(option2.
id);
4203 root.child_ids.push_back(option3.
id);
4211 root.child_ids.push_back(option4.
id);
4213 Init(
root, option1, option2, option3, option4);
4218 ComPtr<ISelectionItemProvider> option1_provider;
4219 EXPECT_HRESULT_SUCCEEDED(
4220 GetIRawElementProviderSimpleFromChildIndex(0)->GetPatternProvider(
4221 UIA_SelectionItemPatternId, &option1_provider));
4222 ASSERT_EQ(
nullptr, option1_provider.Get());
4225 ComPtr<ISelectionItemProvider> option2_provider;
4226 EXPECT_HRESULT_SUCCEEDED(
4227 GetIRawElementProviderSimpleFromChildIndex(1)->GetPatternProvider(
4228 UIA_SelectionItemPatternId, &option2_provider));
4229 ASSERT_NE(
nullptr, option2_provider.Get());
4231 EXPECT_HRESULT_SUCCEEDED(option2_provider->get_IsSelected(&selected));
4232 EXPECT_FALSE(selected);
4234 EXPECT_HRESULT_SUCCEEDED(option2_provider->Select());
4235 EXPECT_HRESULT_SUCCEEDED(option2_provider->get_IsSelected(&selected));
4239 ComPtr<ISelectionItemProvider> option3_provider;
4240 EXPECT_HRESULT_SUCCEEDED(
4241 GetIRawElementProviderSimpleFromChildIndex(2)->GetPatternProvider(
4242 UIA_SelectionItemPatternId, &option3_provider));
4243 ASSERT_NE(
nullptr, option3_provider.Get());
4245 EXPECT_HRESULT_SUCCEEDED(option3_provider->get_IsSelected(&selected));
4248 EXPECT_HRESULT_SUCCEEDED(option3_provider->RemoveFromSelection());
4249 EXPECT_HRESULT_SUCCEEDED(option3_provider->get_IsSelected(&selected));
4250 EXPECT_FALSE(selected);
4252 EXPECT_HRESULT_SUCCEEDED(option3_provider->AddToSelection());
4253 EXPECT_HRESULT_SUCCEEDED(option3_provider->get_IsSelected(&selected));
4257 ComPtr<ISelectionItemProvider> option4_provider;
4258 EXPECT_HRESULT_SUCCEEDED(
4259 GetIRawElementProviderSimpleFromChildIndex(3)->GetPatternProvider(
4260 UIA_SelectionItemPatternId, &option4_provider));
4261 ASSERT_EQ(
nullptr, option4_provider.Get());
4272 root.child_ids.push_back(row1.
id);
4282 ComPtr<ISelectionItemProvider> selection_item_provider;
4283 EXPECT_HRESULT_SUCCEEDED(
4284 GetIRawElementProviderSimpleFromChildIndex(0)->GetPatternProvider(
4285 UIA_SelectionItemPatternId, &selection_item_provider));
4286 ASSERT_EQ(
nullptr, selection_item_provider.Get());
4297 root.child_ids.push_back(row1.
id);
4307 const auto* row = GetRootAsAXNode()->children()[0];
4308 ComPtr<IRawElementProviderSimple> raw_element_provider_simple =
4309 QueryInterfaceFromNode<IRawElementProviderSimple>(row->children()[0]);
4311 ComPtr<ISelectionItemProvider> selection_item_provider;
4312 EXPECT_HRESULT_SUCCEEDED(raw_element_provider_simple->GetPatternProvider(
4313 UIA_SelectionItemPatternId, &selection_item_provider));
4314 ASSERT_NE(
nullptr, selection_item_provider.Get());
4322 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4323 EXPECT_FALSE(selected);
4326 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->AddToSelection());
4327 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4331 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->AddToSelection());
4332 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4336 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->RemoveFromSelection());
4337 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4338 EXPECT_FALSE(selected);
4341 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->RemoveFromSelection());
4342 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4343 EXPECT_FALSE(selected);
4346 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->Select());
4347 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4351 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->Select());
4352 EXPECT_HRESULT_SUCCEEDED(selection_item_provider->get_IsSelected(&selected));
4364 root.child_ids.push_back(row1.
id);
4374 ComPtr<IRawElementProviderSimple> container_provider =
4375 GetRootIRawElementProviderSimple();
4377 const auto* row = GetRootAsAXNode()->children()[0];
4378 ComPtr<ISelectionItemProvider> item_provider =
4379 QueryInterfaceFromNode<ISelectionItemProvider>(row->children()[0]);
4381 ComPtr<IRawElementProviderSimple> container;
4382 EXPECT_HRESULT_SUCCEEDED(item_provider->get_SelectionContainer(&container));
4383 EXPECT_NE(
nullptr, container);
4384 EXPECT_EQ(container, container_provider);
4397 root.child_ids.push_back(tab1.
id);
4401 auto* tab1_node = GetRootAsAXNode()->children()[0];
4402 ComPtr<IRawElementProviderSimple> tab1_raw_element_provider_simple =
4403 QueryInterfaceFromNode<IRawElementProviderSimple>(tab1_node);
4404 ASSERT_NE(
nullptr, tab1_raw_element_provider_simple.Get());
4406 ComPtr<IRawElementProviderFragment> tab1_raw_element_provider_fragment =
4407 IRawElementProviderFragmentFromNode(tab1_node);
4408 ASSERT_NE(
nullptr, tab1_raw_element_provider_fragment.Get());
4410 ComPtr<ISelectionItemProvider> tab1_selection_item_provider;
4411 EXPECT_HRESULT_SUCCEEDED(tab1_raw_element_provider_simple->GetPatternProvider(
4412 UIA_SelectionItemPatternId, &tab1_selection_item_provider));
4413 ASSERT_NE(
nullptr, tab1_selection_item_provider.Get());
4417 tab1_selection_item_provider->get_IsSelected(&is_selected);
4418 EXPECT_FALSE(is_selected);
4421 tab1_raw_element_provider_fragment->SetFocus();
4422 tab1_selection_item_provider->get_IsSelected(&is_selected);
4426 EXPECT_HRESULT_SUCCEEDED(tab1_selection_item_provider->Select());
4427 tab1_selection_item_provider->get_IsSelected(&is_selected);
4431 tab1_selection_item_provider->get_IsSelected(&is_selected);
4438 EXPECT_HRESULT_SUCCEEDED(tab1_selection_item_provider->Select());
4439 tab1_selection_item_provider->get_IsSelected(&is_selected);
4455 root.child_ids.push_back(child1.
id);
4462 root.child_ids.push_back(child2.
id);
4470 root.child_ids.push_back(child3.
id);
4472 Init(
root, child1, child2, child3);
4476 EXPECT_HRESULT_SUCCEEDED(
4477 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[0])
4478 ->get_Value(bstr_value.
Receive()));
4479 EXPECT_STREQ(
L"3", bstr_value.
Get());
4482 EXPECT_HRESULT_SUCCEEDED(
4483 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[1])
4484 ->get_Value(bstr_value.
Receive()));
4485 EXPECT_STREQ(
L"test", bstr_value.
Get());
4488 EXPECT_HRESULT_SUCCEEDED(
4489 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[2])
4490 ->get_Value(bstr_value.
Receive()));
4491 EXPECT_STREQ(
L"test", bstr_value.
Get());
4504 root.child_ids.push_back(child1.
id);
4510 root.child_ids.push_back(child2.
id);
4518 root.child_ids.push_back(child3.
id);
4520 Init(
root, child1, child2, child3);
4522 ComPtr<IValueProvider> root_provider =
4523 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode());
4524 ComPtr<IValueProvider> provider1 =
4525 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[0]);
4526 ComPtr<IValueProvider> provider2 =
4527 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[1]);
4528 ComPtr<IValueProvider> provider3 =
4529 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[2]);
4537 EXPECT_HRESULT_SUCCEEDED(provider1->get_Value(bstr_value.
Receive()));
4538 EXPECT_STREQ(
L"3", bstr_value.
Get());
4541 EXPECT_HRESULT_SUCCEEDED(provider2->SetValue(
L"changed"));
4542 EXPECT_HRESULT_SUCCEEDED(provider2->get_Value(bstr_value.
Receive()));
4543 EXPECT_STREQ(
L"changed", bstr_value.
Get());
4547 EXPECT_HRESULT_SUCCEEDED(provider3->get_Value(bstr_value.
Receive()));
4548 EXPECT_STREQ(
L"test", bstr_value.
Get());
4561 root.child_ids.push_back(child1.
id);
4568 root.child_ids.push_back(child2.
id);
4575 root.child_ids.push_back(child3.
id);
4580 root.child_ids.push_back(child4.
id);
4582 Init(
root, child1, child2, child3, child4);
4586 EXPECT_HRESULT_SUCCEEDED(
4587 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[0])
4591 EXPECT_HRESULT_SUCCEEDED(
4592 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[1])
4596 EXPECT_HRESULT_SUCCEEDED(
4597 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[2])
4601 EXPECT_HRESULT_SUCCEEDED(
4602 QueryInterfaceFromNode<IValueProvider>(GetRootAsAXNode()->children()[3])
4621 ComPtr<IScrollProvider> scroll_provider =
4622 QueryInterfaceFromNode<IScrollProvider>(GetRootAsAXNode());
4623 double x_scroll_percent;
4624 double y_scroll_percent;
4628 EXPECT_HRESULT_SUCCEEDED(scroll_provider->SetScrollPercent(0, 0));
4629 EXPECT_HRESULT_SUCCEEDED(
4630 scroll_provider->get_HorizontalScrollPercent(&x_scroll_percent));
4631 EXPECT_EQ(x_scroll_percent, 0);
4632 EXPECT_HRESULT_SUCCEEDED(
4633 scroll_provider->get_VerticalScrollPercent(&y_scroll_percent));
4634 EXPECT_EQ(y_scroll_percent, 0);
4638 EXPECT_HRESULT_SUCCEEDED(scroll_provider->SetScrollPercent(100, 100));
4639 EXPECT_HRESULT_SUCCEEDED(
4640 scroll_provider->get_HorizontalScrollPercent(&x_scroll_percent));
4641 EXPECT_EQ(x_scroll_percent, 100);
4642 EXPECT_HRESULT_SUCCEEDED(
4643 scroll_provider->get_VerticalScrollPercent(&y_scroll_percent));
4644 EXPECT_EQ(y_scroll_percent, 100);
4648 EXPECT_HRESULT_SUCCEEDED(scroll_provider->SetScrollPercent(500, 600));
4649 EXPECT_HRESULT_SUCCEEDED(
4650 scroll_provider->get_HorizontalScrollPercent(&x_scroll_percent));
4651 EXPECT_EQ(x_scroll_percent, 100);
4652 EXPECT_HRESULT_SUCCEEDED(
4653 scroll_provider->get_VerticalScrollPercent(&y_scroll_percent));
4654 EXPECT_EQ(y_scroll_percent, 100);
4658 EXPECT_HRESULT_SUCCEEDED(scroll_provider->SetScrollPercent(-100, -200));
4659 EXPECT_HRESULT_SUCCEEDED(
4660 scroll_provider->get_HorizontalScrollPercent(&x_scroll_percent));
4661 EXPECT_EQ(x_scroll_percent, 0);
4662 EXPECT_HRESULT_SUCCEEDED(
4663 scroll_provider->get_VerticalScrollPercent(&y_scroll_percent));
4664 EXPECT_EQ(y_scroll_percent, 0);
4668 EXPECT_HRESULT_SUCCEEDED(scroll_provider->SetScrollPercent(12, 34));
4669 EXPECT_HRESULT_SUCCEEDED(
4670 scroll_provider->get_HorizontalScrollPercent(&x_scroll_percent));
4671 EXPECT_EQ(x_scroll_percent, 12);
4672 EXPECT_HRESULT_SUCCEEDED(
4673 scroll_provider->get_VerticalScrollPercent(&y_scroll_percent));
4674 EXPECT_EQ(y_scroll_percent, 34);
4686 ComPtr<AXPlatformNodeWin> platform_node =
4687 QueryInterfaceFromNode<AXPlatformNodeWin>(GetRootAsAXNode());
4690 UIA_ToggleToggleStatePropertyId);
void Reset(BSTR bstr=nullptr)
const VARIANT * ptr() const
void Reset(const VARIANT &var=kEmptyVariant)
virtual AXTreeID GetAXTreeID() const =0
void SetData(const AXNodeData &src)
const std::vector< AXNode * > & children() const
static AXTreeID CreateNewAXTreeID()
~MockIRawElementProviderSimple()
IFACEMETHODIMP GetPatternProvider(PATTERNID pattern_id, IUnknown **result) override
IFACEMETHODIMP GetPropertyValue(PROPERTYID property_id, VARIANT *result) override
static HRESULT CreateMockIRawElementProviderSimple(IRawElementProviderSimple **provider)
MockIRawElementProviderSimple()
IFACEMETHODIMP get_ProviderOptions(enum ProviderOptions *ret) override
IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple **provider) override
static void ClearHitTestResults()
static void SetGlobalIsWebContent(bool is_web_content)
static TestAXNodeWrapper * GetOrCreate(AXTree *tree, AXNode *node)
void ResetNativeEventTarget()
AXPlatformNode * ax_platform_node() const
static void SetNodeFromLastDefaultAction(AXNode *node)
static const AXNode * GetNodeFromLastShowContextMenu()
static void SetGlobalCoordinateOffset(const gfx::Vector2d &offset)
static const AXNode * GetNodeFromLastDefaultAction()
static std::unique_ptr< base::AutoReset< float > > SetScaleFactor(float value)
static void SetHitTestResult(AXNode::AXID src_node_id, AXNode::AXID dst_node_id)
void BuildAllWrappers(AXTree *tree, AXNode *node)
AXNode * GetNodeFromTree(const AXTreeID tree_id, const AXNode::AXID node_id) const override
AXNode * GetRootAsAXNode() const override
gfx::NativeViewAccessible GetParentOfAXFragmentRoot() override
gfx::NativeViewAccessible GetChildOfAXFragmentRoot() override
gfx::NativeViewAccessible child_
gfx::NativeViewAccessible parent_
TestFragmentRootDelegate()
virtual ~TestFragmentRootDelegate()
bool IsAXFragmentRootAControlElement() override
static bool is_readonly(const InterfaceBlock &block)
@ kSilentlyEligibleForAnnotation
@ kAnnotationProcessFailed
@ kIneligibleForAnnotation
def link(from_root, to_root)
DEF_SWITCHES_START aot vmservice shared library name
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
UnimplementedNativeViewAccessible * NativeViewAccessible
void CreateATLModuleIfNeeded()
TEST_F(AXPositionTest, Clone)
AXRelativeBounds relative_bounds
void AddFloatAttribute(ax::mojom::FloatAttribute attribute, float value)
void SetRestriction(ax::mojom::Restriction restriction)
void AddIntListAttribute(ax::mojom::IntListAttribute attribute, const std::vector< int32_t > &value)
void AddState(ax::mojom::State state)
void SetDefaultActionVerb(ax::mojom::DefaultActionVerb default_action_verb)
void AddIntAttribute(ax::mojom::IntAttribute attribute, int32_t value)
std::vector< int32_t > child_ids
void SetHasPopup(ax::mojom::HasPopup has_popup)
void SetName(const std::string &name)
void AddStringAttribute(ax::mojom::StringAttribute attribute, const std::string &value)
void AddBoolAttribute(ax::mojom::BoolAttribute attribute, bool value)
void SetCheckedState(ax::mojom::CheckedState checked_state)
std::vector< AXNodeData > nodes
#define EXPECT_TRUE(handle)