mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Remove reference to CanvasProvider in test methods
This commit is contained in:
parent
2e75467fb4
commit
337538b21a
1 changed files with 8 additions and 4 deletions
|
@ -176,11 +176,13 @@ var compareImageData = function(imageData1, imageData2, tolerance, diffDetail) {
|
||||||
* @return {HTMLImageElement}
|
* @return {HTMLImageElement}
|
||||||
*/
|
*/
|
||||||
function image(imageData) {
|
function image(imageData) {
|
||||||
var canvas = CanvasProvider.getCanvas(imageData.width, imageData.height);
|
var canvas = document.createElement('canvas');
|
||||||
|
canvas.width = imageData.width;
|
||||||
|
canvas.height = imageData.height;
|
||||||
canvas.getContext('2d').putImageData(imageData, 0, 0);
|
canvas.getContext('2d').putImageData(imageData, 0, 0);
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
image.src = canvas.toDataURL();
|
image.src = canvas.toDataURL();
|
||||||
CanvasProvider.release(canvas);
|
canvas.remove();
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,12 +341,14 @@ var compareItem = function(actual, expected, message, options, properties) {
|
||||||
*/
|
*/
|
||||||
var compareCanvas = function(width, height, expectedCallback, actualCallback) {
|
var compareCanvas = function(width, height, expectedCallback, actualCallback) {
|
||||||
function getImageData(width, height, callback) {
|
function getImageData(width, height, callback) {
|
||||||
var canvas = CanvasProvider.getCanvas(width, height);
|
var canvas = document.createElement('canvas');
|
||||||
|
canvas.width = width;
|
||||||
|
canvas.height = height;
|
||||||
var project = new Project(canvas);
|
var project = new Project(canvas);
|
||||||
callback();
|
callback();
|
||||||
project.view.update();
|
project.view.update();
|
||||||
var imageData = canvas.getContext('2d').getImageData(0, 0, width, height);
|
var imageData = canvas.getContext('2d').getImageData(0, 0, width, height);
|
||||||
CanvasProvider.release(canvas);
|
canvas.remove();
|
||||||
project.remove();
|
project.remove();
|
||||||
return imageData;
|
return imageData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue