initial commit
This commit is contained in:
75
testsuite/ale.00/sanity.exp
Normal file
75
testsuite/ale.00/sanity.exp
Normal file
@@ -0,0 +1,75 @@
|
||||
###
|
||||
### Test environment sanity check. For more information, see:
|
||||
###
|
||||
### http://www.gnu.org/software/dejagnu/manual/
|
||||
###
|
||||
|
||||
###
|
||||
### Import globals (XXX: is this necessary?)
|
||||
###
|
||||
|
||||
global ALE
|
||||
|
||||
###
|
||||
### Tests
|
||||
###
|
||||
|
||||
#
|
||||
# ALE version: response and assertions check
|
||||
#
|
||||
|
||||
set test "ALE version response"
|
||||
set result [exec $ALE --version]
|
||||
if [regexp ".*ALE Version.*" $result] {
|
||||
pass "$test";
|
||||
} else {
|
||||
fail "$test";
|
||||
clone_output "$result";
|
||||
}
|
||||
|
||||
set test "ALE assertions enabled"
|
||||
if [regexp ".*Assertions: *Enabled" $result] {
|
||||
pass "$test";
|
||||
} else {
|
||||
fail "$test";
|
||||
}
|
||||
|
||||
#
|
||||
# PPM files: availability (initial and second access)
|
||||
#
|
||||
|
||||
set test "PPM file availability"
|
||||
if [file exists [ppm_file ellipse]] {
|
||||
pass "$test"
|
||||
} else {
|
||||
fail "$test"
|
||||
}
|
||||
|
||||
set test "PPM file availability (re-access)"
|
||||
if [file exists [ppm_file ellipse]] {
|
||||
pass "$test"
|
||||
} else {
|
||||
fail "$test"
|
||||
}
|
||||
|
||||
#
|
||||
# SVG file construction: completion and validity
|
||||
#
|
||||
|
||||
set test "SVG file construction"
|
||||
|
||||
set test_file [svg_open $test-1 300 200]
|
||||
svg_ellipse $test_file 150 100 100 50
|
||||
svg_close $test_file
|
||||
|
||||
if [file exists [svg_file $test-1]] {
|
||||
pass "$test (completion)"
|
||||
} else {
|
||||
fail "$test (completion)"
|
||||
}
|
||||
|
||||
if [file exists [png_file $test-1]] {
|
||||
pass "$test (validity)"
|
||||
} else {
|
||||
fail "$test (validity)"
|
||||
}
|
||||
62
testsuite/ale.00/svg/ellipse.svg
Normal file
62
testsuite/ale.00/svg/ellipse.svg
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
id="svg1"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.39"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
width="300.00000pt"
|
||||
height="200.00000pt"
|
||||
sodipodi:docbase="/var/www/digicam/download/ale-0.7.2-pre1/testsuite/svg"
|
||||
sodipodi:docname="ellipse.svg">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.43415836"
|
||||
inkscape:cx="305.25953"
|
||||
inkscape:cy="417.84947"
|
||||
inkscape:window-width="640"
|
||||
inkscape:window-height="527"
|
||||
showborder="true"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="19" />
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF
|
||||
id="RDF5">
|
||||
<cc:Work
|
||||
rdf:about=""
|
||||
id="Work6">
|
||||
<dc:format
|
||||
id="format7">image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
id="type9"
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#ff0000;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
|
||||
id="path908"
|
||||
sodipodi:cx="161.23149"
|
||||
sodipodi:cy="102.24803"
|
||||
sodipodi:rx="112.28622"
|
||||
sodipodi:ry="43.187008"
|
||||
d="M 273.51771 102.24803 A 112.28622 43.187008 0 1 0 48.945274,102.24803 A 112.28622 43.187008 0 1 0 273.51771 102.24803 z"
|
||||
transform="translate(28.79134,25.91220)" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
164
testsuite/ale.01/align.exp
Normal file
164
testsuite/ale.01/align.exp
Normal file
@@ -0,0 +1,164 @@
|
||||
###
|
||||
### Alignment test file. For more information, see:
|
||||
###
|
||||
### http://www.gnu.org/software/dejagnu/manual/
|
||||
###
|
||||
|
||||
###
|
||||
### Useful Globals
|
||||
###
|
||||
|
||||
global ALE
|
||||
|
||||
###
|
||||
### Helper routines
|
||||
###
|
||||
|
||||
proc is_within {x y tolerance} {
|
||||
return [expr abs($x - $y) < $tolerance]
|
||||
}
|
||||
|
||||
proc is_translation {t x y tolerance} {
|
||||
|
||||
set command [lindex $t 0]
|
||||
|
||||
if [string equal "$command" "P"] {
|
||||
|
||||
#
|
||||
# Projective case
|
||||
#
|
||||
|
||||
set width [lindex $t 1]
|
||||
set height [lindex $t 2]
|
||||
|
||||
set v [expr $x + $width]
|
||||
set w [expr $y + $height]
|
||||
|
||||
return [expr [is_within [lindex $t 3] $x $tolerance] && [is_within [lindex $t 4] $y $tolerance] \
|
||||
&& [is_within [lindex $t 5] $x $tolerance] && [is_within [lindex $t 6] $w $tolerance] \
|
||||
&& [is_within [lindex $t 7] $v $tolerance] && [is_within [lindex $t 8] $w $tolerance] \
|
||||
&& [is_within [lindex $t 9] $v $tolerance] && [is_within [lindex $t 10] $y $tolerance]]
|
||||
|
||||
} elseif [string equal "$command" "E"] {
|
||||
|
||||
#
|
||||
# Euclidean case
|
||||
#
|
||||
|
||||
return [expr [is_within [lindex $t 3] $x $tolerance] \
|
||||
&& [is_within [lindex $t 4] $y $tolerance] \
|
||||
&& [is_within [lindex $t 5] 0 $tolerance]]
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###
|
||||
### Tests
|
||||
###
|
||||
|
||||
#
|
||||
# Transformation Data File Output
|
||||
#
|
||||
|
||||
set test "Transformation Data File Output"
|
||||
|
||||
set file [svg_open $test 200 100]
|
||||
svg_circle $file 50 50 10
|
||||
svg_close $file
|
||||
|
||||
exec $ALE --trans-save [trans_file $test] [ppm_file $test] [out_file $test] 2> /dev/null
|
||||
|
||||
if [file exists [trans_file $test]] {
|
||||
pass "$test (existence)"
|
||||
} else {
|
||||
fail "$test (existence)"
|
||||
}
|
||||
|
||||
if [string equal "[exec grep ^V [trans_file $test]]" "V 2"] {
|
||||
pass "$test (version compatibility)"
|
||||
} else {
|
||||
fail "$test (version compatibility): [exec grep ^V [trans_file $test]]"
|
||||
}
|
||||
|
||||
#
|
||||
# Identical Images
|
||||
#
|
||||
|
||||
set test "Identical Images"
|
||||
|
||||
set file [svg_open $test 100 100]
|
||||
svg_circle $file 50 50 10
|
||||
svg_circle $file 60 60 10
|
||||
svg_circle $file 70 70 10
|
||||
svg_close $file
|
||||
|
||||
foreach scale {1 1.1 1.25 1.5} {
|
||||
foreach type {translation euclidean projective} {
|
||||
|
||||
set test_identifier "$test.$type.scale.$scale"
|
||||
|
||||
exec $ALE --$type --scale=$scale --trans-save [trans_file $test_identifier] \
|
||||
[ppm_file $test] [ppm_file $test] [out_file $test] 2> /dev/null
|
||||
|
||||
set transformation [exec grep ^\[EP\] [trans_file $test_identifier] | tail -1]
|
||||
set tlist [split $transformation { }]
|
||||
|
||||
if [is_translation $tlist 0 0 0.125] {
|
||||
pass "$test_identifier"
|
||||
} else {
|
||||
fail "$test_identifier: $tlist"
|
||||
}
|
||||
}}
|
||||
|
||||
#
|
||||
# Translated Ellipses
|
||||
#
|
||||
|
||||
set test "TranslatedEllipses"
|
||||
|
||||
set file [svg_open $test-reference 100 100]
|
||||
svg_ellipse $file 50 50 30 10
|
||||
svg_ellipse $file 80 50 10 30
|
||||
svg_ellipse $file 20 50 10 30
|
||||
svg_close $file
|
||||
|
||||
foreach scale {1 1.25 1.5} {
|
||||
foreach type {translation euclidean projective} {
|
||||
foreach offset {0 1 5 11 18 20 21 22 25 26 27 28 29} {
|
||||
|
||||
if [expr $offset >= 30] {
|
||||
set fail xfail
|
||||
set pass xpass
|
||||
} else {
|
||||
set fail fail
|
||||
set pass pass
|
||||
}
|
||||
|
||||
if [string equal "$type" "projective"] {
|
||||
set tolerance 1.0
|
||||
} else {
|
||||
set tolerance 0.125
|
||||
}
|
||||
|
||||
set test_identifier "$test.offset.$offset.$type.scale.$scale"
|
||||
|
||||
set file [svg_open $test_identifier 100 100]
|
||||
svg_ellipse $file 50 [expr 50 + $offset] 30 10
|
||||
svg_ellipse $file 80 [expr 50 + $offset] 10 30
|
||||
svg_ellipse $file 20 [expr 50 + $offset] 10 30
|
||||
svg_close $file
|
||||
|
||||
exec $ALE --extend --exp-noregister --mc 100 --$type --scale=$scale --trans-save [trans_file $test_identifier] \
|
||||
--ui=quiet [ppm_file $test-reference] [ppm_file $test_identifier] \
|
||||
[out_file $test_identifier]
|
||||
|
||||
set transformation [exec grep ^\[EP\] [trans_file $test_identifier] | tail -1]
|
||||
set tlist [split $transformation { }]
|
||||
|
||||
if [is_translation $tlist 0 [expr -$offset * $scale] $tolerance] {
|
||||
$pass "$test_identifier"
|
||||
} else {
|
||||
$fail "$test_identifier: $transformation"
|
||||
}
|
||||
}}}
|
||||
287
testsuite/config/unix.exp
Normal file
287
testsuite/config/unix.exp
Normal file
@@ -0,0 +1,287 @@
|
||||
###
|
||||
### Tool initialization file. For more information, see:
|
||||
###
|
||||
### http://www.gnu.org/software/dejagnu/manual/
|
||||
###
|
||||
|
||||
###
|
||||
### Run parameters
|
||||
###
|
||||
|
||||
set KEEP_TEMPORARIES 0
|
||||
|
||||
###
|
||||
### Useful global variables
|
||||
###
|
||||
|
||||
#
|
||||
# Directory and extension names
|
||||
#
|
||||
|
||||
set svg_dir svg
|
||||
set svg_temp_ext temp.svg
|
||||
set output_ext output.ppm
|
||||
set png_tempdir temp.png
|
||||
set ppm_tempdir temp.ppm
|
||||
set trans_tempdir temp.t
|
||||
|
||||
#
|
||||
# Path id counter
|
||||
#
|
||||
|
||||
set path_id 10
|
||||
|
||||
###
|
||||
### Helper routines
|
||||
###
|
||||
|
||||
#
|
||||
# Delete temporaries
|
||||
#
|
||||
|
||||
proc ale_cleanup {} {
|
||||
global ppm_tempdir
|
||||
global png_tempdir
|
||||
global svg_temp_ext
|
||||
global output_ext
|
||||
|
||||
exec find testsuite \( -name $ppm_tempdir -o -name $png_tempdir \) -type d -print0 | xargs -0 rm -rf
|
||||
exec find testsuite -name "*.$svg_temp_ext" -print0 | xargs -r -0 rm
|
||||
exec find testsuite -name "*.$output_ext" -print0 | xargs -r -0 rm
|
||||
}
|
||||
|
||||
###
|
||||
### Standard DejaGnu procedures
|
||||
###
|
||||
|
||||
#
|
||||
# Actions to take before exit
|
||||
#
|
||||
|
||||
proc ale_exit {} {
|
||||
|
||||
global KEEP_TEMPORARIES
|
||||
|
||||
if $KEEP_TEMPORARIES {
|
||||
return
|
||||
}
|
||||
|
||||
#
|
||||
# Delete temporaries if KEEP_TEMPORARIES is not set
|
||||
#
|
||||
|
||||
ale_cleanup
|
||||
}
|
||||
|
||||
#
|
||||
# Display and return the version and path of the program being run.
|
||||
#
|
||||
|
||||
proc ale_version {} {
|
||||
global ALE
|
||||
clone_output "\nProgram tested: [which $ALE]\n\nProgram Version:\n\n[exec $ALE --version]\n"
|
||||
}
|
||||
|
||||
###
|
||||
### SVG file creation routines (based on inkscape file output [http://www.inkscape.org])
|
||||
###
|
||||
|
||||
proc svg_header {svg_file width height} {
|
||||
puts $svg_file "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
|
||||
puts $svg_file {
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg
|
||||
id="svg1"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.39"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
}
|
||||
|
||||
puts $svg_file "width=\"${width}in\""
|
||||
puts $svg_file "height=\"${height}in\""
|
||||
|
||||
puts $svg_file {
|
||||
sodipodi:docbase="/var/www/digicam/download/ale-0.7.2-pre1/testsuite/svg"
|
||||
sodipodi:docname="ellipse.svg">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.43415836"
|
||||
inkscape:cx="305.25953"
|
||||
inkscape:cy="417.84947"
|
||||
inkscape:window-width="640"
|
||||
inkscape:window-height="527"
|
||||
showborder="true"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="19" />
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF
|
||||
id="RDF5">
|
||||
<cc:Work
|
||||
rdf:about=""
|
||||
id="Work6">
|
||||
<dc:format
|
||||
id="format7">image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
id="type9"
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
}
|
||||
}
|
||||
|
||||
proc svg_footer {svg_file} {
|
||||
puts $svg_file {
|
||||
</svg>
|
||||
}
|
||||
}
|
||||
|
||||
proc svg_open {name width height} {
|
||||
global svg_dir
|
||||
global srcdir
|
||||
global subdir
|
||||
global svg_temp_ext
|
||||
|
||||
exec mkdir -p $srcdir/$subdir/$svg_dir
|
||||
|
||||
set svg $srcdir/$subdir/$svg_dir/$name.$svg_temp_ext
|
||||
set svg_file [open $svg "w"]
|
||||
|
||||
svg_header $svg_file $width $height
|
||||
|
||||
return $svg_file
|
||||
}
|
||||
|
||||
proc svg_close {svg_file} {
|
||||
svg_footer $svg_file
|
||||
close $svg_file
|
||||
}
|
||||
|
||||
proc svg_ellipse {svg_file px py rx ry {sc "#000000"} {fc "#000000"} {so 1.0} {fo 1.0} } {
|
||||
global path_id
|
||||
|
||||
puts $svg_file "<path sodipodi:type=\"arc\""
|
||||
puts $svg_file "style=\"fill:$fc;fill-opacity:$fo;fill-rule:evenodd;stroke:$sc;stroke-width:1.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:$so;\""
|
||||
puts $svg_file "id=\"path$path_id\""
|
||||
puts $svg_file "sodipodi:cx=\"${px}in\""
|
||||
puts $svg_file "sodipodi:cy=\"${py}in\""
|
||||
puts $svg_file "sodipodi:rx=\"${rx}in\""
|
||||
puts $svg_file "sodipodi:ry=\"${ry}in\""
|
||||
puts $svg_file {
|
||||
d="M 273.51771 102.24803 A 112.28622 43.187008 0 1 0 48.945274,102.24803 A 112.28622 43.187008 0 1 0 273.51771 102.24803 z"
|
||||
/>
|
||||
}
|
||||
|
||||
incr path_id
|
||||
}
|
||||
|
||||
proc svg_circle {svg_file px py r {sc "#000000"} {fc "#000000"} {so 1.0} {fo 1.0} } {
|
||||
svg_ellipse $svg_file $px $py $r $r $sc $fc $so $fo
|
||||
}
|
||||
|
||||
###
|
||||
### File readers and converters
|
||||
###
|
||||
|
||||
proc svg_file {name} {
|
||||
global svg_dir
|
||||
global srcdir
|
||||
global subdir
|
||||
global svg_temp_ext
|
||||
set svg_base $srcdir/$subdir/$svg_dir/$name
|
||||
|
||||
if [file exists $svg_base.$svg_temp_ext] {
|
||||
return $svg_base.$svg_temp_ext
|
||||
} elseif [file exists $svg_base.svg] {
|
||||
return $svg_base.svg
|
||||
} else {
|
||||
error "Cannot find SVG file for name \"$svg_base\"."
|
||||
}
|
||||
|
||||
return $svg
|
||||
}
|
||||
|
||||
proc png_file {name {bg "white"} } {
|
||||
global png_tempdir
|
||||
global srcdir
|
||||
global subdir
|
||||
set png $srcdir/$subdir/$png_tempdir/$name-$bg.png
|
||||
|
||||
if ([file exists $png]) {
|
||||
return $png
|
||||
}
|
||||
|
||||
exec mkdir -p $srcdir/$subdir/$png_tempdir
|
||||
exec inkscape --export-dpi=1 -b $bg -f [svg_file $name] -e $png
|
||||
|
||||
if (![file exists $png]) {
|
||||
error "Could not create $png."
|
||||
}
|
||||
|
||||
return $png
|
||||
}
|
||||
|
||||
proc ppm_file {name {bg "white"} } {
|
||||
global ppm_tempdir
|
||||
global srcdir
|
||||
global subdir
|
||||
set ppm $srcdir/$subdir/$ppm_tempdir/$name-$bg.ppm
|
||||
|
||||
if ([file exists $ppm]) {
|
||||
return $ppm
|
||||
}
|
||||
|
||||
exec mkdir -p $srcdir/$subdir/$ppm_tempdir
|
||||
exec pngtopnm [png_file $name $bg] > $ppm
|
||||
|
||||
if (![file exists $ppm]) {
|
||||
error "Could not create $ppm."
|
||||
}
|
||||
|
||||
return $ppm
|
||||
}
|
||||
|
||||
proc trans_file {name} {
|
||||
global trans_tempdir
|
||||
global srcdir
|
||||
global subdir
|
||||
set result $srcdir/$subdir/$trans_tempdir/$name.t
|
||||
|
||||
exec mkdir -p $srcdir/$subdir/$trans_tempdir
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
|
||||
proc out_file {name} {
|
||||
global ppm_tempdir
|
||||
global srcdir
|
||||
global subdir
|
||||
global output_ext
|
||||
set result $srcdir/$subdir/$ppm_tempdir/$name.$output_ext
|
||||
|
||||
exec mkdir -p $srcdir/$subdir/$ppm_tempdir
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
###
|
||||
### Clean up before running anything
|
||||
###
|
||||
|
||||
ale_cleanup
|
||||
Reference in New Issue
Block a user