From 68beaa3c57686339f880f401595f493bb2700a47 Mon Sep 17 00:00:00 2001 From: abv Date: Tue, 19 Sep 2017 13:04:23 +0300 Subject: [PATCH] 0029124: Visualization, Tests - failures when tests are executed via Remote Desktop connection Protection against accessing null pointer is added in OpenGl_VertexBuffer::Create(). In command vreadpixel OpenGl-related warnings are redirected to cout so that they do not contaminate the command output. Test grid caf presentation is configured to ignore OpenGl-related warning messages. Tests in grid tools are configured to report status SKIPPED if tools are not available (OCCT is built without Qt). --- src/OpenGl/OpenGl_VertexBuffer.cxx | 2 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 10 ++++++++++ tests/bugs/vis/bug22018 | 10 +++++----- tests/caf/parse.rules | 3 ++- tests/tools/parse.rules | 1 + 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/OpenGl/OpenGl_VertexBuffer.cxx b/src/OpenGl/OpenGl_VertexBuffer.cxx index 6bb3ca4b47..560ccebd66 100644 --- a/src/OpenGl/OpenGl_VertexBuffer.cxx +++ b/src/OpenGl/OpenGl_VertexBuffer.cxx @@ -59,7 +59,7 @@ GLenum OpenGl_VertexBuffer::GetTarget() const // ======================================================================= bool OpenGl_VertexBuffer::Create (const Handle(OpenGl_Context)& theGlCtx) { - if (myBufferId == NO_BUFFER) + if (myBufferId == NO_BUFFER && theGlCtx->core15fwd != NULL) { theGlCtx->core15fwd->glGenBuffers (1, &myBufferId); } diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 1f12147693..4c7f7f2138 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -6022,6 +6022,16 @@ static int VReadPixel (Draw_Interpretor& theDI, return 1; } + // redirect possible warning messages that could have been added by ToPixMap + // into the Tcl interpretor (via DefaultMessenger) to cout, so that they do not + // contaminate result of the command + Standard_CString aWarnLog = theDI.Result(); + if (aWarnLog != NULL && aWarnLog[0] != '\0') + { + std::cout << aWarnLog << std::endl; + } + theDI.Reset(); + Quantity_ColorRGBA aColor = anImage.PixelColor (anX, anY); if (toShowName) { diff --git a/tests/bugs/vis/bug22018 b/tests/bugs/vis/bug22018 index 7ee4b7dfb9..2b92a3f8a5 100755 --- a/tests/bugs/vis/bug22018 +++ b/tests/bugs/vis/bug22018 @@ -43,27 +43,27 @@ vmoveto 0 0 vmoveto 0 0 if { [vreadpixel $x1 $y rgb name] != "IVORY" || [vreadpixel $x2 $y rgb name] != "IVORY" } { - Error: unexpected color of not selected object + puts "Error: unexpected color of not selected object" } vmoveto ${x1} ${y} vmoveto ${x1} ${y} if { [vreadpixel $x1 $y rgb name] != "WHITE" } { - Error: unexpected color of selected object + puts "Error: unexpected color of selected object" } if { [vreadpixel $x2 $y rgb name] != "IVORY" } { - Error: unexpected color of not selected object + puts "Error: unexpected color of not selected object" } vmoveto ${x2} ${y} vmoveto ${x2} ${y} if { [vreadpixel $x1 $y rgb name] != "IVORY" } { - Error: unexpected color of not selected object + puts "Error: unexpected color of not selected object" } if { [vreadpixel $x2 $y rgb name] != "WHITE" } { - Error: unexpected color of selected object + puts "Error: unexpected color of selected object" } checkview -screenshot -3d -path ${imagedir}/${test_image}.png diff --git a/tests/caf/parse.rules b/tests/caf/parse.rules index 9ee55b78eb..3a5fb94bd8 100755 --- a/tests/caf/parse.rules +++ b/tests/caf/parse.rules @@ -1,4 +1,5 @@ +IGNORE /on screen buffer is used for image dump - content might be invalid/ reported when software Microsoft OpenGL driver is used (remote desktop) +IGNORE /^\s*DPrsStd_AISColor\s*:\s*Error\b/ ignore presentation K2 error message FAILED /\binvalid\b/ error FAILED /\bFailed\b/ error FAILED /\bfailed\b/ error -IGNORE /^\s*DPrsStd_AISColor\s*:\s*Error\b/ ignore presentation K2 error message diff --git a/tests/tools/parse.rules b/tests/tools/parse.rules index 95a93927e0..396c2d9c2e 100644 --- a/tests/tools/parse.rules +++ b/tests/tools/parse.rules @@ -1,2 +1,3 @@ +SKIPPED /Draw_Failure: Could not open: TKToolsDraw/ OCCT built without Qt tools FAILED /\bFaulty\b/ bad shape OK /Relative error of mass computation/ message from vprops \ No newline at end of file