0032208: Tests - refactor visualization tests to cover several graphic drivers
[occt.git] / tests / v3d / trsf / bug24623_3
CommitLineData
f751596e 1puts "============"
0d828ac8 2puts "OCC24623_3: Visualization - improve selection mechanism"
3puts "Tests memory leaks in creation of selection primitives for connected interactive objects:"
4puts "checks that there is no 'dead links' in removing Select3D_BVHPrimitiveContent"
f751596e 5puts "============"
6puts ""
f751596e 7
f751596e 8pload MODELING VISUALIZATION
9psphere s 0.5
10tclean s
11incmesh s 0.001
12trinfo s
13
14set aMemInit [meminfo h]
f751596e 15set aNb 1000
16
17# display as copies
18eval compound [lrepeat $aNb s] ss
19explode ss
1beb58d7 20for {set i 1} {$i <= $aNb} {incr i} { vloadselection ss_${i}; vsetlocation -noupdate ss_${i} ${i} 0 0 }
f751596e 21vfit
22set aMemSel1 [meminfo h]
23vclear
24set aMemClear1 [meminfo h]
25
26# display as connected instances of single presentation
27vconnectto i_1 0 0 0 s -nodisplay
28vloadselection i_1
29for {set i 2} {$i < $aNb} {incr i} { vconnectto i_${i} ${i} 0 0 i_1 -nodisplay; vloadselection i_${i} }
30set aMemSel2 [meminfo h]
31vclear
32set aMemClear2 [meminfo h]
33
34puts "Initial memory : [expr $aMemInit / (1024 * 1024)] MiB"
35puts "Compute selection (simple) : [expr $aMemSel1 / (1024 * 1024)] MiB"
36puts "Clearing (simple) : [expr $aMemClear1 / (1024 * 1024)] MiB"
37puts "Compute selection (connected): [expr $aMemSel2 / (1024 * 1024)] MiB"
38puts "Clearing (connected) : [expr $aMemClear2 / (1024 * 1024)] MiB"
39
40set aRatio [expr $aMemClear2 / double($aMemClear1)]
41
42# check if the memory difference is greater than 10%
0d828ac8 43if {[expr $aRatio > 1.1]} { puts "Error : TEST FAILED" }
44vdump $imagedir/${casename}.png