diff --git a/test/public/state.png b/test/public/state.png new file mode 100644 index 0000000..166e7cb Binary files /dev/null and b/test/public/state.png differ diff --git a/test/public/tests.js b/test/public/tests.js index d4bb306..0ed652c 100644 --- a/test/public/tests.js +++ b/test/public/tests.js @@ -1386,4 +1386,44 @@ tests['font state'] = function(ctx){ ctx.restore(); ctx.fillText('Boom again!', 50, 140); +}; + +tests['drawImage(img,0,0)'] = function(ctx){ + var img = new Image; + img.onload = function(){ + ctx.drawImage(img, 0, 0); + }; + img.src = 'state.png'; +}; + +tests['drawImage(img,x,y)'] = function(ctx){ + var img = new Image; + img.onload = function(){ + ctx.drawImage(img, 5, 25); + }; + img.src = 'state.png'; +}; + +tests['drawImage(img,x,y,w,h) scale down'] = function(ctx){ + var img = new Image; + img.onload = function(){ + ctx.drawImage(img, 25, 25, 10, 10); + }; + img.src = 'state.png'; +}; + +tests['drawImage(img,x,y,w,h) scale up'] = function(ctx){ + var img = new Image; + img.onload = function(){ + ctx.drawImage(img, 0, 0, 200, 200); + }; + img.src = 'state.png'; +}; + +tests['drawImage(img,x,y,w,h) scale vertical'] = function(ctx){ + var img = new Image; + img.onload = function(){ + ctx.drawImage(img, 0, 0, img.width, 200); + }; + img.src = 'state.png'; }; \ No newline at end of file diff --git a/test/server.js b/test/server.js index 0deb04c..124a773 100644 --- a/test/server.js +++ b/test/server.js @@ -5,6 +5,7 @@ var express = require('../support/express') , Canvas = require('../lib/canvas') + , Image = Canvas.Image , jade = require('../support/jade') , app = express.createServer();