0032705: Test - name clashes within temporary files within bugs/caf/bug23766_X
[occt.git] / tests / caf / bugs / A8
1 #INTERFACE CAF
2 puts "================"
3 puts "OCC1228"
4 puts "================"
5 puts ""
6
7 # Basic attributes
8 #
9 # Testing attribute: TDataStd_Axis
10 #
11 # Testing command:   SetAxis
12 # Testing command:   GetAxis
13 #
14
15 # ANALOG: puts "caf001-H3"
16
17 # Create a new document and set UndoLimit
18 NewDocument Doc BinOcaf
19 UndoLimit Doc 100
20
21 # Open a transaction
22 NewCommand Doc
23
24 set aTokList { :,}
25
26 # Add an attribute to a data framework
27 set aSetX1 10
28 set aSetY1 20
29 set aSetZ1 30
30 set aSetDX1 100
31 set aSetDY1 200
32 set aSetDZ1 300
33 line aLine1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
34
35 set aDumpLine1 [dump aLine1]
36
37 # [llength ${aDumpLine1}] = 14
38 # Format of ${aDumpLine1}:
39 # *********** Dump of aLine1 *************
40 # Line
41 #   Origin :10, 20, 30 
42 #   Axis   :0.267261241912424, 0.534522483824849, 0.801783725737273 
43
44 set anOriginX_Line1 [lindex [split [lindex ${aDumpLine1} 7] ${aTokList}] 1]
45 set anOriginY_Line1 [lindex [split [lindex ${aDumpLine1} 8] ${aTokList}] 0]
46 set anOriginZ_Line1 [lindex [split [lindex ${aDumpLine1} 9] ${aTokList}] 0]
47 set anAxisDX_Line1 [lindex [split [lindex ${aDumpLine1} 11] ${aTokList}] 1]
48 set anAxisDY_Line1 [lindex [split [lindex ${aDumpLine1} 12] ${aTokList}] 0]
49 set anAxisDZ_Line1 [lindex [split [lindex ${aDumpLine1} 13] ${aTokList}] 0]
50
51 set aLabel 0:2
52 SetAxis Doc ${aLabel} aLine1
53
54 # Close/Open the transaction
55 NewCommand Doc
56
57 # Save the document
58 set aFile ${imagedir}/OCC1228-${casename}.cbf
59 file delete ${aFile}
60 catch {SaveAs Doc ${aFile}}
61 if { ![file exists ${aFile}] } {
62         puts "There is not ${aFile} file; SaveAs command: Error"
63         puts "OCC1228: ERROR (case 1)"
64 }
65 #catch {exec chmod 777 ${aFile}}
66
67 # Restore the document
68 Close Doc
69 catch {Open ${aFile} DDoc}
70
71 # Get a value of the attribute
72 set IsDone [catch {GetAxis DDoc ${aLabel} anAxis3} aResult]
73 if { ${IsDone} != 0 } {
74         puts ${aResult}
75         puts "Get a value of TDataStd_Axis attribute from restoring document: Error"
76         puts "OCC1228: ERROR (case 2)"
77 }
78
79 set aDumpAxis3 [dump anAxis3]
80 set anOriginX_Axis3 [lindex [split [lindex ${aDumpAxis3} 7] ${aTokList}] 1]
81 set anOriginY_Axis3 [lindex [split [lindex ${aDumpAxis3} 8] ${aTokList}] 0]
82 set anOriginZ_Axis3 [lindex [split [lindex ${aDumpAxis3} 9] ${aTokList}] 0]
83 set anAxisDX_Axis3 [lindex [split [lindex ${aDumpAxis3} 11] ${aTokList}] 1]
84 set anAxisDY_Axis3 [lindex [split [lindex ${aDumpAxis3} 12] ${aTokList}] 0]
85 set anAxisDZ_Axis3 [lindex [split [lindex ${aDumpAxis3} 13] ${aTokList}] 0]
86
87 if { ${anOriginX_Line1} != ${anOriginX_Axis3} || 
88      ${anOriginY_Line1} != ${anOriginY_Axis3} || 
89      ${anOriginZ_Line1} != ${anOriginZ_Axis3} || 
90      ${anAxisDX_Line1} != ${anAxisDX_Axis3} || 
91      ${anAxisDY_Line1} != ${anAxisDY_Axis3} || 
92      ${anAxisDZ_Line1} != ${anAxisDZ_Axis3} } {
93         puts "anOriginX_Line1=${anOriginX_Line1} anOriginX_Axis3=${anOriginX_Axis3}"
94         puts "anOriginY_Line1=${anOriginY_Line1} anOriginY_Axis3=${anOriginY_Axis3}"
95         puts "anOriginZ_Line1=${anOriginZ_Line1} anOriginZ_Axis3=${anOriginZ_Axis3}"
96         puts "anAxisDX_Line1=${anAxisDX_Line1} anAxisDX_Axis3=${anAxisDX_Axis3}"
97         puts "anAxisDY_Line1=${anAxisDY_Line1} anAxisDY_Axis3=${anAxisDY_Axis3}"
98         puts "anAxisDZ_Line1=${anAxisDZ_Line1} anAxisDZ_Axis3=${anAxisDZ_Axis3}"
99         puts "Get a value of TDataStd_Axis attribute from restoring document: Error"
100         puts "OCC1228: ERROR (case 2)"
101 } else {
102         puts "Get a value of TDataStd_Axis attribute from restoring document: OK"
103         puts "OCC1228: OK"
104 }