0030773: Application Framework - To allow to inherit existing attributes to reuse...
[occt.git] / tests / caf / basic / C5
1 #INTERFACE CAF
2 # Basic attributes
3 # TDataStd_RealArray
4 #
5 # Testing attribute: User defined (additional GUID) TDataStd_RealArray
6 #
7 # Testing command:   SetRealArray
8 # Testing command:   GetRealArray
9 #
10
11 puts "caf001-C5"
12 set QA_DUP 0
13
14 # Add an attributes to a data framework
15 set aFrom1 1
16 set aTo1 2
17 set aSetAttr11 3.
18 set aSetAttr12 4.
19 set aLabel 0:2
20 set isDelta 0
21 set aGuid1 "12e94511-6dbc-11d4-b9c8-0060b0ee281b"
22
23 SetRealArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
24 SetRealArray D ${aLabel} ${isDelta} -g ${aGuid1} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
25
26 # Close/Open the transaction
27 NewCommand D
28
29 # Forget the attribute
30 ForgetAll D ${aLabel}
31
32 # Close/Open the transaction
33 NewCommand D
34
35 # Undo-Redo-Undo
36 Undo D
37 Redo D
38 Undo D
39
40 # Save Document
41 set aFile ${imagedir}/caf001-C5.cbf
42 SaveAs D ${aFile}; 
43 Close D
44
45 #Open a document
46 Open ${aFile} D
47
48 # Get a value of the attribute
49 set IsGood 1
50 set aMessage1 "Add TDataStd_RealArray attribute: Error"
51 set aGetAttr1 [GetRealArray D ${aLabel}]
52 set aLen1 [llength ${aGetAttr1}]
53 set aGetAttr2 [GetRealArray D ${aLabel} ${aGuid1}]
54 set aLen2 [llength ${aGetAttr2}]
55
56 if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
57    set IsGood 0
58    puts "aLen1=${aLen1}"
59    puts ${aMessage1}
60 }
61 if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
62    set IsGood 0
63    puts "aLen2=${aLen2}"
64    puts ${aMessage1}
65 }
66
67 set aGetAttr11 [lindex ${aGetAttr1} 0]
68 set aGetAttr21 [lindex ${aGetAttr2} 0]
69 if { ${aGetAttr11} != ${aGetAttr21} } {
70    set IsGood 0
71    puts "aGetAttr11=${aGetAttr11}"
72    puts "aGetAttr21=${aGetAttr21}"
73    puts ${aMessage1}
74 }
75 set aGetAttr12 [lindex ${aGetAttr1} 1]
76 set aGetAttr22 [lindex ${aGetAttr2} 1]
77 if { ${aGetAttr12} != ${aGetAttr22} } {
78    set IsGood 0
79    puts "aGetAttr12=${aGetAttr12}"
80    puts "aGetAttr22=${aGetAttr22}"
81    puts ${aMessage1}
82 }
83
84 if { ${IsGood} == 0} {
85   puts "Add TDataStd_RealArray attribute: Error"
86 } else {
87   puts "Add TDataStd_RealArray attribute: OK"
88 }