Package limn.testing

Class AccessibleInvariants

java.lang.Object
limn.testing.AccessibleInvariants

public final class AccessibleInvariants extends Object
The four invariants every published tree holds, whatever is in it: no node has role UNKNOWN; a focusable node has a name; no two nodes share an id; and a node that says it is showing has a box, lies inside the scene, and overlaps every showing ancestor up to the root of the popup it is in, if any. "Inside" cannot mean wholly inside, because a row scrolled half off the top of a list is published where it is, with SHOWING saying how much of it is on screen; and a popup's root (a node that is POPUP_FOR its opener) starts a box of its own, because a drop-down list opens below its field and is published as the field's child, as a native one is.

Written once here so that the gallery test in limn-demo and the per-shape contracts in this package hold the same tree to the same rules; before, the gallery had its own copy.

  • Method Details

    • violations

      public static List<String> violations(String window, AccessibleTree tree)
      Checks one published tree; each violation names the node and the rule.
      Parameters:
      window - the window the tree belongs to, for the message
      tree - what the scene published
      Returns:
      the violations, empty when the tree holds
    • overlaps

      public static boolean overlaps(float x, float y, float w, float h, float ox, float oy, float ow, float oh)
      Whether two boxes share any area.
      Returns:
      true when they overlap by more than an edge
    • describe

      public static String describe(AccessibleNode node)
      One node for a message: id, role, name and box.