Browse Source

Added jpeg test

v1.x
Tj Holowaychuk 14 years ago
parent
commit
10e9dee374
  1. BIN
      test/public/face.jpeg
  2. 9
      test/public/tests.js
  3. 4
      test/server.js

BIN
test/public/face.jpeg

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

9
test/public/tests.js

@ -1412,6 +1412,15 @@ tests['drawImage(img,0,0)'] = function(ctx, done){
img.src = 'state.png';
};
tests['drawImage(img) jpeg'] = function(ctx, done){
var img = new Image;
img.onload = function(){
ctx.drawImage(img,0,0,100,100);
done();
};
img.src = 'face.jpeg';
};
tests['drawImage(img,x,y)'] = function(ctx, done){
var img = new Image;
img.onload = function(){

4
test/server.js

@ -33,7 +33,9 @@ app.get('/', function(req, res){
app.post('/render', function(req, res, next){
// Normalize state.png as ./public/state.png
// no good way around this at the moment
req.body.fn = req.body.fn.replace("'state.png'", "'" + __dirname + "/public/state.png'");
req.body.fn = req.body.fn
.replace("'state.png'", "'" + __dirname + "/public/state.png'")
.replace("'face.jpeg'", "'" + __dirname + "/public/face.jpeg'");
// Do not try this at home :)
var fn = eval('(' + req.body.fn + ')')

Loading…
Cancel
Save