From d7546c0c8d6a8c071057448708aea15a1e1929d6 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sun, 17 Mar 2013 19:24:08 +0100 Subject: [PATCH] Add failing test for Raster#getAverageColor(path). --- test/tests/Raster.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/tests/Raster.js b/test/tests/Raster.js index eb1b32ca..98768166 100644 --- a/test/tests/Raster.js +++ b/test/tests/Raster.js @@ -115,4 +115,20 @@ asyncTest('Raster#getSubImage', function(callback) { }, true); callback(); }; +}); + +test('Raster#getAverageColor(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, + fillColor: new RgbColor(1, 0, 0) + }); + var raster = paper.project.activeLayer.rasterize(); + path.scale(0.9); + compareRgbColors(raster.getAverageColor(path), new RgbColor(1, 0, 0)); }); \ No newline at end of file