0026833: Create command checkview containing all viewer types
[occt.git] / tests / bugs / xde / bug22776
CommitLineData
3bea4c16 1puts "================"
2puts "OCC22776"
3puts "================"
4puts ""
5#######################################################################################
6# XCAFPrs_AISObject does not support transparency
7######################################################################################
8
9catch {pload DCAF}
10pload QAcommands
11
e837410d 12NewDocument D BinXCAF
3bea4c16 13UndoLimit D 100
14NewCommand D
15
16#Set NamedShape attribute
17box Box 100 200 300
18set Label 0:2
19SetShape D ${Label} Box
20
21# Initialize 3D viewer
22AISInitViewer D
23
24# Add AISPresentation attribute with parameter NS
25AISSet D ${Label} NS
26
27# Set shading mode
28vsetdispmode 1
29
30# Display presentation of NamedShape in the viewer
31AISDisplay D ${Label}
32
33# Close/Open transaction
34NewCommand D
35
36set list [OCC1031_AISMaterial D ${Label}]
37regexp {Material = ([-0-9.+eE]+)} $list full AISMaterial1
38
39# Set a material of the shape as NOM_COPPER
40set CopperMaterial 2
41OCC1031_AISMaterial D ${Label} ${CopperMaterial}
42
43set list [OCC1031_AISMaterial D ${Label}]
44regexp {Material = ([-0-9.+eE]+)} $list full AISMaterial2
45
46# Close/Open transaction
47NewCommand D
48
49set list [OCC1032_AISWidth D ${Label}]
50regexp {Width = ([-0-9.+eE]+)} $list full AISWidth1
51
52# Set a width
53set Width 10
54OCC1032_AISWidth D ${Label} ${Width}
55
56set list [OCC1032_AISWidth D ${Label}]
57regexp {Width = ([-0-9.+eE]+)} $list full AISWidth2
58
59# Close/Open transaction
60NewCommand D
61
62set list [OCC1029_AISTransparency D ${Label}]
63regexp {Transparency = ([-0-9.+eE]+)} $list full Transparency1
64
65# Set a transparency
66set Transparency 0.9
67XSetTransparency D ${Transparency} ${Label}
68
69set list [OCC1029_AISTransparency D ${Label}]
70regexp {Transparency = ([-0-9.+eE]+)} $list full Transparency2
71
72# Update the viewer
73AISRepaint D
74
75
76# Check the material
77puts "AISMaterial1 = ${AISMaterial1}"
78puts "AISMaterial2 = ${AISMaterial2}"
79set DefaultAISMaterial 0
80set status 0
81if { ${AISMaterial1} != ${DefaultAISMaterial} } {
82 puts "Default material is wrong: Error"
83 set status 1
84}
85if { ${AISMaterial2} != ${CopperMaterial} } {
86 puts "OCC1031_AISMaterial command: Error"
87 set status 1
88}
89
90# Check the width
91puts "AISWidth1 = ${AISWidth1}"
92puts "AISWidth2 = ${AISWidth2}"
93set DefaultAISWidth 0
94if { ${AISWidth1} != ${DefaultAISWidth} } {
95 puts "Default width is wrong: Error"
96 set status 1
97}
98if { ${AISWidth2} != ${Width} } {
99 puts "OCC1032_AISWidth command: Error"
100 set status 1
101}
102
103# Check the transparency
104puts "Transparency1 = ${Transparency1}"
105puts "Transparency2 = ${Transparency2}"
106set DefaultAISTransparency 0
107if { ${Transparency1} != ${DefaultAISTransparency} } {
108 puts "Default transparency is worng: Error"
109 set status 1
110}
111
112if { ${Transparency2} != ${Transparency} } {
113 puts "XSetTransparency command: Error"
114 set status 1
115}
116
117
118if { ${status} == 0} {
119 puts "OK"
120} else {
121 puts "FAULTY"
122}
123
5747059b 124checkview -display result -3d -path ${imagedir}/${test_image}.png