golang-image/tiff/writer_test.go
Benny Siegert f594c3aad5 go.image/tiff: initial support for writing TIFF images
The basic functionality works. Features to add in future CLs:

- compression
- fast paths for image formats that can be directly expressed in TIFF,
  such as RGBA, NRGBA and maybe Gray and Paletted.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5694051
2012-03-05 11:45:47 +11:00

43 lines
734 B
Go

// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tiff
import (
"bytes"
"os"
"testing"
)
var roundtripTests = []string{
"video-001.tiff",
"bw-packbits.tiff",
}
func TestRoundtrip(t *testing.T) {
for _, filename := range roundtripTests {
f, err := os.Open(testdataDir + filename)
if err != nil {
t.Fatal(err)
}
defer f.Close()
img, err := Decode(f)
if err != nil {
t.Fatal(err)
}
out := new(bytes.Buffer)
err = Encode(out, img)
if err != nil {
t.Fatal(err)
}
img2, err := Decode(&buffer{buf: out.Bytes()})
if err != nil {
t.Fatal(err)
}
compare(t, img, img2)
}
}