0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynami...
[occt.git] / tests / bugs / vis / bug25230
CommitLineData
07dd6e9b 1puts "============"
2puts "OCC25230"
3puts "============"
4puts ""
5####################################################################################
6# Visualization - Test case for selection in perspective views
7# Test is made using comparison of selected points with expected to be selected points.
8# In case of mismatching test will report about an error of certain type:
9# point selection, rectangle selection or polygon selection is broken.
10####################################################################################
11vinit View1
12vsetdispmode 1
13#draw grid of points 7x7
14set j 0
15for {set x 0} {$x<7} {incr x} {
16 for {set y 0} {$y<7} {incr y} {
17 vpoint $j $x $y 10
18 incr j
19 }
20}
21 for {set x 0} {$x<7} {incr x} {
22 for {set y 0} {$y<7} {incr y} {
23 vpoint $j $x $y 0
24 incr j
25 }
26}
27
28#prepare view
29vtop
6b62b2da 30vcamera -persp
07dd6e9b 31vfit
27af3052 32vleft
07dd6e9b 33vtop
34
35#check rectagle selection
36vselect 200 200 0 0
37set stat 0
38set result [vstate]
39set newlist {}
40set ref_selected {55 6 69 18 13 67 54 68 19 12 62 5 53 60 4 61 20 11}
41set asplit [split $result "\n"]
42for {set i 0} {$i < [llength $ref_selected]} {incr i} {
43 lappend newlist [lindex [lindex $asplit $i] 0]
44}
45set newsorted [lsort $newlist]
46set refsorted [lsort $ref_selected]
47for {set i 0} {$i < [llength $refsorted]} {incr i} {
48 if {[lindex $refsorted $i] != [lindex $newsorted $i]} {
49 set stat 1
50 break
51 }
52}
53
54#check point selection
55vselect 0 0
56vselect 27 28
57set stat1 0
58set result [vstate]
59if {[lindex $result 0] != 6} {
60 set stat1 1
61}
62
63#check polygon selection
64vselect 70 70 0 600 200 600 200 200 600 200 600 70
65set stat2 0
66set result [vstate]
67set newlist {}
68set ref_selected {67 97 47 32 12 33 49 74 54 8 50 19\
69 9 63 83 56 39 26 66 75 18 95 81 15 89 51 46 76 57 90\
70 82 58 65 10 11 25 62 59 14 52 40 60 68 16 55 7 64 61\
71 88 69 53 17 96}
72set asplit [split $result "\n"]
73for {set i 0} {$i < [llength $ref_selected]} {incr i} {
74 lappend newlist [lindex [lindex $asplit $i] 0]
75}
76set newsorted [lsort $newlist]
77set refsorted [lsort $ref_selected]
78for {set i 0} {$i < [llength $refsorted]} {incr i} {
79 if {[lindex $refsorted $i] != [lindex $newsorted $i]} {
80 set stat2 1
81 break
82 }
83}
84
85if {$stat == 1} {
86 puts "Error : Perspective selection by rectangle is broken."
87}
88if {$stat1 == 1} {
89 puts "Error : Perspective selection by point is broken."
90}
91if {$stat2 == 1} {
92 puts "Error : Perspective selection by polygon is broken."
93}