1# -*- tcl -*- 2# adjust.test: tests for the adjust sub-package of the textutil package. 3 4################################################################## 5# Main programme to test adjust/hyphenation: shows some examples # 6# of hyphenated text # 7# # 8# Note: the files dehypht.tex, eshyph_vo.tex and ithyph.tex must # 9# reside in the same directory as adjust_hyph.tcl # 10################################################################## 11 12source [file join \ 13 [file dirname [file dirname [file join [pwd] [info script]]]] \ 14 devtools testutilities.tcl] 15 16testsNeedTcl 8.5 17testsNeedTcltest 1.0 18 19support { 20 useLocal string.tcl textutil::string 21 useLocal repeat.tcl textutil::repeat 22} 23testing { 24 useLocal adjust.tcl textutil::adjust 25} 26 27# ------------------------------------------------------------------------- 28 29########## 30# German # 31########## 32 33test adjust-tex-1.0 {German hyphenation} { 34 #puts "\nTest german hyphenation ...\n"; 35 36 set str "Kurz berichtet: Theodor Holzkopf (Name frei erfunden) promovierte \ 37zum Doktor der Rechte �ber das Thema 'Die B�llersch�sse im V�lkerrecht'" 38 set wid 16 39 40 # Setup hyphenation patterns, then perform adjustment 41 textutil::adjust::readPatterns [file join $::tcltest::testsDirectory "dehypht.tex"] 42 textutil::adjust::adjust $str -hyphenate 1 -length $wid 43} {Kurz berichtet: 44Theodor Holzkopf 45(Name frei er- 46funden) promo- 47vierte zum Dok- 48tor der Rechte 49�ber das Thema 50'Die B�ller- 51sch�sse im V�l- 52kerrecht'} 53 54########### 55# italian # 56########### 57 58test adjust-tex-1.1 {Italian hyphenation} { 59 #puts "\nTest italian hyphenation ...\n" 60 61 set str "Non sappiamo con precisione quando a Roma furono \ 62 institutite le prime scuole regolari, cio� 'statali'. \ 63 Plutarcho dice che nacquero verso il 250 avanti Cristo, \ 64 cio� circa cinquecent'anni dopo la fondazione della citt�. \ 65 (Indro Montanelli)" 66 set wid 20; 67 textutil::adjust::readPatterns [file join $::tcltest::testsDirectory "ithyph.tex"] 68 textutil::adjust::adjust $str -hyphenate 1 -length $wid 69} {Non sappiamo con 70precisione quando a 71Roma furono institu- 72tite le prime scuole 73regolari, cio� 'sta- 74tali'. Plutarcho di- 75ce che nacquero ver- 76so il 250 avanti 77Cristo, cio� circa 78cinquecent'anni dopo 79la fondazione della 80citt�. (Indro Monta- 81nelli)} 82 83########### 84# spanish # 85########### 86 87test adjust-tex-1.2 {Spanish hyphenation} { 88 #puts "\nTest spanish hyphenation ...\n"; 89 90 set str "El panorama politico estar� convulsionado porque los emeneristas, \ 91 adem�s de no contar con el apoyo del NFR para gobernar en el periodo \ 92 2002-2007, se proponen junto con los ucesistas a aprobar los \ 93 cambios a la carta magna (Periodico La Razon, Bolivia)" 94 set wid 20; 95 textutil::adjust::readPatterns [file join $::tcltest::testsDirectory "eshyph_vo.tex"] 96 textutil::adjust::adjust $str -hyphenate 1 -length $wid 97} {El panorama politico 98estar� convulsionado 99porque los 100emeneristas, adem�s 101de no contar con el 102apoyo del NFR para 103gobernar en el peri- 104odo 2002-2007, se 105proponen junto con 106los ucesistas a a- 107probar los cambios a 108la carta magna (Pe- 109riodico La Razon, 110Bolivia)} 111 112########## 113 114test adjust-tex-sf-860753 {German hyphenation with plain justification} { 115 116 set str { ein test strin ein 117test string ein test string ein test string ein test 118string ein test string ein test string ein test 119string ein test string ein test string ein test 120string ein test string ein test string ein test 121string ein test string ein test string ein test 122string ein test string g ein test string 123} 124 textutil::adjust::readPatterns [file join $::tcltest::testsDirectory "dehypht.tex"] 125 textutil::adjust::adjust $str -length 76 -hyphenate 1 -strictlength 1 -justify plain 126} {ein test strin ein test string ein test string ein test string ein test 127string ein test string ein test string ein test string ein test string ein 128test string ein test string ein test string ein test string ein test string 129ein test string ein test string ein test string ein test string g ein test 130string} 131 132testsuiteCleanup 133