haikuwebkit/LayoutTests/accessibility/select-element-at-index.html

79 lines
2.9 KiB
HTML
Raw Permalink Normal View History

[ATK] Wrong selected element at a given index in a list box. https://bugs.webkit.org/show_bug.cgi?id=129039 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/select-element-at-index.html The selected element at a given index was wrong. One should be considered among the all children of a list box, not only selected ones. * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (core): (listObjectForSelection): (optionFromList): (optionFromSelection): (webkitAccessibleSelectionRefSelection): Tools: Added missing implementation and proposed some new function for testing selection in a list boxes. * DumpRenderTree/AccessibilityUIElement.cpp: (setSelectedChildAtIndexCallback): (removeSelectionAtIndexCallback): (AccessibilityUIElement::getJSClass): * DumpRenderTree/AccessibilityUIElement.h: * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: (AccessibilityUIElement::selectedChildrenCount): (AccessibilityUIElement::selectedChildAtIndex): (AccessibilityUIElement::setSelectedChildAtIndex): (AccessibilityUIElement::removeSelectionAtIndex): * DumpRenderTree/win/AccessibilityUIElementWin.cpp: (AccessibilityUIElement::selectedChildrenCount): (AccessibilityUIElement::selectedChildAtIndex): * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: (WTR::AccessibilityUIElement::setSelectedChildAtIndex): (WTR::AccessibilityUIElement::removeSelectionAtIndex): * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::selectedChildAtIndex): (WTR::AccessibilityUIElement::selectedChildrenCount): (WTR::AccessibilityUIElement::setSelectedChildAtIndex): (WTR::AccessibilityUIElement::removeSelectionAtIndex): LayoutTests: Proposed test that checks whether correct element at a given index is retrieved. Also testing some other scenarios such as removing selection from rows, counting all selected rows and setting selection. * accessibility/select-element-at-index-expected.txt: Added. * accessibility/select-element-at-index.html: Added. * platform/mac/TestExpectations: Skipping test in Mac, missing implementation. Canonical link: https://commits.webkit.org/147285@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-24 09:31:12 +00:00
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<select id="group" multiple="multiple">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
<p id="description"></p>
<div id="console"></div>
<script>
description("Tests that checks whether setting selection at the given index works correctly");
if (window.accessibilityController) {
document.getElementById("group").focus();
var selectElement = accessibilityController.focusedElement;
shouldBe("selectElement.selectedChildrenCount", "0");
var option1 = selectElement.childAtIndex(0);
var option2 = selectElement.childAtIndex(1);
var option3 = selectElement.childAtIndex(2);
var option4 = selectElement.childAtIndex(3);
selectElement.setSelectedChildAtIndex(0);
shouldBe("selectElement.selectedChildrenCount", "1");
shouldBeTrue("option1.isSelected");
shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option1)");
selectElement.setSelectedChildAtIndex(1);
shouldBe("selectElement.selectedChildrenCount", "2");
shouldBeTrue("option2.isSelected");
shouldBeTrue("selectElement.selectedChildAtIndex(1).isEqual(option2)");
shouldBeFalse("option3.isSelected");
selectElement.setSelectedChildAtIndex(3);
shouldBe("selectElement.selectedChildrenCount", "3");
shouldBeTrue("option4.isSelected");
AX: [ATK] Wrong selected element at a given index in a list box (redux) https://bugs.webkit.org/show_bug.cgi?id=164430 Reviewed by Darin Adler. Source/WebCore: This essentially undoes the implementation change resulting from r164577. As stated in the ATK documentation, atk_selection_ref_selection() takes "a gint specifying the index in the selection set. (e.g. the ith selection as opposed to the ith child)." r164577 deliberately modified that, causing atk_selection_ref_selection() to treat the index as if it were the position with respect to all of the children. There is different API in ATK, namely atk_object_ref_accessible_child(), when the ith child from the set of all children is sought. Tests: accessibility/aria-listbox-no-selection.html accessibility/native-listbox-no-selection.html * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (optionFromSelection): LayoutTests: Add tests to ensure listboxes with no selected children do not report a selected child. Modify select-element-at-index.html to reflect the corrected behavior for ATK. Move the Mac port's expectations to the shared expectations. * accessibility/aria-listbox-no-selection-expected.txt: Added. * accessibility/aria-listbox-no-selection.html: Added. * accessibility/native-listbox-no-selection-expected.txt: Added. * accessibility/native-listbox-no-selection.html: Added. * accessibility/select-element-at-index-expected.txt: Modified. * accessibility/select-element-at-index.html: Modified. * platform/mac/accessibility/select-element-at-index-expected.txt: Removed. Canonical link: https://commits.webkit.org/182174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-09 18:25:42 +00:00
// The index expected by selectedChildAtIndex is with respect to the array of
// selected children; not the array of all children. The element whose text is
// "Option 4" is the third of three selected items, thus the index should be 2.
shouldBeTrue("selectElement.selectedChildAtIndex(2).isEqual(option4)");
// atk_selection_remove_selection() works like atk_selection_ref_selection()
// in that the index is with respect to the array of selected children; not
// the array of all children. Thus to remove the selection from "Option 4"
// in ATK, we again need to specify an index of 2.
if (accessibilityController.platformName == "atk")
selectElement.removeSelectionAtIndex(2);
else
selectElement.removeSelectionAtIndex(3);
[ATK] Wrong selected element at a given index in a list box. https://bugs.webkit.org/show_bug.cgi?id=129039 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/select-element-at-index.html The selected element at a given index was wrong. One should be considered among the all children of a list box, not only selected ones. * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp: (core): (listObjectForSelection): (optionFromList): (optionFromSelection): (webkitAccessibleSelectionRefSelection): Tools: Added missing implementation and proposed some new function for testing selection in a list boxes. * DumpRenderTree/AccessibilityUIElement.cpp: (setSelectedChildAtIndexCallback): (removeSelectionAtIndexCallback): (AccessibilityUIElement::getJSClass): * DumpRenderTree/AccessibilityUIElement.h: * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: (AccessibilityUIElement::selectedChildrenCount): (AccessibilityUIElement::selectedChildAtIndex): (AccessibilityUIElement::setSelectedChildAtIndex): (AccessibilityUIElement::removeSelectionAtIndex): * DumpRenderTree/win/AccessibilityUIElementWin.cpp: (AccessibilityUIElement::selectedChildrenCount): (AccessibilityUIElement::selectedChildAtIndex): * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: (WTR::AccessibilityUIElement::setSelectedChildAtIndex): (WTR::AccessibilityUIElement::removeSelectionAtIndex): * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::selectedChildAtIndex): (WTR::AccessibilityUIElement::selectedChildrenCount): (WTR::AccessibilityUIElement::setSelectedChildAtIndex): (WTR::AccessibilityUIElement::removeSelectionAtIndex): LayoutTests: Proposed test that checks whether correct element at a given index is retrieved. Also testing some other scenarios such as removing selection from rows, counting all selected rows and setting selection. * accessibility/select-element-at-index-expected.txt: Added. * accessibility/select-element-at-index.html: Added. * platform/mac/TestExpectations: Skipping test in Mac, missing implementation. Canonical link: https://commits.webkit.org/147285@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-24 09:31:12 +00:00
shouldBeFalse("option4.isSelected");
shouldBe("selectElement.selectedChildrenCount", "2");
selectElement.removeSelectionAtIndex(1);
shouldBeFalse("option2.isSelected");
shouldBe("selectElement.selectedChildrenCount", "1");
selectElement.removeSelectionAtIndex(0);
shouldBeFalse("option1.isSelected");
shouldBe("selectElement.selectedChildrenCount", "0");
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>