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