Skip to content

Commit c0acfeb

Browse files
author
saŭlo
committed
canvas test
1 parent 87eef06 commit c0acfeb

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

lib/js/tests/Webapi/Canvas/Webapi__Canvas__Canvas2d__test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ ctx.arcTo(1, 1, 2, 2, 4);
9292

9393
ctx.arc(1, 1, 4, 1, 3, true);
9494

95+
ctx.ellipse(1, 1, 4, 8, 4, 1, 3, true);
96+
9597
ctx.rect(0, 0, 10, 10);
9698

9799
var pointInPath = ctx.isPointInPath(0, 0);

tests/Webapi/Canvas/Webapi__Canvas__Canvas2d__test.res

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,25 @@ ctx->lineTo(~x=1., ~y=2.)
5151
ctx->quadraticCurveTo(~cpx=1., ~cpy=1., ~x=1., ~y=1.)
5252
ctx->bezierCurveTo(~cp1x=1., ~cp1y=1., ~cp2x=2., ~cp2y=2., ~x=4., ~y=4.)
5353
ctx->arcTo(~x1=1., ~y1=1., ~x2=2., ~y2=2., ~r=4.)
54-
ctx->arc(~x=1., ~y=1., ~r=4., ~a1=1., ~a2=3., ~ccw=true, ())
54+
ctx->arc(~x=1., ~y=1., ~r=4., ~startAngle=1., ~endAngle=3., ~counterClockWise=true, ())
55+
ctx->ellipse(
56+
~x=1.,
57+
~y=1.,
58+
~rx=4.,
59+
~ry=8.,
60+
~rtn=4.,
61+
~startAngle=1.,
62+
~endAngle=3.,
63+
~counterClockWise=true,
64+
(),
65+
)
5566
ctx->rect(~x=0., ~y=0., ~w=10., ~h=10.)
5667
let pointInPath: bool = ctx->isPointInPath(~x=0., ~y=0.)
5768

5869
let linearGradient: gradient = ctx->createLinearGradient(~x0=0.0, ~y0=0.0, ~x1=0.0, ~y1=0.0)
5970
setStrokeStyle(ctx, Gradient, linearGradient)
60-
let radialGradient: gradient = ctx->createRadialGradient(~x0=0.0, ~y0=0.0, ~x1=0.0, ~y1=0.0, ~r0=0.0, ~r1=0.0)
71+
let radialGradient: gradient =
72+
ctx->createRadialGradient(~x0=0.0, ~y0=0.0, ~x1=0.0, ~y1=0.0, ~r0=0.0, ~r1=0.0)
6173
linearGradient->addColorStop(0.0, "red")
6274
let noRepeatPatern: pattern = ctx->createPattern(document->Document.createElement("img"), #noRepeat)
6375
let repeatPatern: pattern = ctx->createPattern(document->Document.createElement("img"), #repeat)
@@ -112,13 +124,14 @@ ctx->fillRect(~x=1., ~y=0., ~w=10., ~h=10.)
112124
ctx->strokeRect(~x=1., ~y=0., ~w=10., ~h=10.)
113125
ctx->clearRect(~x=1., ~y=0., ~w=10., ~h=10.)
114126

115-
116127
let path1 = Path2d.make()
117-
let path2 = Path2d.make(~d="M24.85,10.126c2.018-4.783,6.628-8.125,11.99-8.125c7.223"
118-
++ ",0,12.425,6.179,13.079,13.543 c0,0,0.353,1.828-0.424,5.119c-1.058,4.482"
119-
++ "-3.545,8.464-6.898,11.503L24.85,48L7.402,32.165c-3.353-3.038-5.84-7.021"
120-
++ "-6.898-11.503 c-0.777-3.291-0.424-5.119-0.424-5.119C0.734,8.179,5.936,2"
121-
++ ",13.159,2C18.522,2,22.832,5.343,24.85,10.126z",())
128+
let path2 = Path2d.make(
129+
~d="M24.85,10.126c2.018-4.783,6.628-8.125,11.99-8.125c7.223" ++
130+
",0,12.425,6.179,13.079,13.543 c0,0,0.353,1.828-0.424,5.119c-1.058,4.482" ++
131+
"-3.545,8.464-6.898,11.503L24.85,48L7.402,32.165c-3.353-3.038-5.84-7.021" ++
132+
"-6.898-11.503 c-0.777-3.291-0.424-5.119-0.424-5.119C0.734,8.179,5.936,2" ++ ",13.159,2C18.522,2,22.832,5.343,24.85,10.126z",
133+
(),
134+
)
122135

123136
path1->Path2d.rect(~x=1., ~y=2., ~w=10., ~h=10.)
124137
path2->Path2d.bezierCurveTo(~cp1x=1., ~cp1y=2., ~cp2x=2., ~cp2y=2., ~x=4., ~y=4.)

0 commit comments

Comments
 (0)