40093367 |
1 | #INTERFACE CAF |
2 | puts "================" |
3 | puts "OCC1228" |
4 | puts "================" |
5 | puts "" |
6 | |
7 | # Basic attributes |
8 | # |
9 | # Testing attribute: TDataStd_IntegerArray |
10 | # |
11 | # Testing command: SetIntArray |
12 | # Testing command: GetIntArray |
13 | # |
14 | |
15 | # ANALOG: puts "caf001-D3" |
16 | set QA_DUP 0 |
17 | |
18 | # Create a new document and set UndoLimit |
19 | NewDocument Doc BinOcaf |
20 | UndoLimit Doc 100 |
21 | |
22 | # Open a transaction |
23 | NewCommand Doc |
24 | |
25 | # Add an attribute to a data framework |
26 | set aFrom1 1 |
27 | set aTo1 2 |
28 | set aSetAttr11 3 |
29 | set aSetAttr12 4 |
30 | set aLabel 0:2 |
31 | set isDelta 0 |
32 | SetIntArray Doc ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12} |
33 | |
34 | # Close/Open the transaction |
35 | NewCommand Doc |
36 | |
37 | # Save the document |
8418c617 |
38 | set aFile ${imagedir}/OCC1228-[file tail [info script]].cbf |
40093367 |
39 | file delete ${aFile} |
40 | catch {SaveAs Doc ${aFile}} |
41 | if { ![file exists ${aFile}] } { |
42 | puts "There is not ${aFile} file; SaveAs command: Error" |
43 | puts "OCC1228: ERROR (case 1)" |
44 | } |
45 | #catch {exec chmod 777 ${aFile}} |
46 | |
47 | # Restore the document |
48 | Close Doc |
49 | catch {Open ${aFile} DDoc} |
50 | |
51 | # Get a value of the attribute |
52 | set aGetAttr3 "" |
53 | set aMessage3 "Get a value of TDataStd_IntegerArray attribute from restoring document: Error" |
54 | set IsDone [catch {set aGetAttr3 [GetIntArray DDoc ${aLabel}]} aResult] |
55 | if { ${IsDone} != 0 } { |
56 | puts ${aMessage3} |
57 | puts "OCC1228: ERROR (case 2)" |
58 | } |
59 | set aLen3 [llength ${aGetAttr3}] |
60 | if { ${aLen3} != [expr ${aTo1} - ${aFrom1} + 1] } { |
61 | puts "aLen3=${aLen3}" |
62 | puts ${aMessage3} |
63 | puts "OCC1228: ERROR (case 3)" |
64 | } |
65 | set aGetAttr41 [lindex ${aGetAttr3} 0] |
66 | if { ${aSetAttr11} != ${aGetAttr41} } { |
67 | puts "aGetAttr41=${aGetAttr41}" |
68 | puts ${aMessage3} |
69 | puts "OCC1228: ERROR (case 4)" |
70 | } |
71 | set aGetAttr42 [lindex ${aGetAttr3} 1] |
72 | if { ${aSetAttr12} != ${aGetAttr42} } { |
73 | puts "aGetAttr42=${aGetAttr42}" |
74 | puts ${aMessage3} |
75 | puts "OCC1228: ERROR (case 5)" |
76 | } else { |
77 | puts "Get a value of TDataStd_IntegerArray attribute from restoring document: OK" |
78 | puts "OCC1228: OK" |
79 | } |