0030464: Visualization - unable to set sub-shape transparency using vaspects command
[occt.git] / tests / bugs / xde / bug28641
1 puts "========"
2 puts "OCC28641"
3 puts "========"
4 puts ""
5 ####################################################
6 # Data Exchange - Support alpha-channel of color
7 ####################################################
8
9 pload OCAF
10
11 # Create document with View
12 NewDocument D_First BinXCAF
13 box b 1 1 1
14 explode b e
15 explode b f
16 XAddShape D_First b
17 XSetColor D_First b_1 1 0 0 s
18 XSetColor D_First b_2 1 1 0 0.3 s
19 XSetColor D_First b_11 1 1 1 0.2 c
20 XSetColor D_First b_10 0 1 1 c
21 XAddColor D_First 0.5 0.5 1 0.1
22
23 XShow D_First
24 vfit
25 vsetdispmode 1
26 vdump $::imagedir/${::casename}_first.png
27 if { [vreadpixel 300 200 rgb name] != "DARKKHAKI" } { puts "Error: wrong color in 3D Viewer" }
28
29 # Write file
30 SaveAs D_First ${imagedir}/bug28521.xbf
31 Close D_First
32 # Read document
33 XOpen ${imagedir}/bug28521.xbf D_Second
34
35 # Results validation
36 set isOK 1
37 set color ""
38 set alpha ""
39 set prec 1e-7
40 #0:1:2:1
41 set res [XGetColor D_Second 0:1:2:1]
42 if {$res != "RED"} {
43   set isOK 0
44 }
45 #0:1:2:2
46 set res [XGetColor D_Second 0:1:2:2]
47 regexp {([A-Z0-9]+) \(([0-9.+eE]+)\)} $res full color alpha
48 if {$color != "YELLOW"} {
49   set isOK 0
50 }
51 if {[expr abs(0.3 - $alpha)] > $prec} {
52   set isOK 0
53 }
54 #0:1:2:3
55 set res [XGetColor D_Second 0:1:2:3]
56 regexp {([A-Z0-9]+) \(([0-9.+eE]+)\)} $res full color alpha
57 if {$color != "WHITE"} {
58   set isOK 0
59 }
60 if {[expr abs(0.2 - $alpha)] > $prec} {
61   set isOK 0
62 }
63 #0:1:2:4
64 set res [XGetColor D_Second 0:1:2:4]
65 if {$res != "CYAN1"} {
66   set isOK 0
67 }
68 #0:1:2:5
69 set res [XGetColor D_Second 0:1:2:5]
70 regexp {([A-Z0-9]+) \(([0-9.+eE]+)\)} $res full color alpha
71 if {$color != "LIGHTSLATEBLUE"} {
72   set isOK 0
73 }
74 if {[expr abs(0.1 - $alpha)] > $prec} {
75   set isOK 0
76 }
77
78 if {$isOK == 0} {
79   puts "Error: wrong color."
80 }
81
82 XShow D_Second
83 vfit
84 vsetdispmode 1
85 vdump $::imagedir/${::casename}.png
86 if { [vreadpixel 300 200 rgb name] != "DARKKHAKI" } { puts "Error: wrong color in 3D Viewer" }
87
88 Close D_Second