a 4êdgÃã@s”ddlZddlZddlmZddlmZmZmZmZddlm Z m Z edƒdZ Gdd„de ej ƒZ Gd d „d e ej ƒZe efZed kreeŽdS) éN)Úfont)ÚrequiresÚ run_unittestÚ gc_collectÚ ALWAYS_EQ)ÚAbstractTkTestÚAbstractDefaultRootTestZguiZ TkDefaultFontc@s`eZdZedd„ƒZdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z dS)ÚFontTestcCsRtj |¡ztj|jtdd|_Wn(tjyLtj|jtdd|_Yn0dS)NT©ÚrootÚnameÚexistsF) rÚ setUpClassÚ__func__rÚFontr ÚfontnameÚtkinterÚTclError)Úcls©rú?/usr/local/lib/python3.9/tkinter/test/test_tkinter/test_font.pyr s  zFontTest.setUpClasscCsè|j ¡}| t|ƒhd£¡|D]2}| |j |¡||¡| |j|||¡q"dD]:}| ||t¡| |j |¡t¡| |j|t¡qZ|jr t nt}dD]:}| |||¡| |j |¡|¡| |j||¡q¨dS©N>Ú underlineÚsizeÚfamilyÚweightÚ overstrikeÚslant)rrr)rrr) rZ configureÚassertGreaterEqualÚsetÚ assertEqualÚcgetÚassertIsInstanceÚstrÚ wantobjectsÚint©ÚselfÚoptionsÚkeyZsizetyperrrÚtest_configures   ÿzFontTest.test_configurecCs`d}ztj|j|dd}Wn&tjy@tj|j|dd}Yn0| | d¡|¡~tƒdS)NuMS ゴシックT)r rr Fr)rrr rrr r!r)r'rÚfrrrÚtest_unicode_family&szFontTest.test_unicode_familycCs®|j ¡}| t|ƒhd£¡|D]}| |j |¡||¡q"dD](}| ||t¡| |j |¡t¡qD|jrxtnt}dD](}| |||¡| |j |¡|¡q€dSr) rÚactualrrr r"r#r$r%r&rrrÚ test_actual0s  ÿzFontTest.test_actualcCs&| |jjt¡| t|jƒt¡dS©N)r rr rr#©r'rrrÚ test_name>szFontTest.test_namecCs¬tj|jtdd}tj|jtdd}| ||¡| ||¡| || ¡¡| |d¡| |t¡t   ¡}|  |j ¡tj|tdd}| t |ƒt |ƒ¡| ||¡dS)NTr r)rrr rZ assertIsNotr ZassertNotEqualÚcopyrrÚTkZ addCleanupÚdestroyr#)r'Zfont1Zfont2Úroot2Zfont3rrrÚ test_equalityBs     zFontTest.test_equalitycCs| |j d¡t¡dS)NÚabc)r"rZmeasurer%r0rrrÚ test_measureRszFontTest.test_measurecCsh|j ¡}| t|ƒhd£¡|D]@}| |j |¡||¡| ||t¡| |j |¡t¡q"dS)N>ZdescentÚfixedZ linespaceZascent)rÚmetricsrrr r"r%)r'r:r)rrrÚ test_metricsUs  ÿzFontTest.test_metricscCsFt |j¡}| |t¡| |¡|D]}| |t¡| |¡q&dSr/)rÚfamiliesr r"ÚtupleÚ assertTruer#)r'r<rrrrÚ test_families^s     zFontTest.test_familiescCsRt |j¡}| |t¡| |¡|D]}| |t¡| |¡q&| t|¡dSr/) rÚnamesr r"r=r>r#ÚassertInr)r'r@r rrrÚ test_namesfs     zFontTest.test_namesN)Ú__name__Ú __module__Ú __qualname__Ú classmethodrr*r,r.r1r6r8r;r?rBrrrrr s   r c@seZdZdd„Zdd„ZdS)ÚDefaultRootTestcCsv| ttj¡t ¡}t ¡}| |t¡| |¡|D]}| |t ¡| |¡q8|  ¡t  ¡| ttj¡dSr/) Ú assertRaisesÚ RuntimeErrorrr<rr3r"r=r>r#r4Ú NoDefaultRoot)r'r r<rrrrr?rs    zDefaultRootTest.test_familiescCs‚| ttj¡t ¡}t ¡}| |t¡| |¡|D]}| |t ¡| |¡q8|  t |¡|  ¡t  ¡| ttj¡dSr/)rHrIrr@rr3r"r=r>r#rArr4rJ)r'r r@r rrrrBs     zDefaultRootTest.test_namesN)rCrDrEr?rBrrrrrGps rGÚ__main__)ZunittestrrZ test.supportrrrrZtkinter.test.supportrrrZTestCaser rGZ tests_guirCrrrrÚs e