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