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