AtlatestRepositorysigil-ui
1
;;; Run under an owned compositor that grants ordinary fullscreen requests.2
(import (sigil test) (sigil time) (sigil ui wayland) (sigil ui raster))4
(define (present-fullscreen-check! surface)5
(wayland-present! surface6
(make-canvas (wayland-surface-device-width surface) (wayland-surface-device-height surface))))8
(test "fullscreen requests report only configured state and emit both transitions"9
(let ((surface (open-wayland-surface title: "Fullscreen state check" width: 640 height: 480))10
(observed '()))11
(define (wait-for! target)12
(let ((deadline (+ (current-jiffy) (* 5 (jiffies-per-second)))))13
(let loop ()14
(when (>= (current-jiffy) deadline) (error "Fullscreen configure timed out" target))15
(for-each (lambda (event)16
(when (eq? (car event) 'fullscreen)17
(set! observed (append observed (list (cadr event))))))18
(wayland-dispatch surface 20))19
(present-fullscreen-check! surface)20
(unless (equal? target (wayland-surface-fullscreen? surface)) (loop)))))21
(dynamic-wind (lambda () #f)22
(lambda ()23
(present-fullscreen-check! surface)24
(assert-false (wayland-surface-fullscreen? surface))25
(assert-true (wayland-set-fullscreen! surface #t))26
;; No client dispatch has read the compositor's answer yet.27
(assert-false (wayland-surface-fullscreen? surface))28
(wait-for! #t)29
(assert-true (wayland-set-fullscreen! surface #f))30
(assert-true (wayland-surface-fullscreen? surface))31
(wait-for! #f)32
(assert-equal '(#t #f) observed)33
(assert-equal 'toplevel (wayland-surface-role surface)))34
(lambda () (wayland-surface-close! surface)))))36
(test "fullscreen requests reject invalid booleans child roles and closed surfaces"37
(let ((surface (open-wayland-surface title: "Fullscreen refusal check")) (child #f))38
(dynamic-wind (lambda () #f)39
(lambda ()40
(present-fullscreen-check! surface)41
(set! child (open-wayland-subsurface surface width: 100 height: 100))42
(assert-error (wayland-set-fullscreen! surface 'yes))43
(assert-false (wayland-set-fullscreen! child #t))44
(assert-false (wayland-surface-fullscreen? child)))45
(lambda ()46
(when child (wayland-surface-close! child))47
(wayland-surface-close! surface)))48
(assert-error (wayland-set-fullscreen! surface #t))))