@@ -52,6 +52,54 @@ def test_boxarrow():
52
52
bbox = dict (boxstyle = stylename , fc = "w" , ec = "k" ))
53
53
54
54
55
+ def prepare_fancyarrow_for_head_size_test ():
56
+ """
57
+ Convenience function that prepares and return a FancyArrowPatch. It aims
58
+ at being used to test that the size of the arrow head does not depend on
59
+ the DPI value of the exported picture.
60
+
61
+ NB: this function *is not* a test in itself!
62
+ """
63
+ fig = plt .figure (figsize = (6 , 4 ), dpi = 50 )
64
+ ax = fig .add_subplot (111 )
65
+ ax .set_xlim ([0 , 1 ])
66
+ ax .set_ylim ([0 , 1 ])
67
+ ax .add_patch (mpatches .FancyArrowPatch (posA = (0.3 , 0.4 ), posB = (0.8 , 0.6 ),
68
+ lw = 3 , arrowstyle = u'->' ,
69
+ mutation_scale = 150 ))
70
+ return fig
71
+
72
+
73
+ @image_comparison (baseline_images = ['fancyarrow_head_size_100dpi' ],
74
+ remove_text = True , extensions = ['svg' , 'pdf' , 'png' ],
75
+ savefig_kwarg = dict (dpi = 100 ))
76
+ def test_fancy_arrow_patch_head_size_100dpi ():
77
+ """
78
+ Check the export of a FancyArrowPatch @ 100 DPI. The FancyArrowPatch
79
+ is instanciated through a dedicated function because another similar test
80
+ checks the same export but with a different DPI value.
81
+
82
+ Remark: may be more explicit to create a dedicated test for SVG and PDF,
83
+ as a DPI value is not very relevant here...
84
+ """
85
+
86
+ prepare_fancyarrow_for_head_size_test ()
87
+
88
+
89
+ @image_comparison (baseline_images = ['fancyarrow_head_size_300dpi' ],
90
+ remove_text = True ,
91
+ extensions = ['png' ], # pdf and svg already tested @ 100 DPI
92
+ savefig_kwarg = dict (dpi = 300 ))
93
+ def test_fancy_arrow_patch_head_size_300dpi ():
94
+ """
95
+ Check the export of a FancyArrowPatch @ 300 DPI. The FancyArrowPatch
96
+ is instanciated through a dedicated function because another similar test
97
+ checks the same export but with a different DPI value.
98
+ """
99
+
100
+ prepare_fancyarrow_for_head_size_test ()
101
+
102
+
55
103
if __name__ == '__main__' :
56
104
import nose
57
105
nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
0 commit comments