Model palette tracks as typed symbol lanes
This commit is contained in:
parent
dff23d7994
commit
26fab9392e
20 changed files with 371 additions and 123 deletions
|
|
@ -318,3 +318,40 @@
|
|||
"the inheriting child follows the lightning cut; an instance override wins")
|
||||
(is (= [17 34 51] (nth (:ramp context) 1)))
|
||||
(is (= [170 187 204] (nth (:ramp context) 3)))))
|
||||
|
||||
(deftest symbol-authoring-palettes-seed-only-the-view-root
|
||||
(let [palette (fn [id name color]
|
||||
{:id id :name name :slots [{:hex color} {:hex color}]})
|
||||
mark {:id :mark :kind :rect :z "a1"
|
||||
:channels {[:geom :size] (ch/framed 2)
|
||||
[:style :color] (ch/framed 1)}}
|
||||
document {:fps 30 :width 20 :height 20
|
||||
:palettes {:day (palette :day "Day" "#112233")
|
||||
:night (palette :night "Night" "#aabbcc")}
|
||||
:default-palette :day
|
||||
:symbols
|
||||
{:main {:id :main :frames 4 :palette :day :palette-track :palette-lane
|
||||
:nodes {:child {:id :child :kind :instance :z "a1"
|
||||
:source {:symbol :drawing}}}}
|
||||
:palette-lane {:id :palette-lane :name "palette"
|
||||
:type :palette-track :display :lane :frames 4
|
||||
:nodes {:night {:id :night :kind :instance :z "a1"
|
||||
:source {:symbol :night-palette}
|
||||
:span [0 1] :time {:at 1}}}}
|
||||
:night-palette {:id :night-palette :name "Night"
|
||||
:type :palette :palette-ref :night
|
||||
:frames 1 :nodes {}}
|
||||
:drawing {:id :drawing :frames 4 :palette :night
|
||||
:nodes {:mark mark}}}}
|
||||
context (pal/compile document)
|
||||
main (clip/resolver document :main nil context nil)
|
||||
drawing (clip/resolver document :drawing nil context nil)
|
||||
color #(-> (%1 %2) first :color)]
|
||||
(is (= (pal/render-index context :day 1) (color main 0))
|
||||
"a nested symbol's authoring palette does not override the viewed root")
|
||||
(is (= (pal/render-index context :night 1) (color main 1))
|
||||
"a covered palette-track interval overrides the root fallback")
|
||||
(is (= (pal/render-index context :day 1) (color main 2))
|
||||
"a nil track interval is a real gap and restores the authoring palette")
|
||||
(is (= (pal/render-index context :night 1) (color drawing 0))
|
||||
"the same nested symbol uses its authoring palette when viewed directly")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue