AtlatestRepositorysigil-wm

sigil-wm / tree / testmodel.sgl

1(import (sigil wm model) (sigil wm scene) (sigil wm layout))
2(define (require condition message) (unless condition (error message)))
3(define initial
4 (wm-state nodes: (list (workspace id: 'main roots: '(root))
5 (container id: 'root children: '(left right))
6 (container id: 'left) (container id: 'right))))
7(define attached (attach-node initial 'left (make-view 7 (handle host: 1 kind: 'window id: 7))))
8(define moved (reparent-node attached 7 'right))
9(require (null? (container-children (find-node initial 'left))) "original tree changed")
10(require (equal? '(7) (container-children (find-node moved 'right))) "reparent failed")
11(require (null? (wm-state-focus moved)) "reparent selected focus")
12(require (guard (exception (#t #t)) (reparent-node moved 'root 'left) #f) "cycle accepted")
13(define focused (set-seat-focus moved 1 7))
14(require (equal? '((1 . 7)) (wm-state-focus focused)) "explicit focus missing")
15(require (not (validate-plan
16 (make-scene-plan
17 (list (placement window: 7 box: (rect x: 0 y: 0 width: -2 height: 5))) 7 100)))
18 "negative geometry accepted")
19(display "MODEL=PASS persistent reparent cycle focus geometry\n")