Adjusting testing cases for current state of OCCT
[occt.git] / tests / caf / bugs / A9
1 #INTERFACE CAF
2 puts "================"
3 puts "OCC1228"
4 puts "================"
5 puts ""
6
7 # Basic attributes
8 #
9 # Testing attribute: TDataStd_Plane
10 #
11 # Testing command:   SetPlane
12 # Testing command:   GetPlane
13 #
14
15 # ANALOG: puts "caf001-I3"
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 -1
31 set aSetDY1 0
32 set aSetDZ1 0
33
34 plane aPlane1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
35
36 set aDumpPlane1 [dump aPlane1]
37
38 # [llength ${aDumpPlane1}] = 22
39 # Format of ${aDumpPlane1}:
40 # *********** Dump of aPlane1 *************
41 # Plane
42 #   Origin :10, 20, 30 
43 #   Axis   :-1, 0, 0 
44 #   XAxis  :-0, 0, -1 
45 #   YAxis  :-0, -1, 0 
46
47 set anOriginX_Plane1 [lindex [split [lindex ${aDumpPlane1} 7] ${aTokList}] 1]
48 set anOriginY_Plane1 [lindex [split [lindex ${aDumpPlane1} 8] ${aTokList}] 0]
49 set anOriginZ_Plane1 [lindex [split [lindex ${aDumpPlane1} 9] ${aTokList}] 0]
50 set anAxisDX_Plane1 [lindex [split [lindex ${aDumpPlane1} 11] ${aTokList}] 1]
51 set anAxisDY_Plane1 [lindex [split [lindex ${aDumpPlane1} 12] ${aTokList}] 0]
52 set anAxisDZ_Plane1 [lindex [split [lindex ${aDumpPlane1} 13] ${aTokList}] 0]
53
54 set aLabel 0:2
55 SetPlane Doc ${aLabel} aPlane1
56
57 # Close/Open the transaction
58 NewCommand Doc
59
60 # Save the document
61 set aFile ${imagedir}/OCC1228-[file tail [info script]].cbf
62 file delete ${aFile}
63 catch {SaveAs Doc ${aFile}}
64 if { ![file exists ${aFile}] } {
65         puts "There is not ${aFile} file; SaveAs command: Error"
66         puts "OCC1228: ERROR (case 1)"
67 }
68 #catch {exec chmod 777 ${aFile}}
69
70 # Restore the document
71 Close Doc
72 catch {Open ${aFile} DDoc}
73
74 # Get a value of the attribute
75 set IsDone [catch {GetPlane DDoc ${aLabel} aPlane5} aResult]
76 if { ${IsDone} != 0 } {
77         puts ${aResult}
78         puts "Get a value of TDataStd_Plane attribute from restoring document: Error"
79         puts "OCC1228: ERROR (case 2)"
80 }
81
82 set aDumpPlane5 [dump aPlane5]
83 set anOriginX_Plane5 [lindex [split [lindex ${aDumpPlane5} 7] ${aTokList}] 1]
84 set anOriginY_Plane5 [lindex [split [lindex ${aDumpPlane5} 8] ${aTokList}] 0]
85 set anOriginZ_Plane5 [lindex [split [lindex ${aDumpPlane5} 9] ${aTokList}] 0]
86 set anAxisDX_Plane5 [lindex [split [lindex ${aDumpPlane5} 11] ${aTokList}] 1]
87 set anAxisDY_Plane5 [lindex [split [lindex ${aDumpPlane5} 12] ${aTokList}] 0]
88 set anAxisDZ_Plane5 [lindex [split [lindex ${aDumpPlane5} 13] ${aTokList}] 0]
89
90 if { ${anOriginX_Plane1} != ${anOriginX_Plane5} || 
91      ${anOriginY_Plane1} != ${anOriginY_Plane5} || 
92      ${anOriginZ_Plane1} != ${anOriginZ_Plane5} || 
93      ${anAxisDX_Plane1} != ${anAxisDX_Plane5} || 
94      ${anAxisDY_Plane1} != ${anAxisDY_Plane5} || 
95      ${anAxisDZ_Plane1} != ${anAxisDZ_Plane5} } {
96         puts "anOriginX_Plane1=${anOriginX_Plane1} anOriginX_Plane5=${anOriginX_Plane5}"
97         puts "anOriginY_Plane1=${anOriginY_Plane1} anOriginY_Plane5=${anOriginY_Plane5}"
98         puts "anOriginZ_Plane1=${anOriginZ_Plane1} anOriginZ_Plane5=${anOriginZ_Plane5}"
99         puts "anAxisDX_Plane1=${anAxisDX_Plane1} anAxisDX_Plane5=${anAxisDX_Plane5}"
100         puts "anAxisDY_Plane1=${anAxisDY_Plane1} anAxisDY_Plane5=${anAxisDY_Plane5}"
101         puts "anAxisDZ_Plane1=${anAxisDZ_Plane1} anAxisDZ_Plane5=${anAxisDZ_Plane5}"
102         puts "Get a value of TDataStd_Plane attribute from restoring document: Error"
103         puts "OCC1228: ERROR (case 3)"
104 } else {
105         puts "Get a value of TDataStd_Plane attribute from restoring document: OK"
106         puts "OCC1228: OK"
107 }