Skip to content

Instantly share code, notes, and snippets.

@deyceg
Created June 17, 2014 21:20
Show Gist options
  • Save deyceg/8234b68b1c5ea910258b to your computer and use it in GitHub Desktop.
Save deyceg/8234b68b1c5ea910258b to your computer and use it in GitHub Desktop.
imagediff node-canvas browserify
it("should parse cpl character printing command and render correctly in canvas", function(done) {
//fs is shimmed by browserify
var buff = fs.readFileSync(__dirname + '/../fixtures/helloworld.png');
/*
node-canvas impl exports Canvas.Image constructor function
browserify canvas shim does not support Canvas.Image
*/
var expected = new Canvas.Image();
expected.src = buff;
//cpl is the parser instance
var ctx = cpl.render("111100000000000Hello World!"); //This is some CPL!!!
expect(imagediff.equal(expected, ctx, 30)).to.be.true; //TODO Review tolerance
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment