4ef398f18ca0f17bea8475aae930db7e9d00c706
[occt.git] / tests / caf / basic / A3
1 #INTERFACE CAF
2 # Basic attributes
3 #
4 # Testing attribute: TDataStd_Integer
5 #
6 # Testing command:   SetInteger
7 # Testing command:   GetInteger
8 #
9
10 puts "caf001-A3"
11
12 # Add an attribute to a data framework
13 set aSetAttr1 100
14 set aLabel 0:2
15 SetInteger D ${aLabel} ${aSetAttr1}
16
17 # Close/Open the transaction
18 NewCommand D
19
20 # Save the document
21 set aFile ${imagedir}/caf001-A3.std
22 file delete ${aFile}
23 SaveAs D ${aFile}
24 if { ![file exists ${aFile}] } {
25         puts "There is not ${aFile} file; SaveAs command: Error"
26         return
27 }
28 #catch {exec chmod 777 ${aFile}}
29
30 # Restore the document
31 Close D
32 Open ${aFile} DD
33
34 # Get a value of the attribute
35 set IsDone [catch {set aGetAttr3 [GetInteger DD ${aLabel}]} aResult]
36 if { ${IsDone} != 0 ||
37         ${aSetAttr1}!=${aGetAttr3} } {
38         puts ${aResult}
39         puts "aSetAttr1=${aSetAttr1} aGetAttr3=${aGetAttr3}"
40         puts "Get a value of TDataStd_Integer attribute from restoring document: Error"
41         return
42 }
43 puts "Get a value of TDataStd_Integer attribute from restoring document: OK"