| 277 | } |
| 278 | |
| 279 | func TestSpaceComponent_Center(t *testing.T) { |
| 280 | components := []SpaceComponent{ |
| 281 | {Width: 0, Height: 0}, |
| 282 | {Width: 100, Height: 100}, |
| 283 | {Width: 100, Height: 200}, |
| 284 | {Width: 100, Height: 200, Rotation: 45}, |
| 285 | } |
| 286 | points := []engo.Point{ |
| 287 | {X: 10, Y: 10}, |
| 288 | {X: 50, Y: 50}, |
| 289 | {X: 10, Y: 50}, |
| 290 | {X: 99, Y: 99}, |
| 291 | } |
| 292 | |
| 293 | for _, sc := range components { |
| 294 | for _, p := range points { |
| 295 | sc.SetCenter(p) |
| 296 | c := sc.Center() |
| 297 | assert.True(t, c.Equal(p), fmt.Sprintf("center %v should be equal to point %v", c, p)) |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | func TestShape_Project(t *testing.T) { |
| 303 | shapes := []Shape{ |