0022898: IGES import fails in german environment
[occt.git] / tests / bugs / caf / bug1722
1 puts "================"
2 puts "OCC1722"
3 puts "================"
4 puts ""
5 #######################################################################################
6 # Wrong behaviour of the method CommitCommand of class TDocStd_MultiTransactionManager
7 #######################################################################################
8
9 proc OCC1722_Check_real_attribute {IsGood doc label good_real case} {
10   global ${doc}
11   # Check real attribute
12   set percent_max 0.1
13   if [catch { set real [GetReal ${doc} ${label}] } message] {
14     set IsGood 0
15     puts "OCC1722 Error (case ${case})"
16   } else {
17     set real_percent [expr abs(${real} - ${good_real}) / double(${good_real}) * 100.]
18     if {${real_percent} > ${percent_max}} {
19        puts "good_real = ${good_real}"
20        puts "real = ${real}"
21        puts "real_percent = ${real_percent}"
22        puts "OCC1722 Error (case ${case}-2)"
23     }
24   }
25   return ${IsGood}
26 }
27
28
29 set IsGood 1
30 set Case 0
31 set aLabel 0:1:1
32 set aReal1 1.1
33 set aReal2 2.1
34
35
36 NewDocument doc1
37 mtmCreate 4
38
39 mtmAdd doc1
40
41 SetReal doc1 ${aLabel} ${aReal1}
42 set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal1} [incr Case]]
43
44 OpenCommand doc1
45 SetReal doc1 ${aLabel} ${aReal2}
46 set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal2} [incr Case]]
47
48 set list [mtmDump]
49 ################################################################################
50 # *** Dump of MTM ***
51 # There is one document ( "3095112" ) in the manager 
52 # Nested transaction mode is off
53 #  
54
55 # ***     End     ***
56 ################################################################################
57 set index1 [lsearch -exact ${list} "Undo:"]
58
59 # Check dump
60 set case [incr Case]
61 if { ${index1} != -1 } {
62   set IsGood 0
63   puts "OCC1722 Error (case ${case})"
64 }
65
66 mtmCommit Transaction1
67
68 set list [mtmDump]
69 ################################################################################
70 # *** Dump of MTM ***
71 # There is one document ( "3095112" ) in the manager 
72 # Nested transaction mode is off
73 #  
74 #  Undo:        Transaction1 - 1 documents  ( "3095112" )   < Last action
75
76 # ***     End     ***
77 ################################################################################
78 set index2 [lsearch -exact ${list} "Undo:"]
79
80 # Check dump
81 set case [incr Case]
82 if { ${index2} == -1 } {
83   set IsGood 0
84   puts "OCC1722 Error (case ${case})"
85 }
86
87 Undo doc1
88 set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal1} [incr Case]]
89
90 Redo doc1
91 set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal2} [incr Case]]
92
93
94 if { ${IsGood} == 1 } {
95   puts "OCC1722 OK"
96 } else {
97   puts "OCC1722 Error"
98 }