0024696: Lower performance of the new Edge/Edge intersection algorithm
[occt.git] / tests / caf / tree / G2
1 #INTERFACE CAF
2 # Tree construction attributes
3 #
4 # Testing attribute: TDataStd_TreeNode
5 #
6 # Testing command:   InsertNodeAfter
7 #
8 # Testing command:   SetNode
9 # Testing command:   AppendNode
10 # Testing command:   ChildNodeIterate
11 #
12
13 puts "caf005-G2"
14 set QA_DUP 0
15
16 # Add an attribute to a data framework
17 set aLabel_Root 0:2
18 set aName_Root Label_1
19 Label D ${aLabel_Root}
20 SetName D ${aLabel_Root} ${aName_Root}
21
22 set aName1 Label_1_1
23 ###set aChild1 [NewChild D ${aLabel_Root}]
24 set aChild1 0:2:1
25 Label D ${aChild1}
26 SetName D ${aChild1} ${aName1}
27
28 set aName2 Label_1_2
29 ###set aChild2 [NewChild D ${aLabel_Root}]
30 set aChild2 0:2:2
31 Label D ${aChild2}
32 SetName D ${aChild2} ${aName2}
33
34 set aName3 Label_1_1_1
35 ###set aChild3 [NewChild D ${aLabel_Root}]
36 set aChild3 0:2:3
37 Label D ${aChild3}
38 SetName D ${aChild3} ${aName3}
39
40 SetNode D ${aLabel_Root}
41
42 AppendNode D ${aLabel_Root} ${aChild1}
43 AppendNode D ${aLabel_Root} ${aChild2}
44 InsertNodeAfter D ${aChild1} ${aChild3}
45
46 # Close/Open the transaction
47 NewCommand D
48
49 # Forget the attribute
50 ForgetAll D ${aLabel_Root}
51
52 # Close/Open the transaction
53 NewCommand D
54
55 # Undo-Redo-Undo
56 Undo D
57 Redo D
58 Undo D
59
60 # Get a value of the attribute
61 set IsDone [catch {set aListChildNodes [ChildNodeIterate D ${aLabel_Root} 1]} aResult]
62 if { ${IsDone} != 0 } {
63         puts ${aResult}
64         puts "InsertAfter TDataStd_TreeNode attribute: Error"
65         return
66 }
67 set aListChildNodesLength [llength ${aListChildNodes}]
68 if { ${aListChildNodesLength}!=[expr 3 + 0]} {
69         puts "aListChildNodes=${aListChildNodes}"
70         puts "aListChildNodesLength=${aListChildNodesLength}"
71         puts "InsertAfter TDataStd_TreeNode attribute: Error"
72         return
73 }
74 set aFirstChildNode [lindex ${aListChildNodes} 0]
75 set aSecondChildNode [lindex ${aListChildNodes} 1]
76 set aThirdChildNode [lindex ${aListChildNodes} 2]
77 if { ${aFirstChildNode}!=${aChild1} ||
78         ${aSecondChildNode}!=${aChild3} ||
79         ${aThirdChildNode}!=${aChild2}} {
80         puts "aFirstChildNode=${aFirstChildNode} aChild1=${aChild1}"
81         puts "aSecondChildNode=${aSecondChildNode} aChild2=${aChild2}"
82         puts "aThirdChildNode=${aThirdChildNode} aChild3=${aChild3}"
83         puts "InsertAfter TDataStd_TreeNode attribute: Error"
84         return
85 }
86
87 puts "InsertAfter TDataStd_TreeNode attribute: OK"