Commit adb9d60c authored by Dave Cheney's avatar Dave Cheney

image/gif: make test repeatable

Fixes issue with go test -cpu=1,1

R=minux.ma, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/7808045
parent 1e0e65ea
......@@ -114,22 +114,25 @@ func try(t *testing.T, b []byte, want string) {
}
func TestBounds(t *testing.T) {
// make a local copy of testGIF
gif := make([]byte, len(testGIF))
copy(gif, testGIF)
// Make the bounds too big, just by one.
testGIF[32] = 2
gif[32] = 2
want := "gif: frame bounds larger than image bounds"
try(t, testGIF, want)
try(t, gif, want)
// Make the bounds too small; does not trigger bounds
// check, but now there's too much data.
testGIF[32] = 0
gif[32] = 0
want = "gif: too much image data"
try(t, testGIF, want)
testGIF[32] = 1
try(t, gif, want)
gif[32] = 1
// Make the bounds really big, expect an error.
want = "gif: frame bounds larger than image bounds"
for i := 0; i < 4; i++ {
testGIF[32+i] = 0xff
gif[32+i] = 0xff
}
try(t, testGIF, want)
try(t, gif, want)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment