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

Skip to content

Commit 702129b

Browse files
streamlined image comparison tests for text antialiasing
1 parent 8890c34 commit 702129b

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
@@ -933,27 +933,16 @@ def test_annotation_antialiased():
933933

934934
@check_figures_equal()
935935
def test_text_antialiased_off_default_vs_manual(fig_test, fig_ref):
936-
# note that the field antialiased is for Text object
937-
# therefore in the test we will make axis antialiasing identical
938-
# which is determined by rcParams['text.antialiased'] when axis is created
939-
# also note that there is no way to change this for axis after creating it
940-
941-
mpl.rcParams['text.antialiased'] = False
942-
# axis: antialiased == rcParams['text.antialiased'] == False
943-
# text: antialiased == False
944-
fig_test.subplots().text(0.5, 0.5, '6 inches x 2 inches',
936+
fig_test.text(0.5, 0.5, '6 inches x 2 inches',
945937
antialiased=False)
946938

947939
mpl.rcParams['text.antialiased'] = False
948-
# axis: antialiased == rcParams['text.antialiased'] == False
949-
# text: antialiased == rcParams['text.antialiased'] == False
950-
fig_ref.subplots().text(0.5, 0.5, '6 inches x 2 inches')
940+
fig_ref.text(0.5, 0.5, '6 inches x 2 inches')
951941

952942

953943
@check_figures_equal()
954944
def test_text_antialiased_on_default_vs_manual(fig_test, fig_ref):
955-
mpl.rcParams['text.antialiased'] = True
956-
fig_test.subplots().text(0.5, 0.5, '6 inches x 2 inches', antialiased=True)
945+
fig_test.text(0.5, 0.5, '6 inches x 2 inches', antialiased=True)
957946

958947
mpl.rcParams['text.antialiased'] = True
959-
fig_ref.subplots().text(0.5, 0.5, '6 inches x 2 inches')
948+
fig_ref.text(0.5, 0.5, '6 inches x 2 inches')

0 commit comments

Comments
 (0)