§
    p¬¸j˜  ã                   óF   — 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
dS )z|
========================
Widget testing utilities
========================

See also :mod:`matplotlib.tests.test_widgets`.
é    )ÚmockNc                  óÆ   — t          j        dd¦  «        \  } }|                     ddgddg¦  «         |                     d¦  «         | j                             ¦   «          |S )z"Create a plot and return its Axes.é   r   éÈ   g      ð?)ÚpltÚsubplotsÚplotÚ
set_aspectÚcanvasÚdraw)ÚfigÚaxs     új/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/matplotlib/testing/widgets.pyÚget_axr      s\   € åŒl˜1˜aÑ Ô �G€CˆØ‡G‚GˆQ�ˆH�q˜#�hÑÔÐØ‡M‚M�#ÑÔÐØ„J‡O‚OÑÔÐØ€Ió    c                  ó   — d S ©N© )ÚargsÚkwargss     r   Únoopr      s   € Ø€Dr   r   c                 óD  — t          j        ¦   «         }||_        | j                             ||f||fg¦  «        d         \  |_        |_        ||c|_        |_        | |_	        |  
                    d¬¦  «        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   T)ÚrootNÚCustom)r   ÚMockÚbuttonÚ	transDataÚ	transformÚxÚyÚxdataÚydataÚinaxesÚ
get_figurer   ÚkeyÚstepÚguiEventÚname)r   r   r!   r"   r%   r&   Úevents          r   Ú
mock_eventr*      s£   € õ6 ŒI‰KŒK€EØ€E„LØ”|×-Ò-°°u¨~Ø05°u¨~ð/?ñ @ô @Ø@AôCÑ€E„GˆUŒWà$ eÐ€E„K�”Ø€E„LØ—=’= d�=Ñ+Ô+Ô2€E„LØ€E„IØ€E„JØ€E„NØ€E„JØ€Lr   c                 ón   — t          | j        |||||¦  «        }t          | |¦  «        } ||¦  «         dS )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_eventr0   D   s=   € õ( �t”w ¨¨u°c¸4Ñ@Ô@€EÝ�4˜ÑÔ€DØ€Dˆ�K„K€K€K€Kr   c                 óV  — |�!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|¬¦  «         dS dS )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)r0   )r-   ÚstartÚendr%   s       r   Úclick_and_dragr9   ]   sÝ   € ð €å��~¨U°1¬X¸UÀ1¼XØ˜sð	$ñ 	$ô 	$ð 	$õ ˆT�7 %¨¤(°%¸´(À1ÐEÑEÔEÐEÝˆT�8 3 q¤6°°Q´ÀÐBÑBÔBÐBÝˆT�9 C¨¤F°#°a´&ÀÐCÑCÔCÐCØ
€å�Ð'¨s°1¬v¸SÀ¼VØ˜sð	$ñ 	$ô 	$ð 	$ð 	$ð 	$ð €r   )r   r   r   Nr   r   )Ú__doc__Úunittestr   Úmatplotlib.pyplotÚpyplotr   r   r   r*   r0   r9   r   r   r   ú<module>r>      sš   ððð ð Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð ðð ð ð	ð 	ð 	ð&ð &ð &ð &ðRð ð ð ð2$ð $ð $ð $ð $ð $r   