U Ä:âeã@sddlZddlZddlmZddlmZmZmZddlmZm Z edƒdZ Gdd„deej ƒZ Gd d „d e ej ƒZ e e fZed krŒeeŽdS) éN)Úfont)ÚrequiresÚ run_unittestÚ gc_collect)ÚAbstractTkTestÚAbstractDefaultRootTestZguiZ TkDefaultFontc@s`eZdZedd„ƒZdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z dS)ÚFontTestcCsTtj |¡ztj|jtdd|_Wn*tjk rNtj|jtdd|_YnXdS)NT©ÚrootÚnameÚexistsF) rÚ setUpClassÚ__func__rÚFontr ÚfontnameÚtkinterÚTclError)Úcls©rúH/usr/local/python38/lib/python3.8/tkinter/test/test_tkinter/test_font.pyr s  zFontTest.setUpClassc Csð|j ¡}| t|ƒddddddh¡|D]2}| |j |¡||¡| |j|||¡q*dD]:}| ||t¡| |j |¡t¡| |j|t¡qb|jr¨t nt}dD]:}| |||¡| |j |¡|¡| |j||¡q°dS© NÚfamilyÚsizeÚweightÚslantÚ underlineÚ overstrike)rrr)rrr) rZ configureÚassertGreaterEqualÚsetÚ assertEqualÚcgetÚassertIsInstanceÚstrÚ wantobjectsÚint©ÚselfÚoptionsÚkeyZsizetyperrrÚtest_configures   ÿzFontTest.test_configurecCsbd}ztj|j|dd}Wn(tjk rBtj|j|dd}YnX| | d¡|¡~tƒdS)NuMS ゴシックT)r rr Fr)rrr rrrr r)r&rÚfrrrÚtest_unicode_family&szFontTest.test_unicode_familyc Cs¶|j ¡}| t|ƒddddddh¡|D]}| |j |¡||¡q*dD](}| ||t¡| |j |¡t¡qL|jr€tnt}dD](}| |||¡| |j |¡|¡qˆdSr) rÚactualrrrr!r"r#r$r%rrrÚ test_actual0s  ÿzFontTest.test_actualcCs&| |jjt¡| t|jƒt¡dS©N)rrr rr"©r&rrrÚ test_name>szFontTest.test_namecCs tj|jtdd}tj|jtdd}| ||¡| ||¡| || ¡¡| |d¡t  ¡}|  |j ¡tj|tdd}| t |ƒt |ƒ¡| ||¡dS)NTr r) rrr rZ assertIsNotrZassertNotEqualÚcopyrÚTkZ addCleanupÚdestroyr")r&Zfont1Zfont2Zroot2Zfont3rrrÚ test_equalityBs    zFontTest.test_equalitycCs| |j d¡t¡dS)NÚabc)r!rZmeasurer$r/rrrÚ test_measureQszFontTest.test_measurecCsl|j ¡}| t|ƒddddh¡|D]@}| |j |¡||¡| ||t¡| |j |¡t¡q&dS)NZascentZdescentZ linespaceZfixed)rÚmetricsrrrr!r$)r&r7r(rrrÚ test_metricsTs   ÿzFontTest.test_metricscCsFt |j¡}| |t¡| |¡|D]}| |t¡| |¡q&dSr.)rÚfamiliesr r!ÚtupleÚ assertTruer")r&r9rrrrÚ 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_nameses     zFontTest.test_namesN)Ú__name__Ú __module__Ú __qualname__Ú classmethodr r)r+r-r0r4r6r8r<r?rrrrr s   rc@seZdZdd„Zdd„ZdS)ÚDefaultRootTestcCsv| ttj¡t ¡}t ¡}| |t¡| |¡|D]}| |t ¡| |¡q8|  ¡t  ¡| ttj¡dSr.) Ú assertRaisesÚ RuntimeErrorrr9rr2r!r:r;r"r3Ú NoDefaultRoot)r&r r9rrrrr<qs    zDefaultRootTest.test_familiescCs‚| ttj¡t ¡}t ¡}| |t¡| |¡|D]}| |t ¡| |¡q8|  t |¡|  ¡t  ¡| ttj¡dSr.)rErFrr=rr2r!r:r;r"r>rr3rG)r&r r=r rrrr?~s     zDefaultRootTest.test_namesN)r@rArBr<r?rrrrrDos rDÚ__main__)ZunittestrrZ test.supportrrrZtkinter.test.supportrrrZTestCaserrDZ tests_guir@rrrrÚs d