0024387: Tests - use system-independent fonts in test cases
[occt.git] / tests / bugs / vis / bug24389
CommitLineData
fe83e1ea 1puts "============"
2puts "CR24389"
3puts "============"
4puts ""
5#######################################################################
6# Invalid hilight of AIS dimension line in local selection
7#######################################################################
8
6fb1a930 9vfont add [locate_data_file DejaVuSans.ttf] SansFont
10
fe83e1ea 11# ----------------------------------------------#
12# Check highlight of length dimension elements #
13# ----------------------------------------------#
14
15vinit View1
16vtop
17
18set anImage1 $imagedir/${casename}_1.png
19set anImage2 $imagedir/${casename}_2.png
20set anImage3 $imagedir/${casename}_3.png
21
22# length
23
24vpoint len_p1 0 0 0
25vpoint len_p2 40 0 0
26verase len_p1 len_p2
27
6fb1a930 28vdimension len1 -length -text 3d -plane xoy -flyout 20 -arrow external -label left -shapes len_p1 len_p2 -font SansFont
29vdimension len2 -length -text 3d -plane xoy -flyout -20 -arrow external -label right -shapes len_p1 len_p2 -font SansFont
fe83e1ea 30
31vpoint len_p3 0 20 0
32vpoint len_p4 40 20 0
33verase len_p3 len_p4
34
6fb1a930 35vdimension len3 -length -text 3d -plane xoy -flyout 20 -arrow internal -label hcenter -shapes len_p3 len_p4 -font SansFont
fe83e1ea 36
37# diameter
38
39vpoint diam_p1 90 0 0
40vpoint diam_p2 120 0 0
41vpoint diam_p3 105 -15 0
42verase diam_p1 diam_p2 diam_p3
43vcircle diam_c1 diam_p1 diam_p2 diam_p3 0
6fb1a930 44vdimension diam1 -diameter -text 3d -plane xoy -arrow external -label left -shapes diam_c1 -font SansFont
fe83e1ea 45
46vpoint diam_p4 90 40 0
47vpoint diam_p5 120 40 0
48vpoint diam_p6 105 25 0
49verase diam_p4 diam_p5 diam_p6
50vcircle diam_c2 diam_p4 diam_p5 diam_p6 0
6fb1a930 51vdimension diam2 -diameter -text 3d -plane xoy -arrow external -label right -shapes diam_c2 -font SansFont
fe83e1ea 52
53vpoint diam_p7 80 -40 0
54vpoint diam_p8 120 -40 0
55vpoint diam_p9 100 -60 0
56verase diam_p7 diam_p8 diam_p9
57vcircle diam_c3 diam_p7 diam_p8 diam_p9 0
6fb1a930 58vdimension diam3 -diameter -text 3d -plane xoy -arrow external -label hcenter -flyout 30 -shapes diam_c3 -font SansFont
fe83e1ea 59
60# radius
61
62vpoint rad_p1 140 -5 0
63vpoint rad_p2 180 -45 0
64vpoint rad_p3 220 -5 0
65verase rad_p1 rad_p2 rad_p3
66vcircle rad_c1 rad_p1 rad_p2 rad_p3 0
6fb1a930 67vdimension rad1 -radius -text 3d -plane xoy -arrow internal -label hcenter -flyout 0 -shapes rad_c1 -font SansFont
fe83e1ea 68
69vpoint rad_p4 180 -70 0
70vpoint rad_p5 160 -90 0
71vpoint rad_p6 140 -70 0
72verase rad_p4 rad_p5 rad_p6
73vcircle rad_c2 rad_p4 rad_p5 rad_p6 0
6fb1a930 74vdimension rad2 -radius -text 3d -plane xoy -arrow external -label left -shapes rad_c2 -font SansFont
fe83e1ea 75
76# angles
77
78vpoint ang_p1 0 -50 0
79vpoint ang_p2 25 -75 0
80vpoint ang_p3 0 -100 0
81verase ang_p1 ang_p2 ang_p3
6fb1a930 82vdimension ang1 -angle -text 3d -plane xoy -arrow internal -label hcenter -flyout 35 -shapes ang_p1 ang_p2 ang_p3 -font SansFont
fe83e1ea 83
84vpoint ang_p4 0 -120 0
85vpoint ang_p5 30 -80 0
86vpoint ang_p6 30 -120 0
87verase ang_p4 ang_p5 ang_p6
6fb1a930 88vdimension ang2 -angle -text 3d -plane xoy -arrow external -label left -flyout 55 -shapes ang_p4 ang_p5 ang_p6 -font SansFont
fe83e1ea 89
90vpoint ang_p8 55 -120 0
91vpoint ang_p9 55 -80 0
92vpoint ang_p10 95 -120 0
93verase ang_p8 ang_p9 ang_p10
6fb1a930 94vdimension ang3 -angle -text 3d -plane xoy -arrow external -label right -flyout 55 -shapes ang_p8 ang_p9 ang_p10 -font SansFont
fe83e1ea 95
fe83e1ea 96vpoint fit1 -75 0 0
97vpoint fit2 235 0 0
98vfit
99
100# ----------------------------------------------------------------------------- #
101# Verify picking in neutral and local selections #
102# ----------------------------------------------------------------------------- #
103
104proc check_picking { pick check name } {
105 for {set i 0} {$i < [llength $pick]} {incr i} {
106
107 set pick_x [lindex [lindex $pick $i] 0]
108 set pick_y [lindex [lindex $pick $i] 1]
109 set check_x [lindex $check 0]
110 set check_y [lindex $check 1]
111
112 vmoveto $pick_x $pick_y
113 set res [checkcolor $check_x $check_y 0 1 1]
114
115 if { $res != 1 } {
116 puts "Error : Highlighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
117 }
118 }
119}
120
121proc check_cross_picking { pick object name } {
122
709e97a0 123 vselmode 0 1
fe83e1ea 124
125 for {set i 1} {$i < 3} {incr i} {
126
127 vselmode $object $i 1
128
129 for {set j 1} {$j < 3} {incr j} {
130
131 set pick_idx_i [expr "[llength $pick] - 2 + $i - 1"]
132 set pick_idx_j [expr "[llength $pick] - 2 + $j - 1"]
133
134 set pick_x [lindex [lindex $pick $pick_idx_i] 0]
135 set pick_y [lindex [lindex $pick $pick_idx_i] 1]
136 set check_x [lindex [lindex $pick $pick_idx_j] 0]
137 set check_y [lindex [lindex $pick $pick_idx_j] 1]
138
139 vmoveto $pick_x $pick_y
140
141 if {$i == $j} {
142 set res [checkcolor $check_x $check_y 0 1 1]
143 if { $res != 1 } {
144 puts "Error : No local hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
145 }
146 } else {
147 set res [checkcolor $check_x $check_y 0 0 0]
148 if { $res != 1 } {
149 puts "Error : Unwanted hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
150 }
151 }
152 }
153 vselmode $object $i 0
154 }
709e97a0 155 vselmode 0 1
fe83e1ea 156}
157
158# pick coord { [flyout], dimension line, text }
159
160# check sensitives "len1"
aad4bc1f 161set pick_coord { {100 133 } { 106 124 } { 76 130 } }
162set check_coord { 123 125 }
fe83e1ea 163check_picking $pick_coord $check_coord "length dimension (len1)"
164check_cross_picking $pick_coord len1 "length dimension (len1)"
165
166# check sensitives "len2"
aad4bc1f 167set pick_coord { { 100 167 } { 126 177 } { 187 180 } }
168set check_coord { 106 177 }
fe83e1ea 169check_picking $pick_coord $check_coord "length dimension (len2)"
170check_cross_picking $pick_coord len2 "length dimension (len2)"
171
172# check sensitives "len3"
aad4bc1f 173set pick_coord { { 100 114 } { 106 99 } { 120 97 } }
174set check_coord { 153 109 }
fe83e1ea 175check_picking $pick_coord $check_coord "length dimension (len3)"
176check_cross_picking $pick_coord len3 "length dimension (len3)"
177
178# check sensitives "diam1"
aad4bc1f 179set pick_coord { { 247 151 } { 184 150 } }
180set check_coord { 236 151 }
fe83e1ea 181check_picking $pick_coord $check_coord "diameter dimension (diam1)"
182check_cross_picking $pick_coord diam1 "diameter dimension (diam1)"
183
184# check sensitives "diam2"
aad4bc1f 185set pick_coord { { 221 99 } { 285 99 } }
186set check_coord { 239 99 }
fe83e1ea 187check_picking $pick_coord $check_coord "diameter dimension (diam2)"
188check_cross_picking $pick_coord diam2 "diameter dimension (diam2)"
189
190# check sensitives "diam3"
aad4bc1f 191set pick_coord { { 205 225 } { 263 242 } { 224 242 } }
192set check_coord { 205 233 }
fe83e1ea 193check_picking $pick_coord $check_coord "diameter dimension (diam3)"
194check_cross_picking $pick_coord diam3 "diameter dimension (diam3)"
195
196# check sensitives "rad1"
aad4bc1f 197set pick_coord { { 288 158 } { 310 157 } }
198set check_coord { 288 158 }
fe83e1ea 199check_picking $pick_coord $check_coord "radius dimension (rad1)"
200check_cross_picking $pick_coord rad1 "radius dimension (rad1)"
201
202# check sensitives "rad2"
aad4bc1f 203set pick_coord { { 320 242 } { 362 241 } }
204set check_coord { 320 242 }
fe83e1ea 205check_picking $pick_coord $check_coord "radius dimension (rad2)"
206check_cross_picking $pick_coord rad2 "radius dimension (rad2)"
207
208# check sensitives "ang1"
aad4bc1f 209set pick_coord { { 113 229 } { 96 221 } { 85 256 } }
210set check_coord { 86 250 }
fe83e1ea 211check_picking $pick_coord $check_coord "angle dimension (ang1)"
212check_cross_picking $pick_coord ang1 "angle dimension (ang1)"
213
214# check sensitives "ang2"
aad4bc1f 215set pick_coord { { 140 311 } { 91 310 } { 50 278 } }
216set check_coord { 105 318 }
fe83e1ea 217check_picking $pick_coord $check_coord "angle dimension (ang2)"
218check_cross_picking $pick_coord ang2 "angle dimension (ang2)"
219
220# check sensitives "ang3"
aad4bc1f 221set pick_coord { { 172 303 } { 163 327 } { 243 287 } }
222set check_coord { 183 326 }
fe83e1ea 223check_picking $pick_coord $check_coord "angle dimension (ang3)"
224check_cross_picking $pick_coord ang3 "angle dimension (ang3)"
225
226# --------------------------------------------------- #
227# Dump selected images #
228# --------------------------------------------------- #
229
230set xmin -500
231set xmax 500
232set ymin -500
233set ymax 500
234set shift 0
235
709e97a0 236vselmode 0 1
fe83e1ea 237vselect $xmin $ymin $xmax $ymax $shift
238vdump $anImage1
239
240vselect 0 0 0 0 0
241vselmode 1 1
242vselect $xmin $ymin $xmax $ymax $shift
243vdump $anImage2
244
245vselect 0 0 0 0 0
709e97a0 246vselmode 0 1
fe83e1ea 247vselmode 2 1
248vselect $xmin $ymin $xmax $ymax $shift
249vdump $anImage3