#INTERFACE CAF
puts "================"
puts "OCC1228"
puts "================"
puts ""

# Basic attributes
#
# Testing attribute: TDataStd_RealArray
#
# Testing command:   SetRealArray
# Testing command:   GetRealArray
#

# ANALOG: puts "caf001-C3"
set QA_DUP 0

# Create a new document and set UndoLimit
NewDocument Doc BinOcaf
UndoLimit Doc 100

# Open a transaction
NewCommand Doc

# Add an attribute to a data framework
set aFrom1 1
set aTo1 2
set aSetAttr11 3.
set aSetAttr12 4.
set aLabel 0:2
set isDelta 0
SetRealArray Doc ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}

# Close/Open the transaction
NewCommand Doc

# Save the document
set aFile ${imagedir}/OCC1228-[file tail [info script]].cbf
file delete ${aFile}
catch {SaveAs Doc ${aFile}}
if { ![file exists ${aFile}] } {
	puts "There is not ${aFile} file; SaveAs command: Error"
	puts "OCC1228: ERROR (case 1)"
}
#catch {exec chmod 777 ${aFile}}

# Restore the document
Close Doc
catch {Open ${aFile} DDoc}

# Get a value of the attribute
set aGetAttr3 ""
set aMessage3 "Get a value of TDataStd_RealArray attribute from restoring document: Error"
set IsDone [catch {set aGetAttr3 [GetRealArray DDoc ${aLabel}]} aResult]
if { ${IsDone} != 0 } {
	puts ${aMessage3}
	puts "OCC1228: ERROR (case 2)"
}
set aLen3 [llength ${aGetAttr3}]
if { ${aLen3} != [expr ${aTo1} - ${aFrom1} + 1] } {
	puts "aLen3=${aLen3}"
	puts ${aMessage3}
	puts "OCC1228: ERROR (case 3)"
}
set aGetAttr41 [lindex ${aGetAttr3} 0]
if { ${aSetAttr11} != ${aGetAttr41} } {
	puts "aGetAttr41=${aGetAttr41}"
	puts ${aMessage3}
	puts "OCC1228: ERROR (case 4)"
}
set aGetAttr42 [lindex ${aGetAttr3} 1]
if { ${aSetAttr12} != ${aGetAttr42} } {
	puts "aGetAttr42=${aGetAttr42}"
	puts ${aMessage3}
	puts "OCC1228: ERROR (case 5)"
} else {
	puts "Get a value of TDataStd_RealArray attribute from restoring document: OK"
	puts "OCC1228: OK"
}
