-
Notifications
You must be signed in to change notification settings - Fork 5
/
imageoutput_test.go
56 lines (44 loc) · 993 Bytes
/
imageoutput_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package oiio
import (
"testing"
)
func TestOpenImageOutput(t *testing.T) {
out, err := OpenImageOutput("png")
if err != nil {
t.Fatal(err.Error())
}
out.Supports("xyz")
actual := out.FormatName()
if actual != "png" {
t.Errorf("Expected FormatName 'png' but got actual %q", actual)
}
}
func TestImageOutputSupports(t *testing.T) {
// Test using .exr format as it has the widest support feature
out, err := OpenImageOutput("exr")
if err != nil {
t.Fatal(err.Error())
}
expectSupports := []string{
"tiles",
"mipmap",
"alpha",
"nchannels",
"channelformats",
"displaywindow",
"origin",
"negativeorigin",
"arbitrary_metadata",
"exif",
"iptc",
"multiimage",
}
for _, expect := range expectSupports {
if !out.Supports(expect) {
t.Errorf("Expected support for feature %q (format %q)", expect, out.FormatName())
}
}
if out.Supports("invalidfeature") {
t.Error("Supports() returned true for a feature we expected to report false")
}
}