
    ;et                        d Z ddlmZ ddlZddlmZ ddlZddlm	Z	 ddl
mZ h dZdhZeez  Zd Zd	 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        d           dS dS )z%Test macosx, coverage 45% on Windows.    )macosxN)requires)FileList>   cocoacarbonxquartzotherc                      t           j        ad S N)r   _tk_typeorig_tktype     4/usr/lib/python3.11/idlelib/idle_test/test_macosx.pysetUpModuler      s    /KKKr   c                  (    t           t          _        d S r   )r   r   r   r   r   r   tearDownModuler      s    !FOOOr   c                   D    e Zd ZdZed             Zed             Zd ZdS )InitTktypeTestzTest _init_tk_type.c                     t          d           t          j                    | _        | j                                         t
          j        | _        d S )Ngui)r   tkTkrootwithdrawr   platformorig_platformclss    r   
setUpClasszInitTktypeTest.setUpClass   s>    577"Or   c                     | j                                          | j                                          | ` | j        t          _        d S r   )r   update_idletasksdestroyr   r   r   r   s    r   tearDownClasszInitTktypeTest.tearDownClass"   s=    !!###H+r   c                 (   dt           fdt          ffD ]~\  }}|                     |          5  |t          _        dt          _        t          j                     |                     t          j        |           ddd           n# 1 swxY w Y   dS )z<Test that _init_tk_type sets _tk_type according to platform.darwinr	   )r   N)alltypesnontypessubTestr   r   r   _init_tk_typeassertIn)selfr   typess      r   test_init_sets_tktypez$InitTktypeTest.test_init_sets_tktype)   s     ((3gx5HH 	6 	6OHex00 6 6"*"&$&&&fou555	6 6 6 6 6 6 6 6 6 6 6 6 6 6 6	6 	6s   ABB
	B
	N)__name__
__module____qualname____doc__classmethodr    r$   r.   r   r   r   r   r      s]        , , [, , , [,6 6 6 6 6r   r   c                       e Zd ZdZej        dfej        dfej        dfej        dffZ	 e
j        d          d             Zd Zd	S )
IsTypeTkTestz*Test each of the four isTypeTk predecates.r   r   r   r   r   zidlelib.macosx._init_tk_typec                    dt           _        | j        D ]k\  }}|                     |          5   |             |                     |j                   |                                 ddd           n# 1 swxY w Y   ldS )zBTest that each isTypeTk calls _init_tk_type when _tk_type is None.N)func)r   r   isfuncsr)   
assertTruecalled
reset_mock)r,   mockinitr8   whentrues       r   test_is_calls_initzIsTypeTkTest.test_is_calls_init;   s     "l 	& 	&ND(4(( & &000##%%%& & & & & & & & & & & & & & &	& 	&s   9A44A8	;A8	c                     | j         D ]n\  }}t          D ]a}|                     |||          5  |t          _         ||v r| j        n| j         |                       ddd           n# 1 swxY w Y   bodS )z,Test that each isTypeTk return correct bool.)r8   r>   tktypeN)r9   r'   r)   r   r   r:   assertFalse)r,   r8   r>   rA   s       r   test_isfuncszIsTypeTkTest.test_isfuncsE   s    "l 	. 	.ND(" . .\\thv\NN . .&,FOP((:(:T__@P&*dff. . .. . . . . . . . . . . . . . ..	. 	.s   0A**A.1A.N)r/   r0   r1   r2   r   isAquaTk
isCarbonTk	isCocoaTk	isXQuartzr9   mockpatchr?   rC   r   r   r   r5   r5   3   s        00!45!H. 7, 9.G TZ.//& & 0/&. . . . .r   r5   c                   p    e Zd ZdZed             Zed             Z ej        d          d             Z	dS )	SetupTestzTest setupApp.c                     t          d           t          j                    | _        | j                                         fd| j        _        d S )Nr   c                 t    t          | t                    sJ t          |t                              sJ d S r   )
isinstancestrtype)tkpathr8   cmds     r   rR   z!SetupTest.setUpClass.<locals>.cmdW   s;    fc*****dDII.......r   )r   r   r   r   r   createcommand)r   rR   s    @r   r    zSetupTest.setUpClassR   sZ    577	/ 	/ 	/ 	/ 	/ "%r   c                 n    | j                                          | j                                          | ` d S r   )r   r"   r#   r   s    r   r$   zSetupTest.tearDownClass\   s3    !!###HHHr   zidlelib.macosx.overrideRootMenuc                 H   | j         }t          |          }t          D ]}|                     |          5  |t          _        t	          j        ||           |dv r|                     |j                   |	                                 ddd           n# 1 swxY w Y   dS )z/Call setupApp with each possible graphics type.)rA   r6   N)
r   r   r'   r)   r   r   setupAppr:   r;   r<   )r,   overrideRootMenur   flistrA   s        r   test_setupappzSetupTest.test_setupappb   s     y 	. 	.FV,, . ."(e,,,000OO$4$;<<< ++---. . . . . . . . . . . . . . .	. 	.s   ABB	B	N)
r/   r0   r1   r2   r3   r    r$   rH   rI   rY   r   r   r   rK   rK   O   sw        % % [%   [
 TZ122
. 
. 32
. 
. 
.r   rK   __main__   )	verbosity)r2   idlelibr   unittesttest.supportr   tkinterr   unittest.mockrH   idlelib.filelistr   mactypesr(   r'   r   r   TestCaser   r5   rK   r/   mainr   r   r   <module>rf      sZ   ' '        ! ! ! ! ! !           % % % % % %)))9h" " "
" " "6 6 6 6 6X& 6 6 66. . . . .8$ . . .8. . . . .! . . .B zHMA r   