Skip to content

Commit

Permalink
Some test beds..
Browse files Browse the repository at this point in the history
  • Loading branch information
jsantell committed Feb 15, 2012
1 parent 7f5812f commit 89d686f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions dev/nodecanvastest.js
@@ -0,0 +1,27 @@
// Sloppy dev tests
// *RUN FROM PROJ ROOT*
var imageDiff = require('../imagediff.js'),
Canvas = require('canvas'),
fs = require('fs');

var c = imageDiff.createCanvas(),
img = new Canvas.Image(),
ctx = c.getContext('2d'),
string = '[';
img.src = 'spec/images/checkmark.png';

// drawImage() test
//ctx.drawImage(img, 0, 0);

// getImageData() test
// still results in all 0s
ctx.lineWidth = 3;
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(30,30);
ctx.stroke();

imageData = ctx.getImageData(0, 0, 30, 30);
for (var i = 0; i < imageData.data.length; i++) { string+=imageData.data[i]+',' };
string = string.substr(0,string.length-1) + ']';
fs.writeFile('canvastest.txt', string);
2 changes: 1 addition & 1 deletion dev/test-canvas.js
Expand Up @@ -17,7 +17,7 @@ var Canvas = require('canvas')

var img = new Canvas.Image();


console.log(ctx.createImageData(30,20));
tester = img
console.log('Type of canvas: ', Object.prototype.toString.apply(tester));
console.log('isContext: ', imageDiff.isContext(tester));
Expand Down

0 comments on commit 89d686f

Please sign in to comment.