Files
aego/tests/integration/profiler_sections_test.go
sanspie 1030dc9a43
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci / checks (push) Successful in 4m58s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 27m47s
ci / release (push) Successful in 11m57s
Stage 10d2: audio fast path, shutdown order, profiler and monitor sections
2026-10-22 14:41:24 +03:00

46 lines
1.0 KiB
Go

package integration
import (
"slices"
"testing"
"aego/core/mathx"
"aego/editor/core/services"
"aego/modules/gameplay"
"aego/platform/input"
)
func TestProfilerGameplayAndCamera(t *testing.T) {
s, pc := rewindSession(t)
for range 60 {
pc.Tick(1.0 / 60)
}
for range 3 {
s.Step()
}
ui := s.App.Context().UI
prof := s.App.Profiler()
full := mathx.Rect{W: 900, H: 4000}
draw := func() {
ui.Begin(&input.State{}, mathx.Vec2{X: full.W, Y: full.H}, 1)
ui.Region(full)
prof.Draw(&services.Frame{UI: ui}, full)
ui.PopCursor()
ui.End()
}
draw()
for _, name := range []string{"Gameplay", "Camera"} {
if !slices.Contains(prof.Sections(), name) {
t.Fatalf("profiler sections %v lack %s", prof.Sections(), name)
}
}
st := gameplay.Of(pc.World()).Stats()
if st.Steps == 0 || st.Controllers == 0 || st.Casts == 0 {
t.Fatalf("gameplay counters %+v", st)
}
if st.Controllers < st.Steps {
t.Fatalf("%d controller steps over %d fixed steps, the player alone runs every step", st.Controllers, st.Steps)
}
draw()
}