fca5e55d16e850b13eac38c52e22ab16ca673801
[occt.git] / tests / caf / basic / P5
1 #INTERFACE CAF
2 # Basic attributes
3 # TDataStd_ByteArray
4 #
5 # Testing attribute: User defined (additional GUID) TDataStd_ByteArray
6 #
7 # Testing command:   SetByteArray
8 # Testing command:   GetByteArray
9 #
10
11 puts "caf001-P5"
12 set QA_DUP 0
13
14 # Add an attribute to a data framework
15 set aFrom1 1
16 set aTo1 2
17 set aSetAttr11 10
18 set aSetAttr12 12
19 set aLabel 0:2
20 set isDelta 0
21 set aGuid1 "12e94517-6dbc-11d4-b9c8-0060b0ee281b"
22
23 SetByteArray D ${aLabel} ${isDelta} ${aFrom1} ${aTo1} ${aSetAttr11} ${aSetAttr12}
24 SetByteArray 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 # Get a value of the attribute
41 set IsGood 1
42 set aMessage1 "Add TDataStd_ByteArray attribute: Error"
43 set aGetAttr1 [GetByteArray D ${aLabel}]
44 set aLen1 [llength ${aGetAttr1}]
45 set aGetAttr2 [GetByteArray D ${aLabel} ${aGuid1}]
46 set aLen2 [llength ${aGetAttr2}]
47
48 if { ${aLen1} != [expr ${aTo1} - ${aFrom1} + 1] } {
49    set IsGood 0
50    puts "aLen1=${aLen1}"
51    puts ${aMessage1}
52 }
53 if { ${aLen2} != [expr ${aTo1} - ${aFrom1} + 1] } {
54    set IsGood 0
55    puts "aLen2=${aLen2}"
56    puts ${aMessage1}
57 }
58
59 set aGetAttr11 [lindex ${aGetAttr1} 0]
60 set aGetAttr21 [lindex ${aGetAttr2} 0]
61 if { ${aGetAttr11} != ${aGetAttr21} } {
62    set IsGood 0
63    puts "aGetAttr11=${aGetAttr11}"
64    puts "aGetAttr21=${aGetAttr21}"
65    puts ${aMessage1}
66 }
67 set aGetAttr12 [lindex ${aGetAttr1} 1]
68 set aGetAttr22 [lindex ${aGetAttr2} 1]
69 if { ${aGetAttr12} != ${aGetAttr22} } {
70    set IsGood 0
71    puts "aGetAttr12=${aGetAttr12}"
72    puts "aGetAttr22=${aGetAttr22}"
73    puts ${aMessage1}
74 }
75
76 if { ${IsGood} == 0} {
77   puts "Add TDataStd_ByteArray attribute: Error"
78 } else {
79   puts "Add TDataStd_ByteArray attribute: OK"
80 }