refactor(colourspace)

This commit is contained in:
Tomas Aparicio 2015-07-11 20:16:39 +01:00
parent fa55264a97
commit 851e65e71e
4 changed files with 42 additions and 11 deletions

View file

@ -272,15 +272,25 @@ func TestInterpretation(t *testing.T) {
}
}
func TestImageColourspaceBW(t *testing.T) {
buf, err := initImage("test.jpg").Colourspace(INTERPRETATION_B_W)
if err != nil {
t.Errorf("Cannot process the image: %#v", err)
func TestImageColourspace(t *testing.T) {
tests := []struct {
file string
interpretation Interpretation
}{
{"test.jpg", INTERPRETATION_sRGB},
{"test.jpg", INTERPRETATION_B_W},
}
interpretation, err := ImageInterpretation(buf)
if interpretation != INTERPRETATION_B_W {
t.Errorf("Invalid colourspace")
for _, test := range tests {
buf, err := initImage(test.file).Colourspace(test.interpretation)
if err != nil {
t.Errorf("Cannot process the image: %#v", err)
}
interpretation, err := ImageInterpretation(buf)
if interpretation != test.interpretation {
t.Errorf("Invalid colourspace")
}
}
}