Remove reference to CanvasProvider in test methods

This commit is contained in:
sasensi 2018-10-18 09:19:03 +02:00 committed by Samuel Asensi
parent 2e75467fb4
commit 337538b21a

View file

@ -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;
} }