0029967: Draw Harness - command bounding has annoying syntax
[occt.git] / tests / caf / xlink / D1
1 #INTERFACE CAF
2 # XLink attributes
3 #
4 # Testing attribute: TDocStd_XLink
5 #
6 # Testing command:   UpdateLink
7 #
8
9 puts "caf004-D1"
10
11 # Create two new documents Doc1, Doc2
12 NewDocument Doc1 BinOcaf
13 NewDocument Doc2 BinOcaf
14
15 # Set UndoLimit for them
16 UndoLimit Doc1 100
17 UndoLimit Doc2 100
18
19 # Set a shape in Doc1 to label 'SLabel'
20 set aLabel1 0:2
21 Label Doc1 ${aLabel1}
22 SetName Doc1 ${aLabel1} SLabel
23
24 set aSetX1 10
25 set aSetY1 20
26 set aSetZ1 30
27 set aSetDX1 100
28 set aSetDY1 200
29 set aSetDZ1 300
30
31 box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
32
33 bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
34
35 SetShape Doc1 ${aLabel1} aBox1
36
37 # Create a new label 'TLabel1' in Doc2
38 set aLabel2 0:3
39 Label Doc2 ${aLabel2}
40 SetName Doc2 ${aLabel2} TLabel1
41
42 # Open transaction in Doc2
43 NewCommand Doc2
44
45 # Copy 'SLabel' to the label 'TLabel1' with link
46 CopyWithLink Doc2 ${aLabel2} Doc1 ${aLabel1}
47
48 # Close/Open transaction in Doc2
49 NewCommand Doc2
50
51 # Set new shape in Doc1 to label 'SLabel'
52 set aRadius 70
53 psphere aSphere ${aRadius}
54 SetShape Doc1 ${aLabel1} aSphere
55
56 # Update link in Doc2
57 UpdateLink Doc2 ${aLabel2}
58
59 # Close/Open transaction in Doc2
60 NewCommand Doc2
61
62 # Undo Doc2
63 Undo Doc2
64
65 # Redo Doc2
66 Redo Doc2
67
68 # Get a shape from 'TLabel1'
69 GetShape Doc2 ${aLabel2} aBox2
70
71 bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
72
73 if { [dval X1_Box1] == [dval X1_Box2] || 
74      [dval Y1_Box1] == [dval Y1_Box2] || 
75      [dval Z1_Box1] == [dval Z1_Box2] || 
76      [dval X2_Box1] == [dval X2_Box2] || 
77      [dval Y2_Box1] == [dval Y2_Box2] || 
78      [dval Z2_Box1] == [dval Z2_Box2] } {
79         puts "X1_Box1=[dval X1_Box1] X1_Box2=[dval X1_Box2]"
80         puts "Y1_Box1=[dval Y1_Box1] Y1_Box2=[dval Y1_Box2]"
81         puts "Z1_Box1=[dval Z1_Box1] Z1_Box2=[dval Z1_Box2]"
82         puts "X2_Box1=[dval X2_Box1] X2_Box2=[dval X2_Box2]"
83         puts "Y2_Box1=[dval Y2_Box1] Y2_Box2=[dval Y2_Box2]"
84         puts "Z2_Box1=[dval Z2_Box1] Z2_Box2=[dval Z2_Box2]"
85         puts "Updating a link between attributes of the same document: Error"
86         return
87 }
88
89 puts "Updating a link between attributes of the same document: OK"