Ë
    µ2Úi�  ã                   óD   — d Z ddlmZ ddlmZ d„ Zd„ Zd	d„Zd	d„Z	d
d„Z
y)z|
========================
Widget testing utilities
========================

See also :mod:`matplotlib.tests.test_widgets`.
é    )ÚmockNc                  óÎ   — t        j                  dd«      \  } }|j                  ddgddg«       |j                  d«       |j                  j
                  j                  «        |S )z"Create a plot and return its axes.é   r   éÈ   g      ð?)ÚpltÚsubplotsÚplotÚ
set_aspectÚfigureÚcanvasÚdraw)ÚfigÚaxs     úQ/var/www/html/acx/venv/lib/python3.12/site-packages/matplotlib/testing/widgets.pyÚget_axr      sS   € ä�l‰l˜1˜aÓ �G€CˆØ‡G�GˆQ�ˆH�q˜#�hÔØ‡M�M�#ÔØ‡I�I×Ñ×ÑÔØ€Ió    c                   ó   — y ©N© )ÚargsÚkwargss     r   Únoopr      s   € Ør   c                 ó8  — t        j                  «       }||_        | j                  j	                  ||f||fg«      d   \  |_        |_        ||c|_        |_        | |_	        | j                  j                  |_        ||_        ||_        d|_        d|_        |S )a  
    Create a mock event that can stand in for `.Event` and its subclasses.

    This event is intended to be used in tests where it can be passed into
    event handling functions.

    Parameters
    ----------
    ax : `~matplotlib.axes.Axes`
        The axes the event will be in.
    xdata : float
        x coord of mouse in data coords.
    ydata : float
        y coord of mouse in data coords.
    button : None or `MouseButton` or {'up', 'down'}
        The mouse button pressed in this event (see also `.MouseEvent`).
    key : None or str
        The key pressed when the mouse event triggered (see also `.KeyEvent`).
    step : int
        Number of scroll steps (positive for 'up', negative for 'down').

    Returns
    -------
    event
        A `.Event`\-like Mock instance.
    r   NÚCustom)r   ÚMockÚbuttonÚ	transDataÚ	transformÚxÚyÚxdataÚydataÚinaxesr   r   ÚkeyÚstepÚguiEventÚname)r   r   r!   r"   r$   r%   Úevents          r   Ú
mock_eventr)      s˜   € ô6 �I‰I‹K€EØ€E„LØ—|‘|×-Ñ-°°u¨~Ø05°u¨~ð/?ó @Ø@AñCÑ€E„GˆUŒWà$ eÐ€E„K�”Ø€E„LØ—9‘9×#Ñ#€E„LØ€E„IØ€E„JØ€E„NØ€E„JØ€Lr   c                 ó`   — t        | j                  |||||«      }t        | |«      } ||«       y)aT  
    Trigger an event on the given tool.

    Parameters
    ----------
    tool : matplotlib.widgets.AxesWidget
    etype : str
        The event to trigger.
    xdata : float
        x coord of mouse in data coords.
    ydata : float
        y coord of mouse in data coords.
    button : None or `MouseButton` or {'up', 'down'}
        The mouse button pressed in this event (see also `.MouseEvent`).
    key : None or str
        The key pressed when the mouse event triggered (see also `.KeyEvent`).
    step : int
        Number of scroll steps (positive for 'up', negative for 'down').
    N)r)   r   Úgetattr)	ÚtoolÚetyper   r!   r"   r$   r%   r(   Úfuncs	            r   Údo_eventr/   D   s/   € ô( �t—w‘w ¨¨u°c¸4Ó@€EÜ�4˜Ó€DÙˆ…Kr   c                 óî   — |�t        | d|d   |d   d|¬«       t        | d|d   |d   d¬«       t        | d|d   |d   d¬«       t        | d	|d   |d   d¬«       |�t        | d
|d   |d   d|¬«       yy)a}  
    Helper to simulate a mouse drag operation.

    Parameters
    ----------
    tool : `~matplotlib.widgets.Widget`
    start : [float, float]
        Starting point in data coordinates.
    end : [float, float]
        End point in data coordinates.
    key : None or str
         An optional key that is pressed during the whole operation
         (see also `.KeyEvent`).
    NÚon_key_pressr   r   )r!   r"   r   r$   Úpress)r!   r"   r   ÚonmoveÚreleaseÚon_key_release)r/   )r,   ÚstartÚendr$   s       r   Úclick_and_dragr8   ]   s˜   € ð €ä��~¨U°1©X¸UÀ1¹XØ˜sõ	$ô ˆT�7 %¨¡(°%¸±(À1ÕEÜˆT�8 3 q¡6°°Q±ÀÕBÜˆT�9 C¨¡F°#°a±&ÀÕCØ
€ä�Ð'¨s°1©v¸SÀ¹VØ˜sö	$ð r   )r   r   r   Nr   r   )Ú__doc__Úunittestr   Úmatplotlib.pyplotÚpyplotr   r   r   r)   r/   r8   r   r   r   ú<module>r=      s,   ðñõ å òò	ó&óRô2$r   