61c421bf |
1 | puts "================" |
2 | puts "OCC2932" |
3 | puts "================" |
4 | puts "" |
5 | ####################################################################################### |
6 | # Create Attribute Delta depending on actual change of the attribute |
7 | ####################################################################################### |
8 | # Case 16 (TDataStd_Shape) |
9 | ####################################################################################### |
10 | |
11 | # Create a new document and set UndoLimit |
e837410d |
12 | NewDocument D BinOcaf |
61c421bf |
13 | UndoLimit D 100 |
14 | |
15 | # Create a label and set attributes |
16 | NewCommand D |
17 | set Label 0:2 |
18 | |
19 | ############################################ |
20 | # Create a box |
21 | set X 10 |
22 | set Y 20 |
23 | set Z 30 |
24 | set DX 100 |
25 | set DY 200 |
26 | set DZ 300 |
27 | box Box ${X} ${Y} ${Z} ${DX} ${DY} ${DZ} |
28 | ############################################ |
29 | |
30 | set Real1 300. |
31 | set Real2 400. |
32 | set modified_attribute TDataStd_Real |
33 | |
34 | ############################################ |
35 | # Set TDataStd_Shape |
36 | SetShape D ${Label} Box |
37 | ############################################ |
38 | |
39 | SetReal D ${Label} ${Real1} |
40 | set list [DumpCommand D] |
41 | |
42 | # Open a transaction |
43 | NewCommand D |
44 | set list [DumpCommand D] |
45 | |
46 | ############################################ |
47 | # Set old value for TDataStd_Shape |
48 | SetShape D ${Label} Box |
49 | ############################################ |
50 | |
51 | # Set new value for TDataStd_Real |
52 | SetReal D ${Label} ${Real2} |
53 | set list [DumpCommand D] |
54 | |
55 | # Open a transaction |
56 | NewCommand D |
57 | set list [DumpCommand D] |
58 | |
59 | # Checking |
60 | if { 1 == 2 } { |
61 | set ll [llength ${list}] |
62 | set good_length 17 |
63 | puts "length = ${ll}" |
64 | puts "good_length = ${good_length}" |
65 | |
66 | if { ${ll} != ${good_length} } { |
67 | puts "OCC2932 Error (case 1)" |
68 | } else { |
69 | set name_attribute [lindex ${list} [expr ${good_length} - 1]] |
70 | puts "name_attribute = ${name_attribute}" |
71 | puts "modified_attribute = ${modified_attribute}" |
72 | if {[string compare ${name_attribute} ${modified_attribute}] == 0} { |
73 | puts "OCC2932 OK" |
74 | } else { |
75 | puts "OCC2932 Error (case 2)" |
76 | } |
77 | } |
78 | } |
79 | |
80 | # NEW VERSION!!!!! |
81 | set ll [llength ${list}] |
82 | set good_length 20 |
83 | puts "length = ${ll}" |
84 | puts "good_length = ${good_length}" |
85 | |
86 | if { ${ll} != ${good_length} } { |
87 | puts "OCC2932 Error (case 1)" |
88 | } else { |
89 | set name_attribute1 [lindex ${list} [expr ${good_length} - 1]] |
90 | set name_attribute2 [lindex ${list} [expr ${good_length} - 4]] |
91 | set modified_attribute2 TNaming_NamedShape |
92 | puts "name_attribute1 = ${name_attribute1}" |
93 | puts "name_attribute2 = ${name_attribute2}" |
94 | puts "modified_attribute = ${modified_attribute}" |
95 | puts "modified_attribute2 = ${modified_attribute2}" |
96 | |
97 | set Is_TDataStd_Real 0 |
98 | set Is_TNaming_NamedShape 0 |
99 | if {[string compare ${name_attribute1} ${modified_attribute}] == 0 || |
100 | [string compare ${name_attribute2} ${modified_attribute}] == 0 } { |
101 | set Is_TDataStd_Real 1 |
102 | } |
103 | if {[string compare ${name_attribute1} ${modified_attribute2}] == 0 || |
104 | [string compare ${name_attribute2} ${modified_attribute2}] == 0 } { |
105 | set Is_TNaming_NamedShape 1 |
106 | } |
107 | |
108 | |
109 | if { ${Is_TDataStd_Real} == 1 && ${Is_TNaming_NamedShape} == 1 } { |
110 | puts "OCC2932 OK" |
111 | } else { |
112 | puts "OCC2932 Error (case 2)" |
113 | } |
114 | |
115 | } |