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