From 7f83633f7efd083277e8ae0598157b20afd06706 Mon Sep 17 00:00:00 2001
From: abv <abv@opencascade.com>
Date: Mon, 9 Oct 2017 13:19:20 +0300
Subject: [PATCH] 0029196: Tests - some test cases fail with Intel HD graphics

Test bugs vis bug26357 is revised to check colors in more robust way.
In tests bugs vis bug29091_*, size of produced file is checked to be within range of known valid sizes, rather than hard-coded (per-platform) exact sizes.
FPE signals are disabled for test bugs vis bug29127 to prevent exceptions cause by software OpenGl driver.

File data/occ/Box.brep is removed to avoid confusion with file box.brep in public data files used in tests.

Two additional non-alphabetic-order combinations of complex types are handled in RWStepAP214_ReadWriteModule.cxx
---
 data/occ/Box.brep                             | 282 ------------------
 .../RWStepAP214_ReadWriteModule.cxx           |  14 +
 tests/bugs/vis/bug21091_3                     |  19 +-
 tests/bugs/vis/bug21091_4                     |  19 +-
 tests/bugs/vis/bug21091_5                     |  19 +-
 tests/bugs/vis/bug21091_6                     |  19 +-
 tests/bugs/vis/bug21091_7                     |   6 +-
 tests/bugs/vis/bug21091_8                     |  19 +-
 tests/bugs/vis/bug21091_9                     |  19 +-
 tests/bugs/vis/bug23407_2                     |   6 +-
 tests/bugs/vis/bug26357                       |  26 +-
 tests/bugs/vis/bug29127                       |   5 +
 12 files changed, 84 insertions(+), 369 deletions(-)
 delete mode 100644 data/occ/Box.brep

diff --git a/data/occ/Box.brep b/data/occ/Box.brep
deleted file mode 100644
index f3aa254ca5..0000000000
--- a/data/occ/Box.brep
+++ /dev/null
@@ -1,282 +0,0 @@
-DBRep_DrawableShape
-
-CASCADE Topology V1, (c) Matra-Datavision
-Locations 0
-Curve2ds 24
-1 0 0 1 0 
-1 0 0 1 0 
-1 50 0 0 -1 
-1 0 0 0 1 
-1 0 -80 1 0 
-1 0 0 1 0 
-1 0 0 0 -1 
-1 0 0 0 1 
-1 0 0 1 0 
-1 0 77 1 0 
-1 50 0 0 -1 
-1 77 0 0 1 
-1 0 -80 1 0 
-1 0 77 1 0 
-1 0 0 0 -1 
-1 77 0 0 1 
-1 0 0 0 1 
-1 0 0 1 0 
-1 50 0 0 1 
-1 0 0 1 0 
-1 0 0 0 1 
-1 0 80 1 0 
-1 50 0 0 1 
-1 0 80 1 0 
-Curves 12
-1 821 803 0 0 0 1 
-1 821 803 50 0 1 0 
-1 821 883 0 0 0 1 
-1 821 803 0 0 1 0 
-1 898 803 0 0 0 1 
-1 898 803 50 0 1 0 
-1 898 883 0 0 0 1 
-1 898 803 0 0 1 0 
-1 821 803 0 1 0 0 
-1 821 803 50 1 0 0 
-1 821 883 0 1 0 0 
-1 821 883 50 1 0 0 
-Polygon3D 0
-PolygonOnTriangulations 0
-Surfaces 6
-1 821 803 0 1 0 0 0 0 1 0 -1 0 
-1 821 803 0 0 1 0 0 0 1 1 0 0 
-1 821 803 50 0 0 1 1 0 0 0 1 0 
-1 821 883 0 0 1 0 0 0 1 1 0 0 
-1 821 803 0 0 0 1 1 0 0 0 1 0 
-1 898 803 0 1 0 0 0 0 1 0 -1 0 
-Triangulations 0
-
-TShapes 34
-Ve
-1e-007
-821 803 50
-0 0
-
-0101100
-*
-Ve
-1e-007
-821 803 0
-0 0
-
-0101100
-*
-Ed
- 1e-007 1 1 0
-1  1 0 0 50
-2  1 1 0 0 50
-2  2 2 0 0 50
-0
-
-0101000
--34 0 +33 0 *
-Ve
-1e-007
-821 883 50
-0 0
-
-0101100
-*
-Ed
- 1e-007 1 1 0
-1  2 0 0 80
-2  3 1 0 0 80
-2  4 3 0 0 80
-0
-
-0101000
--31 0 +34 0 *
-Ve
-1e-007
-821 883 0
-0 0
-
-0101100
-*
-Ed
- 1e-007 1 1 0
-1  3 0 0 50
-2  5 1 0 0 50
-2  6 4 0 0 50
-0
-
-0101000
--31 0 +29 0 *
-Ed
- 1e-007 1 1 0
-1  4 0 0 80
-2  7 1 0 0 80
-2  8 5 0 0 80
-0
-
-0101000
--29 0 +33 0 *
-Wi
-
-0101000
--32 0 -30 0 +28 0 +27 0 *
-Fa
-0  1e-007 1 0
-
-0111000
-+26 0 *
-Ve
-1e-007
-898 803 50
-0 0
-
-0101100
-*
-Ve
-1e-007
-898 803 0
-0 0
-
-0101100
-*
-Ed
- 1e-007 1 1 0
-1  5 0 0 50
-2  9 6 0 0 50
-2  10 2 0 0 50
-0
-
-0101000
--24 0 +23 0 *
-Ve
-1e-007
-898 883 50
-0 0
-
-0101100
-*
-Ed
- 1e-007 1 1 0
-1  6 0 0 80
-2  11 6 0 0 80
-2  12 3 0 0 80
-0
-
-0101000
--21 0 +24 0 *
-Ve
-1e-007
-898 883 0
-0 0
-
-0101100
-*
-Ed
- 1e-007 1 1 0
-1  7 0 0 50
-2  13 6 0 0 50
-2  14 4 0 0 50
-0
-
-0101000
--21 0 +19 0 *
-Ed
- 1e-007 1 1 0
-1  8 0 0 80
-2  15 6 0 0 80
-2  16 5 0 0 80
-0
-
-0101000
--19 0 +23 0 *
-Wi
-
-0101000
--22 0 -20 0 +18 0 +17 0 *
-Fa
-0  1e-007 6 0
-
-0111000
-+16 0 *
-Ed
- 1e-007 1 1 0
-1  9 0 0 77
-2  17 2 0 0 77
-2  18 5 0 0 77
-0
-
-0101000
--23 0 +33 0 *
-Ed
- 1e-007 1 1 0
-1  10 0 0 77
-2  19 2 0 0 77
-2  20 3 0 0 77
-0
-
-0101000
--24 0 +34 0 *
-Wi
-
-0101000
--14 0 -22 0 +13 0 +32 0 *
-Fa
-0  1e-007 2 0
-
-0111000
-+12 0 *
-Ed
- 1e-007 1 1 0
-1  11 0 0 77
-2  21 4 0 0 77
-2  22 5 0 0 77
-0
-
-0101000
--19 0 +29 0 *
-Ed
- 1e-007 1 1 0
-1  12 0 0 77
-2  23 4 0 0 77
-2  24 3 0 0 77
-0
-
-0101000
--21 0 +31 0 *
-Wi
-
-0101000
--10 0 -18 0 +9 0 +28 0 *
-Fa
-0  1e-007 4 0
-
-0111000
-+8 0 *
-Wi
-
-0101000
--27 0 -10 0 +17 0 +14 0 *
-Fa
-0  1e-007 5 0
-
-0111000
-+6 0 *
-Wi
-
-0101000
--30 0 -9 0 +20 0 +13 0 *
-Fa
-0  1e-007 3 0
-
-0111000
-+4 0 *
-Sh
-
-0101100
--25 0 +15 0 -11 0 +7 0 -5 0 +3 0 *
-So
-
-1100000
-+2 0 *
-
-+1 0 
\ No newline at end of file
diff --git a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx
index 185a1e5342..2290ccfe7e 100644
--- a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx
+++ b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx
@@ -3401,6 +3401,15 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
                (types(7).IsEqual(StepType(271)))) {
         return 323;
       }
+      else if ((types(1).IsEqual(StepType(40))) &&
+               (types(2).IsEqual(StepType(41))) &&
+               (types(3).IsEqual(StepType(240))) &&
+               (types(4).IsEqual(StepType(49))) &&
+               (types(5).IsEqual(StepType(247))) &&
+               (types(6).IsEqual(StepType(144))) &&
+               (types(7).IsEqual(StepType(271)))) {
+        return 323;
+      }
     }
     // Added by FMA
     else if (NbComp == 6) {
@@ -3630,6 +3639,11 @@ Standard_Integer RWStepAP214_ReadWriteModule::CaseStep
                (types(3).IsEqual(StepType(336)))) {
         return 335;
       }
+      else if ((types(1).IsEqual(StepType(169))) &&
+               (types(2).IsEqual(StepType(336))) &&
+               (types(3).IsEqual(StepType(264)))) {
+	    return 335;
+      }
       else if ((types(1).IsEqual(StepType(143))) &&
                (types(2).IsEqual(StepType(188))) &&
                (types(3).IsEqual(StepType(246)))) {
diff --git a/tests/bugs/vis/bug21091_3 b/tests/bugs/vis/bug21091_3
index 979866068f..45454c7bd8 100755
--- a/tests/bugs/vis/bug21091_3
+++ b/tests/bugs/vis/bug21091_3
@@ -19,22 +19,19 @@ set aFile ${imagedir}/${test_image}.pdf
 vcaps -ffp 1
 vexport ${aFile} PDF
 
-if { [checkplatform -windows] } {
-   set refsize 153993
-} else {
-   set refsize 144401
-}
+set refsize_min 144000
+set refsize_max 154000
 
 if { [file exists ${aFile}] } {
-   puts "Export to PDF file was done"
+   puts "Export to PDF format successful"
    set filesize [file size ${aFile}]
-   if { $filesize != $refsize } {
-      puts "Error: Export to PDF file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
-	  puts "Error: Compare content of resulting PDF file with reference."
-	  puts "Error: Update refsize if it's necessary."
+   if { $filesize < $refsize_min || $filesize > $refsize_max } {
+      puts "Error: Export to PDF file was done but size of file is incorrect"
+      puts "       (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
+      puts "Error: Update refsize limits if necessary."
    }
 } else {
-   puts "Faulty : Export to PDF file was not done"
+   puts "Error: Export to PDF format has failed"
 }
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug21091_4 b/tests/bugs/vis/bug21091_4
index 4e9b2c2c82..c9ff580858 100755
--- a/tests/bugs/vis/bug21091_4
+++ b/tests/bugs/vis/bug21091_4
@@ -45,22 +45,19 @@ set aFile ${imagedir}/${test_image}.pdf
 vcaps -ffp 1
 vexport ${aFile} PDF
 
-if { [checkplatform -windows] } {
-   set refsize 9087
-} else {
-   set refsize 9063
-}
+set refsize_min 9060
+set refsize_max 9090
 
 if { [file exists ${aFile}] } {
-   puts "Export to PDF file was done"
+   puts "Export to PDF format successful"
    set filesize [file size ${aFile}]
-   if { $filesize != $refsize } {
-      puts "Error: Export to PDF file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
-	  puts "Error: Compare content of resulting PDF file with reference."
-	  puts "Error: Update refsize if it's necessary."
+   if { $filesize < $refsize_min || $filesize > $refsize_max } {
+      puts "Error: Export to PDF file was done but size of file is incorrect"
+      puts "       (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
+      puts "Error: Update refsize limits if necessary."
    }
 } else {
-   puts "Faulty : Export to PDF file was not done"
+   puts "Error: Export to PDF format has failed"
 }
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug21091_5 b/tests/bugs/vis/bug21091_5
index a9c62b8b5a..a2f249fee0 100755
--- a/tests/bugs/vis/bug21091_5
+++ b/tests/bugs/vis/bug21091_5
@@ -45,22 +45,19 @@ set aFile ${imagedir}/${test_image}.ps
 vcaps -ffp 1
 vexport ${aFile} PS
 
-if { [checkplatform -windows] } {
-   set refsize 9568
-} else {
-   set refsize 9544
-}
+set refsize_min 9540
+set refsize_max 9570
 
 if { [file exists ${aFile}] } {
-   puts "Export to PS format was done"
+   puts "Export to PS format successful"
    set filesize [file size ${aFile}]
-   if { $filesize != $refsize } {
-      puts "Error: Export to PS file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
-	  puts "Error: Compare content of resulting PS file with reference."
-	  puts "Error: Update refsize if it's necessary."
+   if { $filesize < $refsize_min || $filesize > $refsize_max } {
+      puts "Error: Export to PS file was done but size of file is incorrect"
+      puts "       (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
+      puts "Error: Update refsize limits if necessary."
    }
 } else {
-   puts "Faulty : Export to PS format was not done"
+   puts "Error: Export to PS format has failed"
 }
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug21091_6 b/tests/bugs/vis/bug21091_6
index b3e91a3e0d..71dcff6f6b 100755
--- a/tests/bugs/vis/bug21091_6
+++ b/tests/bugs/vis/bug21091_6
@@ -44,22 +44,19 @@ set aFile ${imagedir}/${test_image}.eps
 vcaps -ffp 1
 vexport ${aFile} EPS
 
-if { [checkplatform -windows] } {
-   set refsize 9512
-} else {
-   set refsize 9488
-}
+set refsize_min 9480
+set refsize_max 9520
 
 if { [file exists ${aFile}] } {
-   puts "Export to EPS file was done"
+   puts "Export to EPS format successful"
    set filesize [file size ${aFile}]
-   if { $filesize != $refsize } {
-      puts "Error: Export to EPS file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
-	  puts "Error: Compare content of resulting EPS file with reference."
-	  puts "Error: Update refsize if it's necessary."
+   if { $filesize < $refsize_min || $filesize > $refsize_max } {
+      puts "Error: Export to EPS file was done but size of file is incorrect"
+      puts "       (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
+      puts "Error: Update refsize limits if necessary."
    }
 } else {
-   puts "Faulty : Export to EPS file was not done"
+   puts "Error: Export to EPS format has failed"
 }
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug21091_7 b/tests/bugs/vis/bug21091_7
index 27c24bc329..837fd88583 100755
--- a/tests/bugs/vis/bug21091_7
+++ b/tests/bugs/vis/bug21091_7
@@ -47,12 +47,12 @@ vcaps -ffp 1
 vexport ${aFile} TEX
 
 if { [file exists ${aFile}] } {
-   puts "Export to TEX file was done"
+   puts "Export to TEX file successful"
    set filesize [file size ${aFile}]
    puts "Size of TEX file = $filesize"
    if { $filesize > 1500 } {
-      puts "Faulty : Export to TEX file was done but size of file is incorrect"
+      puts "Error : Export to TEX file succeeded but size of file is incorrect"
    }
 } else {
-   puts "Faulty : Export to TEX file was not done"
+   puts "Error : Export to TEX file has failed"
 }
diff --git a/tests/bugs/vis/bug21091_8 b/tests/bugs/vis/bug21091_8
index 7c83b4e895..256f989fa9 100755
--- a/tests/bugs/vis/bug21091_8
+++ b/tests/bugs/vis/bug21091_8
@@ -45,22 +45,19 @@ set aFile ${imagedir}/${test_image}.svg
 vcaps -ffp 1
 vexport ${aFile} SVG
 
-if { [checkplatform -windows] } {
-   set refsize 12127
-} else {
-   set refsize 12113
-}
+set refsize_min 12110
+set refsize_max 12130
 
 if { [file exists ${aFile}] } {
-   puts "Export to SVG file was done"
+   puts "Export to SVG format successful"
    set filesize [file size ${aFile}]
-   if { $filesize != $refsize } {
-      puts "Error: Export to SVG file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
-	  puts "Error: Compare content of resulting SVG file with reference."
-	  puts "Error: Update refsize if it's necessary."
+   if { $filesize < $refsize_min || $filesize > $refsize_max } {
+      puts "Error: Export to SVG file was done but size of file is incorrect"
+      puts "       (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
+      puts "Error: Update refsize limits if necessary."
    }
 } else {
-   puts "Faulty : Export to SVG file was not done"
+   puts "Error: Export to SVG format has failed"
 }
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug21091_9 b/tests/bugs/vis/bug21091_9
index 41ad574d87..51837d00cf 100755
--- a/tests/bugs/vis/bug21091_9
+++ b/tests/bugs/vis/bug21091_9
@@ -45,22 +45,19 @@ set aFile ${imagedir}/${test_image}.pgf
 vcaps -ffp 1
 vexport ${aFile} PGF
 
-if { [checkplatform -windows] } {
-   set refsize 17918
-} else {
-   set refsize 17794
-}
+set refsize_min 17790
+set refsize_max 17920
 
 if { [file exists ${aFile}] } {
-   puts "Export to PGF file was done"
+   puts "Export to PGF format successful"
    set filesize [file size ${aFile}]
-   if { $filesize != $refsize } {
-      puts "Error: Export to PGF file was done but size of file is incorrect (refsize = $refsize, current = $filesize)."
-	  puts "Error: Compare content of resulting PGF file with reference."
-	  puts "Error: Update refsize if it's necessary."
+   if { $filesize < $refsize_min || $filesize > $refsize_max } {
+      puts "Error: Export to PGF file was done but size of file is incorrect"
+      puts "       (current = $filesize, expected to be in range \[$refsize_min, $refsize_max\])."
+      puts "Error: Update refsize limits if necessary."
    }
 } else {
-   puts "Faulty : Export to PGF file was not done"
+   puts "Error: Export to PGF format has failed"
 }
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug23407_2 b/tests/bugs/vis/bug23407_2
index 4f73918ebc..55e373e21f 100755
--- a/tests/bugs/vis/bug23407_2
+++ b/tests/bugs/vis/bug23407_2
@@ -14,10 +14,8 @@ vshowfaceboundary b 1 255 0 0 10 1
 vfit
 vaspects -setwidth 5
 
-if { "[vreadpixel 183 190 rgb name]" != "RED"
-  || "[vreadpixel 314 344 rgb name]" != "RED"
-  || "[vreadpixel  26 267 rgb name]" != "RED"
-} {
+if { "[vreadpixel 314 344 rgb name]" != "RED" ||
+     "[vreadpixel  26 267 rgb name]" != "RED" } {
     puts "Error : Boundary of face is not changed"
 }
 
diff --git a/tests/bugs/vis/bug26357 b/tests/bugs/vis/bug26357
index 465346cc37..97853e0fe0 100644
--- a/tests/bugs/vis/bug26357
+++ b/tests/bugs/vis/bug26357
@@ -1,51 +1,49 @@
 puts "============"
-puts "CR26357"
+puts "0026357: Visualization - Panning zooms view if aspect ratio > 1"
 puts "============"
 puts ""
 
-#########################################################################
-puts "Panning regression after fixing 0026082"
-#########################################################################
-
 box b 100 100 100
 
+vclear
 vinit View1 w=400 h=400
 vinit View2 w=200 h=400
 vinit View3 w=400 h=200
-vclear
-vaxo
 
-vdisplay b
+vdisplay -dispMode 1 -highMode 1 b
 
 # Test panning with aspect ratio 1:1
 vactivate View1
+vaxo
 vfit
 vpan        200 0
 vmoveto     399 200
-checkcolor  399 200 0 1 1
+if { [vreadpixel 399 200 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after forward panning in View1" }
 vpan       -200 0
 vmoveto     200 200
-checkcolor  200 200 0 1 1
+if { [vreadpixel 200 200 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after backward panning in View1" }
 vdump ${imagedir}/${casename}_1.png
 
 # Test panning with aspect ratio 1:2
 vactivate View2
+vaxo
 vfit
 vpan        100 0
 vmoveto     199 100
-checkcolor  199 100 0 1 1
+if { [vreadpixel 199 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after forward panning in View2" }
 vpan       -100 0
 vmoveto     100 100
-checkcolor  100 100 0 1 1
+if { [vreadpixel 100 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after backward panning in View2" }
 vdump ${imagedir}/${casename}_2.png
 
 # Test panning with aspect ratio 2:1
 vactivate View3
+vaxo
 vfit
 vpan        200 0
 vmoveto     399 100
-checkcolor  399 100 0 1 1
+if { [vreadpixel 399 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after forward panning in View3" }
 vpan       -200 0
 vmoveto     200 100
-checkcolor  200 100 0 1 1
+if { [vreadpixel 200 100 rgb name] != "DARKTURQUOISE" } { puts "Error: incorrect color after backward panning in View3" }
 vdump ${imagedir}/${casename}_3.png
diff --git a/tests/bugs/vis/bug29127 b/tests/bugs/vis/bug29127
index 5628b26923..ebb94b043f 100644
--- a/tests/bugs/vis/bug29127
+++ b/tests/bugs/vis/bug29127
@@ -5,9 +5,14 @@ puts ""
 
 pload MODELING VISUALIZATION
 box b 1 2 3 
+
 # request software OpenGL implementation - which is OpenGL 1.1 in case of Windows
 # (test case is useless for other systems)
 vcaps -softMode 1
+
+# disable FPE signals -- these often occur in software OpenGL drivers
+dsetsignal 0
+
 vclear
 vinit View1
 vsetdispmode 1