0029967: Draw Harness - command bounding has annoying syntax
[occt.git] / tests / caf / xlink / B3
CommitLineData
40093367 1#INTERFACE CAF
2# XLink attributes
3#
4# Testing attribute: TDocStd_XLink
5#
6# Testing command: CopyWithLink
7#
8
9puts "caf004-B3"
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
1f26f80b 33bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
40093367 34
35SetShape Doc1 ${aLabel1} aBox1
36
37# Create a new label 'TLabel1' in Doc1
38set aLabel2 0:3
39Label Doc1 ${aLabel2}
40SetName Doc1 ${aLabel2} TLabel1
41
42# Open transaction in Doc1
43NewCommand Doc1
44
45# Copy 'SLabel' to the label 'TLabel1' with link
46CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1}
47
48# Close/Open transaction
49NewCommand Doc1
50
51# Save the document
e837410d 52set aFile ${imagedir}/caf004-B3.cbf
40093367 53file delete ${aFile}
54SaveAs Doc1 ${aFile}
55if { ![file exists ${aFile}] } {
56 puts "There is not ${aFile} file; SaveAs command: Error"
57 return
58}
59#catch {exec chmod 777 ${aFile}}
60
61# Restore the document
62Close Doc1
63Open ${aFile} Doc2
64
65# Get a shape from 'TLabel1' of restoring document
66set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult]
67if { ${IsDone} != 0 } {
68 puts ${aResult}
69 puts "Get a value of TNaming_NamedShape attribute from restoring document: Error"
70 return
71}
72
1f26f80b 73bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
1a0339b4 74
75if { [dval X1_Box1] != [dval X1_Box2] ||
76 [dval Y1_Box1] != [dval Y1_Box2] ||
77 [dval Z1_Box1] != [dval Z1_Box2] ||
78 [dval X2_Box1] != [dval X2_Box2] ||
79 [dval Y2_Box1] != [dval Y2_Box2] ||
80 [dval Z2_Box1] != [dval Z2_Box2] } {
81 puts "X1_Box1=[dval X1_Box1] X1_Box2=[dval X1_Box2]"
82 puts "Y1_Box1=[dval Y1_Box1] Y1_Box2=[dval Y1_Box2]"
83 puts "Z1_Box1=[dval Z1_Box1] Z1_Box2=[dval Z1_Box2]"
84 puts "X2_Box1=[dval X2_Box1] X2_Box2=[dval X2_Box2]"
85 puts "Y2_Box1=[dval Y2_Box1] Y2_Box2=[dval Y2_Box2]"
86 puts "Z2_Box1=[dval Z2_Box1] Z2_Box2=[dval Z2_Box2]"
40093367 87 puts "Get a link between attributes of the same document from restoring document: Error"
88 return
89}
90
91puts "Get a link between attributes of the same document from restoring document: OK"