AtlatestRepositorysigil-ui
1
;;; The portable callback driver uses the unchanged Wayland event contract.2
(import (sigil test) (sigil ui window) (sigil ui raster))4
(test-group "portable window driver"5
(test "closing in the initial step returns without dispatching a closed window"6
(let ((window (open-window width: 100 height: 80)) (calls 0))7
(window-run! window8
(lambda (events)9
(set! calls (+ calls 1))10
(assert-equal '() events)11
(window-close! window)))12
(assert-equal 1 calls)13
(assert-true (window-closed? window))))14
(test "a native event batch reaches the step and can close cleanly"15
(let* ((window (open-window width: 100 height: 80))16
(canvas (make-canvas (window-device-width window) (window-device-height window)))17
(calls 0) (received #f))18
(window-present! window canvas)19
(window-run! window20
(lambda (events)21
(set! calls (+ calls 1))22
(unless (null? events)23
(set! received #t)24
(window-close! window))))25
(assert-true received)26
(assert-true (> calls 1))27
(assert-true (window-closed? window)))))