Add test for Raster#getAverageColor(compoundPath).

This commit is contained in:
Jonathan Puckey 2013-03-17 22:27:44 +01:00
parent e3760afecd
commit a87c9e9a7f

View file

@ -131,4 +131,26 @@ test('Raster#getAverageColor(path)', function() {
var raster = paper.project.activeLayer.rasterize();
path.scale(0.9);
compareRgbColors(raster.getAverageColor(path), new RgbColor(1, 0, 0));
});
});
test('Raster#getAverageColor(path) with compound path', function() {
new Path.Rectangle({
point: [0, 0],
size: [100, 100],
fillColor: new RgbColor(0, 1, 0)
});
var path = new Path.Circle({
center: [50, 50],
radius: 25
});
var path2 = new Path.Circle({
center: [50, 50],
radius: 10
})
var compoundPath = new CompoundPath(path, path2);
compoundPath.fillColor = new RgbColor(1, 0, 0);
var raster = paper.project.activeLayer.rasterize();
path.scale(0.9);
path2.scale(1.1);
compareRgbColors(raster.getAverageColor(compoundPath), new RgbColor(1, 0, 0));
});