shareable: Fix tests

This commit is contained in:
Hajime Hoshi 2018-04-29 19:15:04 +09:00
parent 1f1847c259
commit 5dc1df3260

View File

@ -51,20 +51,22 @@ func TestEnsureNotShared(t *testing.T) {
// with non-upper-left location. // with non-upper-left location.
img1 := NewImage(bigSize, 100) img1 := NewImage(bigSize, 100)
defer img1.Dispose() defer img1.Dispose()
// Ensure img1's region is allocated.
img1.ReplacePixels(make([]byte, 4*bigSize*100))
img2 := NewImage(100, bigSize) img2 := NewImage(100, bigSize)
defer img2.Dispose() defer img2.Dispose()
img2.ReplacePixels(make([]byte, 4*100*bigSize))
const size = 32 const size = 32
img3 := NewImage(size/2, size/2) img3 := NewImage(size/2, size/2)
defer img3.Dispose() defer img3.Dispose()
img3.ReplacePixels(make([]byte, (size/2)*(size/2)*4))
img4 := NewImage(size, size) img4 := NewImage(size, size)
defer img4.Dispose() defer img4.Dispose()
img3.ReplacePixels(make([]byte, (size/2)*(size/2)*4))
pix := make([]byte, size*size*4) pix := make([]byte, size*size*4)
for j := 0; j < size; j++ { for j := 0; j < size; j++ {
for i := 0; i < size; i++ { for i := 0; i < size; i++ {