o
    OZŽh¾  ã                   @   sv   d dl Z d dlmZmZ d dlZd dlZG dd„ de jƒZG dd„ de jƒZG dd„ de jƒZ	e
d	kr9e  ¡  dS dS )
é    N)ÚquestionÚpromptc                   @   s   e Zd Zdd„ ZdS )ÚJoystickTypeTestc                 C   s   |   ¡  d S )N)Zfail©Úself© r   úI/var/www/auris/lib/python3.10/site-packages/pygame/tests/joystick_test.pyÚtodo_test_Joystick	   s   z#JoystickTypeTest.todo_test_JoystickN)Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r      s    r   c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚJoystickModuleTestc                 C   s4  dd„ }|   tj ¡ d¡ tj ¡  |   tj ¡ |ƒ ¡ tj ¡  |   tj ¡ |ƒ ¡ tj ¡  tj ¡  |   tj ¡ |ƒ ¡ tj ¡  |   tj ¡ |ƒ ¡ tj ¡  |   tj ¡ |ƒ ¡ tdƒD ]}tj ¡  qa|   tj ¡ |ƒ ¡ tj ¡  |   tj ¡ |ƒ ¡ tdƒD ]}tj ¡  q†|   tj ¡ |ƒ ¡ d S )Nc                   S   s(   zt j ¡  W dS  t jy   Y dS w )NFT)ÚpygameÚjoystickÚ	get_countÚerrorr   r   r   r   Úerror_check_get_init&   s   þÿz>JoystickModuleTest.test_get_init.<locals>.error_check_get_initFéd   )ÚassertEqualr   r   Úget_initÚinitÚquitÚrange)r   r   Úir   r   r   Útest_get_init$   s*   






z JoystickModuleTest.test_get_initc                 C   s°   t  ¡  t  ¡  |  t j ¡ d¡ t jj ¡  t j ¡  |  t j	¡ t j 
¡  W d  ƒ n1 s2w   Y  d}t|ƒD ]}t j ¡  q=|  t j ¡ d¡ |  t j 
¡ ¡ dS )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   Z_sdl2Ú
controllerÚassertRaisesr   r   r   ÚassertIsNotNone)r   Z
iterationsr   r   r   r   Ú	test_initH   s   
ÿzJoystickModuleTest.test_initc                 C   s`   t j ¡  |  t j ¡ ¡ t j ¡  |  t j¡ t j ¡  W d  ƒ dS 1 s)w   Y  dS )zTest if joystick.quit works.N)r   r   r   r   r   r   r   r   r   r   r   r   Ú	test_quitf   s   

"ÿzJoystickModuleTest.test_quitc                 C   s@   t j ¡  zt j ¡ }|  |dd¡ W t j ¡  d S t j ¡  w )Nr   z-joystick.get_count() must return a value >= 0)r   r   r   r   ZassertGreaterEqualr   )r   Úcountr   r   r   Útest_get_countr   s   

ÿz!JoystickModuleTest.test_get_countN)r
   r   r   r   r   r    r"   r   r   r   r   r   #   s
    $r   c                   @   s   e Zd ZdgZdd„ ZdS )ÚJoystickInteractiveTestÚinteractivec                 C   sž   t dƒ tj ¡  tj ¡ }td|› dƒ}|  |¡ |dkrHt|ƒD ]}tj |¡ q#|  	tj
¡ tj |¡ W d   ƒ n1 sCw   Y  tj ¡  d S )Nz[Please connect any joysticks/controllers now before starting the joystick.get_count() test.z–NOTE: 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   ZJoystickr   r   r   )r   r!   ÚresponseÚxr   r   r   Útest_get_count_interactive‚   s$   ÿ

þÿ
ÿz2JoystickInteractiveTest.test_get_count_interactiveN)r
   r   r   Z__tags__r(   r   r   r   r   r#      s    r#   Ú__main__)ZunittestZpygame.tests.test_utilsr   r   r   Zpygame._sdl2.controllerZTestCaser   r   r#   r
   Úmainr   r   r   r   Ú<module>   s    \&ÿ