Browse Source

Started some integration tests

v1.x
Tj Holowaychuk 14 years ago
parent
commit
c8a0c0666e
  1. 44
      test/public/tests.js

44
test/public/tests.js

@ -420,4 +420,48 @@ tests['textBaseline ideographic'] = function(ctx){
ctx.textBaseline = 'ideographic';
ctx.textAlign = 'center';
ctx.fillText("ideographic", 100, 100);
};
tests['integration 1'] = function(ctx){
ctx.fillStyle = '#eee';
ctx.fillRect(0,0,300,300);
ctx.fillStyle = "rgba(0,0,200,0.5)";
ctx.strokeStyle= "rgba(100,100,100,0.5)";
var n = Date.now()/1000;
var xs = 10, ys = 10, cx = xs/2, cy=ys/2, xd = 300/xs, yd = 300/ys;
for(var xt = 0; xt<300; xt+=xd){
for(var yt = 0; yt<300; yt+=yd){
ctx.moveTo(xt,0);ctx.lineTo(xt,300);
ctx.moveTo(0,yt);ctx.lineTo(300,yt);
}
}
ctx.stroke();
ctx.strokeWidth = 5;
ctx.strokeStyle = "rgba(0,0,0,0.5)";
ctx.fillStyle= "rgba(0,174,239,0.8)";
ctx.beginPath();
ctx.moveTo(0,300);
for(var xt = 0; xt<300; xt+=1)
ctx.lineTo(xt, 100+10*Math.sin(xt/32+n+Math.sin(xt/64+n))*5+Math.sin(xt/48));
ctx.lineTo(300,300);
ctx.lineTo(0,300);
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.fillStyle = "rgba(242,0,144,0.7)"; n = n+2;
for(var xt = 0; xt<300; xt+=1)
ctx.lineTo(xt, 150+10*Math.sin(xt/32+n+Math.sin(xt/64+n))*5+Math.sin(xt/48));
ctx.lineTo(300,300);
ctx.lineTo(0,300);
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.fillStyle = "rgba(255,254,0,0.7)"; n = n+4;
for(var xt = 0; xt<300; xt+=1)
ctx.lineTo(xt, 200+10*Math.sin(xt/32+n+Math.sin(xt/64+n))*5+Math.sin(xt/48));
ctx.lineTo(300,300);
ctx.lineTo(0,300);
ctx.fill();
ctx.stroke();
};
Loading…
Cancel
Save