0024927: Getting rid of "Persistent" functionality -- Tests
[occt.git] / tests / bugs / caf / bug25394_1
1 # =================== OCAF ======================
2 # Standard attributes of List containers (std format)
3 #
4 # Testing purpose: test of set /get & save / restore 
5 #                  of TDataStd_BooleanList,  TDataStd_IntegerList 
6 #                  TDataStd_RealList, TDataStd_ExtStringList,
7 #                  TDataStd_ReferenceList  attributes
8 #                  
9 # ===============================================
10 # Test case: t1 (testing Set /Get attribute with empty list)
11 # 1. create BooleanList attribute with empty list
12 # 2. create IntegerList attribute with empty list
13 # 3. create RealList attribute with empty list
14 # 4. create ExtStringList attribute with empty list
15 # 5. create ReferenceList attribute with empty list
16 # 6. save the Document in external std file 
17 # 7. reopen the Document
18 # 8. check the restored attributes at the specified labels
19 # ===============================================
20
21 NewDocument D BinOcaf
22 # 1.  create BooleanList attribute with empty list
23 set Lab1 [Label D 0:1:1]
24 SetBooleanList D $Lab1
25 set info1 [GetBooleanList D $Lab1]
26 # output => "List is empty"
27
28 # 2. create IntegerList attribute with empty list
29 set Lab2 [Label D 0:1:2]
30 SetIntegerList D $Lab2
31 set info2 [GetIntegerList D $Lab2]
32 # output => "List is empty"
33
34 # 3. create RealList attribute with empty list
35 set Lab3 [Label D 0:1:3]
36 SetRealList D $Lab3
37 set info3 [GetRealList D $Lab3]
38 # output => "List is empty"
39
40 # 4. create ExtStringList attribute with empty list
41 set Lab4 [Label D 0:1:4]
42 SetExtStringList D $Lab4
43 set info4 [GetExtStringList D $Lab4]
44 # output => "List is empty"
45
46 # 5. create ReferenceList attribute with empty list
47 set Lab5 [Label D 0:1:5]
48 SetReferenceList D $Lab5
49 set info5 [GetReferenceList D $Lab5]
50 # output => "List is empty"
51
52 # 6. save the Document in external file
53 SaveAs D ${imagedir}/bug26014_test1.cbf
54 Close D
55
56 # 7. reopen the Document
57 Open ${imagedir}/bug26014_test1.cbf D
58
59 # 8. Check the restored attributes at the specified labels
60 set info8 [GetBooleanList D $Lab1]
61 # output => "List is empty"
62
63 set info9 [GetIntegerList D $Lab2]
64 # output => "List is empty"
65
66 set info10 [GetRealList D $Lab3]
67 # output => "List is empty"
68
69 set info11 [GetExtStringList D $Lab4]
70 # output => "List is empty"
71
72 set info12 [GetReferenceList D $Lab5]
73 # output => "List is empty"
74
75 Close D
76
77 if { [regexp {List is empty} ${info1}] } {
78    puts "OK: created BooleanList attribute is good"
79 } else {
80    puts "Error: created BooleanList attribute is bad"
81 }
82 if { [regexp {List is empty} ${info2}] } {
83    puts "OK: created IntegerList attribute is good"
84 } else {
85    puts "Error: created IntegerList attribute is bad"
86 }
87 if { [regexp {List is empty} ${info3}] } {
88    puts "OK: created RealList attribute is good"
89 } else {
90    puts "Error: created RealList attribute is bad"
91 }
92 if { [regexp {List is empty} ${info4}] } {
93    puts "OK: created ExtStringList attribute is good"
94 } else {
95    puts "Error: created ExtStringList attribute is bad"
96 }
97 if { [regexp {List is empty} ${info5}] } {
98    puts "OK: created ReferenceList attribute is good"
99 } else {
100    puts "Error: created ReferenceList attribute is bad"
101 }
102
103 if { [regexp {List is empty} ${info8}] } {
104    puts "OK: restored BooleanList attribute is good"
105 } else {
106    puts "Error: restored BooleanList attribute is bad"
107 }
108 if { [regexp {List is empty} ${info9}] } {
109    puts "OK: restored IntegerList attribute is good"
110 } else {
111    puts "Error: restored IntegerList attribute is bad"
112 }
113 if { [regexp {List is empty} ${info10}] } {
114    puts "OK: restored RealList attribute is good"
115 } else {
116    puts "Error: restored RealList attribute is bad"
117 }
118 if { [regexp {List is empty} ${info11}] } {
119    puts "OK: restored ExtStringList attribute is good"
120 } else {
121    puts "Error: restored ExtStringList attribute is bad"
122 }
123 if { [regexp {List is empty} ${info12}] } {
124    puts "OK: restored ReferenceList attribute is good"
125 } else {
126    puts "Error: restored ReferenceList attribute is bad"
127 }