"""Pure E2 input/lifecycle predicates shared with offline negative tests.""" import re from model import require from predicates import COLORS, paint, equal, pair, point def opening_pair(lines,target,serial): actual=[] for line in lines: m=re.fullmatch(r'POINTER_BUTTON target=(\w+) serial=(\d+) button=(\d+) state=(\d+)',line) require(m is not None,'opening-button-format');actual.append([m[1],*map(int,m.groups()[1:])]) require(len(actual)==2 and all(e[0]==target for e in actual) and [e[2:] for e in actual]==[[272,1],[272,0]] and actual[0][1]==serial and 00,'child-zero-residual-A-painted') require(before.startswith('') and after.startswith(before),'A-input-protocol-appended') require('POPUP_A DESTROY ' not in after and 'POPUP_A POPUP_DONE ' not in after and after.count(f'POPUP_A MAP wl={a[0]} xdg={a[1]}')==1,'same-A-live-after-input') require(rect[0]<=global_point[0]