
    G8c"                        d dl Z d dlZd dlmZ d dlmZ d dlmZ	 d Z
 edg      d        Z edg      d        Zd Z ed	gd
 ej                         dk(  rd nd ed            d        Z edgd
 ej                         dk(  rd nd ed            d        Z edgd
d      d        Z edgdd
 ej                         dk(  rd nd      d        Z edgdd
      d        Zd  Zy)!    N)image_comparisonc                 R    | j                  ddd|z   fddt        |dd             y )	N       ?r   r      bk)
arrowstylefcec)xyxytextsize
arrowprops)annotatedict)axtrs      E/usr/lib/python3/dist-packages/matplotlib/tests/test_arrow_patches.py
draw_arrowr      s2    KKS1W~jr1#&30  1    fancyarrow_test_imagec            	      Z   g d} ddt         j                  j                         g}t        j                  t        |      t        |       ddt        d            \  }}t        |       D ]?  \  }}t        |      D ],  \  }}|||f   }t        |||       |j                  dd	       . A y )
N)皙?333333?皙?皙?r   fancysimpleF)   g      @   )aspect)squeezefigsize
subplot_kw)	labelleftlabelbottom)
mpatches
ArrowStyleFancypltsubplotslenr   	enumerater   tick_params)	r   r   figaxsi_rr1i_tt1r   s	            r   test_fancyarrowr8      s     	 A	(H//5578A||CFCFE$,QIHC Q< ?R | 	?GCS#XBr2r"NNUN>	??r   zboxarrow_test_image.pngc                  P   t         j                  j                         } t        |       }d}||z  dz   }t	        j
                  d|dz  f      }d}t        t        |             D ]?  \  }}|j                  d||z
  |z  dz
  |z  |d||j                  t        |dd	
             A y )Ng333333?r   gUUUUUU@g      ?r&   g5@centerwr
   )boxstyler   r   )har   	transformbbox)r*   BoxStyle
get_stylesr/   r-   figurer0   sortedtexttransFigurer   )stylesnspacing	figheightr2   fontsizei	stylenames           r   test_boxarrowrN      s     ))+FFAGWr!I
**gy37
8CH!&.1 @9A(3.	99??I##>	 	 	@@r   c            	          t        j                  ddd      } | j                         }|j                  ddg       |j	                  ddg       |j                  t        j                  ddd	d
d             | S )z
    Convenience function that prepares and returns a FancyArrowPatch. It aims
    at being used to test that the size of the arrow head does not depend on
    the DPI value of the exported picture.

    NB: this function *is not* a test in itself!
    fancyarrow_dpi_cor_test)      2   )r&   dpir   r#   )r   r   )皙?g333333?rR   ->d   )posAposBlwr   mutation_scale)r-   rC   add_subplotset_xlimset_ylim	add_patchr*   FancyArrowPatch)fig2r   s     r   !__prepare_fancyarrow_dpi_cor_testrb   3   sq     ::/RHD				BKKAKKALL))z
-.49<> ? Kr   zfancyarrow_dpi_cor_100dpi.pngTx86_64g{Gz?rW   )rT   )remove_texttolsavefig_kwargc                      t                y)a   
    Check the export of a FancyArrowPatch @ 100 DPI. FancyArrowPatch is
    instantiated through a dedicated function because another similar test
    checks a similar export but with a different DPI value.

    Remark: test only a rasterized format.
    Nrb    r   r   test_fancyarrow_dpi_cor_100dpirj   E   s
     &'r   zfancyarrow_dpi_cor_200dpi.png   c                      t                y)z
    As test_fancyarrow_dpi_cor_100dpi, but exports @ 200 DPI. The relative size
    of the arrow head should be the same.
    Nrh   ri   r   r   test_fancyarrow_dpi_cor_200dpirm   T   s
     &'r   zfancyarrow_dash.pngdefault)rd   stylec            
          t        j                         \  } }t        j                  dddddddd	      }t        j                  dddd
dddd	      }|j	                  |       |j	                  |       y )N)r   r   r   z-|>zangle3,angleA=0,angleB=90g      $@   dashedr
   )r   connectionstyler[   	linewidth	linestylecolorangle3dotted)r-   r.   r*   r`   r_   )r2   r   ee2s       r   test_fancyarrow_dashr{   `   sx    llnGC  ,11L04+,+3'*	,A 
	!	!&*-22:15,-,4(+
-B LLOLLr   zarrow_styles.pngmpl20g{Gzt?)ro   rd   re   c                     t         j                  j                         } t        |       }t	        j
                  d      \  }}|j                  dd       |j                  d|       |j                  dddd       t        t        |             D ]E  \  }}t        j                  d|dz  d	z  z   |fd
|dz  d	z  z   |f|d      }|j                  |       G t        g d      D ]  \  }}|}|d   dk7  r|dz  }|d   dk7  r|dz  }t        ddg      D ]Z  \  }}	|j                  dt        |	            }
t        j                  dd|z  |z   fdd|z  |z   f|
d      }|j                  |       \  y )N)r"   r"   r:   r   r#   )leftrightbottomtopr   rq   g?g?   )r   r[   )z]-[z]-z-[z|-|-z,angleA=ANGLEz,angleB=ANGLEi<   ANGLEg?g?)r*   r+   rB   r/   r-   r.   r]   r^   subplots_adjustr0   rD   r`   r_   replacestr)rG   rH   r2   r   rL   rM   patchro   jangler   s              r   test_arrow_stylesr   u   s      ++-FFAll6*GCKK1KKAQaq9!&.1 9((#Q*<a)@*.!a%*=q)A4=8:< 	U ""<=  9Q<3_$ER=C_$E!3), 	 HAuwE
;J,,dAaC!G_sAaC!Gn8B<>@E LL	  r   zconnection_styles.png)ro   rd   c                  l   t         j                  j                         } t        |       }t	        j
                  d      \  }}|j                  dd       |j                  d|       t        t        |             D ]7  \  }}t        j                  d|fd|dz   fd	|d
      }|j                  |       9 y )N)   
   r:   r   r#   r~   r   rU   r   rV   r   )r   rs   r[   )r*   ConnectionStylerB   r/   r-   r.   r]   r^   r0   rD   r`   r_   )rG   rH   r2   r   rL   rM   r   s          r   test_connection_stylesr      s    %%002FFAll7+GCKK1KKA!&.1 9((#qCS>489B8:< 	Ur   c                     t         j                  j                  dd      } t        j                  dd|       }t	        j
                  t              5  t        j                         j                  |       d d d        t         j                  j                  dd      }t        j                  dd|      }t        j                         j                  |       y # 1 sw Y   fxY w)N   rk   )angleAangleB)r   r   r   )rs   gh@)
r*   r   Angle3r`   pytestraises
ValueErrorr-   gcar_   )conn_style_1p1conn_style_2p2s       r   test_invalid_intersectionr      s    ++22"S2IL		!	!(H2>
@B	z	"  	B  ++22"U2KL		!	!(H2>
@BGGI   s   $CC%)r   platformmatplotlib.pyplotpyplotr-   matplotlib.testing.decoratorsr   matplotlib.patchespatchesr*   r   r8   rN   rb   machiner   rj   rm   r{   r   r   r   ri   r   r   <module>r      s]      : %1 *+,? -? ,-.@ /@($ 23+8++-9at $/	(/	( 23+8++-9at $/(/( ()t9M N( %&g4+8++-9auF F > *+7M N 
r   