Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98f397a

Browse files
streamlined image comparison tests for text antialiasing
1 parent 875f8fe commit 98f397a

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

lib/matplotlib/tests/test_text.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -949,27 +949,16 @@ def test_annotation_antialiased():
949949

950950
@check_figures_equal()
951951
def test_text_antialiased_off_default_vs_manual(fig_test, fig_ref):
952-
# note that the field antialiased is for Text object
953-
# therefore in the test we will make axis antialiasing identical
954-
# which is determined by rcParams['text.antialiased'] when axis is created
955-
# also note that there is no way to change this for axis after creating it
956-
957-
mpl.rcParams['text.antialiased'] = False
958-
# axis: antialiased == rcParams['text.antialiased'] == False
959-
# text: antialiased == False
960-
fig_test.subplots().text(0.5, 0.5, '6 inches x 2 inches',
952+
fig_test.text(0.5, 0.5, '6 inches x 2 inches',
961953
antialiased=False)
962954

963955
mpl.rcParams['text.antialiased'] = False
964-
# axis: antialiased == rcParams['text.antialiased'] == False
965-
# text: antialiased == rcParams['text.antialiased'] == False
966-
fig_ref.subplots().text(0.5, 0.5, '6 inches x 2 inches')
956+
fig_ref.text(0.5, 0.5, '6 inches x 2 inches')
967957

968958

969959
@check_figures_equal()
970960
def test_text_antialiased_on_default_vs_manual(fig_test, fig_ref):
971-
mpl.rcParams['text.antialiased'] = True
972-
fig_test.subplots().text(0.5, 0.5, '6 inches x 2 inches', antialiased=True)
961+
fig_test.text(0.5, 0.5, '6 inches x 2 inches', antialiased=True)
973962

974963
mpl.rcParams['text.antialiased'] = True
975-
fig_ref.subplots().text(0.5, 0.5, '6 inches x 2 inches')
964+
fig_ref.text(0.5, 0.5, '6 inches x 2 inches')

0 commit comments

Comments
 (0)