
    zYHh                     >   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 ej                         dk(  rd nd      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 ej                         dk(  rd n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      \/var/www/html/planif/env/lib/python3.12/site-packages/matplotlib/tests/test_arrow_patches.py
draw_arrowr      s2    KKS1W~jr1#&30  1    zfancyarrow_test_image.pngx86_64g~jt?)tolc            	      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_fancyarrowr9      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_stylesr0   r.   figurer1   sortedtexttransFigurer   )stylesnspacing	figheightr3   fontsizei	stylenames           r   test_boxarrowrO      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?rS   ->d   )posAposBlwr   mutation_scale)r.   rD   add_subplotset_xlimset_ylim	add_patchr+   FancyArrowPatch)fig2r   s     r   !__prepare_fancyarrow_dpi_cor_testrc   4   sq     ::/RHD				BKKAKKALL))z
-.49<> ? Kr   zfancyarrow_dpi_cor_100dpi.pngTg{Gz?rX   )rU   )remove_textr   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rc    r   r   test_fancyarrow_dpi_cor_100dpiri   F   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.
    Nrg   rh   r   r   test_fancyarrow_dpi_cor_200dpirl   U   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+   ra   r`   )r3   r   ee2s       r   test_fancyarrow_dashrz   a   sx    llnGC  ,11L04+,+3'*	,A 
	!	!&*-22:15,-,4(+
-B LLOLLr   zarrow_styles.pngmpl20)rn   rd   r   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    rp   g?g?   )r   r\   )z]-[z]-z-[z|-|-z,angleA=ANGLEz,angleB=ANGLEi<   ANGLEg?g?)r+   r,   rC   r0   r.   r/   r^   r_   subplots_adjustr1   rE   ra   r`   replacestr)rH   rI   r3   r   rM   rN   patchrn   jangler   s              r   test_arrow_stylesr   v   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.pngg9v?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    rV   r   rW   r   )r   rr   r\   )r+   ConnectionStylerC   r0   r.   r/   r^   r_   r1   rE   ra   r`   )rH   rI   r3   r   rM   rN   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   rj   )angleAangleB)r   r   r   )rr   gh@)
r+   r   Angle3ra   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   machiner9   rO   rc   r   ri   rl   rz   r   r   r   rh   r   r   <module>r      s      : %1 ./+8++-9auF?F? ,-.@ /@($ 23+8++-9at $/	(/	( 23+8++-9at $/(/( ()t9M N( %&g4+8++-9atE E > *+7+8++-9auFF 
r   