()
| 632 | |
| 633 | |
| 634 | def test_interpolated_closepoly(): |
| 635 | codes = [Path.MOVETO] + [Path.LINETO]*2 + [Path.CLOSEPOLY] |
| 636 | vertices = [(4, 3), (5, 4), (5, 3), (0, 0)] |
| 637 | |
| 638 | path = Path(vertices, codes) |
| 639 | result = path.interpolated(2) |
| 640 | |
| 641 | expected_vertices = np.array([[4, 3], |
| 642 | [4.5, 3.5], |
| 643 | [5, 4], |
| 644 | [5, 3.5], |
| 645 | [5, 3], |
| 646 | [4.5, 3], |
| 647 | [4, 3]]) |
| 648 | expected_codes = [Path.MOVETO] + [Path.LINETO]*5 + [Path.CLOSEPOLY] |
| 649 | |
| 650 | np.testing.assert_allclose(result.vertices, expected_vertices) |
| 651 | np.testing.assert_array_equal(result.codes, expected_codes) |
| 652 | |
| 653 | # Usually closepoly is the last vertex but does not have to be. |
| 654 | codes += [Path.LINETO] |
| 655 | vertices += [(2, 1)] |
| 656 | |
| 657 | path = Path(vertices, codes) |
| 658 | result = path.interpolated(2) |
| 659 | |
| 660 | extra_expected_vertices = np.array([[3, 2], |
| 661 | [2, 1]]) |
| 662 | expected_vertices = np.concatenate([expected_vertices, extra_expected_vertices]) |
| 663 | |
| 664 | expected_codes += [Path.LINETO] * 2 |
| 665 | |
| 666 | np.testing.assert_allclose(result.vertices, expected_vertices) |
| 667 | np.testing.assert_array_equal(result.codes, expected_codes) |
| 668 | |
| 669 | |
| 670 | def test_interpolated_moveto_closepoly(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…