MCPcopy Index your code
hub / github.com/tdewolff/canvas / TestPathToPDF

Function TestPathToPDF

path_test.go:847–861  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

845}
846
847func TestPathToPDF(t *testing.T) {
848 var tts = []struct {
849 p string
850 pdf string
851 }{
852 {"", ""},
853 {"L10 0Q15 10 20 0M20 10C20 20 30 20 30 10z", "0 0 m 10 0 l 13.333333 6.6666667 16.666667 6.6666667 20 0 c 20 10 m 20 20 30 20 30 10 c h"},
854 {"L10 0M20 0L30 0", "0 0 m 10 0 l 20 0 m 30 0 l"},
855 }
856 for _, tt := range tts {
857 t.Run(tt.p, func(t *testing.T) {
858 test.T(t, MustParseSVGPath(tt.p).ToPDF(), tt.pdf)
859 })
860 }
861}
862
863func plotPathLengthParametrization(filename string, N int, speed, length func(float64) float64, tmin, tmax float64) {
864 Tc, totalLength := invSpeedPolynomialChebyshevApprox(N, gaussLegendre7, speed, tmin, tmax)

Callers

nothing calls this directly

Calls 4

MustParseSVGPathFunction · 0.85
TMethod · 0.80
ToPDFMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected