mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-30 13:05:50 +03:00
0025230: Test case for selection in perspective views
Implemented test for selections in perspective view by point, by rectangle and by polygon.
This commit is contained in:
parent
59af51e3c1
commit
07dd6e9bee
93
tests/bugs/vis/bug25230
Normal file
93
tests/bugs/vis/bug25230
Normal file
@ -0,0 +1,93 @@
|
||||
puts "============"
|
||||
puts "OCC25230"
|
||||
puts "============"
|
||||
puts ""
|
||||
####################################################################################
|
||||
# Visualization - Test case for selection in perspective views
|
||||
# Test is made using comparison of selected points with expected to be selected points.
|
||||
# In case of mismatching test will report about an error of certain type:
|
||||
# point selection, rectangle selection or polygon selection is broken.
|
||||
####################################################################################
|
||||
vinit View1
|
||||
vsetdispmode 1
|
||||
#draw grid of points 7x7
|
||||
set j 0
|
||||
for {set x 0} {$x<7} {incr x} {
|
||||
for {set y 0} {$y<7} {incr y} {
|
||||
vpoint $j $x $y 10
|
||||
incr j
|
||||
}
|
||||
}
|
||||
for {set x 0} {$x<7} {incr x} {
|
||||
for {set y 0} {$y<7} {incr y} {
|
||||
vpoint $j $x $y 0
|
||||
incr j
|
||||
}
|
||||
}
|
||||
|
||||
#prepare view
|
||||
vtop
|
||||
vchangecamera proj persp
|
||||
vfit
|
||||
vback
|
||||
vtop
|
||||
|
||||
#check rectagle selection
|
||||
vselect 200 200 0 0
|
||||
set stat 0
|
||||
set result [vstate]
|
||||
set newlist {}
|
||||
set ref_selected {55 6 69 18 13 67 54 68 19 12 62 5 53 60 4 61 20 11}
|
||||
set asplit [split $result "\n"]
|
||||
for {set i 0} {$i < [llength $ref_selected]} {incr i} {
|
||||
lappend newlist [lindex [lindex $asplit $i] 0]
|
||||
}
|
||||
set newsorted [lsort $newlist]
|
||||
set refsorted [lsort $ref_selected]
|
||||
for {set i 0} {$i < [llength $refsorted]} {incr i} {
|
||||
if {[lindex $refsorted $i] != [lindex $newsorted $i]} {
|
||||
set stat 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
#check point selection
|
||||
vselect 0 0
|
||||
vselect 27 28
|
||||
set stat1 0
|
||||
set result [vstate]
|
||||
if {[lindex $result 0] != 6} {
|
||||
set stat1 1
|
||||
}
|
||||
|
||||
#check polygon selection
|
||||
vselect 70 70 0 600 200 600 200 200 600 200 600 70
|
||||
set stat2 0
|
||||
set result [vstate]
|
||||
set newlist {}
|
||||
set ref_selected {67 97 47 32 12 33 49 74 54 8 50 19\
|
||||
9 63 83 56 39 26 66 75 18 95 81 15 89 51 46 76 57 90\
|
||||
82 58 65 10 11 25 62 59 14 52 40 60 68 16 55 7 64 61\
|
||||
88 69 53 17 96}
|
||||
set asplit [split $result "\n"]
|
||||
for {set i 0} {$i < [llength $ref_selected]} {incr i} {
|
||||
lappend newlist [lindex [lindex $asplit $i] 0]
|
||||
}
|
||||
set newsorted [lsort $newlist]
|
||||
set refsorted [lsort $ref_selected]
|
||||
for {set i 0} {$i < [llength $refsorted]} {incr i} {
|
||||
if {[lindex $refsorted $i] != [lindex $newsorted $i]} {
|
||||
set stat2 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if {$stat == 1} {
|
||||
puts "Error : Perspective selection by rectangle is broken."
|
||||
}
|
||||
if {$stat1 == 1} {
|
||||
puts "Error : Perspective selection by point is broken."
|
||||
}
|
||||
if {$stat2 == 1} {
|
||||
puts "Error : Perspective selection by polygon is broken."
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user