
    i                         d dl Z d dlmZmZ d dlZd dlZ G d de j                        Z G d de j                        Z G d de j                        Z	e
d	k(  r e j                          yy)
    N)questionpromptc                       e Zd Zd Zy)JoystickTypeTestc                 $    | j                          y )N)failselfs    d/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/pygame/tests/joystick_test.pytodo_test_Joystickz#JoystickTypeTest.todo_test_Joystick	   s    . 			    N)__name__
__module____qualname__r    r   r   r   r      s    r   r   c                   $    e Zd Zd Zd Zd Zd Zy)JoystickModuleTestc                    d }| j                  t        j                  j                         d       t        j                  j	                          | j                  t        j                  j                          |              t        j                  j                          | j                  t        j                  j                          |              t        j                  j	                          t        j                  j	                          | j                  t        j                  j                          |              t        j                  j                          | j                  t        j                  j                          |              t        j                  j                          | j                  t        j                  j                          |              t        d      D ]   }t        j                  j	                          " | j                  t        j                  j                          |              t        j                  j                          | j                  t        j                  j                          |              t        d      D ]   }t        j                  j                          " | j                  t        j                  j                          |              y )Nc                  t    	 t         j                  j                          y# t         j                  $ r Y yw xY w)NFT)pygamejoystick	get_counterrorr   r   r   error_check_get_initz>JoystickModuleTest.test_get_init.<locals>.error_check_get_init&   s4    ))+  << s   ! 77Fd   )assertEqualr   r   get_initinitquitrange)r
   r   is      r   test_get_initz JoystickModuleTest.test_get_init$   s   	 	113U;1135I5KL1135I5KL1135I5KL1135I5KL1135I5KLs 	#AOO  "	#1135I5KL1135I5KLs 	#AOO  "	#1135I5KLr   c                    t        j                          t        j                          | j                  t         j                  j                         d       t         j                  j                  j                          t         j                  j                          | j                  t         j                        5  t         j                  j                          ddd       d}t        |      D ]   }t         j                  j                          " | j                  t         j                  j                         d       | j                  t         j                  j                                y# 1 sw Y   xY w)z
        This unit test is for joystick.init()
        It was written to help reduce maintenance costs
        and to help test against changes to the code or
        different platforms.
        TN   )r   r   r   r   r   r   _sdl2
controllerassertRaisesr   r   r    assertIsNotNone)r
   
iterationsr!   s      r   	test_initzJoystickModuleTest.test_initH   s     	113T: 	$$&
 	v||, 	(OO%%'	(
 
z" 	#AOO  "	#113T:V__6689	( 	(s   <E//E8c                 z   t         j                  j                          | j                  t         j                  j	                                t         j                  j                          | j                  t         j                        5  t         j                  j	                          ddd       y# 1 sw Y   yxY w)zTest if joystick.quit works.N)r   r   r   r(   r   r   r'   r   r	   s    r   	test_quitzJoystickModuleTest.test_quitf   sv     	V__6689v||, 	(OO%%'	( 	( 	(s   	B11B:c                 &   t         j                  j                          	 t         j                  j                         }| j	                  |dd       t         j                  j                          y # t         j                  j                          w xY w)Nr   z-joystick.get_count() must return a value >= 0)r   r   r   r   assertGreaterEqualr   )r
   counts     r   test_get_countz!JoystickModuleTest.test_get_countr   sb    	#OO--/E##qM OO  "FOO  "s   1A0 0 BN)r   r   r   r"   r*   r,   r0   r   r   r   r   r   #   s    "MH:<
(
#r   r   c                       e Zd ZdgZd Zy)JoystickInteractiveTestinteractivec                    t        d       t        j                  j                          t        j                  j	                         }t        d| d      }| j                  |       |dk7  rvt        |      D ]!  }t        j                  j                  |       # | j                  t        j                        5  t        j                  j                  |       d d d        t        j                  j                          y # 1 sw Y   (xY w)Nz[Please connect any joysticks/controllers now before starting the joystick.get_count() test.zNOTE: Having Steam open may add an extra virtual controller for each joystick/controller physically plugged in.
joystick.get_count() thinks there is [zE] joystick(s)/controller(s)connected to this system. Is this correct?r   )r   r   r   r   r   r   
assertTruer    Joystickr'   r   r   )r
   r/   responsexs       r   test_get_count_interactivez2JoystickInteractiveTest.test_get_count_interactive   s    )	

 	 ))+55:G <99
 	!
 A:5\ ,((+,""6<<0 0((/0 	0 0s   ; DDN)r   r   r   __tags__r9   r   r   r   r2   r2      s    Hr   r2   __main__)unittestpygame.tests.test_utilsr   r   r   pygame._sdl2.controllerTestCaser   r   r2   r   mainr   r   r   <module>rA      se     4  x(( 6Y#** Y#x!h// !L zHMMO r   