Commit 9fdc76d5 authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Implement AXPlatformNodeWin::get_indexInParent

BUG=462748

Review URL: https://codereview.chromium.org/1019663002

Cr-Commit-Position: refs/heads/master@{#321242}
parent cf6f1156
...@@ -572,6 +572,15 @@ STDMETHODIMP AXPlatformNodeWin::get_attributes(BSTR* attributes) { ...@@ -572,6 +572,15 @@ STDMETHODIMP AXPlatformNodeWin::get_attributes(BSTR* attributes) {
return S_OK; return S_OK;
} }
STDMETHODIMP AXPlatformNodeWin::get_indexInParent(LONG* index_in_parent) {
COM_OBJECT_VALIDATE_1_ARG(index_in_parent);
*index_in_parent = GetIndexInParent();
if (*index_in_parent < 0)
return E_FAIL;
return S_OK;
}
// //
// IAccessibleText // IAccessibleText
// //
......
...@@ -129,6 +129,8 @@ AXPlatformNodeWin ...@@ -129,6 +129,8 @@ AXPlatformNodeWin
STDMETHODIMP get_attributes(BSTR* attributes) override; STDMETHODIMP get_attributes(BSTR* attributes) override;
STDMETHODIMP get_indexInParent(LONG* index_in_parent) override;
// //
// IAccessible2 methods not implemented. // IAccessible2 methods not implemented.
// //
...@@ -136,9 +138,6 @@ AXPlatformNodeWin ...@@ -136,9 +138,6 @@ AXPlatformNodeWin
STDMETHODIMP get_attribute(BSTR name, VARIANT* attribute) override { STDMETHODIMP get_attribute(BSTR name, VARIANT* attribute) override {
return E_NOTIMPL; return E_NOTIMPL;
} }
STDMETHODIMP get_indexInParent(LONG* index_in_parent) override {
return E_NOTIMPL;
}
STDMETHODIMP get_extendedRole(BSTR* extended_role) override { STDMETHODIMP get_extendedRole(BSTR* extended_role) override {
return E_NOTIMPL; return E_NOTIMPL;
} }
......
...@@ -369,4 +369,40 @@ TEST_F(AXPlatformNodeWinTest, TestIAccessibleChildAndParent) { ...@@ -369,4 +369,40 @@ TEST_F(AXPlatformNodeWinTest, TestIAccessibleChildAndParent) {
} }
} }
TEST_F(AXPlatformNodeWinTest, TestIAccessible2IndexInParent) {
AXNodeData root;
root.id = 1;
root.role = AX_ROLE_ROOT_WEB_AREA;
root.child_ids.push_back(2);
root.child_ids.push_back(3);
AXNodeData left;
left.id = 2;
AXNodeData right;
right.id = 3;
Init(root, left, right);
ScopedComPtr<IAccessible> root_iaccessible(GetRootIAccessible());
ScopedComPtr<IAccessible2> root_iaccessible2 =
ToIAccessible2(root_iaccessible);
ScopedComPtr<IAccessible> left_iaccessible(
IAccessibleFromNode(GetRootNode()->children()[0]));
ScopedComPtr<IAccessible2> left_iaccessible2 =
ToIAccessible2(left_iaccessible);
ScopedComPtr<IAccessible> right_iaccessible(
IAccessibleFromNode(GetRootNode()->children()[1]));
ScopedComPtr<IAccessible2> right_iaccessible2 =
ToIAccessible2(right_iaccessible);
LONG index;
ASSERT_EQ(E_FAIL, root_iaccessible2->get_indexInParent(&index));
ASSERT_EQ(S_OK, left_iaccessible2->get_indexInParent(&index));
EXPECT_EQ(0, index);
ASSERT_EQ(S_OK, right_iaccessible2->get_indexInParent(&index));
EXPECT_EQ(1, index);
}
} // namespace ui } // namespace ui
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment