3 import "testhelper.js" as Helper
6 id:canvas; width:100;height:50; renderTarget:Canvas.Image
8 name: "strokeStyle"; when: windowShown
9 function test_default() {
10 var ctx = canvas.getContext('2d');
12 compare(ctx.strokeStyle, "#000000")
13 ctx.clearRect(0, 0, 1, 1);
14 compare(ctx.strokeStyle, "#000000")
16 function test_saverestore() {
17 var ctx = canvas.getContext('2d');
18 var old = ctx.strokeStyle;
20 ctx.strokeStyle = "#ffaaff";
22 compare(ctx.strokeStyle, old);
24 ctx.strokeStyle = "#ffcc88";
25 old = ctx.strokeStyle;
27 compare(ctx.strokeStyle, old);
30 function test_namedColor() {
31 var ctx = canvas.getContext('2d');
33 ctx.strokeStyle = "red";
34 ctx.strokeRect(0,0,1,1);
35 verify(Helper.comparePixel(ctx,0,0,255,0,0,255));
37 ctx.strokeStyle = "black";
38 ctx.strokeRect(0,0,1,1);
39 verify(Helper.comparePixel(ctx,0,0,0,0,0,255));
41 ctx.strokeStyle = "white";
42 ctx.strokeRect(0,0,1,1);
43 verify(Helper.comparePixel(ctx,0,0,255,255,255,255));