()
| 20 | |
| 21 | |
| 22 | def test_uses_per_path(): |
| 23 | id = transforms.Affine2D() |
| 24 | paths = [path.Path.unit_regular_polygon(i) for i in range(3, 7)] |
| 25 | tforms_matrices = [id.rotate(i).get_matrix().copy() for i in range(1, 5)] |
| 26 | offsets = np.arange(20).reshape((10, 2)) |
| 27 | facecolors = ['red', 'green'] |
| 28 | edgecolors = ['red', 'green'] |
| 29 | |
| 30 | def check(master_transform, paths, all_transforms, |
| 31 | offsets, facecolors, edgecolors): |
| 32 | rb = RendererBase() |
| 33 | raw_paths = list(rb._iter_collection_raw_paths( |
| 34 | master_transform, paths, all_transforms)) |
| 35 | gc = rb.new_gc() |
| 36 | ids = [path_id for xo, yo, path_id, gc0, rgbFace in |
| 37 | rb._iter_collection( |
| 38 | gc, range(len(raw_paths)), offsets, |
| 39 | transforms.AffineDeltaTransform(master_transform), |
| 40 | facecolors, edgecolors, [], [], [False], |
| 41 | [], 'screen', hatchcolors=[])] |
| 42 | uses = rb._iter_collection_uses_per_path( |
| 43 | paths, all_transforms, offsets, facecolors, edgecolors) |
| 44 | if raw_paths: |
| 45 | seen = np.bincount(ids, minlength=len(raw_paths)) |
| 46 | assert set(seen).issubset([uses - 1, uses]) |
| 47 | |
| 48 | check(id, paths, tforms_matrices, offsets, facecolors, edgecolors) |
| 49 | check(id, paths[0:1], tforms_matrices, offsets, facecolors, edgecolors) |
| 50 | check(id, [], tforms_matrices, offsets, facecolors, edgecolors) |
| 51 | check(id, paths, tforms_matrices[0:1], offsets, facecolors, edgecolors) |
| 52 | check(id, paths, [], offsets, facecolors, edgecolors) |
| 53 | for n in range(0, offsets.shape[0]): |
| 54 | check(id, paths, tforms_matrices, offsets[0:n, :], |
| 55 | facecolors, edgecolors) |
| 56 | check(id, paths, tforms_matrices, offsets, [], edgecolors) |
| 57 | check(id, paths, tforms_matrices, offsets, facecolors, []) |
| 58 | check(id, paths, tforms_matrices, offsets, [], []) |
| 59 | check(id, paths, tforms_matrices, offsets, facecolors[0:1], edgecolors) |
| 60 | |
| 61 | |
| 62 | def test_canvas_ctor(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…