
    daf[                         d dl Z d dlZd dlmZ d dlmZmZmZ d dlmZm	Z	  ed       dZ
 G d dee j                        Z G d	 d
e	e j                        Zedk(  r e j                          yy)    N)font)requires
gc_collect	ALWAYS_EQ)AbstractTkTestAbstractDefaultRootTestguiTkDefaultFontc                   ^    e Zd Zed        Zd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zy)FontTestc                 "   t         j                  j                  |        	 t        j                  | j
                  t        d      | _        y # t        j                  $ r. t        j                  | j
                  t        d      | _        Y y w xY w)NTrootnameexistsF)	r   
setUpClass__func__r   Fontr   fontnametkinterTclError)clss    6/root/Python-3.12.4/Lib/test/test_tkinter/test_font.pyr   zFontTest.setUpClass   sc    !!**3/	MyychhXdKCH 	MyychhXeLCH	Ms   +A >BBc                     | j                   j                         }| j                  t        |      h d       |D ]R  }| j	                  | j                   j                  |      ||          | j	                  | j                   |   ||          T dD ]m  }| j                  ||   t               | j                  | j                   j                  |      t               | j                  | j                   |   t               o | j                  rt        nt        }dD ]a  }| j                  ||   |       | j                  | j                   j                  |      |       | j                  | j                   |   |       c y N>   sizeslantfamilyweight	underline
overstrike)r   r   r   )r   r    r!   )
r   	configureassertGreaterEqualsetassertEqualcgetassertIsInstancestrwantobjectsintselfoptionskeysizetypes       r   test_configurezFontTest.test_configure   s;   ))%%'GL	N 	;CTYY^^C0'#,?TYYs^WS\:	; / 	7C!!'#,4!!$)).."5s;!!$))C.#6	7 **34 	<C!!'#,9!!$)).."5x@!!$))C.(;	<    c                    d}	 t        j                  | j                  |d      }| j                  |j                  d      |       ~t                y # t        j                  $ r% t        j                  | j                  |d      }Y dw xY w)Nu   MS ゴシックT)r   r   r   Fr   )r   r   r   r   r   r%   r&   r   )r,   r   fs      r   test_unicode_familyzFontTest.test_unicode_family&   su    .	G		tyyEA 	)62	  	G		tyyFA	Gs   "A 5B
Bc                 8   | j                   j                         }| j                  t        |      h d       |D ]0  }| j	                  | j                   j                  |      ||          2 dD ]J  }| j                  ||   t               | j                  | j                   j                  |      t               L | j                  rt        nt        }dD ]B  }| j                  ||   |       | j                  | j                   j                  |      |       D y r   )	r   actualr#   r$   r%   r'   r(   r)   r*   r+   s       r   test_actualzFontTest.test_actual0   s    ))""$GL	N 	BCTYY--c2GCLA	B. 	>C!!'#,4!!$))"2"23"7=	> **34 	CC!!'#,9!!$))"2"23"7B	Cr1   c                     | j                  | j                  j                  t               | j                  t	        | j                        t               y N)r%   r   r   r   r(   r,   s    r   	test_namezFontTest.test_name>   s2    2TYY2r1   c                 v   t        j                  | j                  t        d      }t        j                  | j                  t        d      }| j	                  ||       | j                  ||       | j                  ||j                                | j                  |d       | j                  |t               t        j                         }| j                  |j                         t        j                  |t        d      }| j                  t        |      t        |             | j                  ||       y )NTr   r   )r   r   r   r   assertIsNotr%   assertNotEqualcopyr   r   Tk
addCleanupdestroyr(   )r,   font1font2root2font3s        r   test_equalityzFontTest.test_equalityB   s    		tyyxE		tyyxE&&E5::<0E1%	*

&		u8DAUSZ0E5)r1   c                 b    | j                  | j                  j                  d      t               y )Nabc)r'   r   measurer*   r:   s    r   test_measurezFontTest.test_measureR   s!    dii//6<r1   c                 l   | j                   j                         }| j                  t        |      h d       |D ]x  }| j	                  | j                   j                  |      ||          | j                  ||   t               | j                  | j                   j                  |      t               z y )N>   fixedascentdescent	linespace)r   metricsr#   r$   r%   r'   r*   )r,   rQ   r.   s      r   test_metricszFontTest.test_metricsU   s    ))##%G7	9 	?CTYY..s3WS\B!!'#,4!!$))"3"3C"8#>	?r1   c                     t        j                  | j                        }| j                  |t               | j                  |       |D ])  }| j                  |t               | j                  |       + y r9   )r   familiesr   r'   tuple
assertTruer(   )r,   rT   r   s      r   test_familieszFontTest.test_families^   s[    ==+h.! 	$F!!&#.OOF#	$r1   c                    t        j                  | j                        }| j                  |t               | j                  |       |D ])  }| j                  |t               | j                  |       + | j                  t        |       y r9   )	r   namesr   r'   rU   rV   r(   assertInr   )r,   rY   r   s      r   
test_nameszFontTest.test_namesf   sk    

499%eU+ 	"D!!$,OOD!	" 	h&r1   c                     t        j                  t        | j                        }| j	                  |t         j
                         | j                  |j                  t               y )N)r   )r   
nametofontr   r   r'   r   r%   r   )r,   testfonts     r   test_nametofontzFontTest.test_nametofonto   s>    ??8$))<h		21r1   c                 ^    | j                  t        | j                        dt        d       y )Nz<tkinter.font.Font object >)r%   reprr   r   r:   s    r   	test_reprzFontTest.test_reprt   s'    O9(QG	
r1   N)__name__
__module____qualname__classmethodr   r0   r4   r7   r;   rG   rK   rR   rW   r[   r_   rc    r1   r   r   r      sN    M M<"C3* =?$'2

r1   r   c                       e Zd Zd Zd Zd Zy)DefaultRootTestc                    | j                  t        t        j                         t	        j
                         }t        j                         }| j                  |t               | j                  |       |D ])  }| j                  |t               | j                  |       + |j                          t	        j                          | j                  t        t        j                         y r9   )assertRaisesRuntimeErrorr   rT   r   r@   r'   rU   rV   r(   rB   NoDefaultRoot)r,   r   rT   r   s       r   rW   zDefaultRootTest.test_families|   s    ,6zz|==?h.! 	$F!!&#.OOF#	$ 	,6r1   c                    | j                  t        t        j                         t	        j
                         }t        j                         }| j                  |t               | j                  |       |D ])  }| j                  |t               | j                  |       + | j                  t        |       |j                          t	        j                          | j                  t        t        j                         y r9   )rl   rm   r   rY   r   r@   r'   rU   rV   r(   rZ   r   rB   rn   )r,   r   rY   r   s       r   r[   zDefaultRootTest.test_names   s    ,

3zz|

eU+ 	"D!!$,OOD!	" 	h&,

3r1   c                    | j                  t        t        j                  t               t        j                         }t        j                  t              }| j                  |t        j                         | j                  |j                  t               |j                          t        j                          | j                  t        t        j                  t               y r9   )rl   rm   r   r]   r   r   r@   r'   r   r%   r   rB   rn   )r,   r   r^   s      r   r_   zDefaultRootTest.test_nametofont   s    ,Bzz|??8,h		21,Br1   N)rd   re   rf   rW   r[   r_   rh   r1   r   rj   rj   z   s    74Cr1   rj   __main__)unittestr   r   test.supportr   r   r   test.test_tkinter.supportr   r   r   TestCaser   rj   rd   mainrh   r1   r   <module>rw      sl       8 8 M l
~x00 l
^%C-x/@/@ %CP zHMMO r1   