summaryrefslogtreecommitdiff
path: root/integralimg_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integralimg_test.go')
-rw-r--r--integralimg_test.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/integralimg_test.go b/integralimg_test.go
index df97caa..8b882db 100644
--- a/integralimg_test.go
+++ b/integralimg_test.go
@@ -28,7 +28,27 @@ func TestFromPNG(t *testing.T) {
draw.Draw(integral, b, img, b.Min, draw.Src)
if !imgsequal(img, integral) {
- t.Errorf("Read png image differs to integral\n")
+ t.Errorf("Read png image differs to integral image\n")
+ }
+}
+
+func TestSqFromPNG(t *testing.T) {
+ f, err := os.Open("testdata/in.png")
+ if err != nil {
+ t.Fatalf("Could not open file %s: %v\n", "testdata/in.png", err)
+ }
+ defer f.Close()
+ img, _, err := image.Decode(f)
+ if err != nil {
+ t.Fatalf("Could not decode image: %v\n", err)
+ }
+ b := img.Bounds()
+
+ integral := NewSqImage(image.Rect(0, 0, b.Dx(), b.Dy()))
+ draw.Draw(integral, b, img, b.Min, draw.Src)
+
+ if !imgsequal(img, integral) {
+ t.Errorf("Read png image differs to square integral image\n")
}
}