# -*- 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               #
##################################################################

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import ::tcltest::*
}

source [file join $::tcltest::testsDirectory adjust.tcl];

##########
# 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 Bllerschsse im Vlkerrecht'"
    set wid 16

    # Setup hyphenation patterns, then perform adjustment
    textutil::adjust::readPatterns [file join $::tcltest::testsDirectory "dehypht.tex"]
    textutil::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 Bller-
schsse im Vl-
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 $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, \
        adems 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 $str -hyphenate 1 -length $wid
} {El panorama politico
estar convulsionado
porque los
emeneristas, adems
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)}

##########

::tcltest::cleanupTests
