Files
aego/tests/integration/animcreate_test.go
sanspie 515f4ca1b3 Stage 11a: animation (D333–D340, D344, D354–D357)
Clips (.aeanim) and controllers (.aectrl) with importers, AnimationPlayer and Animator with crossfades, root motion and events on fixed steps, rewind support. Editor: Animation panel (dope sheet, curves, record, preview, trajectory), Animator panel, sprite sheet slicer and flipbooks, Programming workspace, export panel redesign. Motion 2D ledge climb. 11c: the component and Create palette.
2026-10-25 15:31:22 +03:00

48 lines
1.5 KiB
Go

package integration
import (
"testing"
"aego/modules/animation"
"aego/platform/input"
"aego/scene"
)
// Create → Animation → Clip from the palette: a new clip file, an Animation Player that plays it, one Undo for the component.
func TestCreateClipFromPalette(t *testing.T) {
s := workspaceSession(t)
sc, h := emptyNode(t, s)
push(t, s, key(input.KeyN, input.PrimaryMod()|input.ModShift)...)
push(t, s, typed("clip")...)
if i := s.App.AddPalette().Palette().Selected(); i < 0 || s.App.AddPalette().Palette().Item(i).Label != "Clip" {
t.Fatal("\"clip\" must highlight Animation → Clip first")
}
push(t, s, key(input.KeyEnter, 0)...)
p, ok := scene.Get[animation.AnimationPlayer](sc, h)
if !ok {
t.Fatal("the node got no Animation Player")
}
rel, ok := s.Host.Pipeline.PathOf(p.Clip.ID)
if !ok || rel != "scenes/Node.aeanim" {
t.Fatalf("clip %v at %q", p.Clip, rel)
}
if err := s.App.Context().Doc().History.Undo(); err != nil {
t.Fatal(err)
}
if _, ok := scene.Get[animation.AnimationPlayer](sc, h); ok {
t.Fatal("one Undo must remove the Animation Player")
}
}
func TestCreateControllerFromPalette(t *testing.T) {
s := workspaceSession(t)
sc, h := emptyNode(t, s)
push(t, s, key(input.KeyN, input.PrimaryMod()|input.ModShift)...)
push(t, s, typed("controller")...)
push(t, s, key(input.KeyEnter, 0)...)
a, ok := scene.Get[animation.Animator](sc, h)
if !ok || a.Controller.ID.IsZero() {
t.Fatal("the node got no Animator with the new controller")
}
}