0024927: Getting rid of "Persistent" functionality -- Tests
[occt.git] / tests / caf / xlink / D1
CommitLineData
40093367 1#INTERFACE CAF
2# XLink attributes
3#
4# Testing attribute: TDocStd_XLink
5#
6# Testing command: UpdateLink
7#
8
9puts "caf004-D1"
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# Create a new label 'TLabel1' in Doc2
44set aLabel2 0:3
45Label Doc2 ${aLabel2}
46SetName Doc2 ${aLabel2} TLabel1
47
48# Open transaction in Doc2
49NewCommand Doc2
50
51# Copy 'SLabel' to the label 'TLabel1' with link
52CopyWithLink Doc2 ${aLabel2} Doc1 ${aLabel1}
53
54# Close/Open transaction in Doc2
55NewCommand Doc2
56
57# Set new shape in Doc1 to label 'SLabel'
58set aRadius 70
59psphere aSphere ${aRadius}
60SetShape Doc1 ${aLabel1} aSphere
61
62# Update link in Doc2
63UpdateLink Doc2 ${aLabel2}
64
65# Close/Open transaction in Doc2
66NewCommand Doc2
67
68# Undo Doc2
69Undo Doc2
70
71# Redo Doc2
72Redo Doc2
73
74# Get a shape from 'TLabel1'
75GetShape Doc2 ${aLabel2} aBox2
76
77set aBoundingBox2 [bounding aBox2]
78set X1_Box2 [lindex ${aBoundingBox2} 0]
79set Y1_Box2 [lindex ${aBoundingBox2} 1]
80set Z1_Box2 [lindex ${aBoundingBox2} 2]
81set X2_Box2 [lindex ${aBoundingBox2} 3]
82set Y2_Box2 [lindex ${aBoundingBox2} 4]
83set Z2_Box2 [lindex ${aBoundingBox2} 5]
84
85if { ${X1_Box1} == ${X1_Box2} ||
86 ${Y1_Box1} == ${Y1_Box2} ||
87 ${Z1_Box1} == ${Z1_Box2} ||
88 ${X2_Box1} == ${X2_Box2} ||
89 ${Y2_Box1} == ${Y2_Box2} ||
90 ${Z2_Box1} == ${Z2_Box2} } {
91 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}"
92 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}"
93 puts "Updating a link between attributes of the same document: Error"
94 return
95}
96
97puts "Updating a link between attributes of the same document: OK"