2014-12-21 20:56:40 +03:00
|
|
|
describe("Canvas Renderer test", function() {
|
|
|
|
var BLACK = '#000000';
|
|
|
|
var WHITE = '#ffffff';
|
|
|
|
var TRANS = Constants.TRANSPARENT_COLOR;
|
|
|
|
|
|
|
|
beforeEach(function() {});
|
|
|
|
afterEach(function() {});
|
|
|
|
|
|
|
|
it("draws transparent as white by default", function() {
|
|
|
|
// create frame
|
2014-12-27 17:02:41 +03:00
|
|
|
var frame = pskl.model.Frame.fromPixelGrid(test.testutils.toFrameGrid([
|
2014-12-21 20:56:40 +03:00
|
|
|
[BLACK, TRANS],
|
|
|
|
[TRANS, BLACK]
|
|
|
|
]));
|
|
|
|
|
|
|
|
var renderer = new pskl.rendering.CanvasRenderer(frame, 1);
|
|
|
|
var canvas = renderer.render();
|
|
|
|
|
|
|
|
var frameFromCanvas = pskl.utils.FrameUtils.createFromImage(canvas);
|
|
|
|
|
2016-08-25 00:07:36 +03:00
|
|
|
test.testutils.colorEqualsColor(frameFromCanvas.getPixel(0,0), BLACK);
|
|
|
|
test.testutils.colorEqualsColor(frameFromCanvas.getPixel(0,1), WHITE);
|
|
|
|
test.testutils.colorEqualsColor(frameFromCanvas.getPixel(1,0), WHITE);
|
|
|
|
test.testutils.colorEqualsColor(frameFromCanvas.getPixel(1,1), BLACK);
|
2014-12-21 20:56:40 +03:00
|
|
|
});
|
|
|
|
});
|