(t *testing.T)
| 716 | } |
| 717 | |
| 718 | func TestBentleyOttmannPerformance(t *testing.T) { |
| 719 | var tts = []struct { |
| 720 | p string |
| 721 | op pathOp |
| 722 | q string |
| 723 | d time.Duration |
| 724 | r string |
| 725 | }{ |
| 726 | // performance bug, takes >5s |
| 727 | {"M0.05603022976765715 -0.0003059739935906691L0.01800512753993644 -0.0030528993247571634z M0.024894563646512324 -0.002555207919613167L0.12000309429959088 -0.002555207919613167z", opSettle, "", 20 * time.Millisecond, ""}, |
| 728 | {"M0.05603022976765715 -0.0003059739935906691L0.01800512753993644 -0.0030528993247571634z M0.05603022976765715 -0.0003059739935906691L0.024894563646512324 -0.002555207919613167L0.12000309429959088 -0.002555207919613167z", opSettle, "", 20 * time.Millisecond, "M0.02489459 -0.00255521L0.12000309 -0.00255521L0.05603023 -0.00030597z"}, |
| 729 | } |
| 730 | |
| 731 | for _, tt := range tts { |
| 732 | t.Run(fmt.Sprint(tt.p), func(t *testing.T) { |
| 733 | ps := MustParseSVGPath(tt.p).Split() |
| 734 | var qs []*Path |
| 735 | if tt.q != "" { |
| 736 | qs = MustParseSVGPath(tt.q).Split() |
| 737 | } |
| 738 | |
| 739 | t0 := time.Now() |
| 740 | r := bentleyOttmann(ps, qs, tt.op, NonZero) |
| 741 | test.T(t, r.Merge(), MustParseSVGPath(tt.r)) |
| 742 | if d := time.Since(t0); tt.d < d { |
| 743 | test.Fail(t, fmt.Sprintf("takes too long: %v instead of <%v", d, tt.d)) |
| 744 | } |
| 745 | }) |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | func TestPathSettle(t *testing.T) { |
| 750 | var tts = []struct { |
nothing calls this directly
no test coverage detected