Initial Lime window manager
This commit is contained in:
109
test/x11-activity-navigation.lisp
Normal file
109
test/x11-activity-navigation.lisp
Normal file
@@ -0,0 +1,109 @@
|
||||
(in-package #:lime.x11.test)
|
||||
(in-suite lime-x11-suite)
|
||||
|
||||
(test activity-portability-is-default-and-extended-intent-is-sticky
|
||||
(with-membership-backend (backend world)
|
||||
(let ((development (current-presentation world "main")) (chill (current-presentation world "other")))
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "development")))
|
||||
(backend-switch-to-activity backend "chill" :head-id "main")
|
||||
(is (eq chill (current-presentation world "main")))
|
||||
(is (eq development (current-presentation world "other")))
|
||||
(is (equal "main" (x11-backend-focused-head-id backend)))
|
||||
(backend-switch-to-activity backend "development" :head-id "main")
|
||||
(is (eq development (current-presentation world "main")))
|
||||
(backend-extend-activity-to-head backend "development" "other")
|
||||
(is (eq :extended (backend-activity-navigation-mode backend "development")))
|
||||
(is (eq development (current-presentation world "main")))
|
||||
(is (null (presentation-client-ids (current-presentation world "other"))))
|
||||
(backend-switch-to-activity backend "chill" :head-id "other")
|
||||
(is (eq chill (current-presentation world "other")))
|
||||
(is (eq :extended (backend-activity-navigation-mode backend "development")))
|
||||
(let ((snapshot (lime.x11::%activity-navigation-snapshot backend)))
|
||||
(setf (gethash backend lime.x11::*backend-activity-navigation-states*)
|
||||
(lime.x11::%activity-navigation-read-data snapshot world))
|
||||
(is (eq :extended (backend-activity-navigation-mode backend "development"))))
|
||||
(backend-make-activity-portable backend "development" "main")
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "development")))
|
||||
(is (validate-world world)))))
|
||||
|
||||
(test old-empty-drafts-do-not-anchor-a-portable-activity-to-a-monitor
|
||||
(with-membership-backend (backend world)
|
||||
(let* ((primary (current-presentation world "main"))
|
||||
(old-empty (open-activity-draft world "other" "development")))
|
||||
(open-activity-draft world "other" "chill")
|
||||
(let ((before (lime.persistence:snapshot-world world)))
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "development")))
|
||||
(is (equalp before (lime.persistence:snapshot-world world))))
|
||||
(backend-switch-to-activity backend "development" :head-id "other")
|
||||
(is (eq primary (current-presentation world "other")))
|
||||
(is (not (eq old-empty (current-presentation world "other"))))
|
||||
(is (= 3 (hash-table-count (lime.core::world-presentations world))))
|
||||
(is (validate-world world))
|
||||
(dotimes (i 10)
|
||||
(backend-switch-to-activity backend "development" :head-id (if (evenp i) "main" "other"))
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "development")))
|
||||
(is (validate-world world))))))
|
||||
|
||||
(test explicit-extension-and-collapse-ui-check-stale-contexts
|
||||
(with-membership-backend (backend world)
|
||||
(let* ((result (lime.x11::%ui-extend-activity-result backend))
|
||||
(choice (second (ui-result-candidates result)))
|
||||
(before (lime.persistence:snapshot-world world)))
|
||||
(is (eq :cancel (ui-candidate-id (first (ui-result-candidates result)))))
|
||||
(is (equalp before (lime.persistence:snapshot-world world)))
|
||||
(backend-hide-client backend "editor")
|
||||
(is (eq :keep-open (ui-result-kind (funcall (ui-candidate-action choice)))))
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "development"))))
|
||||
(backend-extend-activity-to-head backend "development" "other")
|
||||
(let ((before (lime.persistence:snapshot-world world)))
|
||||
(signals invalid-transition (backend-make-activity-portable backend "development" "main"))
|
||||
(is (equalp before (lime.persistence:snapshot-world world)))
|
||||
(signals stale-transition-plan
|
||||
(backend-extend-activity-to-head backend "chill" "main" :expected-revision -1))
|
||||
(is (equalp before (lime.persistence:snapshot-world world))))))
|
||||
|
||||
(test portable-policy-validation-and-sending-to-suspended-arrangement
|
||||
(with-membership-backend (backend world)
|
||||
(let* ((chill (current-presentation world "other"))
|
||||
(data (lime.x11::%activity-navigation-snapshot backend)))
|
||||
(dolist (bad (list (append data (list (first data)))
|
||||
'(("development" :unknown nil) ("chill" :portable nil))
|
||||
`(("development" :portable ,(presentation-id chill)) ("chill" :portable nil))
|
||||
'(("development" :extended nil))))
|
||||
(signals error (lime.x11::%activity-navigation-read-data bad world)))
|
||||
(commit-head-topology-reconciliation-plan world
|
||||
(build-head-topology-reconciliation-plan (preflight-head-topology-reconciliation world '("main"))))
|
||||
(backend-move-client-to-activity backend "editor" "chill")
|
||||
(is (equal '("editor") (presentation-client-ids chill)))
|
||||
(is (null (lease-for-client world "editor")))
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "chill")))
|
||||
(backend-switch-to-activity backend "chill" :head-id "main")
|
||||
(is (eq chill (current-presentation world "main")))
|
||||
(is (validate-world world)))))
|
||||
|
||||
(test portable-checkpoint-recall-preflights-before-moving-any-monitor
|
||||
(with-membership-backend (backend world)
|
||||
(let* ((development (current-presentation world "main"))
|
||||
(chill (current-presentation world "other")))
|
||||
(create-view world "development/alternate" "development" "Alternate"
|
||||
(list (make-placement :client-id "editor")))
|
||||
(backend-activate-view backend "development/alternate" :head-id "other")
|
||||
(is (eq development (current-presentation world "other")))
|
||||
(is (eq chill (current-presentation world "main")))
|
||||
(is (eq :portable (backend-activity-navigation-mode backend "development")))
|
||||
(is (equal '("editor") (presentation-client-ids development)))
|
||||
(set-client-shared world "terminal" t)
|
||||
(show-client-on-presentation world "terminal" (presentation-id chill))
|
||||
(create-view world "development/contested" "development" "Contested"
|
||||
(list (make-placement :client-id "terminal")))
|
||||
(let ((before (lime.persistence:snapshot-world world)))
|
||||
(is (not (activation-report-ready-p
|
||||
(backend-preflight-view-activation backend "development/contested" :head-id "main"))))
|
||||
(signals activation-blocked
|
||||
(backend-activate-view backend "development/contested" :head-id "main"))
|
||||
(is (equalp before (lime.persistence:snapshot-world world))))
|
||||
(backend-activate-view backend "development/contested" :head-id "main" :policy :partial)
|
||||
(is (eq development (current-presentation world "main")))
|
||||
(is (eq chill (current-presentation world "other")))
|
||||
(is (equal "other" (presentation-head-id (find-presentation world (lease-presentation-id (lease-for-client world "terminal"))))))
|
||||
(is (validate-world world)))))
|
||||
Reference in New Issue
Block a user