From cd3e9027d913635eda90b56d2b67dc582ac08aa6 Mon Sep 17 00:00:00 2001 From: atomizer Date: Wed, 20 Apr 2011 01:54:36 +0400 Subject: [PATCH] visual test Signed-off-by: Tj Holowaychuk --- test/public/tests.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/public/tests.js b/test/public/tests.js index 9fd8342..0300b85 100644 --- a/test/public/tests.js +++ b/test/public/tests.js @@ -601,6 +601,33 @@ tests['states with stroke/fill/globalAlpha'] = function(ctx){ ctx.fillRect(60,60,30,30); }; +tests['path through fillRect/strokeRect/clearRect'] = function(ctx){ + // left: fillRect() + ctx.beginPath(); + ctx.rect(0, 50, 50, 50); + ctx.fillStyle = '#F00'; + ctx.fillRect(10, 60, 30, 30); + ctx.fillStyle = '#0F0'; + ctx.fill(); + + // center: strokeRect() + ctx.beginPath(); + ctx.rect(50, 50, 50, 50); + ctx.strokeStyle = '#F00'; + ctx.lineWidth = 5; + ctx.strokeRect(60, 60, 30, 30); + ctx.fillStyle = '#0F0'; + ctx.fill(); + + // right: clearRect() + ctx.beginPath(); + ctx.rect(100, 50, 50, 50); + ctx.fillStyle = '#0F0'; + ctx.fill(); + ctx.clearRect(110, 60, 30, 30); + ctx.fill(); +} + tests['invalid stroke/fill styles'] = function(ctx){ ctx.fillStyle = 'red'; ctx.strokeStyle = 'yellow';