diff --git a/src/DrawResources/TestCommands.tcl b/src/DrawResources/TestCommands.tcl index 5fe1c0acc0..1b55491567 100644 --- a/src/DrawResources/TestCommands.tcl +++ b/src/DrawResources/TestCommands.tcl @@ -2026,3 +2026,145 @@ proc _testgrid_process_jobs {worker {nb_ok 0}} { } catch {tpool::suspend $worker} } + +help checkcolor { + Check pixel color. + Use: checkcolor x y red green blue + x y - pixel coordinates + red green blue - expected pixel color (values from 0 to 1) + Function check color with tolerance (5x5 area) +} +# Procedure to check color using command vreadpixel with tolerance +proc checkcolor { coord_x coord_y rd_get gr_get bl_get } { + puts "Coordinate x = $coord_x" + puts "Coordinate y = $coord_y" + puts "RED color of RGB is $rd_get" + puts "GREEN color of RGB is $gr_get" + puts "BLUE color of RGB is $bl_get" + + if { $coord_x <= 1 || $coord_y <= 1 } { + puts "Error : minimal coordinate is x = 2, y = 2. But we have x = $coord_x y = $coord_y" + return -1 + } + + set color "" + catch { [set color "[vreadpixel ${coord_x} ${coord_y} rgb]"] } + if {"$color" == ""} { + puts "Error : Pixel coordinates (${position_x}; ${position_y}) are out of view" + } + set rd [lindex $color 0] + set gr [lindex $color 1] + set bl [lindex $color 2] + set rd_int [expr int($rd * 1.e+05)] + set gr_int [expr int($gr * 1.e+05)] + set bl_int [expr int($bl * 1.e+05)] + set rd_ch [expr int($rd_get * 1.e+05)] + set gr_ch [expr int($gr_get * 1.e+05)] + set bl_ch [expr int($bl_get * 1.e+05)] + + if { $rd_ch != 0 } { + set tol_rd [expr abs($rd_ch - $rd_int)/$rd_ch] + } else { + set tol_rd $rd_int + } + if { $gr_ch != 0 } { + set tol_gr [expr abs($gr_ch - $gr_int)/$gr_ch] + } else { + set tol_gr $gr_int + } + if { $bl_ch != 0 } { + set tol_bl [expr abs($bl_ch - $bl_int)/$bl_ch] + } else { + set tol_bl $bl_int + } + + set status 0 + if { $tol_rd > 0.2 } { + puts "Warning : RED light of additive color model RGB is invalid" + set status 1 + } + if { $tol_gr > 0.2 } { + puts "Warning : GREEN light of additive color model RGB is invalid" + set status 1 + } + if { $tol_bl > 0.2 } { + puts "Warning : BLUE light of additive color model RGB is invalid" + set status 1 + } + + if { $status != 0 } { + puts "Warning : Colors of default coordinate are not equal" + } + + global stat + if { $tol_rd > 0.2 || $tol_gr > 0.2 || $tol_bl > 0.2 } { + set info [_checkpoint $coord_x $coord_y $rd_ch $gr_ch $bl_ch] + set stat [lindex $info end] + if { ${stat} != 1 } { + puts "Error : Colors are not equal in default coordinate and in the near coordinates too" + return $stat + } else { + puts "Point with valid color was found" + return $stat + } + } else { + set stat 1 + } +} + +# Procedure to check color in the point near default coordinate +proc _checkpoint {coord_x coord_y rd_ch gr_ch bl_ch} { + set x_start [expr ${coord_x} - 2] + set y_start [expr ${coord_y} - 2] + set mistake 0 + set i 0 + while { $mistake != 1 && $i <= 5 } { + set j 0 + while { $mistake != 1 && $j <= 5 } { + set position_x [expr ${x_start} + $j] + set position_y [expr ${y_start} + $i] + puts $position_x + puts $position_y + + set color "" + catch { [set color "[vreadpixel ${position_x} ${position_y} rgb]"] } + if {"$color" == ""} { + puts "Warning : Pixel coordinates (${position_x}; ${position_y}) are out of view" + incr j + continue + } + set rd [lindex $color 0] + set gr [lindex $color 1] + set bl [lindex $color 2] + set rd_int [expr int($rd * 1.e+05)] + set gr_int [expr int($gr * 1.e+05)] + set bl_int [expr int($bl * 1.e+05)] + + if { $rd_ch != 0 } { + set tol_rd [expr abs($rd_ch - $rd_int)/$rd_ch] + } else { + set tol_rd $rd_int + } + if { $gr_ch != 0 } { + set tol_gr [expr abs($gr_ch - $gr_int)/$gr_ch] + } else { + set tol_gr $gr_int + } + if { $bl_ch != 0 } { + set tol_bl [expr abs($bl_ch - $bl_int)/$bl_ch] + } else { + set tol_bl $bl_int + } + + if { $tol_rd > 0.2 || $tol_gr > 0.2 || $tol_bl > 0.2 } { + puts "Warning : Point with true color was not found near default coordinates" + set mistake 0 + } else { + set mistake 1 + } + incr j + } + incr i + } + return $mistake +} diff --git a/src/QADraw/QADraw.cxx b/src/QADraw/QADraw.cxx index 9e6c04ad92..5020a2be95 100644 --- a/src/QADraw/QADraw.cxx +++ b/src/QADraw/QADraw.cxx @@ -16,19 +16,10 @@ #include #include #include -#include -#include -#include -#include #include #include -#include -#include -#include #include #include -#include -#include #include #include #include @@ -48,122 +39,6 @@ #include -Handle(TColStd_HSequenceOfReal) GetColorOfPixel (const Image_PixMap& theImage, - const Standard_Integer theCoordinateX, - const Standard_Integer theCoordinateY, - const Standard_Integer theRadius) -{ - Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal(); - if (theImage.IsEmpty()) { - std::cerr << "The image is null.\n"; - return aSeq; - } - Standard_Integer aWidth = (Standard_Integer )theImage.SizeX(); - Standard_Integer anHeight = (Standard_Integer )theImage.SizeY(); - - Quantity_Color aColorTmp; - for (Standard_Integer anXIter = theCoordinateX - theRadius; - anXIter <= theCoordinateX + theRadius; ++anXIter) - { - if (anXIter < 0 || anXIter >= aWidth) - { - continue; - } - for (Standard_Integer anYIter = theCoordinateY - theRadius; - anYIter <= theCoordinateY + theRadius; ++anYIter) - { - if (anYIter < 0 || anYIter >= anHeight) - { - continue; - } - // Image_PixMap stores image upside-down in memory! - aColorTmp = theImage.PixelColor (anXIter, anYIter); - aSeq->Append (aColorTmp.Red()); - aSeq->Append (aColorTmp.Green()); - aSeq->Append (aColorTmp.Blue()); - } - } - return aSeq; -} - -static Standard_Integer QAAISGetPixelColor (Draw_Interpretor& theDi, - Standard_Integer theArgsNb, - const char** theArgs) -{ - if (theArgsNb != 3 && theArgsNb != 6) - { - theDi << "Usage : " << theArgs[0] << " coordinate_X coordinate_Y [color_R color_G color_B]" << "\n"; - return 1; // TCL_ERROR - } - - Handle(V3d_View) aView3d = ViewerTest::CurrentView(); - if (aView3d.IsNull()) - { - theDi << "You must initialize AISViewer before this command.\n"; - return 1; // TCL_ERROR - } - - const Handle(Aspect_Window) anAISWindow = aView3d->Window(); - Standard_Integer aWindowSizeX = 0; - Standard_Integer aWindowSizeY = 0; - anAISWindow->Size (aWindowSizeX, aWindowSizeY); - - Standard_Integer anArgIter = 1; - const Standard_Integer aPickCoordX = Draw::Atoi (theArgs[anArgIter++]); - const Standard_Integer aPickCoordY = Draw::Atoi (theArgs[anArgIter++]); - const Standard_Integer aRadius = (theArgsNb == 3) ? 0 : 1; - - Image_ColorRGBF aColorInput = {{ 0.0f, 0.0f, 0.0f }}; - if (theArgsNb == 6) - { - aColorInput.r() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]); - aColorInput.g() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]); - aColorInput.b() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]); - } - - Image_PixMap anImage; - aView3d->ToPixMap (anImage, aWindowSizeX, aWindowSizeY); - const Handle(TColStd_HSequenceOfReal) aSeq = GetColorOfPixel (anImage, aPickCoordX, aPickCoordY, aRadius); - cout << "Length = " << aSeq->Length() << endl; - - Image_ColorRGBF aColorPicked = {{ 0.0f, 0.0f, 0.0f }}; - Standard_Boolean isNotEqual = Standard_True; - for (Standard_Integer i = 1; i <= aSeq->Length(); i += 3) - { - aColorPicked.r() = (Standard_ShortReal )aSeq->Value (i + 0); - aColorPicked.g() = (Standard_ShortReal )aSeq->Value (i + 1); - aColorPicked.b() = (Standard_ShortReal )aSeq->Value (i + 2); - - if (theArgsNb == 3 || - ((Abs (aColorPicked.r() - aColorInput.r()) <= Precision::Confusion()) - && (Abs (aColorPicked.g() - aColorInput.g()) <= Precision::Confusion()) - && (Abs (aColorPicked.b() - aColorInput.b()) <= Precision::Confusion()))) - { - isNotEqual = Standard_False; - break; - } - } - - theDi << "RED : " << aColorPicked.r() << " " - << "GREEN : " << aColorPicked.g() << " " - << "BLUE : " << aColorPicked.b() << "\n"; - - if (theArgsNb == 6) - { - theDi << "User color: \n" - << "RED : " << aColorInput.r() << " " - << "GREEN : " << aColorInput.g() << " " - << "BLUE : " << aColorInput.b() << "\n"; - } - - if (isNotEqual) - { - theDi << "Faulty : colors are not equal.\n"; - return 1; // TCL_ERROR - } - return 0; -} - //======================================================================= #if ! defined(WNT) extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS(); @@ -365,12 +240,6 @@ void QADraw::CommonCommands (Draw_Interpretor& theCommands) { const char* group = "QA_Commands"; - theCommands.Add ("QAGetPixelColor", - "QAGetPixelColor coordinate_X coordinate_Y [color_R color_G color_B]", - __FILE__, - QAAISGetPixelColor, - group); - theCommands.Add ("vtri_orig", "vtri_orig : vtri_orig trihedron_name - draws axis origin lines", __FILE__, diff --git a/tests/bugs/begin b/tests/bugs/begin index ae31bbe309..4d7a00ad3e 100755 --- a/tests/bugs/begin +++ b/tests/bugs/begin @@ -53,141 +53,6 @@ proc checkarea {shape area_expected tol_abs tol_rel} { checkreal "area of $shape" $area $area_expected $tol_abs $tol_rel } -# Procedure to check color in the point near default coordinate - -proc checkpoint {coord_x coord_y rd_ch gr_ch bl_ch} { - set x_start [expr ${coord_x} - 2] - set y_start [expr ${coord_y} - 2] - set mistake 0 - set i 0 - while { $mistake != 1 && $i <= 5 } { - set j 0 - while { $mistake != 1 && $j <= 5 } { - set position_x [expr ${x_start} + $j] - set position_y [expr ${y_start} + $i] - puts $position_x - puts $position_y - global color2d - if { [info exists color2d] } { - set color [ QAAISGetPixelColor2d ${position_x} ${position_y} ] - } else { - set color [ QAGetPixelColor ${position_x} ${position_y} ] - } - regexp {RED +: +([-0-9.+eE]+)} $color full rd - regexp {GREEN +: +([-0-9.+eE]+)} $color full gr - regexp {BLUE +: +([-0-9.+eE]+)} $color full bl - set rd_int [expr int($rd * 1.e+05)] - set gr_int [expr int($gr * 1.e+05)] - set bl_int [expr int($bl * 1.e+05)] - - if { $rd_ch != 0 } { - set tol_rd [expr abs($rd_ch - $rd_int)/$rd_ch] - } else { - set tol_rd $rd_int - } - if { $gr_ch != 0 } { - set tol_gr [expr abs($gr_ch - $gr_int)/$gr_ch] - } else { - set tol_gr $gr_int - } - if { $bl_ch != 0 } { - set tol_bl [expr abs($bl_ch - $bl_int)/$bl_ch] - } else { - set tol_bl $bl_int - } - - if { $tol_rd > 0.2 || $tol_gr > 0.2 || $tol_bl > 0.2 } { - puts "Warning : Point with true color was not found near default coordinates" - set mistake 0 - } else { - set mistake 1 - } - incr j - } - incr i - } - return $mistake -} - -# Procedure to check color using command QAgetPixelColor with tolerance -proc checkcolor { coord_x coord_y rd_get gr_get bl_get } { - puts "Coordinate x = $coord_x" - puts "Coordinate y = $coord_y" - puts "RED color of RGB is $rd_get" - puts "GREEN color of RGB is $gr_get" - puts "BLUE color of RGB is $bl_get" - - if { $coord_x <= 1 || $coord_y <= 1 } { - puts "Error : minimal coordinate is x = 2, y = 2. But we have x = $coord_x y = $coord_y" - return -1 - } - global color2d - if { [info exists color2d] } { - set color [ QAAISGetPixelColor2d ${coord_x} ${coord_y} ] - } else { - set color [ QAGetPixelColor ${coord_x} ${coord_y} ] - } - - regexp {RED +: +([-0-9.+eE]+)} $color full rd - regexp {GREEN +: +([-0-9.+eE]+)} $color full gr - regexp {BLUE +: +([-0-9.+eE]+)} $color full bl - set rd_int [expr int($rd * 1.e+05)] - set gr_int [expr int($gr * 1.e+05)] - set bl_int [expr int($bl * 1.e+05)] - set rd_ch [expr int($rd_get * 1.e+05)] - set gr_ch [expr int($gr_get * 1.e+05)] - set bl_ch [expr int($bl_get * 1.e+05)] - - if { $rd_ch != 0 } { - set tol_rd [expr abs($rd_ch - $rd_int)/$rd_ch] - } else { - set tol_rd $rd_int - } - if { $gr_ch != 0 } { - set tol_gr [expr abs($gr_ch - $gr_int)/$gr_ch] - } else { - set tol_gr $gr_int - } - if { $bl_ch != 0 } { - set tol_bl [expr abs($bl_ch - $bl_int)/$bl_ch] - } else { - set tol_bl $bl_int - } - set status 0 - if { $tol_rd > 0.2 } { - puts "Warning : RED light of additive color model RGB is invalid" - set status 1 - } - if { $tol_gr > 0.2 } { - puts "Warning : GREEN light of additive color model RGB is invalid" - set status 1 - } - if { $tol_bl > 0.2 } { - puts "Warning : BLUE light of additive color model RGB is invalid" - set status 1 - } - - if { $status != 0 } { - puts "Warning : Colors of default coordinate are not equal" - } - - global stat - if { $tol_rd > 0.2 || $tol_gr > 0.2 || $tol_bl > 0.2 } { - set info [checkpoint $coord_x $coord_y $rd_ch $gr_ch $bl_ch] - set stat [lindex $info end] - if { ${stat} != 1 } { - puts "Error : Colors are not equal in default coordinate and in the near coordinates too" - return $stat - } else { - puts "Point with valid color was found" - return $stat - } - } else { - set stat 1 - } -} - - # Procedure to check if sequence of values in listval follows linear trend # adding the same delta on each step. # diff --git a/tests/bugs/iges/bug22888 b/tests/bugs/iges/bug22888 index a1e5deb3de..b22a42d4ea 100755 --- a/tests/bugs/iges/bug22888 +++ b/tests/bugs/iges/bug22888 @@ -29,10 +29,10 @@ set inf_after [trinfo a_1] regexp { +([-0-9.+eE]+) +triangles} $inf_after full tri_after regexp { +([-0-9.+eE]+) +nodes} $inf_after full nod_after -set color [QAGetPixelColor ${x1} ${y1}] -regexp {RED +: +([-0-9.+eE]+)} $color full rd -regexp {GREEN +: +([-0-9.+eE]+)} $color full gr -regexp {BLUE +: +([-0-9.+eE]+)} $color full bl +set color [vreadpixel ${x1} ${y1} rgb] +set rd [lindex $color 0] +set gr [lindex $color 1] +set bl [lindex $color 2] if { $rd == 0 || $gr == 0 || $bl == 0 } { puts "Error : Face is not shaded (colors are not equal)" diff --git a/tests/bugs/modalg_2/bug21909 b/tests/bugs/modalg_2/bug21909 index f8872879f2..47fffd377c 100755 --- a/tests/bugs/modalg_2/bug21909 +++ b/tests/bugs/modalg_2/bug21909 @@ -45,17 +45,9 @@ vmoveto ${x1} ${y1} set status 0 for {set i ${y1} } {$i <= ${y2} } {incr i} { - set Color1 [QAGetPixelColor ${x1} ${i}] - - set R1 [lindex ${Color1} 2] - set G1 [lindex ${Color1} 5] - set B1 [lindex ${Color1} 8] - - puts "x = ${x1} y = ${i} R = ${R1} G = ${G1} B = ${B1}" - - if { ${R1} == 0 && ${G1} == 0 && ${B1} == 0 } { - incr status - puts "Error : rendering x = ${x1} y = ${i}" + if { "[vreadpixel ${x1} ${i} rgb name]" == "BLACK" } { + incr status + puts "Error : rendering x = ${x1} y = ${i}" } } diff --git a/tests/bugs/modalg_2/bug22884 b/tests/bugs/modalg_2/bug22884 index 03aa90c26a..6af4f51902 100755 --- a/tests/bugs/modalg_2/bug22884 +++ b/tests/bugs/modalg_2/bug22884 @@ -31,22 +31,10 @@ set nb_compsol_good 0 set nb_compound_good 0 set nb_shape_good 96 -set Color [QAGetPixelColor $x1 $y1] -set R [lindex ${Color} 2] -set G [lindex ${Color} 5] -set B [lindex ${Color} 8] -set color_status 0 -if { $R == 0 && $G == 0 && $B == 0 } { - set color_status 1 +if { "[vreadpixel $x1 $y1 rgb name]" == "BLACK" } { + puts "Faulty ${BugNumber}" } else { - set color_status 0 -} - - -if { ${color_status} == 0} { - puts "OK ${BugNumber}" -} else { - puts "Faulty ${BugNumber}" + puts "OK ${BugNumber}" } set 3dviewer 0 diff --git a/tests/bugs/moddata_1/bug22039 b/tests/bugs/moddata_1/bug22039 index e350bf3014..ec41bf47e2 100755 --- a/tests/bugs/moddata_1/bug22039 +++ b/tests/bugs/moddata_1/bug22039 @@ -20,27 +20,18 @@ vfit ###set x1 101 set x1 102 set y1 199 -set Color [QAGetPixelColor ${x1} ${y1}] +set Color [vreadpixel ${x1} ${y1} rgb] vmoveto ${x1} ${y1} -set ColorMove [QAGetPixelColor ${x1} ${y1}] +set ColorMove [vreadpixel ${x1} ${y1} rgb] vselect ${x1} ${y1} -set ColorSelect [QAGetPixelColor ${x1} ${y1}] +set ColorSelect [vreadpixel ${x1} ${y1} rgb] -set Color_Status 0 if { ${Color} != ${ColorMove} && ${Color} != ${ColorSelect} && ${ColorMove} != ${ColorSelect} } { - set Color_Status 0 + puts "OK ${BugNumber}" } else { - set Color_Status 1 -} - -# Resume -puts "" -if { ${Color_Status} != 0} { - puts "Faulty ${BugNumber}" -} else { - puts "OK ${BugNumber}" + puts "Faulty ${BugNumber}" } set square 24859.6 diff --git a/tests/bugs/vis/buc60574 b/tests/bugs/vis/buc60574 index b439537457..3155b26bd3 100755 --- a/tests/bugs/vis/buc60574 +++ b/tests/bugs/vis/buc60574 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "===========" puts "BUC60574" puts "===========" diff --git a/tests/bugs/vis/buc60688 b/tests/bugs/vis/buc60688 index 94a216dc81..0414c27870 100755 --- a/tests/bugs/vis/buc60688 +++ b/tests/bugs/vis/buc60688 @@ -26,9 +26,8 @@ puts "" set x_coord 88 set y_coord 272 -checkcolor $x_coord $y_coord 0.8 0.8 0.8 - -if {$stat != 1} { +vaspects -setwidth 5 +if {"[vreadpixel $x_coord $y_coord rgb name]" != "GRAY80"} { puts "Error : The rectangular is NOT highlighted." } diff --git a/tests/bugs/vis/bug11615 b/tests/bugs/vis/bug11615 index c13f0d135c..4c6b2e90d6 100755 --- a/tests/bugs/vis/bug11615 +++ b/tests/bugs/vis/bug11615 @@ -16,13 +16,14 @@ vscale 1 1 1 set x1 [list 165 340 70] set y1 [list 384 283 79] - +vaspects -setwidth 5 puts "" for {set i 0} {$i < 3} {incr i} { set x_coord [lindex ${x1} $i] set y_coord [lindex ${y1} $i] - - checkcolor $x_coord $y_coord 1 1 0 + if { "[vreadpixel $x_coord $y_coord rgb name]" != "YELLOW" } { + puts "Error : color is not yellow" + } } vscale 0.5 1.5 0.7 @@ -35,8 +36,9 @@ puts "" for {set i 0} {$i < 3} {incr i} { set x_coord [lindex ${x2} $i] set y_coord [lindex ${y2} $i] - - checkcolor $x_coord $y_coord 1 1 0 + if { "[vreadpixel $x_coord $y_coord rgb name]" != "YELLOW" } { + puts "Error : color is not yellow" + } } set only_screen 1 diff --git a/tests/bugs/vis/bug1174 b/tests/bugs/vis/bug1174 index bf841193c7..98207fe7c5 100755 --- a/tests/bugs/vis/bug1174 +++ b/tests/bugs/vis/bug1174 @@ -38,15 +38,15 @@ set y_GREEN 180 set x_BLUE 180 set y_BLUE 250 -set ColorList1 [QAGetPixelColor ${x_GREEN} ${y_GREEN}] -regexp {RED +: +([-0-9.+eE]+)} $ColorList1 full RED_1 -regexp {GREEN +: +([-0-9.+eE]+)} $ColorList1 full GREEN_1 -regexp {BLUE +: +([-0-9.+eE]+)} $ColorList1 full BLUE_1 +set ColorList1 [vreadpixel ${x_GREEN} ${y_GREEN} rgb] +set RED_1 [lindex $ColorList1 0] +set GREEN_1 [lindex $ColorList1 1] +set BLUE_1 [lindex $ColorList1 2] -set ColorList2 [QAGetPixelColor ${x_BLUE} ${y_BLUE}] -regexp {RED +: +([-0-9.+eE]+)} $ColorList2 full RED_2 -regexp {GREEN +: +([-0-9.+eE]+)} $ColorList2 full GREEN_2 -regexp {BLUE +: +([-0-9.+eE]+)} $ColorList2 full BLUE_2 +set ColorList2 [vreadpixel ${x_BLUE} ${y_BLUE} rgb] +set RED_2 [lindex $ColorList2 0] +set GREEN_2 [lindex $ColorList2 1] +set BLUE_2 [lindex $ColorList2 2] if {${RED_1} == 0 && ${GREEN_1} > 0 && ${BLUE_1} == 0} { set IsGreen 1 diff --git a/tests/bugs/vis/bug12121 b/tests/bugs/vis/bug12121 index dda4aca389..90a211bd55 100755 --- a/tests/bugs/vis/bug12121 +++ b/tests/bugs/vis/bug12121 @@ -61,12 +61,12 @@ vdisplay obj vconnect new 50 50 50 obj vfit vmoveto $x1 $y1 -set ColorObj1 [QAGetPixelColor ${x2} ${y2}] -set ColorNew1 [QAGetPixelColor ${x3} ${y3}] +set ColorObj1 [vreadpixel ${x2} ${y2} rgb] +set ColorNew1 [vreadpixel ${x3} ${y3} rgb] vselect $x1 $y1 -set ColorObj2 [QAGetPixelColor ${x2} ${y2}] -set ColorNew2 [QAGetPixelColor ${x3} ${y3}] +set ColorObj2 [vreadpixel ${x2} ${y2} rgb] +set ColorNew2 [vreadpixel ${x3} ${y3} rgb] puts "Check vconnect command" set status_vconnect 0 diff --git a/tests/bugs/vis/bug173_2 b/tests/bugs/vis/bug173_2 index 2c6a746942..341a53f1f6 100755 --- a/tests/bugs/vis/bug173_2 +++ b/tests/bugs/vis/bug173_2 @@ -17,17 +17,17 @@ vdisplay result vfit vsetdispmode result 1 -set color1 [QAGetPixelColor 175 195] -regexp {RED +: +([-0-9.+eE]+)} $color1 full rd1 -regexp {GREEN +: +([-0-9.+eE]+)} $color1 full gr1 -regexp {BLUE +: +([-0-9.+eE]+)} $color1 full bl1 +set color1 [vreadpixel 175 195 rgb] +set rd1 [lindex $color1 0] +set gr1 [lindex $color1 1] +set bl1 [lindex $color1 2] vsetmaterial result ALUMINIUM -set color2 [QAGetPixelColor 175 195] -regexp {RED +: +([-0-9.+eE]+)} $color2 full rd2 -regexp {GREEN +: +([-0-9.+eE]+)} $color2 full gr2 -regexp {BLUE +: +([-0-9.+eE]+)} $color2 full bl2 +set color2 [vreadpixel 175 195 rgb] +set rd2 [lindex $color2 0] +set gr2 [lindex $color2 1] +set bl2 [lindex $color2 2] if { ${rd2} == ${rd1} || ${gr2} == ${gr1} || ${bl2} == ${bl1} } { puts "Error : material of the shape was NOT changed" diff --git a/tests/bugs/vis/bug173_3 b/tests/bugs/vis/bug173_3 index bca8b0e07c..5cd637be61 100755 --- a/tests/bugs/vis/bug173_3 +++ b/tests/bugs/vis/bug173_3 @@ -18,18 +18,18 @@ vdisplay result vfit vsetdispmode result 1 -set color1 [QAGetPixelColor 175 195] -regexp {RED +: +([-0-9.+eE]+)} $color1 full rd1 -regexp {GREEN +: +([-0-9.+eE]+)} $color1 full gr1 -regexp {BLUE +: +([-0-9.+eE]+)} $color1 full bl1 +set color1 [vreadpixel 175 195 rgb] +set rd1 [lindex $color1 0] +set gr1 [lindex $color1 1] +set bl1 [lindex $color1 2] ######################################################## vsettransparency result 0.5 -set color2 [QAGetPixelColor 175 195] -regexp {RED +: +([-0-9.+eE]+)} $color2 full rd2 -regexp {GREEN +: +([-0-9.+eE]+)} $color2 full gr2 -regexp {BLUE +: +([-0-9.+eE]+)} $color2 full bl2 +set color2 [vreadpixel 175 195 rgb] +set rd2 [lindex $color2 0] +set gr2 [lindex $color2 1] +set bl2 [lindex $color2 2] if { ${rd2} == ${rd1} || ${gr2} == ${gr1} || ${bl2} == ${bl1} } { puts "Error : vsettransparency of shape was NOT made" diff --git a/tests/bugs/vis/bug223 b/tests/bugs/vis/bug223 index 643113f55f..ad1feba3e3 100755 --- a/tests/bugs/vis/bug223 +++ b/tests/bugs/vis/bug223 @@ -28,10 +28,10 @@ vsetcolor face GREEN1 vsetdispmode cylinder 1 vsetcolor cylinder RED1 -set ColorList [QAGetPixelColor $Start_X $Start_Y] -regexp {RED +: +([-0-9.+eE]+)} $ColorList full R_START_POINT -regexp {GREEN +: +([-0-9.+eE]+)} $ColorList full G_START_POINT -regexp {BLUE +: +([-0-9.+eE]+)} $ColorList full B_START_POINT +set ColorList [vreadpixel ${Start_X} ${Start_Y} rgb] +set R_START_POINT [lindex $ColorList 0] +set G_START_POINT [lindex $ColorList 1] +set B_START_POINT [lindex $ColorList 2] puts "R_START_POINT=$R_START_POINT ; G_START_POINT=$G_START_POINT ; B_START_POINT=$B_START_POINT" diff --git a/tests/bugs/vis/bug22900 b/tests/bugs/vis/bug22900 index 3d3e9fc636..ec0a1f5aa7 100755 --- a/tests/bugs/vis/bug22900 +++ b/tests/bugs/vis/bug22900 @@ -27,6 +27,6 @@ vsetcolor c1 GREEN vsetdispmode 1 vsetcolor c1 RED -checkcolor ${x1} ${y1}] 1 0 0 +checkcolor ${x1} ${y1} 1 0 0 set only_screen 1 diff --git a/tests/bugs/vis/bug22906 b/tests/bugs/vis/bug22906 index 47a91e60f5..a7a17cd9d2 100755 --- a/tests/bugs/vis/bug22906 +++ b/tests/bugs/vis/bug22906 @@ -22,33 +22,25 @@ set y4 232 vinit vsetgradientbg 255 0 0 0 0 255 4 -set Color1 [QAGetPixelColor ${x1} ${y1}] -set Color2 [QAGetPixelColor ${x2} ${y2}] -set Color3 [QAGetPixelColor ${x3} ${y3}] -set Color4 [QAGetPixelColor ${x4} ${y4}] +set Color1 [vreadpixel ${x1} ${y1} rgb] +set Color2 [vreadpixel ${x2} ${y2} rgb] +set Color3 [vreadpixel ${x3} ${y3} rgb] +set Color4 [vreadpixel ${x4} ${y4} rgb] vclipplane create pln1 vclipplane change pln1 equation 1 0 0 -0.1 vclipplane set pln1 view Driver1/Viewer1/View1 box b 100 100 100 vdisplay b vsetdispmode 1 -set ColorRes1 [QAGetPixelColor ${x1} ${y1}] -set ColorRes2 [QAGetPixelColor ${x2} ${y2}] -set ColorRes3 [QAGetPixelColor ${x3} ${y3}] -set ColorRes4 [QAGetPixelColor ${x4} ${y4}] +set ColorRes1 [vreadpixel ${x1} ${y1} rgb] +set ColorRes2 [vreadpixel ${x2} ${y2} rgb] +set ColorRes3 [vreadpixel ${x3} ${y3} rgb] +set ColorRes4 [vreadpixel ${x4} ${y4} rgb] -set status 0 if { ${Color1} == ${ColorRes1} && ${Color2} == ${ColorRes2} && ${Color3} == ${ColorRes3} && ${Color4} == ${ColorRes4}} { - set status 0 + puts "OK ${BugNumber}" } else { - set status 1 + puts "Faulty ${BugNumber}" } -# Resume -puts "" -if { ${status} != 0} { - puts "Faulty ${BugNumber}" -} else { - puts "OK ${BugNumber}" -} set only_screen 1 diff --git a/tests/bugs/vis/bug23012 b/tests/bugs/vis/bug23012 index 0dfdeb5478..84fbd1176c 100755 --- a/tests/bugs/vis/bug23012 +++ b/tests/bugs/vis/bug23012 @@ -24,31 +24,17 @@ vsetdispmode b_1 1 vselprecision vselprecision 1 0.1 -set ColorBefore [QAGetPixelColor ${x1} ${y1}] -set R1 [lindex ${ColorBefore} 2] -set G1 [lindex ${ColorBefore} 5] -set B1 [lindex ${ColorBefore} 8] +set ColorBefore [vreadpixel ${x1} ${y1} rgb] vmoveto ${x2} ${y2} -set ColorAfter [QAGetPixelColor ${x1} ${y1}] -set R2 [lindex ${ColorAfter} 2] -set G2 [lindex ${ColorAfter} 5] -set B2 [lindex ${ColorAfter} 8] +set ColorAfter [vreadpixel ${x2} ${y2} rgb] -set check_color 0 -if { ${R1} == ${R2} && ${G1} == ${G2} && ${B1} == ${B2} } { - set check_color 0 +if { "$ColorBefore" == "$ColorAfter" } { + puts "OK ${BugNumber}" } else { - set check_color 1 + puts "Faulty ${BugNumber}" } -# Resume -puts "" -if { ${check_color} != 0} { - puts "Faulty ${BugNumber}" -} else { - puts "OK ${BugNumber}" -} vfit set only_screen 1 diff --git a/tests/bugs/vis/bug23102 b/tests/bugs/vis/bug23102 index a237fb77d8..6fd8788e29 100755 --- a/tests/bugs/vis/bug23102 +++ b/tests/bugs/vis/bug23102 @@ -17,14 +17,13 @@ set R_bg 0.70196002721786499 set G_bg 0.78039199113845825 set B_bg 0.86274499999999998 -set Color [QAGetPixelColor ${x1} ${y1}] -set R [lindex ${Color} 2] -set G [lindex ${Color} 5] -set B [lindex ${Color} 8] +set WrongColor "$R_bg $G_bg $B_bg" + +set Color [vreadpixel ${x1} ${y1} rgb] #Resume puts "" -if { $R != ${R_bg} && $G != ${G_bg} && $B != ${B_bg} } { +if { "[vreadpixel ${x1} ${y1} rgb]" != "$WrongColor" } { puts "OK ${BugNumber}" } else { puts "Faulty ${BugNumber}" diff --git a/tests/bugs/vis/bug23153 b/tests/bugs/vis/bug23153 index e20a3e5569..a4cea94dda 100755 --- a/tests/bugs/vis/bug23153 +++ b/tests/bugs/vis/bug23153 @@ -33,39 +33,24 @@ vtop vfit set status 0 -set RED 0 -set GREEN 0 -set BLUE 0 set x1 223 set y1 195 -set Color1 [QAGetPixelColor ${x1} ${y1}] -regexp {RED +: +([-0-9.+eE]+)} $Color1 full R1 -regexp {GREEN +: +([-0-9.+eE]+)} $Color1 full G1 -regexp {BLUE +: +([-0-9.+eE]+)} $Color1 full B1 -if { $R1 == ${RED} && $G1 == ${GREEN} && $B1 == ${BLUE} } { + +if { "[vreadpixel $x1 $y1 rgb name]" == "BLACK" } { set status 1 puts "Faulty Color1" } set x2 224 set y2 240 -set Color2 [QAGetPixelColor ${x2} ${y2}] -regexp {RED +: +([-0-9.+eE]+)} $Color2 full R2 -regexp {GREEN +: +([-0-9.+eE]+)} $Color2 full G2 -regexp {BLUE +: +([-0-9.+eE]+)} $Color2 full B2 - -if { $R2 == ${RED} && $G2 == ${GREEN} && $B2 == ${BLUE} } { +if { "[vreadpixel $x2 $y2 rgb name]" == "BLACK" } { set status 1 puts "Faulty Color2" } set x3 223 set y3 266 -set Color3 [QAGetPixelColor ${x3} ${y3}] -regexp {RED +: +([-0-9.+eE]+)} $Color3 full R3 -regexp {GREEN +: +([-0-9.+eE]+)} $Color3 full G3 -regexp {BLUE +: +([-0-9.+eE]+)} $Color3 full B3 -if { $R3 == ${RED} && $G3 == ${GREEN} && $B3 == ${BLUE} } { +if { "[vreadpixel $x3 $y3 rgb name]" == "BLACK" } { set status 1 puts "Faulty Color3" } diff --git a/tests/bugs/vis/bug232 b/tests/bugs/vis/bug232 index 8bb8dee270..d93edfdef8 100755 --- a/tests/bugs/vis/bug232 +++ b/tests/bugs/vis/bug232 @@ -32,18 +32,22 @@ set Cyan_R 0 set Cyan_G 1 set Cyan_B 1 +set Cyan "$Cyan_R $Cyan_G $Cyan_B" + set Yellow_R 1 set Yellow_G 1 set Yellow_B 0 +set Yellow "$Yellow_R $Yellow_G $Yellow_B" + # There is not selection puts "There is not selection" -catch {QAGetPixelColor $x1 $y1 $Yellow_R $Yellow_G $Yellow_B} result11 -catch {QAGetPixelColor $x2 $y2 $Yellow_R $Yellow_G $Yellow_B} result12 -catch {QAGetPixelColor $x3 $y3 $Yellow_R $Yellow_G $Yellow_B} result13 -catch {QAGetPixelColor $x4 $y4 $Yellow_R $Yellow_G $Yellow_B} result14 -catch {QAGetPixelColor $x5 $y5 $Yellow_R $Yellow_G $Yellow_B} result15 -catch {QAGetPixelColor $x6 $y6 $Yellow_R $Yellow_G $Yellow_B} result16 +set result11 [regexp "$Yellow" [vreadpixel $x1 $y1 rgb]] +set result12 [regexp "$Yellow" [vreadpixel $x2 $y2 rgb]] +set result13 [regexp "$Yellow" [vreadpixel $x3 $y3 rgb]] +set result14 [regexp "$Yellow" [vreadpixel $x4 $y4 rgb]] +set result15 [regexp "$Yellow" [vreadpixel $x5 $y5 rgb]] +set result16 [regexp "$Yellow" [vreadpixel $x6 $y6 rgb]] # Move a mouse puts "Move a mouse" @@ -51,59 +55,27 @@ vmoveto $x2 $y2 # Second box of first CompSolid is selected puts "Second box of first CompSolid is selected" -catch {QAGetPixelColor $x1 $y1 $Yellow_R $Yellow_G $Yellow_B} result21 -catch {QAGetPixelColor $x3 $y3 $Yellow_R $Yellow_G $Yellow_B} result22 -catch {QAGetPixelColor $x4 $y4 $Yellow_R $Yellow_G $Yellow_B} result23 -catch {QAGetPixelColor $x5 $y5 $Yellow_R $Yellow_G $Yellow_B} result24 -catch {QAGetPixelColor $x6 $y6 $Yellow_R $Yellow_G $Yellow_B} result25 +set result21 [regexp "$Yellow" [vreadpixel $x1 $y1 rgb]] +set result22 [regexp "$Yellow" [vreadpixel $x3 $y3 rgb]] +set result23 [regexp "$Yellow" [vreadpixel $x4 $y4 rgb]] +set result24 [regexp "$Yellow" [vreadpixel $x5 $y5 rgb]] +set result25 [regexp "$Yellow" [vreadpixel $x6 $y6 rgb]] if { [array get env os_type] != "" } { set os $env(os_type) } if { [string compare $os "windows"] != 0 } { - catch {QAGetPixelColor $x2 $y2 $Cyan_R $Cyan_G $Cyan_B} result31 + set result31 [regexp "$Cyan" [vreadpixel $x2 $y2 rgb]] + if { $result31 == 0 } { + set IsFaulty 1 + } } set IsFaulty 0 -if { [regexp "Faulty" $result11] == 1 } { +if { !($result11 && $result12 && $result13 && $result14 && $result15 && $result16) + || !($result21 && $result22 && $result23 && $result24 && $result25) } { set IsFaulty 1 } -if { [regexp "Faulty" $result12] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result13] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result14] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result15] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result16] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result21] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result22] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result23] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result24] == 1 } { - set IsFaulty 1 -} -if { [regexp "Faulty" $result25] == 1 } { - set IsFaulty 1 -} - -if { [string compare $os "windows"] != 0 } { - if { [regexp "Faulty" $result31] == 1 } { - set IsFaulty 1 - } -} if {$IsFaulty != 0} { puts "Error : OCC232" diff --git a/tests/bugs/vis/bug23226 b/tests/bugs/vis/bug23226 index de73740f54..5f81f9f76a 100755 --- a/tests/bugs/vis/bug23226 +++ b/tests/bugs/vis/bug23226 @@ -84,8 +84,7 @@ proc check_primitive {name1 r g b args} { set HasPixel 0 for {set i 0} {$i < $limit_x} {incr i} { for {set j 0} {$j < $limit_y} {incr j} { - set QATestVar [ catch { QAGetPixelColor $i $j $r $g $b } ] - if { $QATestVar == 0 } { + if { "[vreadpixel $i $j rgb]" == "$r $g $b" } { set HasPixel 1 } } @@ -100,8 +99,8 @@ proc check_primitive {name1 r g b args} { set HasPixel 1 for {set i 0} {$i < $limit_x} {incr i} { for {set j 0} {$j < $limit_y} {incr j} { - set QATestVar [ catch { QAGetPixelColor $i [expr $view_height-$j] $r $g $b } ] - if { $QATestVar == 0 } { + set coord_y [expr $view_height-$j] + if { "[vreadpixel $i $coord_y rgb]" == "$r $g $b" } { set HasPixel 1 } } @@ -116,8 +115,9 @@ proc check_primitive {name1 r g b args} { set HasPixel 1 for {set i 0} {$i < $limit_x} {incr i} { for {set j 0} {$j < $limit_y} {incr j} { - set QATestVar [ catch { QAGetPixelColor [expr ($view_width-$limit_y) + $i] [expr ($view_height-$limit_y)/2 + $j] $r $g $b } ] - if { $QATestVar == 0 } { + set coord_x [expr ($view_width-$limit_y) + $i] + set coord_y [expr ($view_height-$limit_y)/2 + $j] + if { "[vreadpixel $coord_x $coord_y rgb]" == "$r $g $b" } { set HasPixel 1 } } @@ -132,8 +132,9 @@ proc check_primitive {name1 r g b args} { set HasPixel 0 for {set i 0} {$i < $limit_x} {incr i} { for {set j 0} {$j < $limit_y} {incr j} { - set QATestVar [ catch { QAGetPixelColor [expr $view_width/4 + $i] [expr ($view_height-$limit_y)/2 + $j] $r $g $b } ] - if { $QATestVar == 0 } { + set coord_x [expr $view_width/4 + $i] + set coord_y [expr ($view_height-$limit_y)/2 + $j] + if { "[vreadpixel $coord_x $coord_y rgb]" == "$r $g $b" } { set HasPixel 1 } } diff --git a/tests/bugs/vis/bug23363 b/tests/bugs/vis/bug23363 index 8c32306427..236b154fb8 100755 --- a/tests/bugs/vis/bug23363 +++ b/tests/bugs/vis/bug23363 @@ -15,11 +15,10 @@ vdisplay p vsetdispmode p 1 vsetinteriorstyle p 1 -set color [QAGetPixelColor 10 0] -regexp {RED +: +([-0-9.+eE]+)} $color full R_check - puts "" -if { ${R_check} == 0 } { +set color1 [vreadpixel 10 0 rgb] +set rd1 [lindex $color1 0] +if { $rd1 == 0 } { puts "Faulty ${BugNumber}" } else { puts "OK ${BugNumber}" diff --git a/tests/bugs/vis/bug23385 b/tests/bugs/vis/bug23385 index b8beee8810..f0ff8eebc3 100755 --- a/tests/bugs/vis/bug23385 +++ b/tests/bugs/vis/bug23385 @@ -17,22 +17,10 @@ vtexrepeat b_16 3 2 vsetdispmode b_16 1 vfit -set color [QAGetPixelColor 85 73] -regexp {RED +: +([-0-9.+eE]+)} $color full R_check -regexp {GREEN +: +([-0-9.+eE]+)} $color full G_check -regexp {BLUE +: +([-0-9.+eE]+)} $color full B_check -set color_status 0 -if { ${R_check} != 0 || ${G_check} != 0 || ${B_check} != 0 } { - set color_status 0 -} else { - set color_status 1 -} - -puts "" -if { ${color_status} != 0 } { - puts "Faulty ${BugNumber}" -} else { +if { "[vreadpixel 85 73 rgb name]" != "BLACK" } { puts "OK ${BugNumber}" +} else { + puts "Faulty ${BugNumber}" } set only_screen 1 diff --git a/tests/bugs/vis/bug23407_2 b/tests/bugs/vis/bug23407_2 index 56a7becb71..1b9a435808 100755 --- a/tests/bugs/vis/bug23407_2 +++ b/tests/bugs/vis/bug23407_2 @@ -12,31 +12,12 @@ vdisplay b vsetdispmode 1 vshowfaceboundary b 1 255 0 0 10 1 vfit +vaspects -setwidth 5 -set x_coord 183 -set y_coord 190 - -checkcolor $x_coord $y_coord 1 0 0 - -if { $stat != 1 } { - puts "Error : Boundary of face is not changed" -} - -set x_coord 292 -set y_coord 358 - -checkcolor $x_coord $y_coord 1 0 0 - -if { $stat != 1 } { - puts "Error : Boundary of face is not changed" -} - -set x_coord 26 -set y_coord 265 - -checkcolor $x_coord $y_coord 1 0 0 - -if { $stat != 1 } { +if { "[vreadpixel 183 190 rgb name]" != "RED" + || "[vreadpixel 292 358 rgb name]" != "RED" + || "[vreadpixel 26 265 rgb name]" != "RED" +} { puts "Error : Boundary of face is not changed" } diff --git a/tests/bugs/vis/bug23709_1 b/tests/bugs/vis/bug23709_1 index 60a928ac08..de5814d9f2 100644 --- a/tests/bugs/vis/bug23709_1 +++ b/tests/bugs/vis/bug23709_1 @@ -18,7 +18,10 @@ vhlrtype polyalgo b set x_coord 290 set y_coord 170 -checkcolor $x_coord $y_coord 1 1 0 +vaspects -setwidth 5 +if { "[vreadpixel $x_coord $y_coord rgb name]" != "YELLOW" } { + puts "Error : color is not yellow" +} set x_coord 86 set y_coord 221 diff --git a/tests/bugs/vis/bug23709_2 b/tests/bugs/vis/bug23709_2 index 507df8c832..3ddc6733b8 100644 --- a/tests/bugs/vis/bug23709_2 +++ b/tests/bugs/vis/bug23709_2 @@ -18,7 +18,10 @@ vhlrtype algo a set x_coord 290 set y_coord 170 -checkcolor $x_coord $y_coord 1 1 0 +vaspects -setwidth 5 +if { "[vreadpixel $x_coord $y_coord rgb name]" != "YELLOW" } { + puts "Error : color is not yellow" +} set x_coord 86 set y_coord 221 diff --git a/tests/bugs/vis/bug23709_3 b/tests/bugs/vis/bug23709_3 index 4c5f174e5e..225d7c3612 100644 --- a/tests/bugs/vis/bug23709_3 +++ b/tests/bugs/vis/bug23709_3 @@ -17,9 +17,9 @@ vfit vhlr on vhlrtype algo result -checkcolor $x_coord $y_coord 1 1 0 +vaspects -setwidth 5 +if { "[vreadpixel $x_coord $y_coord rgb name]" != "YELLOW" } { + puts "Error : color is not yellow" +} set only_screen 1 - - - diff --git a/tests/bugs/vis/bug23709_4 b/tests/bugs/vis/bug23709_4 index 5186c2bf09..350cf50eb5 100644 --- a/tests/bugs/vis/bug23709_4 +++ b/tests/bugs/vis/bug23709_4 @@ -17,10 +17,9 @@ vfit vhlr on vhlrtype algo result -checkcolor $x_coord $y_coord 1 1 0 +vaspects -setwidth 5 +if { "[vreadpixel $x_coord $y_coord rgb name]" != "YELLOW" } { + puts "Error : color is not yellow" +} set only_screen 1 - - - - diff --git a/tests/bugs/vis/bug24391 b/tests/bugs/vis/bug24391 index 7bc3720e93..753bd8d7ab 100644 --- a/tests/bugs/vis/bug24391 +++ b/tests/bugs/vis/bug24391 @@ -16,12 +16,9 @@ vremove -context a vdisplay a vfit +vaspects -setwidth 5 vmoveto 204 205 - -set x_coord 204 -set y_coord 205 -checkcolor $x_coord $y_coord 0 1 1 -if { $stat != 1 } { +if { "[vreadpixel 204 205 rgb name]" != "CYAN1" } { puts "Error : Erased object is not displayed after its removing." } diff --git a/tests/bugs/vis/bug24555 b/tests/bugs/vis/bug24555 index 1fd7d04c77..e1eb6cd3fe 100755 --- a/tests/bugs/vis/bug24555 +++ b/tests/bugs/vis/bug24555 @@ -20,14 +20,7 @@ set R 0 set G 0.9843137264251709 set B 0 -decho off -set catch_status 0 -if { [catch {QAGetPixelColor $x $y $R $G $B} catch_result] } { - set catch_status 1 -} -decho on - -if {${catch_status} == 0} { +if {"[vreadpixel $x $y rgb]" == "$R $G $B" } { puts "Error : color is bad" } else { puts "OK : color is good" diff --git a/tests/bugs/vis/bug24564 b/tests/bugs/vis/bug24564 index b7caab020a..7d7f315e9c 100644 --- a/tests/bugs/vis/bug24564 +++ b/tests/bugs/vis/bug24564 @@ -23,10 +23,9 @@ vdisplay b vfit vtop +vaspects -setwidth 5 vmoveto 199 200 -checkcolor 199 200 0 1 1 - -if { $stat != 1 } { +if { "[vreadpixel 199 200 rgb name]" != "CYAN1" } { puts "Error : The box is not selectable!" } @@ -35,8 +34,6 @@ vaxo vfit vmoveto 199 200 -checkcolor 199 200 0 1 1 - -if { $stat != 1 } { +if { "[vreadpixel 199 200 rgb name]" != "CYAN1" } { puts "Error : The box is not selectable!" } diff --git a/tests/bugs/vis/bug24714 b/tests/bugs/vis/bug24714 index 04f33a3036..aade48c6a1 100644 --- a/tests/bugs/vis/bug24714 +++ b/tests/bugs/vis/bug24714 @@ -19,11 +19,9 @@ vfit vviewparams -size 22 +vaspects -setwidth 5 vmoveto 200 100 - -checkcolor 200 9 0 1 1 - -if { $stat != 1 } { +if { "[vreadpixel 200 9 rgb name]" != "CYAN1" } { puts "Error : the view projection size is incorrect!" } diff --git a/tests/bugs/vis/bug24717 b/tests/bugs/vis/bug24717 index 06ead2728e..5acd33fef5 100644 --- a/tests/bugs/vis/bug24717 +++ b/tests/bugs/vis/bug24717 @@ -20,10 +20,9 @@ vclipplane create pln1 vclipplane set pln1 view Driver1/Viewer1/View1 vclipplane change pln1 equation 0 1 0 0 vfit +vaspects -setwidth 5 -checkcolor $check_x $check_y 0 1 1 - -if {$stat != 1} { +if { "[vreadpixel $check_x $check_y rgb name]" != "CYAN1" } { puts "Error : Viewer clipping is broken." } diff --git a/tests/bugs/vis/bug24867 b/tests/bugs/vis/bug24867 index 468585c925..3d87f0fb2a 100644 --- a/tests/bugs/vis/bug24867 +++ b/tests/bugs/vis/bug24867 @@ -11,20 +11,13 @@ vinit View1 vdisplay b vfit vsetdispmode 1 +vaspects -setwidth 5 vmoveto 200 200 - -set x1_coord 264 -set y1_coord 288 -set x2_coord 251 -set y2_coord 271 - -checkcolor $x1_coord $y1_coord 0 1 1 -if { $stat != 1 } { +if { "[vreadpixel 264 288 rgb name]" != "CYAN1" } { puts "Error : Highlighting of dimension with flipping in local context failed." } -checkcolor $x2_coord $y2_coord 0 1 1 -if { $stat != 1 } { +if { "[vreadpixel 251 271 rgb name]" != "CYAN1" } { puts "Error : Highlighting of dimension with flipping in local context failed." } diff --git a/tests/bugs/vis/bug24901 b/tests/bugs/vis/bug24901 index 215e0b2f73..01de2e1ae3 100755 --- a/tests/bugs/vis/bug24901 +++ b/tests/bugs/vis/bug24901 @@ -18,10 +18,7 @@ vclipplane change pln1 capping on vfit vmoveto 304 146 -set x_coord 304 -set y_coord 146 -checkcolor $x_coord $y_coord 0 1 1 -if { $stat != 1 } { +if { "[vreadpixel 304 146 rgb name]" != "CYAN1" } { puts "Error : Highlighting is broken." } diff --git a/tests/bugs/vis/bug24966 b/tests/bugs/vis/bug24966 index e6841ddc94..ead507db0d 100644 --- a/tests/bugs/vis/bug24966 +++ b/tests/bugs/vis/bug24966 @@ -23,10 +23,7 @@ vselmode e1 1 1 vselect 0 0 2500 2500 verase -local -set x_coord 261 -set y_coord 204 -checkcolor $x_coord $y_coord 0 0 0 -if { $stat != 1 } { +if { "[vreadpixel 261 204 rgb name]" != "BLACK" } { puts "Error : Selection is not erased." } diff --git a/tests/bugs/vis/bug349 b/tests/bugs/vis/bug349 index 28a4a015b7..a6f535c158 100755 --- a/tests/bugs/vis/bug349 +++ b/tests/bugs/vis/bug349 @@ -12,41 +12,8 @@ OCC280 1 0 vfit -set x1 135 -set y1 119 - -set x2 387 -set y2 33 - -set x3 172 -set y3 144 - -set x4 28 -set y4 190 - -set x5 160 -set y5 257 - -set x6 365 -set y6 150 - -set x7 212 -set y7 272 - -set x8 60 -set y8 343 - -set x9 26 -set y9 255 - -set x10 353 -set y10 99 - -set x11 389 -set y11 113 - -set x12 60 -set y12 276 +set yellow_coords {{135 119} {387 33} {172 144} {28 190} {212 272} {60 343} {26 255} {389 113} {60 276}} +set black_coords {{160 257} {365 150} {353 99}} # # ___________2________________ @@ -86,17 +53,18 @@ set y12 276 # # -checkcolor ${x1} ${y1} 1 1 0 -checkcolor ${x2} ${y2} 1 1 0 -checkcolor ${x3} ${y3} 1 1 0 -checkcolor ${x4} ${y4} 1 1 0 -checkcolor ${x7} ${y7} 1 1 0 -checkcolor ${x8} ${y8} 1 1 0 -checkcolor ${x9} ${y9} 1 1 0 -checkcolor ${x11} ${y11} 1 1 0 -checkcolor ${x12} ${y12} 1 1 0 -checkcolor ${x5} ${y5} 0 0 0 -checkcolor ${x6} ${y6} 0 0 0 -checkcolor ${x10} ${y10} 0 0 0 +vaspects -setwidth 5 + +foreach i $yellow_coords { + if {"[vreadpixel [lindex $i 0] [lindex $i 1] rgb name]" != "YELLOW" } { + puts "Error : ${i} is not yellow" + } +} + +foreach i $black_coords { + if {"[vreadpixel [lindex $i 0] [lindex $i 1] rgb name]" != "BLACK" } { + puts "Error : ${i} is not black" + } +} set only_screen 1 diff --git a/tests/bugs/vis/bug349_1 b/tests/bugs/vis/bug349_1 index ce1a8b1375..44004600b7 100755 --- a/tests/bugs/vis/bug349_1 +++ b/tests/bugs/vis/bug349_1 @@ -12,49 +12,9 @@ OCC280 1 1 vfit -set x1 135 -set y1 119 +set yellow_coords {{135 119} {387 33} {172 144} {28 190} {212 272} {60 343} {26 255} {389 113} {60 276}} -set x2 387 -set y2 33 - -set x3 172 -set y3 144 - -set x4 28 -set y4 190 - -set x5 160 -set y5 257 - -set x6 365 -set y6 150 - -set x7 212 -set y7 272 - -set x8 60 -set y8 343 - -set x9 26 -set y9 255 - -set x10 353 -set y10 99 - -set x11 389 -set y11 113 - -set x12 60 -set y12 276 - -set Black_R 0 -set Black_G 0 -set Black_B 0 - -set Yellow_R 1 -set Yellow_G 1 -set Yellow_B 0 +set black_coords {{160 257} {365 150} {353 99}} # # ___________2________________ @@ -94,17 +54,18 @@ set Yellow_B 0 # # -checkcolor ${x1} ${y1} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x2} ${y2} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x3} ${y3} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x4} ${y4} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x7} ${y7} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x8} ${y8} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x9} ${y9} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x11} ${y11} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x12} ${y12} ${Yellow_R} ${Yellow_G} ${Yellow_B} -checkcolor ${x5} ${y5} ${Black_R} ${Black_G} ${Black_B} -checkcolor ${x6} ${y6} ${Black_R} ${Black_G} ${Black_B} -checkcolor ${x10} ${y10} ${Black_R} ${Black_G} ${Black_B} +vaspects -setwidth 5 + +foreach i $yellow_coords { + if {"[vreadpixel [lindex $i 0] [lindex $i 1] rgb name]" != "YELLOW" } { + puts "Error : ${i} is not yellow" + } +} + +foreach i $black_coords { + if {"[vreadpixel [lindex $i 0] [lindex $i 1] rgb name]" != "BLACK" } { + puts "Error : ${i} is not black" + } +} set only_screen 0 diff --git a/tests/bugs/vis/bug597_1 b/tests/bugs/vis/bug597_1 index a2539ec6da..807097ca67 100755 --- a/tests/bugs/vis/bug597_1 +++ b/tests/bugs/vis/bug597_1 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug597_2 b/tests/bugs/vis/bug597_2 index 2ea54ede9f..0eae2e6238 100755 --- a/tests/bugs/vis/bug597_2 +++ b/tests/bugs/vis/bug597_2 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug597_3 b/tests/bugs/vis/bug597_3 index aaa5f40cb4..fabe847937 100755 --- a/tests/bugs/vis/bug597_3 +++ b/tests/bugs/vis/bug597_3 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug597_4 b/tests/bugs/vis/bug597_4 index 3299f92111..354dc9ad16 100755 --- a/tests/bugs/vis/bug597_4 +++ b/tests/bugs/vis/bug597_4 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug597_5 b/tests/bugs/vis/bug597_5 index b93c0150ee..2f4dfeb46f 100755 --- a/tests/bugs/vis/bug597_5 +++ b/tests/bugs/vis/bug597_5 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug597_6 b/tests/bugs/vis/bug597_6 index 66084cffec..fd465f3f91 100755 --- a/tests/bugs/vis/bug597_6 +++ b/tests/bugs/vis/bug597_6 @@ -1,9 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug597_7 b/tests/bugs/vis/bug597_7 index 76339a0c25..0a3e785990 100755 --- a/tests/bugs/vis/bug597_7 +++ b/tests/bugs/vis/bug597_7 @@ -1,10 +1,3 @@ -if { [array get env os_type] != "" } { - set os $env(os_type) -} -if { [string compare $os "windows"] != 0 } { -} - - puts "==================================" puts "BUC60569" puts "OCC597" diff --git a/tests/bugs/vis/bug5988 b/tests/bugs/vis/bug5988 index d2deb9eae6..c67e547cba 100755 --- a/tests/bugs/vis/bug5988 +++ b/tests/bugs/vis/bug5988 @@ -27,15 +27,13 @@ vtexture box [locate_data_file OCC5988_2d_floor.rgb] set x 200 set y 200 -decho off -if [catch { QAGetPixelColor $x $y 0 0 0 } res] { +if { "[vreadpixel $x $y rgb name]" != "BLACK" } { puts "box is not black - OK" puts "OK ${BugNumber}" } else { puts "box is black - Faulty" puts "Faulty ${BugNumber}" } -decho on set only_screen 1 diff --git a/tests/bugs/vis/bug60 b/tests/bugs/vis/bug60 index bf3cffd71b..80f84a0031 100755 --- a/tests/bugs/vis/bug60 +++ b/tests/bugs/vis/bug60 @@ -8,11 +8,14 @@ vinit box b 10 10 10 vdisplay b vfit +vaspects -setwidth 5 set x_coord 83 set y_coord 337 -checkcolor $x_coord $y_coord 1 1 0 +if { [vreadpixel ${x_coord} ${y_coord} rgb name] != "YELLOW" } { + puts "Error : color is not yellow" +} set xmin 1 set ymin 1 @@ -27,6 +30,8 @@ set Selection_R 0.8 set Selection_G 0.8 set Selection_B 0.8 -checkcolor $x_coord $y_coord 0.8 0.8 0.8 +if { [vreadpixel ${x_coord} ${y_coord} rgb name] != "GRAY80" } { + puts "Error : color is not gray" +} set only_screen 1 diff --git a/tests/bugs/vis/bug7186 b/tests/bugs/vis/bug7186 index 65cf2b11a2..a1d94a9a28 100755 --- a/tests/bugs/vis/bug7186 +++ b/tests/bugs/vis/bug7186 @@ -37,17 +37,13 @@ if { ${NbSelected2} != 0 } { set x [list 125 204 283 29 111 298 379 125 204 283 125 283] set y [list 47 100 47 200 150 150 200 250 300 250 361 361] - +vaspects -setwidth 5 puts "" for {set i 0} {$i < 12} {incr i} { - set x_coord [lindex ${x} $i] - set y_coord [lindex ${y} $i] - checkcolor $x_coord $y_coord 1 1 0 - if { ${stat} != 1 } { + if { [vreadpixel [lindex ${x} $i] [lindex ${y} $i] rgb name] != "YELLOW" } { set mistake 1 } } - puts "" if { ${mistake} == 1 } { puts "${BugNumber}: Faulty" diff --git a/tests/bugs/vis/bug74 b/tests/bugs/vis/bug74 index a6894fc0b6..6d1a55a2cb 100755 --- a/tests/bugs/vis/bug74 +++ b/tests/bugs/vis/bug74 @@ -32,29 +32,19 @@ vinit box b 10 10 10 vdisplay b vfit +vaspects -setwidth 5 ### FIRST PART # Check Shape color -checkcolor ${Shape_X} ${Shape_Y} 1 1 0 +if { [vreadpixel ${Shape_X} ${Shape_Y} rgb name] != "YELLOW" } { + puts "Error : shape color is not yellow" +} # Check Vertex color -checkcolor ${Vertex_X} ${Vertex_Y} 1 1 0 - -# Check Edge color -checkcolor ${Edge_X} ${Edge_Y} 1 1 0 - -# Check Wire color -checkcolor ${Wire_X} ${Wire_Y} 1 1 0 - -# Check Face color -checkcolor ${Face_X} ${Face_Y} 1 1 0 - -# Check Shell color -checkcolor ${Shell_X} ${Shell_Y} 1 1 0 - -# Check Solid color -checkcolor ${Solid_X} ${Solid_Y} 1 1 0 +if { [vreadpixel ${Vertex_X} ${Vertex_Y} rgb name] != "YELLOW" } { + puts "Error : vertex color is not yellow" +} ### SECOND PART @@ -69,7 +59,9 @@ if { ${GetSelectMode} != ${SetSelectMode} } { } vmoveto ${Shape_X} ${Shape_Y} -checkcolor ${Shape_X} ${Shape_Y} 0 1 1 +if { [vreadpixel ${Shape_X} ${Shape_Y} rgb name] != "CYAN1" } { + puts "Error : shape color is not cyan" +} # Check Vertex color vmoveto 1 1 @@ -161,44 +153,14 @@ if { ${GetSelectMode} != ${SetSelectMode} } then { # Check Shape color vmoveto 1 1 -vmoveto ${Shape_X} ${Shape_Y} - -checkcolor ${Shape_X} ${Shape_Y} 1 1 0 +if { [vreadpixel ${Shape_X} ${Shape_Y} rgb name] != "YELLOW" } { + puts "Error : shape color is not yellow" +} # Check Vertex color vmoveto 1 1 -vmoveto ${Vertex_X} ${Vertex_Y} - -checkcolor ${Vertex_X} ${Vertex_Y} 1 1 0 - -# Check Edge color -vmoveto 1 1 -vmoveto ${Edge_X} ${Edge_Y} - -checkcolor ${Edge_X} ${Edge_Y} 1 1 0 - -# Check Wire color -vmoveto 1 1 -vmoveto ${Wire_X} ${Wire_Y} - -checkcolor ${Wire_X} ${Wire_Y} 1 1 0 - -# Check Face color -vmoveto 1 1 -vmoveto ${Face_X} ${Face_Y} - -checkcolor ${Face_X} ${Face_Y} 1 1 0 - -# Check Shell color -vmoveto 1 1 -vmoveto ${Shell_X} ${Shell_Y} - -checkcolor ${Shell_X} ${Shell_Y} 1 1 0 - -# Check Solid color -vmoveto 1 1 -vmoveto ${Solid_X} ${Solid_Y} - -checkcolor ${Solid_X} ${Solid_Y} 1 1 0 +if { [vreadpixel ${Vertex_X} ${Vertex_Y} rgb name] != "YELLOW" } { + puts "Error : vertex color is not yellow" +} set only_screen 1 diff --git a/tests/bugs/vis/ger61351_1 b/tests/bugs/vis/ger61351_1 index d0f3a4765a..b58a2f4d48 100755 --- a/tests/bugs/vis/ger61351_1 +++ b/tests/bugs/vis/ger61351_1 @@ -10,9 +10,7 @@ GER61351 RED2 set x_coord 200 set y_coord 200 -checkcolor $x_coord $y_coord 0.93 0 0 - -if {$stat != 1} { +if {"[vreadpixel $x_coord $y_coord rgb name]" != "RED2"} { puts "Error : Background color is NOT RED2." } diff --git a/tests/bugs/vis/ger61351_2 b/tests/bugs/vis/ger61351_2 index e4f4dc8b7e..d547583b97 100755 --- a/tests/bugs/vis/ger61351_2 +++ b/tests/bugs/vis/ger61351_2 @@ -14,9 +14,8 @@ GER61351 0 255 0 set x_coord 200 set y_coord 200 -checkcolor $x_coord $y_coord 0 1 0 - -if {$stat != 1} { +#checkcolor $x_coord $y_coord 0 1 0 +if {"[vreadpixel $x_coord $y_coord rgb name]" != "GREEN"} { puts "Error : Background color is NOT 0 1 0." } diff --git a/tests/bugs/xde/bug22982 b/tests/bugs/xde/bug22982 index efc373b79a..cf1824c5e5 100755 --- a/tests/bugs/xde/bug22982 +++ b/tests/bugs/xde/bug22982 @@ -1,9 +1,6 @@ puts "TODO ?OCC11111 ALL: Error on Record" puts "TODO ?OCC11111 ALL: Error : Colors are not equal" puts "TODO ?OCC11111 ALL: \\*\\* Exception" -puts "TODO ?OCC11111 ALL: Faulty : colors are not equal." -puts "TODO ?OCC11111 ALL: Tcl Exception" -puts "TODO ?OCC11111 ALL: TEST INCOMPLETE" pload QAcommands diff --git a/tests/bugs/xde/bug23193 b/tests/bugs/xde/bug23193 index 5d4a707438..13578a17c6 100755 --- a/tests/bugs/xde/bug23193 +++ b/tests/bugs/xde/bug23193 @@ -22,9 +22,9 @@ vfit set x_coord 189 set y_coord 236 -checkcolor $x_coord $y_coord 0 0 0.7 +#checkcolor $x_coord $y_coord 0 0 0.7 -if { ${stat} != 1 } { +if { "[vreadpixel $x_coord $y_coord rgb name]" != "MATRABLUE" } { puts "Error : There is missing triangle" } diff --git a/tests/bugs/xde/bug25381 b/tests/bugs/xde/bug25381 index a21bfb84e1..a35c6ee670 100644 --- a/tests/bugs/xde/bug25381 +++ b/tests/bugs/xde/bug25381 @@ -6,15 +6,11 @@ puts "" # Visualization - XCAFPrs_AISObject ignores visibility flag for sub-shapes ###################################################### -pload QAcommands - ReadStep D [locate_data_file bug25381_test_assembly_invisible.step] XShow D vfit -decho off -if { [catch { QAGetPixelColor 198 172 1 1 1 }] != 0 } { - decho on +if { "[vreadpixel 198 172 rgb name]" != "WHITE" } { puts "OK : XCAFPrs_AISObject get visibility flag for sub-shapes" } else { puts "Error : XCAFPrs_AISObject ignores visibility flag for sub-shapes" diff --git a/tests/demo/begin b/tests/demo/begin index d5ef63addc..d664818133 100755 --- a/tests/demo/begin +++ b/tests/demo/begin @@ -1,135 +1 @@ # File : begin - -# Procedure to check color in the point near default coordinate - -proc checkpoint {coord_x coord_y rd_ch gr_ch bl_ch} { - set x_start [expr ${coord_x} - 2] - set y_start [expr ${coord_y} - 2] - set mistake 0 - set i 0 - while { $mistake != 1 && $i <= 5 } { - set j 0 - while { $mistake != 1 && $j <= 5 } { - set position_x [expr ${x_start} + $j] - set position_y [expr ${y_start} + $i] - puts $position_x - puts $position_y - global color2d - if { [info exists color2d] } { - set color [ QAAISGetPixelColor2d ${position_x} ${position_y} ] - } else { - set color [ QAGetPixelColor ${position_x} ${position_y} ] - } - regexp {RED +: +([-0-9.+eE]+)} $color full rd - regexp {GREEN +: +([-0-9.+eE]+)} $color full gr - regexp {BLUE +: +([-0-9.+eE]+)} $color full bl - set rd_int [expr int($rd * 1.e+05)] - set gr_int [expr int($gr * 1.e+05)] - set bl_int [expr int($bl * 1.e+05)] - - if { $rd_ch != 0 } { - set tol_rd [expr abs($rd_ch - $rd_int)/$rd_ch] - } else { - set tol_rd $rd_int - } - if { $gr_ch != 0 } { - set tol_gr [expr abs($gr_ch - $gr_int)/$gr_ch] - } else { - set tol_gr $gr_int - } - if { $bl_ch != 0 } { - set tol_bl [expr abs($bl_ch - $bl_int)/$bl_ch] - } else { - set tol_bl $bl_int - } - - if { $tol_rd > 0.2 || $tol_gr > 0.2 || $tol_bl > 0.2 } { - puts "Warning : Point with true color was not found near default coordinates" - set mistake 0 - } else { - set mistake 1 - } - incr j - } - incr i - } - return $mistake -} - -# Procedure to check color using command QAgetPixelColor with tolerance -proc checkcolor { coord_x coord_y rd_get gr_get bl_get } { - puts "Coordinate x = $coord_x" - puts "Coordinate y = $coord_y" - puts "RED color of RGB is $rd_get" - puts "GREEN color of RGB is $gr_get" - puts "BLUE color of RGB is $bl_get" - - if { $coord_x <= 1 || $coord_y <= 1 } { - puts "Error : minimal coordinate is x = 2, y = 2. But we have x = $coord_x y = $coord_y" - return -1 - } - global color2d - if { [info exists color2d] } { - set color [ QAAISGetPixelColor2d ${coord_x} ${coord_y} ] - } else { - set color [ QAGetPixelColor ${coord_x} ${coord_y} ] - } - - regexp {RED +: +([-0-9.+eE]+)} $color full rd - regexp {GREEN +: +([-0-9.+eE]+)} $color full gr - regexp {BLUE +: +([-0-9.+eE]+)} $color full bl - set rd_int [expr int($rd * 1.e+05)] - set gr_int [expr int($gr * 1.e+05)] - set bl_int [expr int($bl * 1.e+05)] - set rd_ch [expr int($rd_get * 1.e+05)] - set gr_ch [expr int($gr_get * 1.e+05)] - set bl_ch [expr int($bl_get * 1.e+05)] - - if { $rd_ch != 0 } { - set tol_rd [expr abs($rd_ch - $rd_int)/$rd_ch] - } else { - set tol_rd $rd_int - } - if { $gr_ch != 0 } { - set tol_gr [expr abs($gr_ch - $gr_int)/$gr_ch] - } else { - set tol_gr $gr_int - } - if { $bl_ch != 0 } { - set tol_bl [expr abs($bl_ch - $bl_int)/$bl_ch] - } else { - set tol_bl $bl_int - } - set status 0 - if { $tol_rd > 0.2 } { - puts "Warning : RED light of additive color model RGB is invalid" - set status 1 - } - if { $tol_gr > 0.2 } { - puts "Warning : GREEN light of additive color model RGB is invalid" - set status 1 - } - if { $tol_bl > 0.2 } { - puts "Warning : BLUE light of additive color model RGB is invalid" - set status 1 - } - - if { $status != 0 } { - puts "Warning : Colors of default coordinate are not equal" - } - - global stat - if { $tol_rd > 0.2 || $tol_gr > 0.2 || $tol_bl > 0.2 } { - set info [checkpoint $coord_x $coord_y $rd_ch $gr_ch $bl_ch] - set stat [lindex $info end] - if { ${stat} != 1 } { - puts "Error : Colors are not equal in default coordinate and in the near coordinates too" - return $stat - } else { - puts "Point with valid color was found" - return $stat - } - } else { - set stat 1 - } -}