Skip to content

Commit

Permalink
add bb test
Browse files Browse the repository at this point in the history
  • Loading branch information
emicklei committed Oct 11, 2024
1 parent 480fa9a commit 2e1201b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions space_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ func TestSpace_ShapeQuery(t *testing.T) {
func TestSpace_ReindexShape(t *testing.T) {
space := NewSpace()
circle := space.AddShape(NewCircle(space.StaticBody, 1, Vector{}))
bb1 := circle.bb
space.ReindexShape(circle)
bb2 := circle.bb
// check unchanged
if got, want := bb1.String(), bb2.String(); got != want {
t.Errorf("got [%[1]v:%[1]T] want [%[2]v:%[2]T]", got, want)
}
circle.body.SetPosition(Vector{X: 12.0, Y: 34.0})
space.ReindexShape(circle)
bb3 := circle.bb
// check changed
if got, want := bb2.String(), bb3.String(); got == want {
t.Errorf("got [%[1]v:%[1]T] want [%[2]v:%[2]T]", got, want)
}
}

0 comments on commit 2e1201b

Please sign in to comment.