|
9 | 9 | import matplotlib.pyplot as plt
|
10 | 10 | import matplotlib.patches as mpatches
|
11 | 11 | import matplotlib.transforms as mtransforms
|
| 12 | +from matplotlib.transforms import Affine2D, Bbox, TransformedBbox |
12 | 13 | from matplotlib.path import Path
|
13 | 14 | from matplotlib.testing.decorators import image_comparison, check_figures_equal
|
14 | 15 |
|
@@ -755,3 +756,14 @@ def test_offset_copy_errors():
|
755 | 756 | with pytest.raises(ValueError,
|
756 | 757 | match='For units of inches or points a fig kwarg is needed'):
|
757 | 758 | mtransforms.offset_copy(None, units='inches')
|
| 759 | + |
| 760 | + |
| 761 | +def test_transformedbbox_contains(): |
| 762 | + bb = TransformedBbox(Bbox.unit(), Affine2D().rotate_deg(30)) |
| 763 | + assert bb.contains(.8, .5) |
| 764 | + assert bb.contains(-.4, .85) |
| 765 | + assert not bb.contains(.9, .5) |
| 766 | + bb = TransformedBbox(Bbox.unit(), Affine2D().translate(.25, .5)) |
| 767 | + assert bb.contains(1.25, 1.5) |
| 768 | + assert not bb.fully_contains(1.25, 1.5) |
| 769 | + assert not bb.fully_contains(.1, .1) |
0 commit comments