2 # Persistence functionality
4 # Testing feature: Saving empty labels (BinOcaf format)
6 # Testing command: SaveAs, Open
12 set Lab1 [Label D 0:1:1]
13 set Lab2 [Label D 0:1:2]
14 set Lab3 [Label D 0:1:3]
15 ## set List1 {0:1:1 0:1:2 0:1:3}
18 set aFile1 ${imagedir}/caf001-y1-1.cbf
19 set aFile2 ${imagedir}/caf001-y1-2.cbf
21 #1. Open a new Document in BinOcaf format
22 # NewDocument D BinOcaf
24 #2. Put integer attribute at the label Lab2
25 SetInteger D $Lab2 321
26 SetReal D $Lab2 871.33
28 #3. Save the Document with flag saveEmptyLabels = 1
29 catch {SaveAs D ${aFile1} 1}
30 if { ![file exists ${aFile1}] } {
31 puts "There is not ${aFile} file; SaveAs command: Error writing binary file"
36 #4. Save the Document with flag saveEmptyLabels = 0
37 catch {SaveAs D ${aFile2} 0}
38 if { ![file exists ${aFile2}] } {
39 puts "There is not ${aFile} file; SaveAs command: Error writing binary file"
44 #5. Open the just saved binary files
46 catch {Open ${aFile1} D1}
47 catch {Open ${aFile2} D2}
50 #5. Get list of child labels of main label (0:1)
51 set List1 [Children D1 0:1]
52 set List2 [Children D2 0:1]
54 #6. Check length of the list of labels in aFile1 (to be len == 3)
55 set len1 [llength ${List1}]
57 puts "ERROR: Incorrect number of saved labels in cbf file, n = $len1"
61 #7. Check length of the list of labels in aFile2 (to be len == 1)
62 set len2 [llength ${List2}]
64 puts "ERROR: Incorrect number of saved labels in cbf file, n = $len2"
73 puts "Saving empty labels: OK"