voluptasquisquam
Version:
Image processing and manipulation in JavaScript
36 lines (32 loc) • 907 B
JavaScript
import {Image, getSquare} from 'test/common';
import 'should';
describe('getPixelsArray', function () {
it('should work with grey images', function () {
const data = [
0, 0, 0, 0, 0,
0, 1, 1, 1, 1,
0, 1, 2, 2, 2,
0, 1, 3, 3, 3
];
let image = new Image(5, 4, data,
{kind: 'GREY'}
);
let array = image.getPixelsArray();
array.should.eql(data.map(x => [x]));
});
it('should work with RGB images', function () {
const square = getSquare();
let array = square.getPixelsArray();
array.should.eql([
[],
[],
[],
[],
[],
[],
[],
[],
[]
]);
});
});