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
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.
126 lines
3.3 KiB
Go
126 lines
3.3 KiB
Go
//go:build aego_editor && aego_gltest && linux && cgo && !aego_nonative
|
|
|
|
package docsview
|
|
|
|
import (
|
|
"encoding/json"
|
|
"image"
|
|
"image/png"
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"aego/app/playground"
|
|
"aego/engine/docs"
|
|
)
|
|
|
|
// These run the actual docs renderer in SDL/OpenGL; Set and Reset use the
|
|
// existing Try session. They do not claim a physical GPU or OS pointer input.
|
|
func TestMesh2DTryNativeVisibleOrderAndReset(t *testing.T) {
|
|
tryVisibleOrderAndReset(t, "engine.Mesh2D", 0, "AEGO_MESH_TRY_SHOTS")
|
|
}
|
|
|
|
func TestSpriteRendererTryNativeVisibleOrderAndReset(t *testing.T) {
|
|
tryVisibleOrderAndReset(t, "engine.SpriteRenderer", -1, "AEGO_SPRITE_TRY_SHOTS")
|
|
}
|
|
|
|
func tryVisibleOrderAndReset(t *testing.T, component string, order float64, shotEnv string) {
|
|
t.Helper()
|
|
runtime.LockOSThread()
|
|
defer runtime.UnlockOSThread()
|
|
p, err := playground.New()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var entry docs.Entry
|
|
for _, candidate := range p.TryScenes() {
|
|
if candidate.ID == component {
|
|
entry = candidate
|
|
break
|
|
}
|
|
}
|
|
if entry.Try == "" {
|
|
t.Fatalf("%s Try is missing", component)
|
|
}
|
|
a, err := New(Options{Width: 960, Height: 440})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer a.Close()
|
|
request, err := json.Marshal(map[string]any{"scene": entry.Try, "select": entry.TrySelect, "artifacts": entry.TryArtifacts})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if reply := a.Call("load", request); reply.Error != "" {
|
|
t.Fatal(reply.Error)
|
|
}
|
|
if err := a.Step(30); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
capture := func(name string) *image.RGBA {
|
|
t.Helper()
|
|
var shot *image.RGBA
|
|
var shotErr error
|
|
a.e.CaptureFrame(func(img *image.RGBA, err error) { shot, shotErr = img, err })
|
|
if err := a.Step(1); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if shotErr != nil || shot == nil {
|
|
t.Fatalf("capture %s: %v", name, shotErr)
|
|
}
|
|
if dir := os.Getenv(shotEnv); dir != "" {
|
|
if err := os.MkdirAll(dir, 0755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
f, err := os.Create(filepath.Join(dir, name+".png"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
encodeErr := png.Encode(f, shot)
|
|
closeErr := f.Close()
|
|
if encodeErr != nil || closeErr != nil {
|
|
t.Fatalf("capture write: %v %v", encodeErr, closeErr)
|
|
}
|
|
}
|
|
return shot
|
|
}
|
|
before := capture("before")
|
|
if err := a.session.Set(component, "order", order); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := a.Step(4); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
after := capture("edited")
|
|
if err := a.session.Reset(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := a.Step(4); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
reset := capture("reset")
|
|
if before.Bounds() != after.Bounds() || before.Bounds() != reset.Bounds() {
|
|
t.Fatal("Try window changed size")
|
|
}
|
|
// The left half is Game View; exclude Inspector labels and the toolbar.
|
|
area := before.Bounds().Intersect(image.Rect(0, 30, before.Bounds().Dx()/2, before.Bounds().Dy()))
|
|
different := func(x, y *image.RGBA) int {
|
|
count := 0
|
|
for py := area.Min.Y; py < area.Max.Y; py++ {
|
|
for px := area.Min.X; px < area.Max.X; px++ {
|
|
a, b := x.RGBAAt(px, py), y.RGBAAt(px, py)
|
|
if a != b {
|
|
count++
|
|
}
|
|
}
|
|
}
|
|
return count
|
|
}
|
|
changed, residual := different(before, after), different(before, reset)
|
|
t.Logf("native Game View changed pixels=%d, reset difference=%d", changed, residual)
|
|
if changed < 100 || residual != 0 {
|
|
t.Fatalf("%s order/reset did not visibly work: changed=%d residual=%d", component, changed, residual)
|
|
}
|
|
}
|