broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    local=d['width']-d['x'] if d['rtl'] else d['x']
    logical=local+d['scroll']
    start=d['depth']*d['indent']
    end=start+d['indent']
    inside=0<=d['x']<d['width'] and 0<=d['y']<d['height']
    disclosure=start<=logical<end and d['branch']
    text=logical>start
    control=next((name for name,left,right in d['controls'] if left<=logical<right),None)
    action=('control:'+control) if control is not None else ('toggle' if disclosure else ('select' if text else 'none'))
    action=action if inside and not d['disabled'] else 'none'
    return [action,logical,start,end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('disclosure start', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 130, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 130, 'x': 110, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 130, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 130, 'x': 130, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 130, 20, 30]), ('bottom edge', {'width': 130, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 130, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 2: [('disclosure start', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 140, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 140, 'x': 120, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 140, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 140, 'x': 140, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 140, 20, 30]), ('bottom edge', {'width': 140, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 140, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 3: [('disclosure start', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 150, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 150, 'x': 130, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 150, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 150, 'x': 150, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 150, 20, 30]), ('bottom edge', {'width': 150, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 150, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 4: [('disclosure start', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 160, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 160, 'x': 140, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 160, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 160, 'x': 160, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 160, 20, 30]), ('bottom edge', {'width': 160, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 160, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 5: [('disclosure start', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 170, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 170, 'x': 150, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 170, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 170, 'x': 170, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 170, 20, 30]), ('bottom edge', {'width': 170, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 170, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    local=d['width']-d['x'] if d['rtl'] else d['x']
    logical=local+d['scroll']
    start=d['depth']*d['indent']
    end=start+d['indent']
    inside=0<=d['x']<d['width'] and 0<=d['y']<d['height']
    disclosure=start<=logical<end and d['branch']
    text=logical>end
    control=next((name for name,left,right in d['controls'] if left<=logical<right),None)
    action=('control:'+control) if control is not None else ('toggle' if disclosure else ('select' if text else 'none'))
    action=action if inside and not d['disabled'] else 'none'
    return [action,logical,start,end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('disclosure start', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 130, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 130, 'x': 110, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 130, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 130, 'x': 130, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 130, 20, 30]), ('bottom edge', {'width': 130, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 130, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 2: [('disclosure start', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 140, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 140, 'x': 120, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 140, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 140, 'x': 140, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 140, 20, 30]), ('bottom edge', {'width': 140, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 140, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 3: [('disclosure start', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 150, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 150, 'x': 130, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 150, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 150, 'x': 150, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 150, 20, 30]), ('bottom edge', {'width': 150, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 150, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 4: [('disclosure start', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 160, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 160, 'x': 140, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 160, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 160, 'x': 160, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 160, 20, 30]), ('bottom edge', {'width': 160, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 160, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 5: [('disclosure start', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 170, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 170, 'x': 150, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 170, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 170, 'x': 170, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 170, 20, 30]), ('bottom edge', {'width': 170, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 170, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Text selection region overlaps or excludes disclosure boundary produces the wrong hierarchical widget state in a regression fixture.

Hit testing is in logical row coordinates after horizontal scrolling. Disclosure zone occupies one indent unit at the row depth; row text starts after it. Leaves have no disclosure action. RTL reflects the physical x coordinate. Drag handles and editable fields take priority over row selection.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    local=d['width']-d['x'] if d['rtl'] else d['x']
    logical=local+d['scroll']
    start=d['depth']*d['indent']
    end=start+d['indent']
    inside=0<=d['x']<d['width'] and 0<=d['y']<d['height']
    disclosure=start<=logical<end and d['branch']
    text=logical>=end
    control=next((name for name,left,right in d['controls'] if left<logical<=right),None)
    action=('control:'+control) if control is not None else ('toggle' if disclosure else ('select' if text else 'none'))
    action=action if inside and not d['disabled'] else 'none'
    return [action,logical,start,end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('disclosure start', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 130, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 130, 'x': 110, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 130, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 130, 'x': 130, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 130, 20, 30]), ('bottom edge', {'width': 130, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 130, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 2: [('disclosure start', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 140, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 140, 'x': 120, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 140, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 140, 'x': 140, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 140, 20, 30]), ('bottom edge', {'width': 140, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 140, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 3: [('disclosure start', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 150, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 150, 'x': 130, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 150, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 150, 'x': 150, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 150, 20, 30]), ('bottom edge', {'width': 150, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 150, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 4: [('disclosure start', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 160, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 160, 'x': 140, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 160, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 160, 'x': 160, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 160, 20, 30]), ('bottom edge', {'width': 160, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 160, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 5: [('disclosure start', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 170, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 170, 'x': 150, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 170, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 170, 'x': 170, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 170, 20, 30]), ('bottom edge', {'width': 170, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 170, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    local=d['width']-d['x'] if d['rtl'] else d['x']
    logical=local+d['scroll']
    start=d['depth']*d['indent']
    end=start+d['indent']
    inside=0<=d['x']<d['width'] and 0<=d['y']<d['height']
    disclosure=start<=logical<end and d['branch']
    text=logical>=end
    control=next((name for name,left,right in d['controls'] if left<=local<right),None)
    action=('control:'+control) if control is not None else ('toggle' if disclosure else ('select' if text else 'none'))
    action=action if inside and not d['disabled'] else 'none'
    return [action,logical,start,end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('disclosure start', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 130, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 130, 'x': 110, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 130, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 130, 'x': 130, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 130, 20, 30]), ('bottom edge', {'width': 130, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 130, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 2: [('disclosure start', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 140, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 140, 'x': 120, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 140, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 140, 'x': 140, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 140, 20, 30]), ('bottom edge', {'width': 140, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 140, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 3: [('disclosure start', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 150, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 150, 'x': 130, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 150, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 150, 'x': 150, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 150, 20, 30]), ('bottom edge', {'width': 150, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 150, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 4: [('disclosure start', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 160, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 160, 'x': 140, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 160, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 160, 'x': 160, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 160, 20, 30]), ('bottom edge', {'width': 160, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 160, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 5: [('disclosure start', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 170, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 170, 'x': 150, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 170, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 170, 'x': 170, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 170, 20, 30]), ('bottom edge', {'width': 170, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 170, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Embedded control hit uses wrong coordinate or boundary produces the wrong hierarchical widget state in a regression fixture.

Hit testing is in logical row coordinates after horizontal scrolling. Disclosure zone occupies one indent unit at the row depth; row text starts after it. Leaves have no disclosure action. RTL reflects the physical x coordinate. Drag handles and editable fields take priority over row selection.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    local=d['width']-d['x'] if d['rtl'] else d['x']
    logical=local+d['scroll']
    start=d['depth']*d['indent']
    end=start+d['indent']
    inside=0<=d['x']<d['width'] and 0<=d['y']<d['height']
    disclosure=start<=logical<end and d['branch']
    text=logical>=end
    control=next((name for name,left,right in d['controls'] if left<=logical<right),None)
    action=('toggle' if disclosure else ('control:'+control if control is not None else ('select' if text else 'none')))
    action=action if inside and not d['disabled'] else 'none'
    return [action,logical,start,end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('disclosure start', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 130, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 130, 'x': 110, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 130, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 130, 'x': 130, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 130, 20, 30]), ('bottom edge', {'width': 130, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 130, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 2: [('disclosure start', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 140, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 140, 'x': 120, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 140, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 140, 'x': 140, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 140, 20, 30]), ('bottom edge', {'width': 140, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 140, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 3: [('disclosure start', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 150, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 150, 'x': 130, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 150, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 150, 'x': 150, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 150, 20, 30]), ('bottom edge', {'width': 150, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 150, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 4: [('disclosure start', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 160, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 160, 'x': 140, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 160, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 160, 'x': 160, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 160, 20, 30]), ('bottom edge', {'width': 160, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 160, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 5: [('disclosure start', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 170, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 170, 'x': 150, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 170, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 170, 'x': 170, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 170, 20, 30]), ('bottom edge', {'width': 170, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 170, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    local=d['width']-d['x'] if d['rtl'] else d['x']
    logical=local+d['scroll']
    start=d['depth']*d['indent']
    end=start+d['indent']
    inside=0<=d['x']<d['width'] and 0<=d['y']<d['height']
    disclosure=start<=logical<end and d['branch']
    text=logical>=end
    control=next((name for name,left,right in d['controls'] if left<=logical<right),None)
    action=('toggle' if disclosure else ('select' if text else 'none'))
    action=action if inside and not d['disabled'] else 'none'
    return [action,logical,start,end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('disclosure start', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 130, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 130, 'x': 110, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 130, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 130, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 130, 'x': 130, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 130, 20, 30]), ('bottom edge', {'width': 130, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 130, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 130, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 2: [('disclosure start', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 140, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 140, 'x': 120, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 140, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 140, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 140, 'x': 140, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 140, 20, 30]), ('bottom edge', {'width': 140, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 140, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 140, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 3: [('disclosure start', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 150, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 150, 'x': 130, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 150, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 150, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 150, 'x': 150, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 150, 20, 30]), ('bottom edge', {'width': 150, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 150, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 150, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 4: [('disclosure start', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 160, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 160, 'x': 140, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 160, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 160, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 160, 'x': 160, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 160, 20, 30]), ('bottom edge', {'width': 160, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 160, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 160, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])], 5: [('disclosure start', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('text boundary', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['select', 30, 20, 30]), ('leaf disclosure', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 20, 20, 30]), ('leaf indent', {'width': 170, 'x': 25, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': False, 'controls': [], 'disabled': False}, ['none', 25, 20, 30]), ('scrolled control', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('RTL', {'width': 170, 'x': 150, 'y': 3, 'rtl': True, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('scrolled', {'width': 170, 'x': 10, 'y': 3, 'rtl': False, 'scroll': 10, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['toggle', 20, 20, 30]), ('control overlay', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 20, 30]], 'disabled': False}, ['control:edit', 20, 20, 30]), ('control start', {'width': 170, 'x': 30, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [['edit', 30, 40]], 'disabled': False}, ['control:edit', 30, 20, 30]), ('right edge', {'width': 170, 'x': 170, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 170, 20, 30]), ('bottom edge', {'width': 170, 'x': 40, 'y': 20, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('above row', {'width': 170, 'x': 40, 'y': -1, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': False}, ['none', 40, 20, 30]), ('disabled', {'width': 170, 'x': 20, 'y': 3, 'rtl': False, 'scroll': 0, 'depth': 2, 'indent': 10, 'height': 20, 'branch': True, 'controls': [], 'disabled': True}, ['none', 20, 20, 30])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Disclosure activation outranks an embedded row control produces the wrong hierarchical widget state in a regression fixture.

Hit testing is in logical row coordinates after horizontal scrolling. Disclosure zone occupies one indent unit at the row depth; row text starts after it. Leaves have no disclosure action. RTL reflects the physical x coordinate. Drag handles and editable fields take priority over row selection.

split: open-access