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

Function TestPathDiv

path_intersection_test.go:1305–1324  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1303}
1304
1305func TestPathDiv(t *testing.T) {
1306 var tts = []struct {
1307 p, q string
1308 r string
1309 }{
1310 {"L10 0L5 10z", "M0 5L10 5L5 15z", "L10 0L7.5 5L2.5 5zM2.5 5L7.5 5L5 10z"},
1311 {"L2 0L2 2L0 2zM4 0L6 0L6 2L4 2z", "M1 1L5 1L5 3L1 3z", "M0 0L2 0L2 1L1 1L1 2L0 2zM1 1L2 1L2 2L1 2zM4 0L6 0L6 2L5 2L5 1L4 1zM4 1L5 1L5 2L4 2z"},
1312 {"L2 0L2 2L0 2zM4 0L6 0L6 2L4 2z", "M1 1L1 3L5 3L5 1z", "M0 0L2 0L2 1L1 1L1 2L0 2zM1 1L2 1L2 2L1 2zM4 0L6 0L6 2L5 2L5 1L4 1zM4 1L5 1L5 2L4 2z"},
1313 }
1314 for _, tt := range tts {
1315 t.Run(fmt.Sprint(tt.p, "x", tt.q), func(t *testing.T) {
1316 p := MustParseSVGPath(tt.p)
1317 q := MustParseSVGPath(tt.q)
1318 r := p.Div(q)
1319 test.T(t, r, MustParseSVGPath(tt.r))
1320
1321 p.Relate(q) // test no panic
1322 })
1323 }
1324}
1325
1326/*func TestPathCut(t *testing.T) {
1327 var tts = []struct {

Callers

nothing calls this directly

Calls 5

MustParseSVGPathFunction · 0.85
TMethod · 0.80
RelateMethod · 0.80
RunMethod · 0.45
DivMethod · 0.45

Tested by

no test coverage detected