MCPcopy
hub / github.com/tdewolff/minify / TestPathDataTruncated

Function TestPathDataTruncated

svg/pathdata_test.go:92–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestPathDataTruncated(t *testing.T) {
93 var pathDataTests = []struct {
94 pathData string
95 expected string
96 }{
97 {"m100 0 50 50zM100 0z", "m1e2.0 50 50zm0 0z"},
98 {"M194.4 16.4C194.4 7.4 187 0 177.9 0 168.8 0 161.5 7.4 161.5 16.4", "M194 16.4C194 7.4 187 0 178 0S162 7.4 162 16.4"}, // #233
99 //{"M100 100L200.4 200.4l100.2 100.2", "M100 100L200 200L301 301"}, // remember rounding error
100 //{"M100 100L200.4 200.4L300.6 300.6", "M100 100L200 200L301 301"},
101 }
102
103 p := NewPathData(&Minifier{Precision: 3})
104 for _, tt := range pathDataTests {
105 t.Run(tt.pathData, func(t *testing.T) {
106 path := p.ShortenPathData([]byte(tt.pathData))
107 test.Minify(t, tt.pathData, nil, string(path), tt.expected)
108 })
109 }
110}
111
112////////////////////////////////////////////////////////////////
113

Callers

nothing calls this directly

Calls 5

ShortenPathDataMethod · 0.95
NewPathDataFunction · 0.85
RunMethod · 0.80
MinifyMethod · 0.65
stringFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…