0024927: Getting rid of "Persistent" functionality -- Tests
[occt.git] / tests / caf / xlink / D2
CommitLineData
40093367 1#INTERFACE CAF
2# XLink attributes
3#
4# Testing attribute: TDocStd_XLink
5#
6# Testing command: UpdateLink
7#
8
9puts "caf004-D2"
10
11# Create two new documents Doc1, Doc2
e837410d 12NewDocument Doc1 BinOcaf
13NewDocument Doc2 BinOcaf
40093367 14
15# Set UndoLimit for them
16UndoLimit Doc1 100
17UndoLimit Doc2 100
18
19# Set a shape in Doc1 to label 'SLabel'
20set aLabel1 0:2
21Label Doc1 ${aLabel1}
22SetName Doc1 ${aLabel1} SLabel
23
24set aSetX1 10
25set aSetY1 20
26set aSetZ1 30
27set aSetDX1 100
28set aSetDY1 200
29set aSetDZ1 300
30
31box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
32
33set aBoundingBox1 [bounding aBox1]
34set X1_Box1 [lindex ${aBoundingBox1} 0]
35set Y1_Box1 [lindex ${aBoundingBox1} 1]
36set Z1_Box1 [lindex ${aBoundingBox1} 2]
37set X2_Box1 [lindex ${aBoundingBox1} 3]
38set Y2_Box1 [lindex ${aBoundingBox1} 4]
39set Z2_Box1 [lindex ${aBoundingBox1} 5]
40
41SetShape Doc1 ${aLabel1} aBox1
42
43# Set a shape in Doc1 to label 'S2Label'
44set aLabel12 0:22
45Label Doc1 ${aLabel12}
46SetName Doc1 ${aLabel12} S2Label
47
48set aSetX12 210
49set aSetY12 220
50set aSetZ12 230
51set aSetDX12 2100
52set aSetDY12 2200
53set aSetDZ12 2300
54
55box aBox12 ${aSetX12} ${aSetY12} ${aSetZ12} ${aSetDX12} ${aSetDY12} ${aSetDZ12}
56
57set aBoundingBox12 [bounding aBox12]
58set X1_Box12 [lindex ${aBoundingBox12} 0]
59set Y1_Box12 [lindex ${aBoundingBox12} 1]
60set Z1_Box12 [lindex ${aBoundingBox12} 2]
61set X2_Box12 [lindex ${aBoundingBox12} 3]
62set Y2_Box12 [lindex ${aBoundingBox12} 4]
63set Z2_Box12 [lindex ${aBoundingBox12} 5]
64
65SetShape Doc1 ${aLabel12} aBox12
66
67# Create a new label 'TLabel1' in Doc2
68set aLabel2 0:3
69Label Doc2 ${aLabel2}
70SetName Doc2 ${aLabel2} TLabel1
71
72# Create a new label 'T2Label1' in Doc2
73set aLabel22 0:32
74Label Doc2 ${aLabel22}
75SetName Doc2 ${aLabel22} T2Label1
76
77# Open transaction in Doc2
78NewCommand Doc2
79
80# Copy 'SLabel' to the label 'TLabel1' with link
81CopyWithLink Doc2 ${aLabel2} Doc1 ${aLabel1}
82
83# Copy 'S2Label' to the label 'T2Label1' with link
84CopyWithLink Doc2 ${aLabel22} Doc1 ${aLabel12}
85
86# Close/Open transaction in Doc2
87NewCommand Doc2
88
89# Set new shape in Doc1 to label 'SLabel'
90set aRadius 70
91psphere aSphere ${aRadius}
92SetShape Doc1 ${aLabel1} aSphere
93
94# Set new shape in Doc1 to label 'SLabel'
95set aRadius 270
96psphere aSphere ${aRadius}
97SetShape Doc1 ${aLabel12} aSphere
98
99# Update all links in Doc2
100UpdateLink Doc2
101
102# Close/Open transaction in Doc2
103NewCommand Doc2
104
105# Undo Doc2
106Undo Doc2
107
108# Redo Doc2
109Redo Doc2
110
111# Get a shape from 'TLabel1'
112GetShape Doc2 ${aLabel2} aBox2
113
114set aBoundingBox2 [bounding aBox2]
115set X1_Box2 [lindex ${aBoundingBox2} 0]
116set Y1_Box2 [lindex ${aBoundingBox2} 1]
117set Z1_Box2 [lindex ${aBoundingBox2} 2]
118set X2_Box2 [lindex ${aBoundingBox2} 3]
119set Y2_Box2 [lindex ${aBoundingBox2} 4]
120set Z2_Box2 [lindex ${aBoundingBox2} 5]
121
122# Get a shape from 'T2Label1'
123GetShape Doc2 ${aLabel22} aBox22
124
125set aBoundingBox22 [bounding aBox22]
126set X1_Box22 [lindex ${aBoundingBox22} 0]
127set Y1_Box22 [lindex ${aBoundingBox22} 1]
128set Z1_Box22 [lindex ${aBoundingBox22} 2]
129set X2_Box22 [lindex ${aBoundingBox22} 3]
130set Y2_Box22 [lindex ${aBoundingBox22} 4]
131set Z2_Box22 [lindex ${aBoundingBox22} 5]
132
133if { ${X1_Box1} == ${X1_Box2} ||
134 ${Y1_Box1} == ${Y1_Box2} ||
135 ${Z1_Box1} == ${Z1_Box2} ||
136 ${X2_Box1} == ${X2_Box2} ||
137 ${Y2_Box1} == ${Y2_Box2} ||
138 ${Z2_Box1} == ${Z2_Box2} ||
139
140 ${X1_Box12} == ${X1_Box22} ||
141 ${Y1_Box12} == ${Y1_Box22} ||
142 ${Z1_Box12} == ${Z1_Box22} ||
143 ${X2_Box12} == ${X2_Box22} ||
144 ${Y2_Box12} == ${Y2_Box22} ||
145 ${Z2_Box12} == ${Z2_Box22} ||
146
147 ${X1_Box2} == ${X1_Box22} ||
148 ${Y1_Box2} == ${Y1_Box22} ||
149 ${Z1_Box2} == ${Z1_Box22} ||
150 ${X2_Box2} == ${X2_Box22} ||
151 ${Y2_Box2} == ${Y2_Box22} ||
152 ${Z2_Box2} == ${Z2_Box22} } {
153
154 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}"
155 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}"
156 puts "X1_Box12=${X1_Box12} Y1_Box12=${Y1_Box12} Z1_Box12=${Z1_Box12} X2_Box12=${X2_Box12} Y2_Box12=${Y2_Box12} Z2_Box12=${Z2_Box12}"
157 puts "X1_Box22=${X1_Box22} Y1_Box22=${Y1_Box22} Z1_Box22=${Z1_Box22} X2_Box22=${X2_Box22} Y2_Box22=${Y2_Box22} Z2_Box22=${Z2_Box22}"
158 puts "Updating all links between attributes of the same document: Error"
159 return
160}
161
162puts "Updating all links between attributes of the same document: OK"