Replace deprecated Node Buffer constructor (#3126)
This commit is contained in:
@@ -199,7 +199,7 @@ test('Map', function(t) {
|
||||
var map = new mbgl.Map(options);
|
||||
|
||||
t.throws(function() {
|
||||
map.addImage('foo', new Buffer(''), {
|
||||
map.addImage('foo', Buffer.from(''), {
|
||||
width: 401,
|
||||
height: 400,
|
||||
pixelRatio: 1
|
||||
@@ -214,7 +214,7 @@ test('Map', function(t) {
|
||||
var map = new mbgl.Map(options);
|
||||
|
||||
t.throws(function() {
|
||||
map.addImage('foo', new Buffer(''), {
|
||||
map.addImage('foo', Buffer.from(''), {
|
||||
width: 1025,
|
||||
height: 1025,
|
||||
pixelRatio: 1
|
||||
@@ -230,7 +230,7 @@ test('Map', function(t) {
|
||||
var map = new mbgl.Map(options);
|
||||
|
||||
t.throws(function() {
|
||||
map.addImage('foo', new Buffer(' '), {
|
||||
map.addImage('foo', Buffer.from(' '), {
|
||||
width: 401,
|
||||
height: 400,
|
||||
pixelRatio: 1
|
||||
@@ -245,7 +245,7 @@ test('Map', function(t) {
|
||||
var map = new mbgl.Map(options);
|
||||
|
||||
t.doesNotThrow(function() {
|
||||
map.addImage('foo', new Buffer(' '), {
|
||||
map.addImage('foo', Buffer.from(' '), {
|
||||
width: 1,
|
||||
height: 1,
|
||||
pixelRatio: 1
|
||||
|
||||
2
test/fixtures/sprites/convert_sprite.js
vendored
2
test/fixtures/sprites/convert_sprite.js
vendored
@@ -7,7 +7,7 @@ var zlib = require('zlib');
|
||||
var PNG = require('png-js');
|
||||
var png = PNG.load('styles/sprites/bright.png');
|
||||
png.decodePixels(function(data) {
|
||||
var result = new Buffer(8 + data.length);
|
||||
var result = Buffer.alloc(8 + data.length);
|
||||
result.writeUInt32BE(png.width, 0);
|
||||
result.writeUInt32BE(png.height, 4);
|
||||
data.copy(result, 8);
|
||||
|
||||
Reference in New Issue
Block a user