0026742: Update test cases for using checknbshapes procedure instead of global variables
[occt.git] / tests / fillet2d / end
CommitLineData
8b7c5e47 1if { [info exists square] } {
2 set prop "square"
3 set mass $square
4 if { [info exists tol_square] } {
5 regexp {Mass +: +([-0-9.+eE]+)} [sprops result $tol_square] full m
6 } else {
7 regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
8 }
9}
10if { [info exists length] } {
11 set prop "length"
12 set mass $length
13 regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full m
14
15 puts "checksection"
16 puts [checksection result]
17}
18
19#if mass (length or square) is empty in test case then result should be an empty shape.
20if { [info exists mass] } {
21 puts "checkshape"
22 checkshape result
23
24 if { [string compare "$mass" "empty"] != 0 } {
25 if { $m == 0 } {
26 puts "Error : The command is not valid. The $prop is 0."
27 }
28 if { $mass > 0 } {
29 puts "The expected $prop is $mass"
30 }
31 #check of change of square is < 1%
32 if { ($mass != 0 && [expr 1.*abs($mass - $m)/$mass] > 0.01) || ($mass == 0 && $m != 0) } {
33 puts "Error : The $prop of result shape is $m"
34 }
35 } else {
36 if { $m != 0 } {
37 puts "Error : The command is not valid. The $prop is $m"
38 }
39 }
40}
41
8b7c5e47 42if { [info exists rel_tol] } {
43 puts "\nChecking triangulation area (triarea command)..."
44 set rel_err [expr abs([CheckTriArea result $area_eps])]
45 if { $rel_err > $rel_tol } {
46 puts "Error : area by triangles differs from the actual area by $rel_err %"
47 } else {
48 if { $rel_tol > 1 && $rel_tol < 100 } {
49 puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
50 }
51 }
52}
53
54if { [isdraw result] } {
55 if { [info exists 2dviewer] } {
56 clear
57 smallview
58 donly result
59 fit
60 xwd $imagedir/${test_image}.png
61 }
62 if { [info exists 3dviewer] } {
63 #for multiview support: dump result from all opened views
64 set view_str [vviewlist long]
65 set view_list [regexp -all -inline {\S+} $view_str]
66 foreach {view_name} $view_list {
67 vactivate $view_name
68 vclear
69 vdisplay result
70 vsetdispmode 1
71 vfit
72 vzfit
73 vdump $imagedir/${test_image}_[regsub -all {/} $view_name {_}].png
74 }
75 }
76}
77
78if { [info exists only_screen] } {
79 #for multiview support: dump result from all opened views
80 set view_str [vviewlist long]
81 set view_list [regexp -all -inline {\S+} $view_str]
82 foreach {view_name} $view_list {
83 vactivate $view_name
84 vdump $imagedir/${test_image}_[regsub -all {/} $view_name {_}].png
85 }
86}
87
88if { [info exists only_screen_axo] } {
89 xwd $imagedir/${test_image}.png
90}
91
92# to end a test script
93puts "TEST COMPLETED"