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.
117 lines
3.2 KiB
Go
117 lines
3.2 KiB
Go
package art
|
|
|
|
import (
|
|
"context"
|
|
"image"
|
|
"testing"
|
|
)
|
|
|
|
// Deferred tests: these are not evidence of a passing build or UI acceptance.
|
|
func TestSoftEraserStrengthKeepsUndoAndLegacyDefault(t *testing.T) {
|
|
s, _ := sessionForTest(t)
|
|
defer s.Document.Close()
|
|
point := image.Pt(4, 5)
|
|
if _, err := s.Execute(context.Background(), Operation{Kind: "stroke", Points: []image.Point{point}, Brush: brush(red)}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cel := s.ActiveCel()
|
|
if err := s.BeginGesture("eraser", point, Brush{Size: 1, EraseStrength: 128}, false); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.MoveGesture([]image.Point{point}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.EndGesture(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 4, 5, Color{255, 0, 0, 127})
|
|
if s.Info().Undo != 2 {
|
|
t.Fatal("one erase gesture must be one history entry")
|
|
}
|
|
if err := s.Undo(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 4, 5, red)
|
|
if err := s.Redo(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 4, 5, Color{255, 0, 0, 127})
|
|
if err := s.BeginGesture("eraser", point, Brush{Size: 1}, false); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.EndGesture(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 4, 5, Color{})
|
|
}
|
|
|
|
func TestSmudgeUsesPreviousDabAndOneUndo(t *testing.T) {
|
|
s, _ := sessionForTest(t)
|
|
defer s.Document.Close()
|
|
for _, v := range []struct {
|
|
point image.Point
|
|
color Color
|
|
}{{image.Pt(1, 1), red}, {image.Pt(2, 1), blue}} {
|
|
if _, err := s.Execute(context.Background(), Operation{Kind: "stroke", Points: []image.Point{v.point}, Brush: brush(v.color)}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
cel, before := s.ActiveCel(), s.Info().Undo
|
|
if err := s.BeginGesture("eraser", image.Pt(1, 1), Brush{Size: 1, EraseStrength: 128, Smudge: true}, false); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 2, 1, blue)
|
|
if err := s.MoveGesture([]image.Point{{2, 1}}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := s.EndGesture(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 2, 1, Color{128, 0, 127, 255})
|
|
if s.Info().Undo != before+1 {
|
|
t.Fatal("smudge must publish exactly one history entry")
|
|
}
|
|
if err := s.Undo(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 2, 1, blue)
|
|
if err := s.Redo(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pixel(t, s.Document, cel, 2, 1, Color{128, 0, 127, 255})
|
|
}
|
|
|
|
func TestSoftEraserRespectsAlphaLockAndIndexedPalette(t *testing.T) {
|
|
d, layer, _, cel := doc(t, Indexed)
|
|
defer d.Close()
|
|
e := edit(t, d)
|
|
if err := e.SetPixel(cel, 2, 2, Paint{UseIndex: true, Index: 6}, nil, false); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
done(t, e)
|
|
before := d.Info()
|
|
e = edit(t, d)
|
|
l := e.Info().Layers[0]
|
|
if l.ID != layer {
|
|
t.Fatal("fixture layer changed")
|
|
}
|
|
l.AlphaLock = true
|
|
if err := e.SetLayer(l); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
g, err := e.Stroke(cel, Brush{Size: 1, Erase: true, EraseStrength: 128}, nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := g.Point(image.Pt(2, 2)); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got, err := e.Pixel(cel, 2, 2); err != nil || got != before.Palette[6].Color {
|
|
t.Fatalf("alpha lock did not protect indexed pixel: %+v, %v", got, err)
|
|
}
|
|
if len(e.Info().Palette) != len(before.Palette) {
|
|
t.Fatal("soft erasing changed the indexed palette")
|
|
}
|
|
e.Cancel()
|
|
}
|