From 8da4889d17e01635439a3920ad7a6675eaad3124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 29 Mar 2019 16:20:13 +0100 Subject: [PATCH] Adapt test to the new version of canvas --- test/acceptance/example.js | 6 +++--- test/support/point_renderer.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/acceptance/example.js b/test/acceptance/example.js index 092d032..9602903 100644 --- a/test/acceptance/example.js +++ b/test/acceptance/example.js @@ -1,12 +1,12 @@ -var Canvas = require('canvas'); -var image = require('../support/image'); +const { createCanvas }= require('canvas'); +const image = require('../support/image'); QUnit.module('example'); test('reference test with canvas', function() { var circleRadius = 20; var canvasSize = circleRadius * 2 + 2; - var canvas = new Canvas(canvasSize, canvasSize); + var canvas = createCanvas(canvasSize, canvasSize); var ctx = canvas.getContext('2d'); diff --git a/test/support/point_renderer.js b/test/support/point_renderer.js index 54c6732..9d06c44 100644 --- a/test/support/point_renderer.js +++ b/test/support/point_renderer.js @@ -1,4 +1,4 @@ -var Canvas = require('canvas'); +const { createCanvas, Canvas, Image }= require('canvas'); var request = require('request'); var _ = require('underscore'); var fs = require('fs'); @@ -14,7 +14,7 @@ function getTile(jsonRelPath, cartocss, z, x, y, step, callback) { var provider = new torque.providers.windshaft(_.extend({ no_fetch_map: true }, cartoCssOptions)); var rendererOptions = _.extend({cartocss: cartocss}, cartoCssOptions, { canvasClass: Canvas, - imageClass: Canvas.Image, + imageClass: Image, setImageSrc: function(img, url, callback) { var requestOpts = { url: url, @@ -45,7 +45,7 @@ function getTile(jsonRelPath, cartocss, z, x, y, step, callback) { var rows = JSON.parse(fs.readFileSync(__dirname + '/../fixtures/json/' + jsonRelPath)); - var canvas = new Canvas(256, 256); + var canvas = createCanvas(256, 256); var pointRenderer = new torque.renderer.Point(canvas, rendererOptions); pointRenderer.renderTile(provider.proccessTile(rows, {x: x, y: y}, z), step, function(err) {