chromium/third_party/blink/renderer/modules/accessibility/ax_position_test.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/accessibility/ax_position.h"

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/editing/position.h"
#include "third_party/blink/renderer/core/editing/position_with_affinity.h"
#include "third_party/blink/renderer/core/editing/text_affinity.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/modules/accessibility/ax_object.h"
#include "third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h"
#include "third_party/blink/renderer/modules/accessibility/testing/accessibility_test.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"

namespace blink {
namespace test {

namespace {

constexpr char kCSSBeforeAndAfter[] =;

constexpr char kHTMLTable[] =;

constexpr char kAOM[] =;

constexpr char kMap[] =;
}  // namespace

//
// Basic tests.
//

TEST_F(AccessibilityTest, PositionInText) {}

// To prevent surprises when comparing equality of two |AXPosition|s, position
// before text object should be the same as position in text object at offset 0.
TEST_F(AccessibilityTest, PositionBeforeText) {}

TEST_F(AccessibilityTest, PositionBeforeTextWithFirstLetterCSSRule) {}

// To prevent surprises when comparing equality of two |AXPosition|s, position
// after text object should be the same as position in text object at offset
// text length.
TEST_F(AccessibilityTest, PositionAfterText) {}

TEST_F(AccessibilityTest, PositionBeforeLineBreak) {}

TEST_F(AccessibilityTest, PositionAfterLineBreak) {}

TEST_F(AccessibilityTest, FirstPositionInDivContainer) {}

TEST_F(AccessibilityTest, LastPositionInDivContainer) {}

TEST_F(AccessibilityTest, FirstPositionInTextContainer) {}

TEST_F(AccessibilityTest, LastPositionInTextContainer) {}

//
// Test comparing two AXPosition objects based on their position in the
// accessibility tree.
//

TEST_F(AccessibilityTest, AXPositionComparisonOperators) {}

TEST_F(AccessibilityTest, AXPositionOperatorBool) {}

//
// Test converting to and from visible text with white space.
// The accessibility tree is based on visible text with white space compressed,
// vs. the DOM tree where white space is preserved.
//

TEST_F(AccessibilityTest, PositionInTextWithWhiteSpace) {}

TEST_F(AccessibilityTest, PositionBeforeTextWithWhiteSpace) {}

TEST_F(AccessibilityTest, PositionAfterTextWithWhiteSpace) {}

TEST_F(AccessibilityTest, PositionBeforeLineBreakWithWhiteSpace) {}

TEST_F(AccessibilityTest, PositionAfterLineBreakWithWhiteSpace) {}

TEST_F(AccessibilityTest, FirstPositionInDivContainerWithWhiteSpace) {}

TEST_F(AccessibilityTest, LastPositionInDivContainerWithWhiteSpace) {}

TEST_F(AccessibilityTest, FirstPositionInTextContainerWithWhiteSpace) {}

TEST_F(AccessibilityTest, LastPositionInTextContainerWithWhiteSpace) {}

// Test that DOM positions in white space will be collapsed to the first or last
// valid offset in an |AXPosition|.
TEST_F(AccessibilityTest, AXPositionFromDOMPositionWithWhiteSpace) {}

TEST_F(AccessibilityTest, AXPositionsWithPreservedLeadingWhitespace) {}

TEST_F(AccessibilityTest, AXPositionsWithPreservedLeadingWhitespaceAndBreak) {}

TEST_F(AccessibilityTest, AXPositionsInSVGTextWithXCoordinates) {}

//
// Test affinity.
// We need to distinguish between the caret at the end of one line and the
// beginning of the next.
//

TEST_F(AccessibilityTest, PositionInTextWithAffinity) {}

//
// Test converting to and from accessibility positions with offsets in HTML
// labels. HTML labels are ignored in the accessibility tree when associated
// with checkboxes and radio buttons.
//

TEST_F(AccessibilityTest, PositionInHTMLLabel) {}

TEST_F(AccessibilityTest, PositionInHTMLLabelIgnored) {}

//
// Objects with "display: none" or the "hidden" attribute are accessibility
// ignored.
//

TEST_F(AccessibilityTest, PositionInIgnoredObject) {}

//
// Aria-hidden can cause things in the DOM to be hidden from accessibility.
//

TEST_F(AccessibilityTest, BeforePositionInARIAHiddenShouldNotSkipARIAHidden) {}

TEST_F(AccessibilityTest,
       PreviousPositionAfterARIAHiddenShouldNotSkipARIAHidden) {}

TEST_F(AccessibilityTest, FromPositionInARIAHidden) {}

//
// Canvas fallback can cause things to be in the accessibility tree that are not
// in the layout tree.
//

TEST_F(AccessibilityTest, PositionInCanvas) {}

//
// Some layout objects, e.g. list bullets and CSS::before/after content, appear
// in the accessibility tree but are not present in the DOM.
//

TEST_F(AccessibilityTest, PositionBeforeListMarker) {}

TEST_F(AccessibilityTest, PositionAfterListMarker) {}

// TODO(nektar) Fix test to work with ignored containers of pseudo content.
TEST_F(AccessibilityTest, DISABLED_PositionInCSSContent) {}

// TODO(nektar) Fix test to work with ignored containers of pseudo content.
TEST_F(AccessibilityTest, DISABLED_PositionInCSSImageContent) {}

// TODO(nektar) Fix test to work with ignored containers of pseudo content.
TEST_F(AccessibilityTest, DISABLED_PositionInTableWithCSSContent) {}

//
// Objects deriving from |AXMockObject|, e.g. table columns, are in the
// accessibility tree but are neither in the DOM or layout trees.
// Same for virtual nodes created using the Accessibility Object Model (AOM).
//

TEST_F(AccessibilityTest, PositionBeforeAndAfterTable) {}

TEST_F(AccessibilityTest, PositionAtStartAndEndOfTable) {}

TEST_F(AccessibilityTest, PositionInTableHeader) {}

TEST_F(AccessibilityTest, PositionInTableRow) {}

TEST_F(AccessibilityTest, DISABLED_PositionInVirtualAOMNode) {}

TEST_F(AccessibilityTest, PositionInInvalidMapLayout) {}

TEST_F(AccessibilityTest, ToPositionWithAffinityWithMultipleInlineTextBoxes) {}

}  // namespace test
}  // namespace blink