
    &hZ3                         S SK r S SKrS SKrS SKrS SKrS\R                  " 5       ;   r " S S\ R                  5      r " S S\5      r " S S\5      r	\
S	:X  a  \ R                  " 5         gg)
    NDarwinc                   4    \ rS rSr\S 5       r\S 5       rSrg)
MouseTests   c                 @    [         R                  R                  5         g N)pygamedisplayinitclss    O/var/www/auris/envauris/lib/python3.13/site-packages/pygame/tests/mouse_test.py
setUpClassMouseTests.setUpClass   s     	    c                 @    [         R                  R                  5         g r   )r	   r
   quitr   s    r   tearDownClassMouseTests.tearDownClass   s    r    N)__name__
__module____qualname____firstlineno__classmethodr   r   __static_attributes__r   r   r   r   r      s(       r   r   c                        \ rS rSrS/rS rSrg)MouseModuleInteractiveTest   interactivec                 
   [         R                  R                  S5        [         R                  R	                  5         [         R
                  R                  5       (       d  g[         R                  R                  5       nSnU H  u  p4[         R
                  R                  X45        [         R                  R	                  5         [         R
                  R                  5       nUR                  5         SnSnU(       dn  US::  ah  XaR                  5       -  n[         R                  R	                  5        H%  nUR                  [         R                  :X  d  M#  SnM'     U(       d  US::  a  Mh  U R                  XSU45        M     g)zXEnsures set_pos works correctly.
Requires tester to move the mouse to be on the window.
)  r"   N))
   r   r   r   )  r   )r%   r%   )iU     )^   1   g        Fg     @@T)r	   r
   set_modeeventgetmouseget_focusedtimeClockset_posget_posticktypeMOUSEMOTIONassertEqual)	selfclockexpected_posxy	found_postime_passedready_to_testr*   s	            r   test_set_pos'MouseModuleInteractiveTest.test_set_pos   s    	
+||''))!!#T DALL  &LL,,.IJJLK!M#v(=zz|+#\\--/EzzV%7%77(, 0 $v(= YA/ !r   r   N)r   r   r   r   __tags__r>   r   r   r   r   r   r      s    H0r   r   c                      \ rS rSr\R
                  " \R                  R                  SS5      S:H  S5      S 5       r	\R
                  " \R                  R                  SS5      S:H  S5      S 5       r
\R
                  " \R                  R                  SS5      S:H  S5      S	 5       rS
 rS rS rS rS rS rS rS rSrg)MouseModuleTest9   SDL_VIDEODRIVER dummyz/Cursors not supported on headless test machinesc                 D   U R                  [        R                  5         [        R                  R	                  5         [        R
                  R                  5         SSS5        [        R                  R                  5         SnSnSnSnSn[        R                  R                  XX45      n[        R
                  R                  U5         [        R
                  R                  5       nU R                  U[        R                  R                  5        U R                  [        U5      U5        U H  nU R                  U[        5        M     [        R
                  R                  XX45        U R                  [        R
                  R                  5       U5        g! , (       d  f       GNH= f! [        R                   a[    U R                  [        R                  5         [        R
                  R                  5         SSS5         g! , (       d  f        g= ff = f)z#Ensures get_cursor works correctly.N   rI   r$   )r   `   x   ~   p   rJ   r   r   )            rP   rO   rJ   r      )assertRaisesr	   errorr
   r   r,   
get_cursorr   cursorsCursor
set_cursorassertIsInstancer5   lentuple)	r6   sizehotspotxormaskandmaskexpected_lengthexpected_cursorcursorinfos	            r   test_get_cursorMouseModuleTest.test_get_cursor:   sn    v||,NN!LL##% - 	27 ..//wP0	*\\,,.F!!&&..*?*?@S[/:%%dE2  LL##D7DV\\446H3 -,8 || 	*""6<<0'') 1000	*s6   =FCF0 
F-03H#HH
H	HHz.mouse.set_system_cursor only available in SDL2c                 R   [         R                  " SS9 n [         R                  " S5        U R                  [        R
                  5         [        R                  R                  5         [        R                  R                  [        R                  5        SSS5        [        R                  R                  5         U R                  [        5         [        R                  R                  S5        SSS5        U R                  [        5         [        R                  R                  S5        SSS5        U R                  [        5         [        R                  R                  SS5        SSS5        U R                  [        R
                  5         [        R                  R                  S5        SSS5        U R                  [        R                  R                  [        R                  5      S5        U R                  [        U5      S	5        U R!                  [#        S
 U 5       5      5        SSS5        g! , (       d  f       GN= f! , (       d  f       GNe= f! , (       d  f       GN:= f! , (       d  f       GN= f! , (       d  f       N= f! , (       d  f       g= f)z*Ensures set_system_cursor works correctly.T)recordalwaysNbrH   r$   i     c              3   V   #    U  H  n[        UR                  [        5      v   M!     g 7fr   )
issubclasscategoryDeprecationWarning).0warns     r   	<genexpr>9MouseModuleTest.test_set_system_cursor.<locals>.<genexpr>   s     PadJt}}.@AAas   '))warningscatch_warningssimplefilterrS   r	   rT   r
   r   r,   set_system_cursorSYSTEM_CURSOR_HANDr   	TypeErrorr5   SYSTEM_CURSOR_ARROWrZ   
assertTrueall)r6   ws     r   test_set_system_cursor&MouseModuleTest.test_set_system_cursorb   s    $$D1Q[!!(+ ""6<<0##%..v/H/HI 1 NN! ""9-..s3 .""9-..t4 .""9-..vv> . ""6<<0..t4 1 ..v/I/IJD
 SVQ'OOPaPP? 21 10 .----- 10+ 21s   7JAH?;J I3J I#0J!I5.'J J5BJ?
I		J
I 	J#
I2	-J5
J	?J
J	J
J&c                    SnSnSnSn[         R                  R                  XX45      n[         R                  n[         R                  R                  U5      n[         R                  " S5      n[         R                  R                  X(5      n	[         R
                  R                  5         U R                  [         R                  5         [         R                  R                  U5        SSS5        U R                  [         R                  5         [         R                  R                  U5        SSS5        U R                  [         R                  5         [         R                  R                  U	5        SSS5        [         R
                  R                  5         U R                  [        5         [         R                  R                  SX#U5        SSS5        U R                  [        5         [         R                  R                  USX45        SSS5        U R                  [        5         [         R                  R                  US	X45        SSS5        U R                  [        5         [         R                  R                  XS
U5        SSS5        U R                  [        5         [         R                  R                  XUS
5        SSS5        U R                  [        5         [         R                  R                  XSU5        SSS5        U R                  [        5         [         R                  R                  XUSS/SSSSSS45        SSS5        U R                  [        5         [         R                  R                  SX#U5        SSS5        U R                  [        5         [         R                  R                  SUSU5        SSS5        U R                  [        5         [         R                  R                  SX#S5        SSS5        U R                  [         R                  R                  SUSS5      S5        [         R                  R                  XX45        U R                  [         R                  R                  5       U5        [         R                  R                  X[!        U5      [!        U5      5        U R                  [         R                  R                  5       U5        U R                  [        5         [         R                  R                  S5        SSS5        U R                  [        5         [         R                  R                  S5        SSS5        U R                  [         R                  R                  U5      S5        [         R                  R                  U5        U R                  [         R                  R                  5       U5        [         R                  R                  U5        U R                  [         R                  R                  5       U5        U R                  [        5         [         R                  R                  SU5        SSS5        U R                  [        5         [         R                  R                  US5        SSS5        U R                  [         R                  R                  X(5      S5        [         R                  R                  X(5        U R                  [         R                  R                  5       U	5        [         R                  R                  U	5        U R                  [         R                  R                  5       U	5        [         R                  R                  S[         R                  " S5      5        [         R                  R                  5       n
U R                  U
R"                  S5        U R                  U
R$                  S   S5        U R                  U
R$                  S   R'                  5       S5        g! , (       d  f       GN_= f! , (       d  f       GN*= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN}= f! , (       d  f       GNP= f! , (       d  f       GN#= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GNf= f! , (       d  f       GN8= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f! , (       d  f       GN= f)z#Ensures set_cursor works correctly.rH   r$   )r   rL   @   r          r   r   )rP   rQ   rP   rM   8         r   )r#   r#   N)r|   h)0r   )r9   r:   ziNa 00000000   r   rR   rI      )   rI   )r   r   )   r   r   )   rJ   0   r   r   )r   r   )rI   r   )r   r   iyellow)r9   r:   not_a_surface)   r   color)r	   rV   rW   ry   Surfacer
   r   rS   rT   r,   rX   r   rx   
ValueErrorr5   rU   listr3   dataget_size)r6   r\   r]   r^   r_   bitmap_cursorconstantsystem_cursorsurfacecolor_cursorrb   s              r   test_set_cursorMouseModuleTest.test_set_cursor   s    05--dWN ----h7 ..*~~,,W> v||,LL##M2 - v||,LL##M2 - v||,LL##L1 - 	 y)LL##J'J *y)LL##D*gG *y)LL##D/7L * y)LL##D8WE *y)LL##D7HE * y)LL##D:wG *y)LL##D7QQ1aQRTU<VW * z*LL##FGgF + z*LL##GWmWM +z*LL##GW?RS + 	LL##GWfhG	
 	w@002MB 	tG}d7mL002MB y)LL##I. *y)LL##H- * 	00:DA)002MB.002MB y)LL##J8 *y)LL##G_= * 	00BDI1002LA-002LA 	x(@A((*g.Q0Q002H=k -, -, -, *))))) *))) *))) +* +*** *))) *)))s   
 a a a&3"a82"b
1"b0"b./"c ."c-+c$5"c64#d4"d d, d>!e!e"
a
a#&
a58
b

b
b+.
b= 
c
c!$
c36
d
d
d),
d;>
e
e"
e1c                 l    [         R                  R                  5       nU R                  U[        5        g)z-Ensures get_focused returns the correct type.N)r	   r,   r-   rY   int)r6   focuseds     r   test_get_focused MouseModuleTest.test_get_focused   s$    ,,**,gs+r   c                 "   Sn[         R                  R                  5       nU R                  U[        5        U R                  [        U5      U5        U H  nU R                  U[        5        M     Sn[         R                  R                  SS9nU R                  U[        5        U R                  [        U5      U5        U H  nU R                  U[        5        M     Sn[         R                  R                  S5      nU R                  U[        5        U R                  [        U5      U5        U H  nU R                  U[        5        M     Sn[         R                  R                  S5      nU R                  U[        5        U R                  [        U5      U5        U H  nU R                  U[        5        M     U R                  [        5         [         R                  R                  S5        SSS5        g! , (       d  f       g= f)z.Ensures get_pressed returns the correct types.r      )num_buttonsrR   N)
r	   r,   get_pressedrY   r[   r5   rZ   boolrS   r   )r6   r`   buttons_pressedvalues       r   test_get_pressed MouseModuleTest.test_get_pressed  s    ,,224ou5_-?$E!!%. %  ,,22q2Aou5_-?$E!!%. %  ,,2215ou5_-?$E!!%. %  ,,2215ou5_-?$E!!%. % z*LL$$Q' +**s    H  
Hc                     Sn[         R                  R                  5       nU R                  U[        5        U R                  [        U5      U5        U H  nU R                  U[        5        M     g)z*Ensures get_pos returns the correct types.r   N)r	   r,   r1   rY   r[   r5   rZ   r   )r6   r`   posr   s       r   test_get_posMouseModuleTest.test_get_pos#  W    ll""$c5)S?3E!!%- r   c                     S/ SQSSS/ 4 H@  nU R                  [        5         [        R                  R	                  U5        SSS5        MB     g! , (       d  f       MT  = f)z4Ensures set_pos handles invalid positions correctly.r   r   r   r   r   1r   r   N)rS   rx   r	   r,   r0   )r6   invalid_poss     r   test_set_pos__invalid_pos)MouseModuleTest.test_set_pos__invalid_pos.  sI     )QXrBK""9-$$[1 .- C--    A
A	c                     Sn[         R                  R                  5       nU R                  U[        5        U R                  [        U5      U5        U H  nU R                  U[        5        M     g)z*Ensures get_rel returns the correct types.r   N)r	   r,   get_relrY   r[   r5   rZ   r   )r6   r`   relr   s       r   test_get_relMouseModuleTest.test_get_rel4  r   r   c                     S HQ  n[         R                  R                  U5        [         R                  R                  5       nU R	                  X!5        MS     g)z$Ensures get_visible works correctly.FTN)r	   r,   set_visibleget_visibler5   )r6   expected_valuevisibles      r   test_get_visible MouseModuleTest.test_get_visible?  s>    +NLL$$^4ll..0GW5 ,r   c                     [         R                  R                  S5        S H8  n[         R                  R                  U5      nU R                  X!(       + 5        M:     g)z/Ensures set_visible returns the correct values.Tr   N)r	   r,   r   r5   )r6   expected_visibleprev_visibles      r   test_set_visible MouseModuleTest.test_set_visibleH  sG     	  & -!<<334DEL\+?@ !.r   c                     S/ SQSSS/ 4 H@  nU R                  [        5         [        R                  R	                  U5      nSSS5        MB     g! , (       d  f       MT  = f)z8Ensures set_visible handles invalid positions correctly.r   r   g?r   r   N)rS   rx   r	   r,   r   )r6   invalid_valuer   s      r   test_set_visible__invalid_value/MouseModuleTest.test_set_visible__invalid_valueR  sK    "IsC2FM""9-%||77F .- G--r   r   N)r   r   r   r   unittestskipIfosenvironr+   rd   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   rB   rB   9   s    __


("-89"*	"*H __


("-88$	$L __


("-89j>	j>X,(B	.2	.6AGr   rB   __main__)r   r   platformrs   r	   DARWINTestCaser   r   rB   r   mainr   r   r   <module>r      sq     	    
X&&(	(""  0  0F]Gj ]GD	 zMMO r   