File tree 2 files changed +17
-1
lines changed 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -701,6 +701,22 @@ def test_wrap():
701
701
'times.' )
702
702
703
703
704
+ def test_get_window_extent_wrapped ():
705
+ # Test that a long title that wraps to two lines has the same vertical
706
+ # extent as an explicit two line title.
707
+
708
+ fig1 = plt .figure (figsize = (3 , 3 ))
709
+ fig1 .suptitle ("suptitle that is clearly too long in this case" , wrap = True )
710
+ window_extent_test = fig1 ._suptitle .get_window_extent ()
711
+
712
+ fig2 = plt .figure (figsize = (3 , 3 ))
713
+ fig2 .suptitle ("suptitle that is clearly\n too long in this case" )
714
+ window_extent_ref = fig2 ._suptitle .get_window_extent ()
715
+
716
+ assert window_extent_test .y0 == window_extent_ref .y0
717
+ assert window_extent_test .y1 == window_extent_ref .y1
718
+
719
+
704
720
def test_long_word_wrap ():
705
721
fig = plt .figure (figsize = (6 , 4 ))
706
722
text = fig .text (9.5 , 8 , 'Alonglineoftexttowrap' , wrap = True )
Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ def _get_layout(self, renderer):
367
367
of a rotated text when necessary.
368
368
"""
369
369
thisx , thisy = 0.0 , 0.0
370
- lines = self .get_text ().split ("\n " ) # Ensures lines is not empty.
370
+ lines = self ._get_wrapped_text ().split ("\n " ) # Ensures lines is not empty.
371
371
372
372
ws = []
373
373
hs = []
You can’t perform that action at this time.
0 commit comments