§
    ‡Ûg‹  ã                   ó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`.
é    N)Úmockc                  óÐ   — t          j        dd¦  «        \  } }|                     ddgddg¦  «         |                     d¦  «         |j        j                             ¦   «          |S )z"Create a plot and return its axes.é   r   éÈ   g      ð?)ÚpltÚsubplotsÚplotÚ
set_aspectÚfigureÚcanvasÚdraw)ÚfigÚaxs     úP/granary/edev/quantum/lib/python3.11/site-packages/matplotlib/testing/widgets.pyÚget_axr      sa   € åŒl˜1˜aÑ Ô �G€CˆØ‡G‚GˆQ�ˆH�q˜#�hÑÔÐØ‡M‚M�#ÑÔÐØ„IÔ×ÒÑÔÐØ€Ió    c                  ó   — d S ©N© )ÚargsÚkwargss     r   Únoopr      s   € Ø€Dr   r   c                 ó&  — t          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 : int
        x coord of mouse in data coords.
    ydata : int
        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‰KŒK€EØ€E„LØ”|×-Ò-°°u¨~Ø05°u¨~ð/?ñ @ô @Ø@AôCÑ€E„GˆUŒWà$ eÐ€E„K�”Ø€E„LØ”9Ô#€E„LØ€E„IØ€E„JØ€E„NØ€E„JØ€Lr   c                 ón   — t          | j        |||||¦  «        }t          | |¦  «        } ||¦  «         dS )aW  
    Trigger an event on the given tool.

    Parameters
    ----------
    tool : matplotlib.widgets.RectangleSelector
    etype : str
        The event to trigger.
    xdata : int
        x coord of mouse in data coords.
    ydata : int
        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/   C   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)r/   )r,   ÚstartÚendr$   s       r   Úclick_and_dragr8   \   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__Úmatplotlib.pyplotÚpyplotr   Úunittestr   r   r   r)   r/   r8   r   r   r   ú<module>r=      sš   ððð ð  Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð	ð 	ð 	ð&ð &ð &ð &ðRð ð ð ð2$ð $ð $ð $ð $ð $r   