mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Explicitly state raster resolution in unit tests.
Since #rasterize() uses the HiDPI resolution if present now.
This commit is contained in:
parent
dfac101bfc
commit
a1c74b8fd3
4 changed files with 7 additions and 7 deletions
|
@ -380,7 +380,7 @@ test('hitting raster bounding box', function() {
|
||||||
radius: 50,
|
radius: 50,
|
||||||
fillColor: 'red'
|
fillColor: 'red'
|
||||||
});
|
});
|
||||||
var raster = path.rasterize();
|
var raster = path.rasterize(72);
|
||||||
path.remove();
|
path.remove();
|
||||||
|
|
||||||
var hitResult = paper.project.hitTest(raster.bounds.topLeft, {
|
var hitResult = paper.project.hitTest(raster.bounds.topLeft, {
|
||||||
|
@ -432,7 +432,7 @@ test('hitting raster items', function() {
|
||||||
// Create a path, rasterize it and then remove the path:
|
// Create a path, rasterize it and then remove the path:
|
||||||
var path = new Path.Rectangle(new Point(), new Size(320, 240));
|
var path = new Path.Rectangle(new Point(), new Size(320, 240));
|
||||||
path.fillColor = 'red';
|
path.fillColor = 'red';
|
||||||
var raster = path.rasterize();
|
var raster = path.rasterize(72);
|
||||||
|
|
||||||
var hitResult = paper.project.hitTest(new Point(160, 120));
|
var hitResult = paper.project.hitTest(new Point(160, 120));
|
||||||
|
|
||||||
|
|
|
@ -646,7 +646,7 @@ test('Item#blendMode in a transformed Group', function() {
|
||||||
blendMode: 'screen'
|
blendMode: 'screen'
|
||||||
});
|
});
|
||||||
|
|
||||||
var raster = layer.rasterize();
|
var raster = layer.rasterize(72);
|
||||||
compareColors(raster.getPixel(0, 0), new Color(1, 0, 0, 1),
|
compareColors(raster.getPixel(0, 0), new Color(1, 0, 0, 1),
|
||||||
'Top left pixel should be red:');
|
'Top left pixel should be red:');
|
||||||
compareColors(raster.getPixel(50, 50), new Color(1, 1, 0, 1),
|
compareColors(raster.getPixel(50, 50), new Color(1, 1, 0, 1),
|
||||||
|
@ -658,7 +658,7 @@ test('Item#blendMode in a transformed Group', function() {
|
||||||
var group = new Group(path2);
|
var group = new Group(path2);
|
||||||
group.position = [50, 50];
|
group.position = [50, 50];
|
||||||
|
|
||||||
var raster = layer.rasterize();
|
var raster = layer.rasterize(72);
|
||||||
compareColors(raster.getPixel(0, 0), new Color(1, 0, 0, 1),
|
compareColors(raster.getPixel(0, 0), new Color(1, 0, 0, 1),
|
||||||
'Top left pixel should be red:');
|
'Top left pixel should be red:');
|
||||||
compareColors(raster.getPixel(50, 50), new Color(1, 1, 0, 1),
|
compareColors(raster.getPixel(50, 50), new Color(1, 1, 0, 1),
|
||||||
|
|
|
@ -149,7 +149,7 @@ test('Raster#clone()', function() {
|
||||||
fillColor: new Color(0, 0, 1),
|
fillColor: new Color(0, 0, 1),
|
||||||
strokeColor: new Color(0, 0, 1)
|
strokeColor: new Color(0, 0, 1)
|
||||||
};
|
};
|
||||||
var raster = path.rasterize();
|
var raster = path.rasterize(72);
|
||||||
raster.opacity = 0.5;
|
raster.opacity = 0.5;
|
||||||
raster.locked = true;
|
raster.locked = true;
|
||||||
raster.visible = false;
|
raster.visible = false;
|
||||||
|
|
|
@ -129,7 +129,7 @@ test('Raster#getAverageColor(path)', function() {
|
||||||
radius: 25,
|
radius: 25,
|
||||||
fillColor: new Color(1, 0, 0)
|
fillColor: new Color(1, 0, 0)
|
||||||
});
|
});
|
||||||
var raster = paper.project.activeLayer.rasterize();
|
var raster = paper.project.activeLayer.rasterize(72);
|
||||||
circle.scale(0.9);
|
circle.scale(0.9);
|
||||||
compareColors(raster.getAverageColor(circle), circle.fillColor, null, 3);
|
compareColors(raster.getAverageColor(circle), circle.fillColor, null, 3);
|
||||||
});
|
});
|
||||||
|
@ -150,7 +150,7 @@ test('Raster#getAverageColor(path) with compound path', function() {
|
||||||
});
|
});
|
||||||
var compoundPath = new CompoundPath(path, path2);
|
var compoundPath = new CompoundPath(path, path2);
|
||||||
compoundPath.fillColor = new Color(1, 0, 0);
|
compoundPath.fillColor = new Color(1, 0, 0);
|
||||||
var raster = paper.project.activeLayer.rasterize();
|
var raster = paper.project.activeLayer.rasterize(72);
|
||||||
path.scale(0.9);
|
path.scale(0.9);
|
||||||
path2.scale(1.1);
|
path2.scale(1.1);
|
||||||
compareColors(raster.getAverageColor(compoundPath), new Color(1, 0, 0), null, 3);
|
compareColors(raster.getAverageColor(compoundPath), new Color(1, 0, 0), null, 3);
|
||||||
|
|
Loading…
Reference in a new issue