0024927: Getting rid of "Persistent" functionality -- Tests
[occt.git] / tests / bugs / caf / bug1031
CommitLineData
352ffd73 1puts "================"
2puts "OCC1031"
3puts "================"
4puts ""
5#
6# Note: Numerical control of setting material
7#
8
9pload QAcommands
10
e837410d 11NewDocument D BinOcaf
352ffd73 12UndoLimit D 100
13NewCommand D
14
15# Set NamedShape attribute
16box aBox1 100 200 300
17set aLabel 0:2
18SetShape D ${aLabel} aBox1
19
20# Initialize 3D viewer
21AISInitViewer D
22
23# Add AISPresentation attribute with parameter NS
24AISSet D ${aLabel} NS
25
26# Set shading mode
27vsetdispmode 1
28
29# Display presentation of NamedShape in the viewer
30AISDisplay D ${aLabel}
31
32# Close/Open transaction
33NewCommand D
34
35set list [OCC1031_AISMaterial D ${aLabel}]
36set AISMaterial1 [lindex ${list} [expr [llength ${list}] - 1] ]
37
38# Set a material of the shape as NOM_JADE
39set JadeMaterial 18
40OCC1031_AISMaterial D ${aLabel} ${JadeMaterial}
41
42set list [OCC1031_AISMaterial D ${aLabel}]
43set AISMaterial2 [lindex ${list} [expr [llength ${list}] - 1] ]
44
45# Close/Open transaction
46NewCommand D
47
48# Undo
49Undo D
50
51# Update the viewer
52AISRepaint D
53
54set list [OCC1031_AISMaterial D ${aLabel}]
55set AISMaterial3 [lindex ${list} [expr [llength ${list}] - 1] ]
56
57# Redo
58Redo D
59
60# Update the viewer
61AISRepaint D
62
63set list [OCC1031_AISMaterial D ${aLabel}]
64set AISMaterial4 [lindex ${list} [expr [llength ${list}] - 1] ]
65
66# Check the material
67puts "AISMaterial1 = ${AISMaterial1}"
68puts "AISMaterial2 = ${AISMaterial2}"
69puts "AISMaterial3 = ${AISMaterial3}"
70puts "AISMaterial4 = ${AISMaterial4}"
71
72set status 0
73if { ${AISMaterial1} != 0 } {
74 puts "OCC1031_AISMaterial command: Error (case 1)"
75 set status 1
76}
77
78if { ${AISMaterial2} != ${JadeMaterial} } {
79 puts "OCC1031_AISMaterial command: Error (case 2)"
80 set status 1
81}
82
83if { ${AISMaterial3} != 0 } {
84 puts "OCC1031_AISMaterial command: Error (case 3)"
85 set status 1
86}
87
88if { ${AISMaterial4} != ${JadeMaterial} } {
89 puts "OCC1031_AISMaterial command: Error (case 4)"
90 set status 1
91}
92
93if { ${status} == 0} {
94 puts "OCC1031_AISMaterial command: OK"
95}
96