o
    i                     @   s  d dl Z d dlZd dlmZ d dlmZ d dlmZ	 dd Z
edgdd Zedgd	d
 Zdd Zedgde dkr@d ndeddddd Zedgde dkrXd ndeddddd Zedgddddd Zedgd dd!d"d# Zed$gd dd!d%d& Zd'd( ZdS ))    N)image_comparisonc              
   C   s*   | j ddd| fddt|dddd d S )	N       ?r   r      bk)
arrowstylefcec)xyxytextsize
arrowprops)annotatedict)axtr r   ^/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/tests/test_arrow_patches.py
draw_arrow   s
   
r   fancyarrow_test_imagec            	      C   s   g d} ddt j g}tjt|t| ddtddd\}}t| D ] \}}t|D ]\}}|||f }t||| |j	ddd	 q+q#d S )
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   r   r   r   test_fancyarrow   s   

r5   zboxarrow_test_image.pngc                  C   s   t j } t| }d}|| d }tjd|d fd}d}tt| D ]\}}|jd|| | d | |d||j	t
|dd	d
d q#d S )Ng333333?r   gUUUUUU@g      ?r#   g5@centerwr   )boxstyler
   r   )har   	transformbbox)r'   BoxStyle
get_stylesr,   r*   figurer-   sortedtexttransFigurer   )stylesnspacing	figheightr/   fontsizei	stylenamer   r   r   test_boxarrow   s   
rJ   c               	   C   sT   t jdddd} | d}|ddg |ddg |tjd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#   dpio   r   r    )r   r   )皙?g333333?rM   ->d   )posAposBlwr	   mutation_scale)r*   r?   add_subplotset_xlimset_ylim	add_patchr'   FancyArrowPatch)fig2r   r   r   r   !__prepare_fancyarrow_dpi_cor_test3   s   
r^   zfancyarrow_dpi_cor_100dpi.pngTx86_64g{Gz?rS   )rO   )remove_texttolsavefig_kwargc                   C   
   t   dS )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r^   r   r   r   r   test_fancyarrow_dpi_cor_100dpiE   s   
re   zfancyarrow_dpi_cor_200dpi.png   c                   C   rc   )z
    As test_fancyarrow_dpi_cor_100dpi, but exports @ 200 DPI. The relative size
    of the arrow head should be the same.
    Nrd   r   r   r   r   test_fancyarrow_dpi_cor_200dpiT   s   
	rg   zfancyarrow_dash.pngdefault)r`   stylec               
   C   sX   t  \} }tjddddddddd	}tjdddd
ddddd	}|| || d S )N)r   r   r   z-|>zangle3,angleA=0,angleB=90g      $@   dashedr   )r	   connectionstylerW   	linewidth	linestylecolorangle3dotted)r*   r+   r'   r\   r[   )r/   r   ee2r   r   r   test_fancyarrow_dash`   s&   
rt   zarrow_styles.pngmpl20)ri   r`   c                  C   sx   t j } t| }tjdd\}}|dd |d| tt	| D ]\}}t j
d|fd|f|dd	}|| q#d S )
N   
   r6   r   r    r   rQ      )r	   rW   )r'   r(   r>   r,   r*   r+   rY   rZ   r-   r@   r\   r[   rC   rD   r/   r   rH   rI   patchr   r   r   test_arrow_stylesu   s   
r}   zconnection_styles.pngc                  C   s~   t j } t| }tjdd\}}|dd |d| tt	| D ]\}}t j
d|fd|d fd	|d
d}|| q#d S )Nrv   r6   r   r    ry   r   rQ   r   rR   rz   )r	   rl   rW   )r'   ConnectionStyler>   r,   r*   r+   rY   rZ   r-   r@   r\   r[   r{   r   r   r   test_connection_styles   s   
r   c                  C   s   t jjddd} t jdd| d}tt t 	| W d    n1 s'w   Y  t jjddd}t jdd|d}t 	| d S )N   rf   )angleAangleB)r   r   r   )rl   gh@)
r'   r~   Angle3r\   pytestraises
ValueErrorr*   gcar[   )conn_style_1p1conn_style_2p2r   r   r   test_invalid_intersection   s   r   )r   platformmatplotlib.pyplotpyplotr*   matplotlib.testing.decoratorsr   matplotlib.patchespatchesr'   r   r5   rJ   r^   machiner   re   rg   rt   r}   r   r   r   r   r   r   <module>   s8    



	


