0024927: Getting rid of "Persistent" functionality -- Tests
[occt.git] / tests / xml / data / ocaf / B7
CommitLineData
607a96d4 1set aTestName "caf004-B3"
2puts ${aTestName}
3
4# Create two new documents Doc1, Doc2
e837410d 5set FileFormat "BinOcaf"
607a96d4 6if { $FileSuffix == "xml" } {
7 set FileFormat "XmlOcaf"
8}
9NewDocument Doc1 $FileFormat
10NewDocument Doc2 $FileFormat
11
12# Set UndoLimit for them
13UndoLimit Doc1 100
14UndoLimit Doc2 100
15
16# Set a shape in Doc1 to label 'SLabel'
17set aLabel1 0:2
18Label Doc1 ${aLabel1}
19SetName Doc1 ${aLabel1} SLabel
20
21set aSetX1 10
22set aSetY1 20
23set aSetZ1 30
24set aSetDX1 100
25set aSetDY1 200
26set aSetDZ1 300
27
28box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
29
30set aBoundingBox1 [bounding aBox1]
31set X1_Box1 [lindex ${aBoundingBox1} 0]
32set Y1_Box1 [lindex ${aBoundingBox1} 1]
33set Z1_Box1 [lindex ${aBoundingBox1} 2]
34set X2_Box1 [lindex ${aBoundingBox1} 3]
35set Y2_Box1 [lindex ${aBoundingBox1} 4]
36set Z2_Box1 [lindex ${aBoundingBox1} 5]
37
38SetShape Doc1 ${aLabel1} aBox1
39
40# Create a new label 'TLabel1' in Doc1
41set aLabel2 0:3
42Label Doc1 ${aLabel2}
43SetName Doc1 ${aLabel2} TLabel1
44
45# Open transaction in Doc1
46NewCommand Doc1
47
48# Copy 'SLabel' to the label 'TLabel1' with link
49CopyWithLink Doc1 ${aLabel2} Doc1 ${aLabel1}
50
51# Close/Open transaction
52NewCommand Doc1
53
54# Save the document
55set aFile $WorkDirectory/${aTestName}.${FileSuffix}
56
57SaveToFile Doc1 $aFile
58
59# Restore the document
60Close Doc1
61Open ${aFile} Doc2
62
63# Get a shape from 'TLabel1' of restoring document
64set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult]
65if { ${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