Eskil

Artifact [ea53cedec3]
Login

Artifact ea53cedec38ce869ff896c76a2cb3e88b8c9d71b:


# Tests for printing.                                       -*- tcl -*-
#----------------------------------------------------------------------
# $Revision$
#----------------------------------------------------------------------

test print-1.1 {Tab expansion} {FixTextBlock "a\fp\fa" 1.0} {apa}
test print-1.2 {Tab expansion} {FixTextBlock "\tapa"   1.0} {        apa}
test print-1.3 {Tab expansion} {FixTextBlock "\tapa"   1.1} {       apa}
test print-1.4 {Tab expansion} {FixTextBlock "\tapa"   1.7} { apa}
test print-1.5 {Tab expansion} {FixTextBlock "\tapa"   1.8} {        apa}

test print-1.6 {Tab expansion} {FixTextBlock "apa\tapa"   1.0} {apa     apa}
test print-1.7 {Tab expansion} {FixTextBlock "a\fpa\tapa" 1.1} {apa    apa}
test print-1.8 {Tab expansion} {FixTextBlock "apa\tapa"   1.4} {apa apa}
test print-1.9 {Tab expansion} {FixTextBlock "apa\tapa"   1.5} {apa        apa}

test print-2.1 {Pdf, line numbers} -setup {
    # Create big files with differences at five-digit line numbers
    set f1 [tcltest::makeFile {} _test1]
    set f2 [tcltest::makeFile {} _test2]
    set f3 [tcltest::makeFile {} _test3]
    set ch1 [open $f1 w]
    set ch2 [open $f2 w]
    set data [string repeat xx\n 12345]
    puts $ch1 "Diffline0.1"
    puts $ch2 "Diffline0.2"
    puts $ch1 $data
    puts $ch2 $data
    puts $ch1 "Diffline1.1"
    puts $ch2 "Diffline1.2"
    puts $ch1 $data
    puts $ch2 $data
    puts $ch1 "Diffline2.1"
    puts $ch2 "Diffline2.2"
    puts $ch1 $data
    puts $ch2 $data
    close $ch1
    close $ch2
} -body {
    set res [ExecEskil -context 5 -printpdf $f3 $f1 $f2]
    puts $res
    set ch [open $f3 r]
    set data [read $ch]
    close $ch
    # Check that line numbers take up 7 chars
    string match "*(    3: )*(24690: )*" $data
} -cleanup {
    tcltest::removeFile {} _test1
    tcltest::removeFile {} _test2
    tcltest::removeFile {} _test3
} -result {1}

test print-3.1 {Pdf, cmd line} -body {
    set res [ExecEskil -printHeaderSize x]
} -result {Argument -printHeaderSize must be a positive number}

test print-3.2 {Pdf, cmd line} -body {
    set res [ExecEskil -printCharsPerLine -5]
} -result {Argument -printCharsPerLine must be a positive number}

test print-3.3 {Pdf, cmd line} -body {
    set res [ExecEskil -printPaper qx]
} -match glob -result {Argument -printPaper must be a valid paper size*}

test print-3.4 {Pdf, cmd line} -body {
    set res [ExecEskil -printColorChange x]
} -result {Argument -printColorChange must be a list of RBG values from 0.0 to 1.0}

test print-3.5 {Pdf, cmd line} -body {
    set res [ExecEskil -printColorOld "0 1 2"]
} -result {Argument -printColorOld must be a list of RBG values from 0.0 to 1.0}

test print-3.6 {Pdf, cmd line} -body {
    set res [ExecEskil -printColorNew "0 -1 0.5"]
} -result {Argument -printColorNew must be a list of RBG values from 0.0 to 1.0}