607a96d4 |
1 | set aTestName "caf004-B3" |
2 | puts ${aTestName} |
3 | |
4 | # Create two new documents Doc1, Doc2 |
e837410d |
5 | set FileFormat "BinOcaf" |
607a96d4 |
6 | if { $FileSuffix == "xml" } { |
7 | set FileFormat "XmlOcaf" |
8 | } |
9 | NewDocument Doc1 $FileFormat |
10 | NewDocument Doc2 $FileFormat |
11 | |
12 | # Set UndoLimit for them |
13 | UndoLimit Doc1 100 |
14 | UndoLimit Doc2 100 |
15 | |
16 | # Set a shape in Doc1 to label 'SLabel' |
17 | set aLabel1 0:2 |
18 | Label Doc1 ${aLabel1} |
19 | SetName Doc1 ${aLabel1} SLabel |
20 | |
21 | set aSetX1 10 |
22 | set aSetY1 20 |
23 | set aSetZ1 30 |
24 | set aSetDX1 100 |
25 | set aSetDY1 200 |
26 | set aSetDZ1 300 |
27 | |
28 | box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1} |
29 | |
30 | set aBoundingBox1 [bounding aBox1] |
31 | set X1_Box1 [lindex ${aBoundingBox1} 0] |
32 | set Y1_Box1 [lindex ${aBoundingBox1} 1] |
33 | set Z1_Box1 [lindex ${aBoundingBox1} 2] |
34 | set X2_Box1 [lindex ${aBoundingBox1} 3] |
35 | set Y2_Box1 [lindex ${aBoundingBox1} 4] |
36 | set Z2_Box1 [lindex ${aBoundingBox1} 5] |
37 | |
38 | SetShape Doc1 ${aLabel1} aBox1 |
39 | |
40 | # Create a new label 'TLabel1' in Doc1 |
41 | set aLabel2 0:3 |
42 | Label Doc1 ${aLabel2} |
43 | SetName Doc1 ${aLabel2} TLabel1 |
44 | |
45 | # Open transaction in Doc1 |
46 | NewCommand Doc1 |
47 | |
48 | # Copy 'SLabel' to the label 'TLabel1' with link |
49 | CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1} |
50 | |
51 | # Close/Open transaction |
52 | NewCommand Doc1 |
53 | |
54 | # Save the document |
55 | set aFile $WorkDirectory/${aTestName}.${FileSuffix} |
56 | |
57 | SaveToFile Doc1 $aFile |
58 | |
59 | # Restore the document |
60 | Close Doc1 |
61 | Open ${aFile} Doc2 |
62 | |
63 | # Get a shape from 'TLabel1' of restoring document |
64 | set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult] |
65 | if { ${IsDone} != 0 } { |
66 | puts "Error : Get a value of TNaming_NamedShape attribute from restoring document" |
67 | } else { |
68 | set aBoundingBox2 [bounding aBox2] |
69 | set X1_Box2 [lindex ${aBoundingBox2} 0] |
70 | set Y1_Box2 [lindex ${aBoundingBox2} 1] |
71 | set Z1_Box2 [lindex ${aBoundingBox2} 2] |
72 | set X2_Box2 [lindex ${aBoundingBox2} 3] |
73 | set Y2_Box2 [lindex ${aBoundingBox2} 4] |
74 | set Z2_Box2 [lindex ${aBoundingBox2} 5] |
75 | |
76 | if { ${X1_Box1} != ${X1_Box2} || |
77 | ${Y1_Box1} != ${Y1_Box2} || |
78 | ${Z1_Box1} != ${Z1_Box2} || |
79 | ${X2_Box1} != ${X2_Box2} || |
80 | ${Y2_Box1} != ${Y2_Box2} || |
81 | ${Z2_Box1} != ${Z2_Box2} } { |
82 | 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}" |
83 | 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}" |
84 | puts "Error : Get a link between attributes of the same document from restoring document" |
85 | } |
86 | } |
87 | |