f594c3aad5
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
43 lines
734 B
Go
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)
|
|
}
|
|
}
|