Skip to content

Instantly share code, notes, and snippets.

@NetguruGist
Created November 28, 2016 13:32
Show Gist options
  • Save NetguruGist/39b5aa477255da7fb971410d87033eda to your computer and use it in GitHub Desktop.
Save NetguruGist/39b5aa477255da7fb971410d87033eda to your computer and use it in GitHub Desktop.
func TestNewSceneReturnsANewScene(t *testing.T) {
scene := NewScene(4, 4)
rect := image.Rect(0, 0, 4, 4)
assert.Equal(t, 4, scene.Width, "sets width of the scene")
assert.Equal(t, 4, scene.Height, "sets height of the scene")
assert.True(t, assert.ObjectsAreEqualValues(rect, scene.Img.Bounds()),
"creates an image.RGBA with proper bounds")
}
func NewScene(width int, height int) *Scene {
return &Scene{
Width: width,
Height: height,
Img: image.NewRGBA(image.Rect(0, 0, width, height)),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment