Created
November 10, 2021 04:01
-
-
Save dooman87/5166d6739fe6428a3bad00989302bf3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isIllustrationTests = []*testIsIllustration{ | |
{"illustration-1.png", true}, | |
{"illustration-2.png", true}, | |
{"illustration-3.png", true}, | |
{"logo-1.png", true}, | |
{"logo-2.png", true}, | |
{"banner-1.png", false}, | |
{"screenshot-1.png", false}, | |
{"photo-1.png", false}, | |
{"photo-2.png", false}, | |
{"photo-3.png", false}, | |
{"product-1.png", false}, | |
{"product-2.png", false}, | |
} | |
func TestImageMagick_IsIllustration(t *testing.T) { | |
for _, tt := range isIllustrationTests { | |
imgFile := tt.file | |
f := fmt.Sprintf("%s/%s", "./test_files/is_illustration", imgFile) | |
orig, err := ioutil.ReadFile(f) | |
if err != nil { | |
t.Errorf("Can't read file %s: %+v", f, err) | |
} | |
image := &img.Image{ | |
Id: imgFile, | |
Data: orig, | |
MimeType: "", | |
} | |
info, err := proc.LoadImageInfo(image) | |
if err != nil { | |
t.Errorf("could not load image info %s: %s", imgFile, err) | |
} | |
if err != nil { | |
t.Errorf("Unexpected error [%s]: %s", imgFile, err) | |
} | |
if info.Illustration != tt.isIllustration { | |
t.Errorf("Expected [%t] for [%s], but got [%t]", tt.isIllustration, imgFile, info.Illustration) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment