Created
November 28, 2016 13:32
-
-
Save NetguruGist/39b5aa477255da7fb971410d87033eda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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