haikuwebkit/LayoutTests/accessibility/content-editable-as-textare...

73 lines
2.5 KiB
HTML
Raw Permalink Normal View History

2014-04-30 20:47:16 +00:00
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="content" contenteditable tabindex="0">
hello<br>
<b>world</b>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that a contenteditable region behaves as a proper AXTextArea.");
var notification = 0;
var textArea = 0;
[ATK] accessibility/content-editable-as-textarea.html fails https://bugs.webkit.org/show_bug.cgi?id=155353 Reviewed by Darin Adler. Source/WebCore: The test was timing out because it expected an AXValueChanged notification. In ATK, AXValueChanged notifications are made for widgets which implement the AtkValue interface (sliders, progress bars, etc.). We should be listening for AXTextChanged instead. In addition, for contenteditable elements, we should emit the notification on the element itself. Because we were handling the notification in the same way as native text controls (where the notification we receive from WebCore is for StaticTextRole children), we were attempting to emit the notification from the parent of the contenteditable. Lastly, ATK's AccessibilityUIElement support had a number of unimplemented methods that are being used as part of the previously-failing test. Those methods are now implemented so that the ATK results are much more similar to those on the Mac. No new tests needed. The previously-failing test now passes. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::childrenChanged): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isNonNativeTextControl): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textChanged): * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::nodeTextChangePlatformNotification): Tools: The test was timing out because it expected an AXValueChanged notification. In ATK, AXValueChanged notifications are made for widgets which implement the AtkValue interface (sliders, progress bars, etc.). We should be listening for AXTextChanged instead. AtkText's text-insert and text-remove have been added to the AccessibilityNotificationHandler. Also, ATK's AccessibilityUIElement support had a number of unimplemented methods that are being used as part of the previously-failing test. Those methods are now implemented so that the ATK results are much more similar to those on the Mac. * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp: (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks): * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::stringAttributeValue): (WTR::AccessibilityUIElement::rangeForLine): (WTR::AccessibilityUIElement::boundsForRange): (WTR::AccessibilityUIElement::attributedStringForRange): LayoutTests: Updated the test identified in the bug to listen for the appropriate notification for ATK and created platform-specific expectations. In addition, set-selected-text-range-contenteditable.html was timing out due to the use of shouldBecomeEqual() with an assertion that is wrong for ATK. Modifying the test so that it verifies the result appropriate for each platform eliminates the timeout. * accessibility/content-editable-as-textarea.html: Updated. * accessibility/set-selected-text-range-contenteditable.html: Updated. * platform/gtk/TestExpectations: Unskipped the failing tests. * platform/gtk/accessibility/content-editable-as-textarea-expected.txt: Added. * platform/gtk/accessibility/set-selected-text-range-contenteditable-expected.txt: Added. Canonical link: https://commits.webkit.org/175403@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-03 15:23:23 +00:00
var notificationType = "AXValueChanged";
2014-04-30 20:47:16 +00:00
function callback(notification) {
[ATK] accessibility/content-editable-as-textarea.html fails https://bugs.webkit.org/show_bug.cgi?id=155353 Reviewed by Darin Adler. Source/WebCore: The test was timing out because it expected an AXValueChanged notification. In ATK, AXValueChanged notifications are made for widgets which implement the AtkValue interface (sliders, progress bars, etc.). We should be listening for AXTextChanged instead. In addition, for contenteditable elements, we should emit the notification on the element itself. Because we were handling the notification in the same way as native text controls (where the notification we receive from WebCore is for StaticTextRole children), we were attempting to emit the notification from the parent of the contenteditable. Lastly, ATK's AccessibilityUIElement support had a number of unimplemented methods that are being used as part of the previously-failing test. Those methods are now implemented so that the ATK results are much more similar to those on the Mac. No new tests needed. The previously-failing test now passes. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::childrenChanged): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isNonNativeTextControl): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textChanged): * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::nodeTextChangePlatformNotification): Tools: The test was timing out because it expected an AXValueChanged notification. In ATK, AXValueChanged notifications are made for widgets which implement the AtkValue interface (sliders, progress bars, etc.). We should be listening for AXTextChanged instead. AtkText's text-insert and text-remove have been added to the AccessibilityNotificationHandler. Also, ATK's AccessibilityUIElement support had a number of unimplemented methods that are being used as part of the previously-failing test. Those methods are now implemented so that the ATK results are much more similar to those on the Mac. * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp: (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks): * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::stringAttributeValue): (WTR::AccessibilityUIElement::rangeForLine): (WTR::AccessibilityUIElement::boundsForRange): (WTR::AccessibilityUIElement::attributedStringForRange): LayoutTests: Updated the test identified in the bug to listen for the appropriate notification for ATK and created platform-specific expectations. In addition, set-selected-text-range-contenteditable.html was timing out due to the use of shouldBecomeEqual() with an assertion that is wrong for ATK. Modifying the test so that it verifies the result appropriate for each platform eliminates the timeout. * accessibility/content-editable-as-textarea.html: Updated. * accessibility/set-selected-text-range-contenteditable.html: Updated. * platform/gtk/TestExpectations: Unskipped the failing tests. * platform/gtk/accessibility/content-editable-as-textarea-expected.txt: Added. * platform/gtk/accessibility/set-selected-text-range-contenteditable-expected.txt: Added. Canonical link: https://commits.webkit.org/175403@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-03 15:23:23 +00:00
if (notification == notificationType) {
2014-04-30 20:47:16 +00:00
textArea.removeNotificationListener();
debug("Updated value: " + textArea.stringValue);
document.getElementById("content").style.visibility = "hidden";
finishJSTest();
}
}
if (window.accessibilityController) {
window.jsTestIsAsync = true;
[ATK] accessibility/content-editable-as-textarea.html fails https://bugs.webkit.org/show_bug.cgi?id=155353 Reviewed by Darin Adler. Source/WebCore: The test was timing out because it expected an AXValueChanged notification. In ATK, AXValueChanged notifications are made for widgets which implement the AtkValue interface (sliders, progress bars, etc.). We should be listening for AXTextChanged instead. In addition, for contenteditable elements, we should emit the notification on the element itself. Because we were handling the notification in the same way as native text controls (where the notification we receive from WebCore is for StaticTextRole children), we were attempting to emit the notification from the parent of the contenteditable. Lastly, ATK's AccessibilityUIElement support had a number of unimplemented methods that are being used as part of the previously-failing test. Those methods are now implemented so that the ATK results are much more similar to those on the Mac. No new tests needed. The previously-failing test now passes. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::childrenChanged): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::isNonNativeTextControl): * accessibility/AccessibilityObject.h: * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textChanged): * accessibility/atk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::nodeTextChangePlatformNotification): Tools: The test was timing out because it expected an AXValueChanged notification. In ATK, AXValueChanged notifications are made for widgets which implement the AtkValue interface (sliders, progress bars, etc.). We should be listening for AXTextChanged instead. AtkText's text-insert and text-remove have been added to the AccessibilityNotificationHandler. Also, ATK's AccessibilityUIElement support had a number of unimplemented methods that are being used as part of the previously-failing test. Those methods are now implemented so that the ATK results are much more similar to those on the Mac. * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp: (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks): * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::stringAttributeValue): (WTR::AccessibilityUIElement::rangeForLine): (WTR::AccessibilityUIElement::boundsForRange): (WTR::AccessibilityUIElement::attributedStringForRange): LayoutTests: Updated the test identified in the bug to listen for the appropriate notification for ATK and created platform-specific expectations. In addition, set-selected-text-range-contenteditable.html was timing out due to the use of shouldBecomeEqual() with an assertion that is wrong for ATK. Modifying the test so that it verifies the result appropriate for each platform eliminates the timeout. * accessibility/content-editable-as-textarea.html: Updated. * accessibility/set-selected-text-range-contenteditable.html: Updated. * platform/gtk/TestExpectations: Unskipped the failing tests. * platform/gtk/accessibility/content-editable-as-textarea-expected.txt: Added. * platform/gtk/accessibility/set-selected-text-range-contenteditable-expected.txt: Added. Canonical link: https://commits.webkit.org/175403@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-03 15:23:23 +00:00
// In ATK, value-changed notifications are made for widgets which implement
// the AtkValue interface (sliders, progress bars, etc.).
if (accessibilityController.platformName == "atk")
notificationType = "AXTextChanged";
2014-04-30 20:47:16 +00:00
textArea = accessibilityController.accessibleElementById("content");
textArea.addNotificationListener(callback);
debug("Role: " + textArea.role);
debug("Value: " + textArea.stringValue);
debug("Value (writable): " + textArea.isAttributeSettable("AXValue"));
debug("String with range: " + textArea.stringForRange(1, 9));
debug("Attributed string with range: " + textArea.attributedStringForRange(1, 9));
debug("Line for index(0): " + textArea.lineForIndex(0));
debug("Line for index(7): " + textArea.lineForIndex(7));
debug("Range for line(0): " + textArea.rangeForLine(0));
debug("Range for line(1): " + textArea.rangeForLine(1));
debug("Bounds for range: " + textArea.boundsForRange(3, 5));
var range = document.createRange();
range.setStart(document.getElementById("content").firstChild, 0);
range.setEnd(document.getElementById("content").firstChild, 4);
var sel = window.getSelection();
sel.addRange(range);
debug("Selected text range: " + textArea.selectedTextRange);
debug("Selected text: " + textArea.stringAttributeValue("AXSelectedText"));
// Send a value cahnge.
document.getElementById("content").focus();
eventSender.keyDown('q', []);
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>