Files
aego/tests/integration/workspaces_test.go
sanspie 50be5c04bc
ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Stage 12.5: Art Workspace and asset authoring
Add dockable Art tools, animation and previews, guarded asset workflows,
and the Web Asset Studio built on the shared Art Core. Expand English and
Russian documentation, interactive Try scenes, examples and editor icons.

Add audio waveform navigation, source analysis, guarded previews and a
browser Worker mixer. Preserve source changes and recovery with bounded
checks, and strengthen native, browser and interoperability CI.

Prepare version 0.12.5 and manually built native artifact candidates.
Fix the production site image demo build dependency.
Reuse immutable scene indices when capturing keyframes.
Wait for real Persist save/load completion in component tests.
Stabilize browser Game View captures outside pointer hover.
Aseprite interchange and persistent Audio EDL recovery remain limited;
the artifact workflow does not publish releases or change stable.
2026-11-15 10:37:50 +03:00

134 lines
3.5 KiB
Go

package integration
import (
"testing"
"aego/app/edit"
"aego/core/log"
"aego/core/mathx"
"aego/editor/core/command"
"aego/editor/core/play"
"aego/editor/core/session"
"aego/editor/core/workspace"
"aego/editor/shell"
"aego/platform"
"aego/platform/headless"
"aego/platform/input"
"aego/project"
"aego/ui/core"
)
type fullscreener interface {
Fullscreen() bool
}
func workspaceSession(t *testing.T) *edit.Session {
t.Helper()
p, err := project.Load(copyExample(t, "platformer"))
if err != nil {
t.Fatal(err)
}
s, err := edit.Open(p, edit.Config{Headless: true, NoWatch: true, Logger: log.Nop()}, combatModule{})
if err != nil {
t.Fatal(err)
}
t.Cleanup(s.Close)
s.Step()
return s
}
func TestWorkspaceSwitchKeepsDocuments(t *testing.T) {
s := workspaceSession(t)
ctx := s.App.Context()
ws := s.App.Workspace()
d := ctx.Doc()
if d == nil {
t.Fatal("platformer must open its main scene")
}
d.MarkDirty()
docs := len(ctx.Docs.Docs())
for _, p := range shell.BuiltinWorkspaces() {
if !ws.Switch(p.ID) {
t.Fatalf("cannot switch to %s", p.ID)
}
s.Step()
if ctx.Doc() != d || len(ctx.Docs.Docs()) != docs || !d.Dirty() {
t.Fatalf("switching to %s changed the documents", p.ID)
}
}
ws.Switch(workspace.Programming)
if ws.Tree.Has(workspace.Hierarchy) || ws.Tree.Has(workspace.Scene) || !ws.Tree.Has(workspace.Assets) {
t.Fatal("programming hides the hierarchy and the scene and keeps the assets")
}
ws.Switch(workspace.Art)
if ws.Tree.Has(workspace.Console) || !ws.Tree.Has(workspace.Assets) {
t.Fatal("art hides the console and keeps the assets")
}
}
func TestWorkspaceKeysWorkInTextFields(t *testing.T) {
s := workspaceSession(t)
ws := s.App.Workspace()
plat, ok := s.Host.Engine.Platform().(*headless.Platform)
if !ok {
t.Skip("needs the headless platform")
}
s.App.Context().UI.SetFocus(core.IDOf("test.field"))
plat.Push(platform.Event{Kind: platform.EvKeyDown, Key: input.KeyEvent{Scan: input.Key2, Mods: input.PrimaryMod()}})
s.Step()
if ws.Current().ID != workspace.Programming {
t.Fatalf("primary modifier + 2 with a focused field switched to %s", ws.Current().ID)
}
}
func TestFullScreenPlay(t *testing.T) {
s := workspaceSession(t)
ctx := s.App.Context()
pc := s.App.Play()
win, ok := s.Host.Engine.Window().(fullscreener)
if !ok {
t.Skip("window cannot report full screen")
}
if err := ctx.Commands.Run(shell.CommandFullscreenPlay); err != nil {
t.Fatal(err)
}
s.Step()
if !s.App.FullScreen() || !win.Fullscreen() || !pc.Captured() || pc.State() == play.Stopped {
t.Fatal("F11 must start Play in full screen with input captured")
}
pc.SetCapture(false, mathx.Vec2{}, mathx.Vec2{})
s.Step()
if s.App.FullScreen() || win.Fullscreen() {
t.Fatal("releasing the input must leave full screen")
}
if pc.State() == play.Stopped {
t.Fatal("leaving full screen must keep Play running")
}
if err := ctx.Commands.Run(shell.CommandFullscreenPlay); err != nil {
t.Fatal(err)
}
s.Step()
if !win.Fullscreen() {
t.Fatal("F11 during Play must enter full screen")
}
if err := ctx.Commands.Run(command.PlayStop); err != nil {
t.Fatal(err)
}
s.Step()
if s.App.FullScreen() || win.Fullscreen() || pc.State() != play.Stopped {
t.Fatal("Stop must leave full screen")
}
}
func TestHandoffKeepsWorkspace(t *testing.T) {
s := workspaceSession(t)
s.App.Workspace().Switch(workspace.Art)
if err := s.App.Handoff(); err != nil {
t.Fatal(err)
}
h, ok := session.Take(s.Host.Project.Root)
if !ok || h.State.Workspace != workspace.Art {
t.Fatal("handoff must carry the current workspace")
}
}