1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0030915: Visualization - AIS_ColorScale::FindColor() returns Wrong color for maximal value

Map the very upper value (theValue==theMax) to the largest color interval.
This commit is contained in:
kgv
2019-08-26 11:08:23 +03:00
parent 8ed0708507
commit 61f73653ba
2 changed files with 42 additions and 58 deletions

View File

@@ -1,11 +1,10 @@
puts "============"
puts "0027573"
puts "AIS_ColorScale::FindColor does not take into account custom colors."
puts "0027573: AIS_ColorScale::FindColor does not take into account custom colors."
puts "============"
puts ""
vclose all
vinit
vinit View1
vclear
vaxo
@@ -14,46 +13,18 @@ vcolorscale cs -range 0 20 5
# Set user-defined colors and labels for color scale
vcolorscale cs -colors white red green blue1 gray
vdump ${imagedir}/${casename}_pos.png
# Check the first interval border color
if {[vcolorscale cs -findcolor 0] != "WHITE"} {
puts "ERROR: Find color result for the first segment is wrong!"
}
# Check first-second intervals border
if {[vcolorscale cs -findcolor 4] != "WHITE"} {
puts "ERROR: Find color result for the first segment border is wrong!"
}
# Check the second interval color
if {[vcolorscale cs -findcolor 5] != "RED"} {
puts "ERROR: Find color result for the second segment is wrong!"
}
# Check the second interval color
if {[vcolorscale cs -findcolor 9] != "GREEN"} {
puts "ERROR: Find color result for the third segment is wrong!"
}
# Check the last interval border color
if {[vcolorscale cs -findcolor 20] != "GRAY"} {
puts "ERROR: Find color result for the last segment is wrong!"
}
if {[vcolorscale cs -findcolor 0] != "WHITE"} { puts "ERROR: wrong 1st segment сolor" }
if {[vcolorscale cs -findcolor 4] != "RED"} { puts "ERROR: wrong color on border between 1st and 2nd segments" }
if {[vcolorscale cs -findcolor 5] != "RED"} { puts "ERROR: wrong 2nd segment color" }
if {[vcolorscale cs -findcolor 9] != "GREEN"} { puts "ERROR: wrong 3rd segment color" }
if {[vcolorscale cs -findcolor 20] != "GRAY"} { puts "ERROR: wrong last segment color at border" }
# Check negative value limits
vcolorscale cs -range -5 5 5
vdump ${imagedir}/${casename}_neg.png
if {[vcolorscale cs -findcolor -5] != "WHITE"} {
puts "ERROR: Find color result for the first segment is wrong!"
}
if {[vcolorscale cs -findcolor 0] != "GREEN"} {
puts "ERROR: Find color result for the middle segment is wrong!"
}
if {[vcolorscale cs -findcolor 5] != "GRAY"} {
puts "ERROR: Find color result for the last segment is wrong!"
}
# Dump result
set only_screen 1
if {[vcolorscale cs -findcolor -5] != "WHITE"} { puts "ERROR: wrong first segment color" }
if {[vcolorscale cs -findcolor 0] != "GREEN"} { puts "ERROR: wrong middle segment color" }
if {[vcolorscale cs -findcolor 5] != "GRAY"} { puts "ERROR: wrong last segment color" }