diff --git a/frontend/lab/samples/intro/img/coords-30-60.svg b/frontend/lab/samples/intro/img/coords-30-60.svg index 89374e3b..4759321e 100644 --- a/frontend/lab/samples/intro/img/coords-30-60.svg +++ b/frontend/lab/samples/intro/img/coords-30-60.svg @@ -34,7 +34,7 @@ - + diff --git a/pkg/cli/svg/runtime.go b/pkg/cli/svg/runtime.go index 39e48d83..2031546e 100644 --- a/pkg/cli/svg/runtime.go +++ b/pkg/cli/svg/runtime.go @@ -72,6 +72,8 @@ func NewGraphicsRuntime() *GraphicsRuntime { }, }, } + rt.x = rt.transformX(0) + rt.y = rt.transformY(0) rt.Clear("white") return rt } diff --git a/pkg/cli/svg/runtime_test.go b/pkg/cli/svg/runtime_test.go index 628736e0..ac4e9846 100644 --- a/pkg/cli/svg/runtime_test.go +++ b/pkg/cli/svg/runtime_test.go @@ -19,10 +19,15 @@ func TestRuntimeCircleRect(t *testing.T) { rt.Color("red") rt.Circle(10) rt.Gridn(10, "hsl(0deg 100% 0% / 50%)") - assertSVG(t, "testdata/circle-rect.svg", rt) } +func TestRuntimeQuarterCircle(t *testing.T) { + rt := newTestRuntime() + rt.Circle(100) // should be centered at 0 0 + assertSVG(t, "testdata/quarter-circle.svg", rt) +} + func TestRuntimeEllipse(t *testing.T) { rt := newTestRuntime() rt.Ellipse(50, 85, 30, 10, 0, 0, 0) diff --git a/pkg/cli/svg/testdata/quarter-circle.svg b/pkg/cli/svg/testdata/quarter-circle.svg new file mode 100644 index 00000000..a21c50f3 --- /dev/null +++ b/pkg/cli/svg/testdata/quarter-circle.svg @@ -0,0 +1,6 @@ + + + + + +