Vixen
dd8b0a81
csharp
public static class AccessibilitySnapshot

The accessibility tree of a document, as text a test can compare.

Read the guide page for this →

Remarks

Doc 09's Testing table promises an "ARIA-role snapshot" per control, and this is the thing that makes writing one a line of test code. It captures the accessibility tree with AccessibilityTree and renders each node as its role, its accessible name, its value and its states, indented by depth. A control's snapshot is then a string literal in a test, and a change to what a screen reader would say shows up as a diff rather than as nothing.

⚠ A snapshot that is empty is a snapshot that passes, which is why Unnamed exists beside it. "The tree matches this expected text" is satisfied perfectly by a tree with nothing in it and an expectation to match, and that is this repository's commonest defect rather than a hypothetical. Unnamed is the assertion that cannot be satisfied vacuously: every element that a user can operate must have a role and a non-empty name, and an interface with no such elements has no interactive elements to get wrong.

⚠ Here rather than in a test project, because there are two control assemblies. Vixen.Ui.Controls.Tests and Vixen.Ui.Controls.Advanced.Tests cannot see each other, and a renderer copied into both would be two renderers producing two formats the day one of them was improved.

Methods (3)

  • public static string Render(UiElement root)

    Renders the accessibility tree under an element.

  • public static IReadOnlyList<string> Unnamed(UiElement root)

    The interactive elements under an element that have no accessible name.

  • public static IReadOnlyList<string> Untranslated(UiElement root, IReadOnlyList<StringId> declarations)

    The elements under an element whose announced words are still the source language.

Used by (8)

  • AccessibilityTreeTestsVixen.Ui.Controls.Tests
  • AccessibilityTreeTestsVixen.Ui.Controls.Advanced.Tests
  • AccessibleNameLocalisationTestsVixen.Ui.Controls.Advanced.Tests
  • AccessibleNameLocalisationTestsVixen.Ui.Controls.Tests
  • BridgeVixen.Ui.Controls.Advanced.Tests
  • BridgeVixen.Ui.Controls.Tests
  • ColorPickerKeyboardTestsVixen.Ui.Controls.Advanced.Tests
  • PropertyGridTestsVixen.Ui.Controls.Advanced.Tests