internal/atlas: bug fix: fix tests

Updates #2897
This commit is contained in:
Hajime Hoshi 2024-01-29 20:51:56 +09:00
parent 9a8dde6503
commit f37ebe549b

View File

@ -811,12 +811,11 @@ func TestIteratingImagesToPutOnSourceBackend(t *testing.T) {
} }
func TestGC(t *testing.T) { func TestGC(t *testing.T) {
c0 := atlas.DeferredFuncCountForTesting()
img := atlas.NewImage(16, 16, atlas.ImageTypeRegular) img := atlas.NewImage(16, 16, atlas.ImageTypeRegular)
img.WritePixels(make([]byte, 4*16*16), image.Rect(0, 0, 16, 16)) img.WritePixels(make([]byte, 4*16*16), image.Rect(0, 0, 16, 16))
_ = img runtime.KeepAlive(img)
c0 := atlas.DeferredFuncCountForTesting()
runtime.GC() runtime.GC()
c1 := atlas.DeferredFuncCountForTesting() c1 := atlas.DeferredFuncCountForTesting()
if got, want := c1, c0+1; got != want { if got, want := c1, c0+1; got != want {
t.Errorf("got: %d, want: %d", got, want) t.Errorf("got: %d, want: %d", got, want)