File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -701,6 +701,22 @@ def test_wrap():
701701 'times.' )
702702
703703
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+
704720def test_long_word_wrap ():
705721 fig = plt .figure (figsize = (6 , 4 ))
706722 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):
367367 of a rotated text when necessary.
368368 """
369369 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.
371371
372372 ws = []
373373 hs = []
You can’t perform that action at this time.
0 commit comments