0023087: Upgrade of the OCCT test system
[occt.git] / tests / caf / bugs / B7
1 #INTERFACE CAF
2 puts "================"
3 puts "OCC1228"
4 puts "================"
5 puts ""
6
7 # XLink attributes
8 #
9 # Testing attribute: TDocStd_XLink
10 #
11 # Testing command:   CopyWithLink
12 #
13
14 # ANALOG: puts "caf004-B3"
15
16 # Create two new documents Doc1, Doc2
17 NewDocument Doc1 BinOcaf
18 NewDocument Doc2 BinOcaf
19
20 # Set UndoLimit for them
21 UndoLimit Doc1 100
22 UndoLimit Doc2 100
23
24 # Set a shape in Doc1 to label 'SLabel'
25 set aLabel1 0:2
26 Label Doc1 ${aLabel1}
27 SetName Doc1 ${aLabel1} SLabel
28
29 set aSetX1 10
30 set aSetY1 20
31 set aSetZ1 30
32 set aSetDX1 100
33 set aSetDY1 200
34 set aSetDZ1 300
35
36 box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
37
38 set aBoundingBox1 [bounding aBox1]
39 set X1_Box1 [lindex ${aBoundingBox1} 0]
40 set Y1_Box1 [lindex ${aBoundingBox1} 1]
41 set Z1_Box1 [lindex ${aBoundingBox1} 2]
42 set X2_Box1 [lindex ${aBoundingBox1} 3]
43 set Y2_Box1 [lindex ${aBoundingBox1} 4]
44 set Z2_Box1 [lindex ${aBoundingBox1} 5]
45
46 SetShape Doc1 ${aLabel1} aBox1
47
48 # Create a new label 'TLabel1' in Doc1
49 set aLabel2 0:3
50 Label Doc1 ${aLabel2}
51 SetName Doc1 ${aLabel2} TLabel1
52
53 # Open transaction in Doc1
54 NewCommand Doc1
55
56 # Copy 'SLabel' to the label 'TLabel1' with link
57 CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1}
58
59 # Close/Open transaction
60 NewCommand Doc1
61
62 # Save the document
63 set aFile ${WorkDirectory}/OCC1228-[file tail [info script]].cbf
64 file delete ${aFile}
65 catch {SaveAs Doc1 ${aFile}}
66 if { ![file exists ${aFile}] } {
67         puts "There is not ${aFile} file; SaveAs command: Error"
68         puts "OCC1228: ERROR (case 1)"
69 }
70 #catch {exec chmod 777 ${aFile}}
71
72 # Restore the document
73 Close Doc1
74 catch {Open ${aFile} Doc2}
75
76 # Get a shape from 'TLabel1' of restoring document
77 set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult]
78 if { ${IsDone} != 0 } {
79         puts ${aResult}
80         puts "Get a value of TNaming_NamedShape attribute from restoring document: Error"
81         puts "OCC1228: ERROR (case 2)"
82 }
83
84 catch {set aBoundingBox2 [bounding aBox2]}
85 set X1_Box2 0
86 set Y1_Box2 0
87 set Z1_Box2 0
88 set X2_Box2 0
89 set Y2_Box2 0
90 set Z2_Box2 0
91 catch {set X1_Box2 [lindex ${aBoundingBox2} 0]}
92 catch {set Y1_Box2 [lindex ${aBoundingBox2} 1]}
93 catch {set Z1_Box2 [lindex ${aBoundingBox2} 2]}
94 catch {set X2_Box2 [lindex ${aBoundingBox2} 3]}
95 catch {set Y2_Box2 [lindex ${aBoundingBox2} 4]}
96 catch {set Z2_Box2 [lindex ${aBoundingBox2} 5]}
97
98 if { ${X1_Box1} != ${X1_Box2} || 
99      ${Y1_Box1} != ${Y1_Box2} || 
100      ${Z1_Box1} != ${Z1_Box2} || 
101      ${X2_Box1} != ${X2_Box2} || 
102      ${Y2_Box1} != ${Y2_Box2} || 
103      ${Z2_Box1} != ${Z2_Box2} } {
104         puts "X1_Box1=${X1_Box1} Y1_Box1=${Y1_Box1} Z1_Box1=${Z1_Box1} X2_Box1=${X2_Box1} Y2_Box1=${Y2_Box1} Z2_Box1=${Z2_Box1}"
105         puts "X1_Box2=${X1_Box2} Y1_Box2=${Y1_Box2} Z1_Box2=${Z1_Box2} X2_Box2=${X2_Box2} Y2_Box2=${Y2_Box2} Z2_Box2=${Z2_Box2}"
106         puts "Get a link between attributes of the same document from restoring document: Error"
107         puts "OCC1228: ERROR (case 3)"
108 } else {
109         puts "Get a link between attributes of the same document from restoring document: OK"
110         puts "OCC1228: OK"
111 }