Increase tolerances in #getAverageColor() tests.

The phantomjs canvas appear to produce less precise results.
This commit is contained in:
Jürg Lehni 2015-07-27 10:03:11 +02:00
parent 59b7da0ed5
commit 5f42020869

View file

@ -130,8 +130,9 @@ test('Raster#getAverageColor(path)', function() {
fillColor: new Color(1, 0, 0)
});
var raster = paper.project.activeLayer.rasterize(72);
circle.scale(0.9);
equals(raster.getAverageColor(circle), circle.fillColor);
circle.scale(0.8);
equals(raster.getAverageColor(circle), circle.fillColor, null,
{ tolerance: 10e-4 });
});
test('Raster#getAverageColor(path) with compound path', function() {
@ -151,7 +152,8 @@ test('Raster#getAverageColor(path) with compound path', function() {
var compoundPath = new CompoundPath(path, path2);
compoundPath.fillColor = new Color(1, 0, 0);
var raster = paper.project.activeLayer.rasterize(72);
path.scale(0.9);
path2.scale(1.1);
equals(raster.getAverageColor(compoundPath), new Color(1, 0, 0), null, { tolerance: 10e-4 });
path.scale(0.8);
path2.scale(1.2);
equals(raster.getAverageColor(compoundPath), new Color(1, 0, 0), null,
{ tolerance: 10e-4 });
});