This commit is contained in:
Your Name 2026-10-02 17:44:11 -04:00
parent edca82cd5d
commit 664252e0fc
17 changed files with 373 additions and 112 deletions

View file

@ -384,6 +384,14 @@
(is (seq (ch/problems (ch/keyed {0 :a, 10 :b} :linear)))
"a cut or tone cannot interpolate"))
(deftest palette-choice-channels-can-cut-or-blend
(let [held (assoc (ch/keyed {0 :day 10 :night} :hold) :semantic :palette)
blend (assoc held :interp :linear)]
(is (empty? (ch/problems blend)))
(is (= :day (ch/value-at held 5 nil)))
(is (= {:from :day :to :night :t 0.5}
(ch/value-at blend 5 nil)))))
(deftest numeric-channels-can-ramp-between-keys
(let [c (ch/keyed {0 0.0, 10 1.0} :linear)
cursor (ch/cursor c nil)]

View file

@ -4,6 +4,7 @@
[arthur.domain.channel :as ch]
[arthur.domain.clip :as clip]
[arthur.domain.leaf :as leaf]
[arthur.domain.nest :as nest]
[arthur.domain.node :as node]
[arthur.domain.paint :as paint]
[arthur.domain.pose :as pose]
@ -362,3 +363,46 @@
(is (= :night (clip/active-palette main)))
(is (= (pal/render-index context :night 0)
(pal/background-index context (clip/active-palette main))))))
(deftest a-palette-lane-can-blend-between-keyed-palettes
(let [palette (fn [id color]
{:id id :name (name id) :slots [{:hex color} {:hex color}]})
mark {:id :mark :kind :rect :z "a1"
:channels {[:geom :size] (ch/framed 2)
[:style :color] (ch/framed 1)}}
choice (assoc (ch/keyed {0 :day 4 :night} :linear) :semantic :palette)
document {:fps 30 :width 20 :height 20
:palettes {:day (palette :day "#000000")
:night (palette :night "#ffffff")}
:default-palette :day
:symbols
{:main {:id :main :frames 5 :palette-track :palettes
:nodes {:drawing {:id :drawing :kind :instance :z "a1"
:source {:symbol :drawing}}}}
:palettes {:id :palettes :type :palette-track :display :lane :frames 5
:nodes {:change {:id :change :kind :instance :z "a1"
:source {:symbol :day-palette}
:span [0 5] :time {:at 0}
:channels {[:palette] choice}}}}
:day-palette {:id :day-palette :type :palette :palette-ref :day
:frames 1 :nodes {}}
:drawing {:id :drawing :frames 5 :nodes {:mark mark}}}}
context (pal/compile document)
resolve (clip/resolver document :main nil context nil)
slid (nest/slide document :palettes [:change] 1)
trimmed (nest/resize-in document :palettes [:change] 1)
extended (nest/resize-out document :palettes [:change] 1 false)]
(resolve 2)
(is (= {:from :day :to :night :t 0.5} (clip/active-palette resolve)))
(is (= [128 128 128]
(nth (pal/effective-ramp context (clip/active-palette resolve))
(pal/render-index context :day 1))))
(is (nil? (:refused slid)) (:refused slid))
(is (= [1 6] (node/placed-span
(get-in slid [:clip :symbols :palettes :nodes :change]))))
(is (nil? (:refused trimmed)) (:refused trimmed))
(is (= [1 5] (node/placed-span
(get-in trimmed [:clip :symbols :palettes :nodes :change]))))
(is (nil? (:refused extended)) (:refused extended))
(is (= [0 6] (node/placed-span
(get-in extended [:clip :symbols :palettes :nodes :change]))))))

View file

@ -52,6 +52,13 @@
(is (nil? (get-in after [:ui :selection])))
(is (nil? (get-in after [:ui :target])))))
(deftest clearing-selection-also-clears-the-creation-target
(let [db {:ui {:selection [:symbol :drawing]
:target {:sid :main :id :lane :path [:lane]}}}
after (ui/selected db nil)]
(is (nil? (get-in after [:ui :selection])))
(is (nil? (get-in after [:ui :target])))))
(deftest an-explicit-lane-is-one-row-of-clips
(let [doc (fixture/document)
rows (timeline/rows doc :main #{})
@ -206,6 +213,14 @@
(is (= address (get-in after [:ui :selection])))
(is (= [address] (get-in after [:ui :selections])))))
(deftest selecting-or-trimming-a-nested-lane-item-does-not-open-its-row
(let [selection [:node :inner :clip [:lane :clip]]
before {:ui {:expanded #{[:already-open]}}}
after (ui/selected before selection)]
(is (= selection (get-in after [:ui :selection])))
(is (= #{[:already-open]} (get-in after [:ui :expanded]))
"disclosure is changed only by the twist control")))
(deftest finishing-a-polygon-opens-no-rows
;; Expansion is the twist triangle's business. Finishing a shape used to open
;; every row down to it, which inside a lane meant tearing its one row into a