mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
refactor(colourspace)
This commit is contained in:
parent
fa55264a97
commit
851e65e71e
4 changed files with 42 additions and 11 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue