0024755: TDF_Label::AddAttribute() reverses the order of added attributes
[occt.git] / tests / geometry / end
CommitLineData
18e25fc9 1proc comparison { x1 x1_o prop } {
2 set precision 0.0000001
3 if { ( abs($x1) > $precision ) || ( abs($x1_o) > $precision ) } {
4 if { ($x1_o != 0 && [expr 1.*abs($x1_o - $x1)/$x1_o] > 0.01) || ($x1_o == 0 && $x1 != 0) } {
94a57f1f 5 puts "Error : The $prop of the resulting shape is $x1 and the expected $prop is $x1_o"
18e25fc9 6 }
7 }
8}
9
10if { [isdraw result] } {
11 if { [info exists type] && [string compare "$type" "infinite"] == 0 && ![info exists length] } {
12 set ddump [dump result]
13 regexp {Axis *: *([-0-9.+eE]+), *([-0-9.+eE]+),* *([-0-9.+eE]*) *} $ddump full Axis_1 Axis_2 Axis_3
14 comparison $Axis_1 $Axis_o_1 "Axis_1"
15 comparison $Axis_2 $Axis_o_2 "Axis_2"
16 if { [info exists Axis_o_3] } {
17 comparison $Axis_3 $Axis_o_3 "Axis_3"
18 }
19 if { [regexp {Line} $ddump] } {
20 regexp {Origin *: *([-0-9.+eE]+), *([-0-9.+eE]+),* *([-0-9.+eE]*) *} $ddump full Origin_1 Origin_2 Origin_3
21 comparison $Origin_1 $Origin_o_1 "Origin_1"
22 comparison $Origin_2 $Origin_o_2 "Origin_2"
23 if { [info exists Origin_o_3] } {
24 comparison $Origin_3 $Origin_o_3 "Origin_3"
25 }
26 } elseif { [regexp {Parabola} $ddump] || [regexp {Hyperbola} $ddump] } {
27 regexp {Center *: *([-0-9.+eE]+), *([-0-9.+eE]+),* *([-0-9.+eE]*) *} $ddump full Center_1 Center_2 Center_3
28 comparison $Center_1 $Center_o_1 "Center_1"
29 comparison $Center_2 $Center_o_2 "Center_2"
30 if { [info exists Center_o_3] } {
31 comparison $Center_3 $Center_o_3 "Center_3"
32 }
33 regexp {XAxis *: *([-0-9.+eE]+), *([-0-9.+eE]+),* *([-0-9.+eE]*) *} $ddump full XAxis_1 XAxis_2 XAxis_3
34 comparison $XAxis_1 $XAxis_o_1 "XAxis_1"
35 comparison $XAxis_2 $XAxis_o_2 "XAxis_2"
36 if { [info exists XAxis_o_3] } {
37 comparison $XAxis_3 $XAxis_o_3 "XAxis_3"
38 }
39 regexp {YAxis *: *([-0-9.+eE]+), *([-0-9.+eE]+),* *([-0-9.+eE]*) *} $ddump full YAxis_1 YAxis_2 YAxis_3
40 comparison $YAxis_1 $YAxis_o_1 "YAxis_1"
41 comparison $YAxis_2 $YAxis_o_2 "YAxis_2"
42 if { [info exists YAxis_o_3] } {
43 comparison $YAxis_3 $YAxis_o_3 "YAxis_3"
44 }
45 if { [regexp {Hyperbola} $ddump] } {
46 regexp {Radii *: *([-0-9.+eE]+), *([-0-9.+eE]+) *} $ddump full LastParam_1 LastParam_2
47 } else {
48 regexp {Focal *: *([-0-9.+eE]+) *} $ddump full LastParam_1
49 }
50 comparison $LastParam_1 $LastParam_o_1 "LastParam_1"
51 if { [info exists LastParam_o_2] } {
52 comparison $LastParam_2 $LastParam_o_2 "LastParam_2"
53 }
54 } else {
55 puts "Error : undefined type"
56 }
57 } else {
58 if { [info exists length] } {
59 set prop "length"
60 set mass $length
61 regexp {The +length +result +is +([-0-9.+eE]+)} [length result] full m
62 } elseif { [info exist square] } {
6aac585a 63 set prop "area"
18e25fc9 64 set mass $square
65 regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
66 }
67
68 if { [string compare "$mass" "empty"] != 0 } {
69 if { $m == 0 } {
70 puts "Error : The $command is not valid. The $prop is 0."
71 }
72 if { $mass > 0 } {
73 puts "The expected $prop is $mass"
74 }
75 #check of change of length is < 1%
76 if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
94a57f1f 77 puts "Error : The $prop of the resulting shape is $m"
18e25fc9 78 }
79 } else {
80 if { $m != 0 } {
81 puts "Error : The $command is not valid. The $prop is $m"
82 }
83 }
84 }
85} else {
94a57f1f 86 puts "Error : The $command cannot be built."
18e25fc9 87}
88
89$viewer
90if { [string compare "$viewer" "v2d"] == 0 } {
91 2dclear
92 donly result
93 2dfit
94} elseif { [string compare "$viewer" "smallview"] == 0 } {
95 clear
96 donly result
97 fit
98} else {
99 puts "Error : wrong value of variable viewer"
100}
c4ecd257 101xwd $imagedir/${test_image}.png
18e25fc9 102
103# to end a test script
104puts "TEST COMPLETED"
105
106