2 ### Alignment test file.
For more information
, see
:
4 ### http
://www.gnu.org
/software
/dejagnu
/manual
/
17 proc is_within
{x y tolerance
} {
18 return [expr
abs($x
- $y
) < $tolerance
]
21 proc is_translation
{t x y tolerance
} {
23 set command
[lindex $t
0]
25 if [string equal
"$command" "P"] {
31 set width
[lindex $t
1]
32 set height
[lindex $t
2]
34 set v
[expr $x
+ $width
]
35 set w
[expr $y
+ $height
]
37 return [expr
[is_within
[lindex $t
3] $x $tolerance
] && [is_within
[lindex $t
4] $y $tolerance
] \
38 && [is_within
[lindex $t
5] $x $tolerance
] && [is_within
[lindex $t
6] $w $tolerance
] \
39 && [is_within
[lindex $t
7] $v $tolerance
] && [is_within
[lindex $t
8] $w $tolerance
] \
40 && [is_within
[lindex $t
9] $v $tolerance
] && [is_within
[lindex $t
10] $y $tolerance
]]
42 } elseif
[string equal
"$command" "E"] {
48 return [expr
[is_within
[lindex $t
3] $x $tolerance
] \
49 && [is_within
[lindex $t
4] $y $tolerance
] \
50 && [is_within
[lindex $t
5] 0 $tolerance
]]
61 # Transformation Data File Output
64 set test
"Transformation Data File Output"
66 set file
[svg_open $test
200 100]
67 svg_circle $file
50 50 10
70 exec $ALE
--trans
-save
[trans_file $test
] [ppm_file $test
] [out_file $test
] 2> /dev
/null
72 if [file
exists [trans_file $test
]] {
73 pass
"$test (existence)"
75 fail
"$test (existence)"
78 if [string equal
"[exec grep ^V [trans_file $test]]" "V 2"] {
79 pass
"$test (version compatibility)"
81 fail
"$test (version compatibility): [exec grep ^V [trans_file $test]]"
88 set test
"Identical Images"
90 set file
[svg_open $test
100 100]
91 svg_circle $file
50 50 10
92 svg_circle $file
60 60 10
93 svg_circle $file
70 70 10
96 foreach scale
{1 1.1 1.25 1.5} {
97 foreach type
{translation euclidean projective
} {
99 set test_identifier
"$test, $type, scale=$scale"
101 exec $ALE
--$type
--scale
=$scale
--trans
-save
[trans_file $test_identifier
] \
102 [ppm_file $test
] [ppm_file $test
] [out_file $test
] 2> /dev
/null
104 set transformation
[exec grep ^\
[EP\
] [trans_file $test_identifier
] | tail
-1]
105 set tlist
[split $transformation
{ }]
107 if [is_translation $tlist
0 0 0.125] {
108 pass
"$test_identifier"
110 fail
"$test_identifier: $tlist"
115 # Translated Ellipses
118 set test
"Translated Ellipses"
120 set file
[svg_open $test
-reference
100 100]
121 svg_ellipse $file
50 50 30 10
122 svg_ellipse $file
80 50 10 30
123 svg_ellipse $file
20 50 10 30
126 foreach scale
{1 1.25 1.5} {
127 foreach type
{translation euclidean projective
} {
128 foreach offset
{0 1 5 11 18 20 21 22 25 26 27 28 29} {
130 if [expr $offset
>= 30] {
138 if [string equal
"$type" "projective"] {
144 set test_identifier
"$test, offset=$offset, $type, scale=$scale"
146 set file
[svg_open $test_identifier
100 100]
147 svg_ellipse $file
50 [expr
50 + $offset
] 30 10
148 svg_ellipse $file
80 [expr
50 + $offset
] 10 30
149 svg_ellipse $file
20 [expr
50 + $offset
] 10 30
152 exec $ALE
--extend
--exp
-noregister
--no
-mc
--$type
--scale
=$scale
--trans
-save
[trans_file $test_identifier
] \
153 [ppm_file $test
-reference
] [ppm_file $test_identifier
] \
154 [out_file $test_identifier
] 2> /dev
/null
156 set transformation
[exec grep ^\
[EP\
] [trans_file $test_identifier
] | tail
-1]
157 set tlist
[split $transformation
{ }]
159 if [is_translation $tlist
0 [expr
-$offset
* $scale
] $tolerance
] {
160 $pass
"$test_identifier"
162 $fail
"$test_identifier: $transformation"