Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new test for images with overlapping anomalies

  • Loading branch information...
commit 85c29b866be3bda5d7635befcd317a4898d47ac8 1 parent c74ce9b
@steren authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 lib/test/anomalies.spec.js
View
30 lib/test/anomalies.spec.js
@@ -138,5 +138,35 @@ define([
});
+ it("From 4 images, including 2 with overlapping anomalies, should return a clean image", function() {
+ var bgCol = [100, 100, 200, 255];
+ var bgString = "rgb("+ bgCol[0] +", "+ bgCol[1] +", "+ bgCol[2] +")";
+
+ var diffParams1 = { x : 10, y: 10, width: 50, heigth: 50};
+ var imgWithAnomaly1 = SpecUtils.newAnomalyColorCanvas(bgString, diffParams1, "rgb(100, 0, 0)");
+ appendCanvas(imgWithAnomaly1, "Image with anomaly 1");
+
+ var diffParams2 = { x : diffParams1.x + 10, y: diffParams1.y + 10, width: 50, heigth: 50};
+ var imgWithAnomaly2 = SpecUtils.newAnomalyColorCanvas(bgString, diffParams2, "rgb(0, 100, 0)");
+ appendCanvas(imgWithAnomaly2, "Image with anomaly 2");
+
+ var img3 = SpecUtils.newColorCanvas(bgString);
+ var img4 = SpecUtils.newColorCanvas(bgString);
+
+ var inputs = [imgWithAnomaly1, imgWithAnomaly2, img3, img4];
+
+ var result = SpecUtils.newEmptyCanvas();
+
+ GOOH.process(inputs, {}, result);
+ appendCanvas(result, "Process result of GOOH");
+
+ var resultContent = result.getContext('2d').getImageData(0, 0, result.width, result.height);
+
+ SpecUtils.expectColor(resultContent, bgCol, 0, 0);
+ SpecUtils.expectColor(resultContent, bgCol, diffParams1.x, diffParams1.y);
+ SpecUtils.expectColor(resultContent, bgCol, diffParams2.x, diffParams2.y);
+
+ });
+
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.