Initial Lime window manager
This commit is contained in:
50
test/x11-session-settings.lisp
Normal file
50
test/x11-session-settings.lisp
Normal file
@@ -0,0 +1,50 @@
|
||||
(in-package #:lime.x11.test)
|
||||
(in-suite lime-x11-suite)
|
||||
|
||||
(test cursor-resource-edits-preserve-unrelated-records
|
||||
(let* ((original (format nil "! comment~%Xft.dpi: 96~% Xcursor.theme : Adwaita~%st.value: foo\\~%Xcursor.size: not-a-resource~%last: no newline"))
|
||||
(next (lime.x11::%replace-cursor-resource original "Xcursor.theme"
|
||||
(list (format nil "Xcursor.theme: Bibata~%"))))
|
||||
(state (lime.x11::make-cursor-session-settings
|
||||
:resources-before original :resources-last next :resources-owned-p t)))
|
||||
(is (= 5 (length (lime.x11::%cursor-resource-records original))))
|
||||
(is (null (lime.x11::%cursor-resource-entries original "Xcursor.size")))
|
||||
(is (search (format nil "st.value: foo\\~%Xcursor.size: not-a-resource~%") next))
|
||||
(is (equal original (lime.x11::%unpublished-cursor-resources state next)))
|
||||
(let ((external (concatenate 'string next (format nil "Other.setting: changed~%"))))
|
||||
(is (search "Other.setting: changed" (lime.x11::%unpublished-cursor-resources state external)))
|
||||
(is (equal (lime.x11::%cursor-resource-entries original "Xcursor.theme")
|
||||
(lime.x11::%cursor-resource-entries
|
||||
(lime.x11::%unpublished-cursor-resources state external) "Xcursor.theme"))))
|
||||
(let ((external (lime.x11::%replace-cursor-resource next "Xcursor.theme"
|
||||
(list (format nil "Xcursor.theme: Other~%")))))
|
||||
(is (equal external (lime.x11::%unpublished-cursor-resources state external))))
|
||||
(is (equal "" (lime.x11::%replace-cursor-resource nil "Xcursor.theme" nil)))
|
||||
(is (null (lime.x11::%unpublished-cursor-resources
|
||||
(lime.x11::make-cursor-session-settings :resources-before nil :resources-last next
|
||||
:resources-owned-p t) next)))))
|
||||
|
||||
(test cursor-settings-wire-encoding
|
||||
(let ((bytes (lime.x11::%xsettings-cursor-bytes "Ice" 24 #x12345678)))
|
||||
(is (equalp #(0 0 0 0 120 86 52 18 2 0 0 0 1 0 19 0) (subseq bytes 0 16)))
|
||||
(is (equalp #(71 116 107 47 67 117 114 115 111 114 84 104 101 109 101 78 97 109 101 0)
|
||||
(subseq bytes 16 36)))
|
||||
(is (equalp #(120 86 52 18 3 0 0 0 73 99 101 0 0 0 19 0) (subseq bytes 36 52)))
|
||||
(is (equalp #(120 86 52 18 24 0 0 0) (subseq bytes 72 80))))
|
||||
(is (= 12 (length (lime.x11::%xsettings-cursor-bytes nil nil 1))))
|
||||
(is (= 48 (length (lime.x11::%xsettings-cursor-bytes "氷" nil 1))))
|
||||
(dolist (bad (list (format nil "Ice~%Xft.dpi: 999") (format nil "Ice~C" #\Return)))
|
||||
(signals invalid-transition
|
||||
(lime.x11::%validate-ui-cursor-style (make-ui-cursor-style :theme bad)))))
|
||||
|
||||
(test cursor-child-environment-is-an-argument-vector
|
||||
(let* ((backend (lime.x11::%make-x11-backend))
|
||||
(argv '("program" "argument with spaces" "$no-shell-expansion")))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(is (eq argv (lime.x11::%cursor-session-launch-argv backend argv)))
|
||||
(setf (gethash backend lime.x11::*cursor-session-settings*)
|
||||
(lime.x11::make-cursor-session-settings :theme "A theme" :size 32))
|
||||
(is (equal (append '("env" "XCURSOR_THEME=A theme" "XCURSOR_SIZE=32") argv)
|
||||
(lime.x11::%cursor-session-launch-argv backend argv))))
|
||||
(remhash backend lime.x11::*cursor-session-settings*))))
|
||||
Reference in New Issue
Block a user