0025624: Visualization - selection is incorrect in perspective mode in a specific...
[occt.git] / tests / bugs / caf / bug1722
CommitLineData
61c421bf 1puts "================"
2puts "OCC1722"
3puts "================"
4puts ""
5#######################################################################################
6# Wrong behaviour of the method CommitCommand of class TDocStd_MultiTransactionManager
7#######################################################################################
8
9proc 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
29set IsGood 1
30set Case 0
31set aLabel 0:1:1
32set aReal1 1.1
33set aReal2 2.1
34
35
36NewDocument doc1
37mtmCreate 4
38
39mtmAdd doc1
40
41SetReal doc1 ${aLabel} ${aReal1}
42set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal1} [incr Case]]
43
44OpenCommand doc1
45SetReal doc1 ${aLabel} ${aReal2}
46set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal2} [incr Case]]
47
48set 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################################################################################
57set index1 [lsearch -exact ${list} "Undo:"]
58
59# Check dump
60set case [incr Case]
61if { ${index1} != -1 } {
62 set IsGood 0
63 puts "OCC1722 Error (case ${case})"
64}
65
66mtmCommit Transaction1
67
68set 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################################################################################
78set index2 [lsearch -exact ${list} "Undo:"]
79
80# Check dump
81set case [incr Case]
82if { ${index2} == -1 } {
83 set IsGood 0
84 puts "OCC1722 Error (case ${case})"
85}
86
87Undo doc1
88set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal1} [incr Case]]
89
90Redo doc1
91set IsGood [OCC1722_Check_real_attribute ${IsGood} ${doc1} ${aLabel} ${aReal2} [incr Case]]
92
93
94if { ${IsGood} == 1 } {
95 puts "OCC1722 OK"
96} else {
97 puts "OCC1722 Error"
98}