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

Function TestPathOffset

path_stroke_test.go:98–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestPathOffset(t *testing.T) {
99 tolerance := 0.01
100 var tts = []struct {
101 orig string
102 w float64
103 offset string
104 }{
105 {"L10 0L10 10L0 10z", 0.0, "L10 0L10 10L0 10z"},
106 //{"L10 0L10 10L0 10", 1.0, "M0 -1L10 -1A1 1 0 0 1 11 0L11 10A1 1 0 0 1 10 11L0 11"},
107 //{"L10 0L10 10L0 10z", 1.0, "M10 -1A1 1 0 0 1 11 0L11 10A1 1 0 0 1 10 11L0 11A1 1 0 0 1 -1 10L-1 0A1 1 0 0 1 0 -1z"},
108 {"L10 0L10 10L0 10z", -1.0, "M1 1L9 1L9 9L1 9z"},
109 {"L10 0L5 0z", -1.0, ""},
110 }
111 for _, tt := range tts {
112 t.Run(fmt.Sprintf("%v/%v", tt.orig, tt.w), func(t *testing.T) {
113 offset := MustParseSVGPath(tt.orig).Offset(tt.w, tolerance)
114 test.T(t, offset, MustParseSVGPath(tt.offset))
115 })
116 }
117}

Callers

nothing calls this directly

Calls 4

MustParseSVGPathFunction · 0.85
OffsetMethod · 0.80
TMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected