MCPcopy Create free account
hub / github.com/tdewolff/canvas / TestPathToSVG

Function TestPathToSVG

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

Source from the content-addressed store, hash-verified

803}
804
805func TestPathToSVG(t *testing.T) {
806 var tts = []struct {
807 p string
808 svg string
809 }{
810 {"", ""},
811 {"L10 0Q15 10 20 0M20 10C20 20 30 20 30 10z", "M0 0H10Q15 10 20 0M20 10C20 20 30 20 30 10z"},
812 {"L10 0M20 0L30 0", "M0 0H10M20 0H30"},
813 {"L0 0L0 10L20 20", "M0 0V10L20 20"},
814 {"A5 5 0 0 1 10 0", "M0 0A5 5 0 0110 0"},
815 {"A10 5 90 0 0 10 0", "M0 0A5 10 0 0010 0"},
816 {"A10 5 90 1 0 10 0", "M0 0A5 10 0 1010 0"},
817 {"M20 0L20 0", ""},
818 {"A.25.2 0 01.5 0", "M0 0A.25.2 0 01.5 0"},
819 {"A.2.25 0 010-.5", "M0 0A.2.25 0 010-.5"},
820 }
821 for _, tt := range tts {
822 t.Run(tt.p, func(t *testing.T) {
823 p := MustParseSVGPath(tt.p)
824 test.T(t, p.ToSVG(), tt.svg)
825 })
826 }
827}
828
829func TestPathToPS(t *testing.T) {
830 var tts = []struct {

Callers

nothing calls this directly

Calls 4

MustParseSVGPathFunction · 0.85
TMethod · 0.80
RunMethod · 0.45
ToSVGMethod · 0.45

Tested by

no test coverage detected