0023087: Upgrade of the OCCT test system
[occt.git] / tests / caf / tree / E1
1 #INTERFACE CAF
2 # Tree construction attributes
3 #
4 # Testing attribute: TDataStd_TreeNode
5 #
6 # Testing command:   PrependNode
7 #
8 # Testing command:   SetNode
9 # Testing command:   AppendNode
10 # Testing command:   ChildNodeIterate
11 #
12
13 puts "caf005-E1"
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 AppendNode D ${aLabel_Root} ${aChild1}
42 PrependNode D ${aLabel_Root} ${aChild2}
43 PrependNode D ${aLabel_Root} ${aChild3}
44
45 # Close/Open the transaction
46 NewCommand D
47
48 # Forget the attribute
49 ForgetAll D ${aLabel_Root}
50
51 # Close/Open the transaction
52 NewCommand D
53
54 # Undo-Redo-Undo
55 Undo D
56 Redo D
57 Undo D
58
59 # Get a value of the attribute
60 set IsDone [catch {set aListChildNodes [ChildNodeIterate D ${aLabel_Root} 1]} aResult]
61 if { ${IsDone} != 0 } {
62         puts ${aResult}
63         puts "Prepend TDataStd_TreeNode attribute: Error"
64         return
65 }
66 set aListChildNodesLength [llength ${aListChildNodes}]
67 if { ${aListChildNodesLength}!=[expr 3 + 0]} {
68         puts "aListChildNodes=${aListChildNodes}"
69         puts "aListChildNodesLength=${aListChildNodesLength}"
70         puts "Prepend TDataStd_TreeNode attribute: Error"
71         return
72 }
73
74 puts "Prepend TDataStd_TreeNode attribute: OK"