200cc657a88fd3a699b04e3ff8c97bda05f50250
[occt.git] / tests / caf / basic / F4
1 #INTERFACE CAF
2 # Basic attributes
3 #
4 # Testing attributes: TDataStd_Tick TDataStd_Directory TDataStd_NoteBook TDataXtd_Axis TDataXtd_Placement TDataXtd_Plane TDataXtd_Point TDataXtd_Shape 
5 #
6 # Testing command:   SetEmptyAttribute
7 # BinOcaf format open/save with these attributes
8
9 Label D 0:2
10
11 set IsGood 1
12
13 NewCommand D
14 SetEmptyAttribute D 0:2 TDataStd_Tick
15 SetEmptyAttribute D 0:2 TDataStd_Directory
16 SetEmptyAttribute D 0:2 TDataStd_NoteBook
17 SetEmptyAttribute D 0:2 TDataXtd_Axis
18 SetEmptyAttribute D 0:2 TDataXtd_Placement
19 SetEmptyAttribute D 0:2 TDataXtd_Plane
20 SetEmptyAttribute D 0:2 TDataXtd_Point
21 SetEmptyAttribute D 0:2 TDataXtd_Shape 
22 CommitCommand D
23
24 set aLen1 [llength [Attributes D 0:2]]
25 if { ${aLen1} != 8 } {
26    set IsGood 0
27    puts "Not all attributes were added aLen1=${aLen1}"
28 }
29
30 NewCommand D
31 # check forget attribute by its type
32 ForgetAtt D 0:2 TDataXtd_Point
33 CommitCommand D
34
35 set aLen2 [llength [Attributes D 0:2]]
36 if { ${aLen2} != ${aLen1} - 1 } {
37    set IsGood 0
38    puts "TDataXtd_Point was not removed from the label"
39 }
40
41 Undo D
42 Undo D
43
44 set aLen3 [llength [Attributes D 0:2]]
45 if { ${aLen3} != 0 } {
46    set IsGood 0
47    puts "Not all attributes were removed on Undo aLen3=${aLen3}"
48 }
49
50 Redo D
51
52 set aLen4 [llength [Attributes D 0:2]]
53 if { ${aLen4} != 8 } {
54    set IsGood 0
55    puts "Not all attributes were restored by Redo aLen4=${aLen4}"
56 }
57
58 set aFile ${imagedir}/caf001-F4.cbf
59 file delete ${aFile}
60 SaveAs D ${aFile}
61 if { ![file exists ${aFile}] } {
62         puts "There is not ${aFile} file; SaveAs command: Error"
63         return
64 }
65 Close D
66
67 Open ${aFile} DD
68
69 Label DD 0:2
70
71 set aLen5 [llength [Attributes DD 0:2]]
72 if { ${aLen5} != 8 } {
73    set IsGood 0
74    puts "Not all attributes were restored on Open aLen4=${aLen5}"
75 }
76
77 if { ${IsGood} == 0} {
78   puts "Set empty attributes: Error"
79 } else {
80   puts "Set empty attributes: OK"
81 }