0029520: Visualization - drop deprecated V3d_View::Export() functionality and depende...
[occt.git] / tests / bugs / begin
CommitLineData
fa920fb1 1# File : begin
5ae01c85 2
fa920fb1 3if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
4 pload TOPTEST
5 pload VISUALIZATION
fa920fb1 6}
7
8# to prevent loops limit to 16 minutes
9cpulimit 1000
10
7856b126 11set rel_tol 0
12set max_rel_tol_diff 0
13
fa920fb1 14if { [info exists imagedir] == 0 } {
15 set imagedir .
16}
17if { [info exists test_image] == 0 } {
18 set test_image photo
19}
20
c2f5c748 21# Procedure to check equality of two reals with tolerance (relative and absolute)
91322f44 22help checkarea {shape area_expected tol_abs tol_rel}
23proc checkarea {shape area_expected tol_abs tol_rel} {
24 # compute area with half of the relative tolerance
25 # to be used in comparison; 0.001 is added to avoid zero value
26 set prop [uplevel sprops $shape [expr 0.5 * abs($tol_rel) + 0.001]]
27
28 # get te value
29 if { ! [regexp {Mass\s*:\s*([0-9.e+-]+)} $prop res area] } {
30 puts "Error: cannot get area of the shape $shape"
31 return
32 }
f1aa2b62 33
91322f44 34 # compare with expected value
35 checkreal "area of $shape" $area $area_expected $tol_abs $tol_rel
36}
f1aa2b62 37
74f764ba 38# Check if area of triangles is valid
39proc CheckTriArea {shape {eps 0}} {
40 upvar #0 $shape result
41 set area [triarea result $eps]
42 set t_area [lindex $area 0]
43 set g_area [expr abs([lindex $area 1])]
44 puts "area by triangles: $t_area"
45 puts "area by geometry: $g_area"
46 expr ($t_area - $g_area) / $g_area * 100
47}
02effd35 48
74da0216 49# Check expected time
50proc checktime {value expected tol_rel message} {
51 set t1 [expr ${value} - ${expected}]
52 set t2 [expr ${expected} * abs (${tol_rel})]
53
54 if { abs (${t1}) <= ${t2} } {
55 puts "OK. ${message}, ${value} seconds, is equal to expected time - ${expected} seconds"
56 } elseif {${t1} > ${t2}} {
57 puts "Error. ${message}, ${value} seconds, is more than expected time - ${expected} seconds"
58 } else {
59 puts "Improvement. ${message}, ${value} seconds, is less than expected time - ${expected} seconds"
60 }
61}