Files
aego/editor/panels/assets/context_menu_test.go
sanspie a46347e2c6
ci-platforms / darwin arm64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 12m19s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / windows amd64 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 / checks (push) Failing after 23m57s
ci / release (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: failure
GitHub / darwin arm64 native GitHub-hosted native CI: failure
GitHub / darwin amd64 native GitHub-hosted native CI: failure
GitHub / linux amd64 native GitHub-hosted native CI: success
editor: add art studio and stage 12.5 workflows
2026-11-08 18:47:57 +03:00

46 lines
1.2 KiB
Go

package assets
import (
"testing"
"aego/core/mathx"
"aego/editor/core/services"
"aego/platform/input"
"aego/ui/core"
"aego/ui/dnd"
)
func TestGridContextMenuOnEmptyCellsAndFolder(t *testing.T) {
for _, tc := range []struct {
name string
at mathx.Vec2
want string
}{
{"empty cell beside folder", mathx.Vec2{X: 150, Y: 40}, "assets"},
{"gap above folder", mathx.Vec2{X: 40, Y: 1}, "assets"},
{"folder", mathx.Vec2{X: 40, Y: 40}, "assets/one"},
} {
t.Run(tc.name, func(t *testing.T) {
ui, in := core.New(nil), &input.State{}
p := New(Deps{})
p.dirs = []string{"assets", "assets/one"}
p.f = &services.Frame{UI: ui, DnD: &dnd.State{}}
p.dirMenuID = core.IDOf("test-assets-directory-menu")
draw := func() {
ui.Begin(in, mathx.Vec2{X: 300, Y: 300}, 1)
p.drawGrid(mathx.Rect{W: 210, H: 250})
ui.End()
}
in.BeginFrame()
draw()
in.BeginFrame()
in.ApplyMouseMove(tc.at, mathx.Vec2{})
in.ApplyMouseDown(tc.at, input.MouseRight)
draw()
if !ui.PopupOpen(p.dirMenuID) || p.menuDir != tc.want {
t.Fatalf("right click at %v: open=%v directory=%q, want %q", tc.at, ui.PopupOpen(p.dirMenuID), p.menuDir, tc.want)
}
})
}
}