OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/accessibility/platform/ax_platform_node.h" | 5 #include "ui/accessibility/platform/ax_platform_node.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <oleacc.h> | 9 #include <oleacc.h> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | 117 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); |
118 ScopedBstr name; | 118 ScopedBstr name; |
119 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); | 119 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); |
120 EXPECT_STREQ(L"Name", name); | 120 EXPECT_STREQ(L"Name", name); |
121 | 121 |
122 tree_.reset(new AXTree()); | 122 tree_.reset(new AXTree()); |
123 ScopedBstr name2; | 123 ScopedBstr name2; |
124 EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive())); | 124 EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive())); |
125 } | 125 } |
126 | 126 |
127 TEST_F(AXPlatformNodeWinTest, TestIAccessibleHitTest) { | |
128 AXNodeData root; | |
129 root.id = 0; | |
130 root.child_ids.push_back(1); | |
131 root.child_ids.push_back(2); | |
132 root.location = gfx::RectF(0, 0, 30, 30); | |
133 | |
134 AXNodeData node1; | |
135 node1.id = 1; | |
136 node1.location = gfx::RectF(0, 0, 10, 10); | |
137 node1.AddStringAttribute(AX_ATTR_NAME, "Name1"); | |
138 | |
139 AXNodeData node2; | |
140 node2.id = 2; | |
141 node2.location = gfx::RectF(20, 20, 10, 10); | |
142 node2.AddStringAttribute(AX_ATTR_NAME, "Name2"); | |
143 | |
144 Init(root, node1, node2); | |
145 | |
146 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | |
147 | |
148 ScopedVariant obj; | |
149 | |
150 // This is way outside of the root node | |
151 EXPECT_EQ(S_FALSE, root_obj->accHitTest(50, 50, obj.Receive())); | |
152 EXPECT_EQ(VT_EMPTY, obj.type()); | |
153 | |
154 // this is directly on node 1. | |
155 EXPECT_EQ(S_OK, root_obj->accHitTest(5, 5, obj.Receive())); | |
156 ASSERT_NE(nullptr, obj.ptr()); | |
157 | |
158 // We got something back, make sure that it has the corerct name. | |
dmazzoni
2017/06/26 16:52:58
corerct -> correct
dougt
2017/06/26 19:12:21
Done.
| |
159 base::win::ScopedComPtr<IAccessible> accessible; | |
160 HRESULT hr = V_DISPATCH(obj.ptr())->QueryInterface(IID_PPV_ARGS(&accessible)); | |
161 EXPECT_EQ(S_OK, hr); | |
162 ScopedBstr name; | |
163 EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive())); | |
164 EXPECT_STREQ(L"Name1", name); | |
165 } | |
166 | |
127 TEST_F(AXPlatformNodeWinTest, TestIAccessibleName) { | 167 TEST_F(AXPlatformNodeWinTest, TestIAccessibleName) { |
128 AXNodeData root; | 168 AXNodeData root; |
129 root.id = 1; | 169 root.id = 1; |
130 root.AddStringAttribute(AX_ATTR_NAME, "Name"); | 170 root.AddStringAttribute(AX_ATTR_NAME, "Name"); |
131 Init(root); | 171 Init(root); |
132 | 172 |
133 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); | 173 ScopedComPtr<IAccessible> root_obj(GetRootIAccessible()); |
134 ScopedBstr name; | 174 ScopedBstr name; |
135 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); | 175 EXPECT_EQ(S_OK, root_obj->get_accName(SELF, name.Receive())); |
136 EXPECT_STREQ(L"Name", name); | 176 EXPECT_STREQ(L"Name", name); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 1, 0)); | 553 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 1, 0)); |
514 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 2, 2)); | 554 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, 2, 2)); |
515 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, IA2_TEXT_OFFSET_CARET, | 555 EXPECT_HRESULT_SUCCEEDED(text_field->setSelection(0, IA2_TEXT_OFFSET_CARET, |
516 IA2_TEXT_OFFSET_LENGTH)); | 556 IA2_TEXT_OFFSET_LENGTH)); |
517 | 557 |
518 EXPECT_HRESULT_FAILED(text_field->setSelection(1, 0, 0)); | 558 EXPECT_HRESULT_FAILED(text_field->setSelection(1, 0, 0)); |
519 EXPECT_HRESULT_FAILED(text_field->setSelection(0, 0, 5)); | 559 EXPECT_HRESULT_FAILED(text_field->setSelection(0, 0, 5)); |
520 } | 560 } |
521 | 561 |
522 } // namespace ui | 562 } // namespace ui |
OLD | NEW |