b7586090812487523c0eb6c3becce4cf05453f13
[occt.git] / tests / caf / nam / A5
1 #################### select shape and check selection procedure ####################
2 proc Select {lab shape context} {
3   global D IsDone TestError
4   upvar 1 $shape myshape $context mycontext
5   set res ""
6   if {[string compare $context ""] == 0} {
7     if {[catch {set res [SelectShape D $lab myshape]}]} {
8         set IsDone 0
9         set TestError "$TestError # SelectShape bad result for args: $lab myshape"
10     }
11   } else {
12     if {[catch {set res [SelectShape D $lab myshape mycontext]}]} {
13         set IsDone 0
14         set TestError "$TestError # SelectShape bad result for args: $lab myshape"
15     }
16   }
17   return [CenterOfShape myshape]
18 }
19
20 if {[catch {set TestLab}] == 1} {
21         NewDocument D
22         set TestLab 0:1
23 }
24
25 set IsDone 1
26 source ${scriptdir}/A3
27 set Test "TNaming_Selector test"
28 if {$IsDone == 0} {
29         set TestError " # Can't test iterators becouse of Tool errors: # $TestError"
30 } else {
31
32 #################### selection and checking shapes ####################
33
34 ### IDENTIFY NAMING
35 set res1 [Select "[set TestLab]:10:1" f ""]
36 set res2 [Select "[set TestLab]:10:2" e1 f]
37 set res3 [Select "[set TestLab]:10:3" e2 ""]
38 ### INTERSECTION NAMING (complex : with GENERATION and IDENTITY)
39 set res4 [Select "[set TestLab]:10:4" v1 "f"]
40 explode b E
41 set res5 [Select "[set TestLab]:10:5" b_1 "b"]
42 puts [dump $res5]
43 explode b V
44 set res6 [Select "[set TestLab]:10:6" b_1 "b"]
45 explode c E
46 # labels 7-24
47
48 if {0} {
49
50 for {set i 1} {$i <= 18} {incr i} {
51   set res[expr $i+6] [Select "[set TestLab]:10:[expr $i+6]" c_$i "c"]
52 }
53 explode c F
54 # labels 25-32
55 for {set i 1} {$i <= 8} {incr i} {
56   set res[expr $i+24] [Select "[set TestLab]:10:[expr $i+24]" c_$i "c"]
57 }
58 #################### simple GENERATION naming ####################
59 #explode p F
60 ##labels 33-35
61 #for {set i 1} {$i <= 3} {incr i} {
62 #  set res[expr $i+32] [Select "[set TestLab]:10:[expr $i+32]" p_$i "p"]
63 #}
64 explode c So
65 set res33 [Select "[set TestLab]:10:33" c_1 c]
66 set res34 [Select "[set TestLab]:10:34" c_2 c]
67 ####################### simple MODIFUNTIL naming ####################
68 set res35 [Select "[set TestLab]:10:35" c ""]
69
70 #################### solve selection checking with empty valid map ####################
71 for {set i 1} {$i <= 35} {incr i} {
72   if {[catch {SolveSelection D [set TestLab]:10:$i}]} {
73         set IsDone 0
74         set TestError "$TestError # SolveSelection failed for label [set TestLab]:10:$i"
75   } else {
76     GetShape D [set TestLab]:10:$i r
77     if {[string compare [CenterOfShape r] [set res$i]] != 0} {
78         set IsDone 0
79         set TestError "$TestError # SolveSelection result not same for lab $i : [CenterOfShape r] and [set res$i]"
80     }
81   }
82 }
83 #################### with setted valid map ####################
84
85 }
86
87 puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
88
89 if {[catch {SolveSelection D [set TestLab]:10:4 [set TestLab]:1:1}] == 0} {
90   set IsDone 0
91   set TestError "$TestError # SolveSelection is not failed with deficit of valid map (label [set TestLab]:10:4)"
92 }
93 #if {[catch {SolveSelection D [set TestLab]:10:4 [set TestLab]:1:1 [set TestLab]:1:3}] == 1} {
94 #  set IsDone 0
95 #  set TestError "$TestError # SolveSelection failed for good valid map (label [set TestLab]:10:4)"
96 #}
97
98 }