Salome HOME
Update tests reference data due to the new behavior of GeomAlgoAPI_ShapeTools::volume...
authorazv <artem.zhidkov@opencascade.com>
Sun, 14 Feb 2021 16:45:20 +0000 (19:45 +0300)
committerazv <artem.zhidkov@opencascade.com>
Sun, 14 Feb 2021 16:45:20 +0000 (19:45 +0300)
env.sh
src/BuildPlugin/Test/Test2398.py [changed mode: 0644->0755]
src/ExchangePlugin/Test/TestExport.py [changed mode: 0644->0755]
src/ExchangePlugin/Test/TestImport.py

diff --git a/env.sh b/env.sh
index e2f1de53556f0ba186ff88a9a7cacc99eac43a47..3f0e105ef48d609a877d1fc375db5a968933f84a 100644 (file)
--- a/env.sh
+++ b/env.sh
@@ -1,6 +1,6 @@
 #!/bin/bash -x
 
-export SALOME_DIR=/dn46/SALOME/series9x/current-2021-02-10
+export SALOME_DIR=/dn46/SALOME/series9x/current-2021-02-12
 
 # Path to sources
 export SOURCES_DIR=$(pwd)
old mode 100644 (file)
new mode 100755 (executable)
index 5b53791..7041adb
@@ -92,7 +92,7 @@ from GeomAPI import *
 
 # check fillings
 REF_DATA = [(Filling_1, 719.149788883378505488508380949),
-            (Filling_2, 910.894041506332769131404347718),
+            (Filling_2, 910.894530912501409147807862610),
             (Filling_3, 719.149788883378505488508380949),
             (Filling_4, 910.894530912501409147807862610)]
 for ref in REF_DATA:
old mode 100644 (file)
new mode 100755 (executable)
index 8e4ca98..877c160
@@ -49,7 +49,7 @@ def removeFile(theFileName):
 #=========================================================================
 # Common test function
 #=========================================================================
-def testExport(theType, theFormat, theFile, theVolume, theDelta, theErrorExpected = False):
+def testExport(theType, theFormat, theFile, theVolume, theArea, theDelta, theErrorExpected = False):
     # Import a reference part
     aSession.startOperation("Add part")
     aPartFeature = aSession.moduleDocument().addFeature("Part")
@@ -84,7 +84,7 @@ def testExport(theType, theFormat, theFile, theVolume, theDelta, theErrorExpecte
         assert os.path.exists(theFile)
 
         # Test exported file by importing
-        testImport(theType, theFile, theVolume, theDelta)
+        testImport(theType, theFile, theVolume, theArea, theDelta)
 
 def testExportXAO(theFile, theEmptyFormat = False):
     type = "XAO"
@@ -176,23 +176,23 @@ if __name__ == '__main__':
         # Export a shape into BREP
         #=========================================================================
         aRealVolume = 3.78827401738e-06
-        testExport("BREP", "BREP", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 10 ** -17)
-        testExport("BRP", "BREP", os.path.join(tmp_dir, "screw_export.brp"), aRealVolume, 10 ** -17)
-        testExport("BREP", "", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 10 ** -17)
+        testExport("BREP", "BREP", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 0.0019293313778547098, 10 ** -17)
+        testExport("BRP", "BREP", os.path.join(tmp_dir, "screw_export.brp"), aRealVolume, 0.0019293313778547098, 10 ** -17)
+        testExport("BREP", "", os.path.join(tmp_dir, "screw_export.brep"), aRealVolume, 0.0019293313778547098, 10 ** -17)
         #=========================================================================
         # Export a shape into STEP
         #=========================================================================
-        testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 10 ** -17)
-        testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.stp"), 3.788258075329978e-06, 10 ** -17)
-        testExport("STEP", "", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 10 ** -17)
+        testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 0.0019293304476337928, 10 ** -17)
+        testExport("STEP", "STEP", os.path.join(tmp_dir, "screw_export.stp"), 3.788258075329978e-06, 0.0019293304476337928, 10 ** -17)
+        testExport("STEP", "", os.path.join(tmp_dir, "screw_export.step"), 3.788258075329978e-06, 0.0019293304476337928, 10 ** -17)
         #=========================================================================
         # Export a shape into IGES
         #=========================================================================
-        testExport("IGES", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0019293313766693052, 10 ** -17)
-        testExport("IGS", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.igs"), 0.0019293313766693052, 10 ** -17)
-        testExport("IGES", "", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0019293313766693052, 10 ** -17)
-        testExport("IGES", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.iges"), 3.78827401651e-06, 10 ** -17)
-        testExport("IGS", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.igs"), 3.78827401651e-06, 10 ** -17)
+        testExport("IGES", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0, 0.0019293313766693052, 10 ** -17)
+        testExport("IGS", "IGES-5.1", os.path.join(tmp_dir, "screw_export-5.1.igs"), 0.0, 0.0019293313766693052, 10 ** -17)
+        testExport("IGES", "", os.path.join(tmp_dir, "screw_export-5.1.iges"), 0.0, 0.0019293313766693052, 10 ** -17)
+        testExport("IGES", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.iges"), 3.78827401651e-06, 0.001929331377591282, 10 ** -17)
+        testExport("IGS", "IGES-5.3", os.path.join(tmp_dir, "screw_export-5.3.igs"), 3.78827401651e-06, 0.001929331377591282, 10 ** -17)
         #=========================================================================
         # Export a shape into XAO
         #=========================================================================
@@ -201,7 +201,7 @@ if __name__ == '__main__':
         #=========================================================================
         # Check error when export to unsupported format
         #=========================================================================
-        testExport("BREP", "", os.path.join(tmp_dir, "screw_export.dwg"), 3.78825807533e-06, 10 ** -17, True)
+        testExport("BREP", "", os.path.join(tmp_dir, "screw_export.dwg"), 3.78825807533e-06, 0.0019293313766693052, 10 ** -17, True)
         #=========================================================================
         # End of test
         #=========================================================================
index 67998ea22b93f337479f2bed1432d08878a10436..7c15d9dad91e1b63826f88e55892a0b764c84f42 100644 (file)
@@ -43,7 +43,7 @@ def getShapePath(path):
     shapes_dir = os.path.join(os.getenv("DATA_DIR"), "Shapes")
     return os.path.join(shapes_dir, path)
 
-def testImport(theType, theFile, theVolume, theDelta, theErrorExpected = False):
+def testImport(theType, theFile, theVolume, theArea, theDelta, theErrorExpected = False):
     # Create a part for import
     aSession.startOperation("Create part for import")
     aPartFeature = aSession.moduleDocument().addFeature("Part")
@@ -88,6 +88,10 @@ def testImport(theType, theFile, theVolume, theDelta, theErrorExpected = False):
         aRefVolume = theVolume
         aResVolume = GeomAlgoAPI_ShapeTools.volume(aShape)
         assert (math.fabs(aResVolume - aRefVolume) < theDelta), "{0}: The volume is wrong: expected = {1}, real = {2}".format(theType, aRefVolume, aResVolume)
+        # Check shape area
+        aRefArea = theArea
+        aResArea = GeomAlgoAPI_ShapeTools.area(aShape)
+        assert (math.fabs(aResArea - aRefArea) < theDelta), "{0}: The area is wrong: expected = {1}, real = {2}".format(theType, aRefArea, aResArea)
 
 def testImportXAO():
     # Create a part for import
@@ -149,23 +153,23 @@ if __name__ == '__main__':
         # Create a shape imported from BREP
         #=========================================================================
         shape_path = getShapePath("Brep/solid.brep")
-        testImport("BREP", shape_path, 259982.297176, 10 ** -5)
+        testImport("BREP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5)
         shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "solid.brp"))
-        testImport("BRP", shape_path, 259982.297176, 10 ** -5)
+        testImport("BRP", shape_path, 259982.297176, 39481.415022205365, 10 ** -5)
         #=========================================================================
         # Create a shape imported from STEP
         #=========================================================================
         shape_path = getShapePath("Step/screw.step")
-        testImport("STEP", shape_path, 3.78827401738e-06, 10 ** -17)
+        testImport("STEP", shape_path, 3.78827401738e-06, 0.0019293313778547085, 10 ** -17)
         shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "screw.stp"))
-        testImport("STEP", shape_path, 3.78827401738e-06, 10 ** -17)
+        testImport("STEP", shape_path, 3.78827401738e-06, 0.0019293313778547085, 10 ** -17)
         #=========================================================================
         # Create a shape imported from IGES
         #=========================================================================
         shape_path = getShapePath("Iges/bearing.igs")
-        testImport("IGS", shape_path, 1.3407098545036494e-08, 10 ** -25)
+        testImport("IGS", shape_path, 0.0, 1.3407098545036494e-08, 10 ** -25)
         shape_path = shutil.copyfile(shape_path, os.path.join(tmp_dir, "bearing.iges"))
-        testImport("IGES", shape_path, 1.3407098545036494e-08, 10 ** -25)
+        testImport("IGES", shape_path, 0.0, 1.3407098545036494e-08, 10 ** -25)
 
         #=========================================================================
         # Create a shape imported from XAO
@@ -182,8 +186,8 @@ if __name__ == '__main__':
         #=========================================================================
         # Check import errors
         #=========================================================================
-        testImport("BREP", "", 0, 10 ** -25, True)
+        testImport("BREP", "", 0, 0, 10 ** -25, True)
         shape_path = getShapePath("Brep/solid.dwg")
-        testImport("BREP", shape_path, 0, 10 ** -25, True)
+        testImport("BREP", shape_path, 0, 0, 10 ** -25, True)
         shape_path = getShapePath("Xao/wrong_file.xao")
-        testImport("XAO", shape_path, 0, 10 ** -25, True)
+        testImport("XAO", shape_path, 0, 0, 10 ** -25, True)