31e3367dfc97befc611f8f2004b11a37f74f9a3f
[occt.git] / tests / bugs / vis / bug25532
1 puts "============"
2 puts "OCC25532"
3 puts "============"
4 puts ""
5 #######################################################################
6 # Visualization - fix cross-references between AIS_ConnectedInteractive
7 #                 and connected presentation
8 #######################################################################
9
10 pload MODELING VISUALIZATION
11 psphere s 0.5
12 tclean  s
13 incmesh s 0.001
14 trinfo  s
15
16 vinit View1
17 vclear
18 vaxo
19 vcaps -vbo 0
20 vsetdispmode 1
21 vdefaults absDefl=1.0
22 vselprops -autoactivate 0
23 set aMemInit [meminfo h]
24
25 set aNb 1000
26
27 # display as copies
28 eval compound [lrepeat $aNb s] ss
29 explode ss
30 for {set i 1} {$i <= $aNb} {incr i} { vdisplay -noupdate ss_${i}; vsetlocation -noupdate ss_${i} ${i} 0 0 }
31 vfit
32 set aMemDisp1  [meminfo h]
33 vclear
34 set aMemClear1 [meminfo h]
35
36 # display as connected instances of single presentation
37 vconnectto i_1 0 0 0 s
38 for {set i 2} {$i < $aNb} {incr i} { vconnectto i_${i} ${i} 0 0 i_1 }
39 set aMemDisp2  [meminfo h]
40 vclear
41 set aMemClear2 [meminfo h]
42
43 puts "Initial memory:         [expr $aMemInit   / (1024 * 1024)] MiB"
44 puts "Displaying (simple):    [expr $aMemDisp1  / (1024 * 1024)] MiB"
45 puts "Clearing   (simple):    [expr $aMemClear1 / (1024 * 1024)] MiB"
46 puts "Displaying (connected): [expr $aMemDisp2  / (1024 * 1024)] MiB"
47 puts "Clearing   (connected): [expr $aMemClear2 / (1024 * 1024)] MiB"
48
49 set aRatio [expr $aMemClear2 / double($aMemClear1)]
50
51 # check if the memory difference is greater than 20%
52 if [expr $aRatio > 1.2] {
53     puts "Error : TEST FAILED"
54 }
55