| 424 | } |
| 425 | |
| 426 | func TestPathTransform(t *testing.T) { |
| 427 | var tts = []struct { |
| 428 | p string |
| 429 | m Matrix |
| 430 | r string |
| 431 | }{ |
| 432 | {"L10 0Q15 10 20 0C23 10 27 10 30 0z", Identity.Translate(0, 100), "M0 100L10 100Q15 110 20 100C23 110 27 110 30 100z"}, |
| 433 | {"A10 10 0 0 0 20 0", Identity.Translate(0, 10), "M0 10A10 10 0 0 0 20 10"}, |
| 434 | {"A10 10 0 0 0 20 0", Identity.Scale(1, -1), "A10 10 0 0 1 20 0"}, |
| 435 | {"A10 5 0 0 0 20 0", Identity.Rotate(270), "A10 5 90 0 0 0 -20"}, |
| 436 | {"A10 10 0 0 0 20 0", Identity.Rotate(120).Scale(1, -2), "A20 10 30 0 1 -10 17.3205080757"}, |
| 437 | } |
| 438 | for _, tt := range tts { |
| 439 | t.Run(tt.p, func(t *testing.T) { |
| 440 | test.T(t, MustParseSVGPath(tt.p).Transform(tt.m), MustParseSVGPath(tt.r)) |
| 441 | }) |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | func TestPathReplace(t *testing.T) { |
| 446 | line := func(p0, p1 Point) *Path { |