0030773: Application Framework - To allow to inherit existing attributes to reuse...
[occt.git] / tests / caf / basic / G1
1 #INTERFACE CAF
2 # Basic attributes
3 #
4 # Testing attribute: TDataStd_Point
5 #
6 # Testing command:   SetPoint
7 # Testing command:   GetPoint
8 #
9
10 puts "caf001-G1"
11
12 set aTokList { :,}
13
14 # Add an attribute to a data framework
15 set aSetX1 10
16 set aSetY1 20
17 set aSetZ1 30
18 point aPoint1 ${aSetX1} ${aSetY1} ${aSetZ1}
19
20 set aDumpPoint1 [dump aPoint1]
21
22 # [llength ${aDumpPoint1}] = 10
23 # Format of ${aDumpPoint1}:
24 # *********** Dump of aPoint1 *************
25 # Point : 1.000000000000000e+01, 2.000000000000000e+01, 3.000000000000000e+01
26
27 set X_Point1 [lindex [split [lindex ${aDumpPoint1} 7] ${aTokList}] 0]
28 set Y_Point1 [lindex [split [lindex ${aDumpPoint1} 8] ${aTokList}] 0]
29 set Z_Point1 [lindex [split [lindex ${aDumpPoint1} 9] ${aTokList}] 0]
30
31 set aLabel 0:2
32 SetPoint D ${aLabel} aPoint1
33
34 # Close/Open the transaction
35 NewCommand D
36
37 # Forget the attribute
38 ForgetAll D ${aLabel}
39
40 # Close/Open the transaction
41 NewCommand D
42
43 # Undo-Redo-Undo
44 Undo D
45 Redo D
46 Undo D
47
48 # Get a value of the attribute
49 GetPoint D ${aLabel} aPoint2
50
51 set aDumpPoint2 [dump aPoint2]
52 set X_Point2 [lindex [split [lindex ${aDumpPoint2} 7] ${aTokList}] 0]
53 set Y_Point2 [lindex [split [lindex ${aDumpPoint2} 8] ${aTokList}] 0]
54 set Z_Point2 [lindex [split [lindex ${aDumpPoint2} 9] ${aTokList}] 0]
55
56 if { ${X_Point1} != ${X_Point2} || 
57      ${Y_Point1} != ${Y_Point2} || 
58      ${Z_Point1} != ${Z_Point2} } {
59         puts "X_Point1=${X_Point1} X_Point2=${X_Point2}"
60         puts "Y_Point1=${Y_Point1} Y_Point2=${Y_Point2}"
61         puts "Z_Point1=${Z_Point1} Z_Point2=${Z_Point2}"
62         puts "Add Point attribute: Error"
63         return
64 }
65 puts "Add Point attribute: OK"