MCPcopy
hub / github.com/tdewolff/canvas / TestPathDash

Function TestPathDash

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

Source from the content-addressed store, hash-verified

682}
683
684func TestPathDash(t *testing.T) {
685 var tts = []struct {
686 p string
687 offset float64
688 d []float64
689 dashes string
690 }{
691 {"", 0.0, []float64{0.0}, ""},
692 {"L10 0", 0.0, []float64{}, "L10 0"},
693 {"L10 0", 0.0, []float64{2.0}, "L2 0M4 0L6 0M8 0L10 0"},
694 {"L10 0", 0.0, []float64{2.0, 1.0}, "L2 0M3 0L5 0M6 0L8 0M9 0L10 0"},
695 {"L10 0", 1.0, []float64{2.0, 1.0}, "L1 0M2 0L4 0M5 0L7 0M8 0L10 0"},
696 {"L10 0", -1.0, []float64{2.0, 1.0}, "M1 0L3 0M4 0L6 0M7 0L9 0"},
697 {"L10 0", 2.0, []float64{2.0, 1.0}, "M1 0L3 0M4 0L6 0M7 0L9 0"},
698 {"L10 0", 5.0, []float64{2.0, 1.0}, "M1 0L3 0M4 0L6 0M7 0L9 0"},
699 {"L10 0L20 0", 0.0, []float64{15.0}, "L10 0L15 0"},
700 {"L10 0L20 0", 15.0, []float64{15.0}, "M15 0L20 0"},
701 {"L10 0L10 10L0 10z", 0.0, []float64{10.0}, "L10 0M10 10L0 10"},
702 {"L10 0L10 10L0 10z", 0.0, []float64{15.0}, "M0 10L0 0L10 0L10 5"},
703 {"M10 0L20 0L20 10L10 10z", 0.0, []float64{15.0}, "M10 10L10 0L20 0L20 5"},
704 {"L10 0M0 10L10 10", 0.0, []float64{8.0}, "L8 0M0 10L8 10"},
705 }
706 for _, tt := range tts {
707 t.Run(tt.p, func(t *testing.T) {
708 test.T(t, MustParseSVGPath(tt.p).Dash(tt.offset, tt.d...), MustParseSVGPath(tt.dashes))
709 })
710 }
711}
712
713func TestPathReverse(t *testing.T) {
714 var tts = []struct {

Callers

nothing calls this directly

Calls 4

MustParseSVGPathFunction · 0.85
TMethod · 0.80
DashMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected